diff options
author | Jean Delvare <jdelvare@suse.de> | 2009-04-22 03:49:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-22 03:49:51 -0400 |
commit | cc29c70dd581f85ee7a3e7980fb031f90b90a2ab (patch) | |
tree | b28331df9330eb6ba156bc9baeae966ff44196a1 /net/netrom | |
parent | 50b2ff1bc47baacb8e9882b2b2a74b240ddbeecf (diff) |
net/netrom: Fix socket locking
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.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netrom')
-rw-r--r-- | net/netrom/af_netrom.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 4e705f87969f..3be0e016ab7d 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1084,8 +1084,10 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1084 | 1084 | ||
1085 | /* Build a packet - the conventional user limit is 236 bytes. We can | 1085 | /* Build a packet - the conventional user limit is 236 bytes. We can |
1086 | do ludicrously large NetROM frames but must not overflow */ | 1086 | do ludicrously large NetROM frames but must not overflow */ |
1087 | if (len > 65536) | 1087 | if (len > 65536) { |
1088 | return -EMSGSIZE; | 1088 | err = -EMSGSIZE; |
1089 | goto out; | ||
1090 | } | ||
1089 | 1091 | ||
1090 | SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); | 1092 | SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); |
1091 | size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 1093 | size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; |