Skip to contentSkip to conversation

net/netrom: Fix socket locking

PATCH David Miller 1 participant 1 message Apr 22, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

David Miller

author Applied
#1 lore raw

From: Jean Delvare <[email protected]>
Date: Tue, 21 Apr 2009 22:49:45 +0200

Quoted 9 lines

Patch "af_rose/x25: Sanity check the maximum user frame size" (commit 83e0bbcbe2145f160fbaa109b0439dae7f4a38a9) from Alan Cox got locking wrong. If we bail out due to user frame size being too large, we must unlock the socket beforehand.

Cc Ralf Baechle <[email protected]>
Cc Alan Cox <[email protected]>
Cc David S. Miller <[email protected]>

Applied, thanks.

Please CC: [email protected] on all networking patches in the future. Otherwise it won't get tracked properly at:

http://patchwork.ozlabs.org/project/netdev/list/

Thanks.

Quoted 23 lines
---
 net/netrom/af_netrom.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/netrom/af_netrom.c +4 -2
@@ -1084,8 +1084,10 @@ static int nr_sendmsg(struct kiocb *iocb
 
 	/* Build a packet - the conventional user limit is 236 bytes. We can
 	   do ludicrously large NetROM frames but must not overflow */
-	if (len > 65536)
-		return -EMSGSIZE;
+	if (len > 65536) {
+		err = -EMSGSIZE;
+		goto out;
+	}
 
 	SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n");
 	size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
Signature · 3 lines
-- 
Jean Delvare
Suse L3