[PATCH 4.9 165/271] rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()

From: Greg Kroah-Hartman
Date: Tue Jan 28 2020 - 09:21:33 EST


From: David Howells <dhowells@xxxxxxxxxx>

[ Upstream commit 3427beb6375d04e9627c67343872e79341a684ea ]

With gcc 4.1:

net/rxrpc/output.c: In function ârxrpc_send_data_packetâ:
net/rxrpc/output.c:338: warning: âretâ may be used uninitialized in this function

Indeed, if the first jump to the send_fragmentable label is made, and
the address family is not handled in the switch() statement, ret will be
used uninitialized.

Fix this by BUG()'ing as is done in other places in rxrpc where internal
support for future address families will need adding. It should not be
possible to reach this normally as the address families are checked
up-front.

Fixes: 5a924b8951f835b5 ("rxrpc: Don't store the rxrpc header in the Tx queue sk_buffs")
Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
net/rxrpc/output.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 59d3286033120..64389f493bb28 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -400,6 +400,9 @@ send_fragmentable:
}
break;
#endif
+
+ default:
+ BUG();
}

up_write(&conn->params.local->defrag_sem);
--
2.20.1