summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2009-04-22 00:49:51 -0700
committerChris Wright <chrisw@sous-sol.org>2009-04-27 10:36:57 -0700
commitdf5b6025d1a9e2e61dde1fd28257082751264c07 (patch)
tree38a049482629d74878fd1b388d9739a214f2b8aa /net
parent33d06566b593703a972da232d08b6a12176f1854 (diff)
net/netrom: Fix socket locking
upstream commit: cc29c70dd581f85ee7a3e7980fb031f90b90a2ab 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> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Diffstat (limited to 'net')
-rw-r--r--net/netrom/af_netrom.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 2d7fbe7e12db..dcce77871da3 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,
/* 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;