Skip to content

Commit

Permalink
net/netrom: Fix socket locking
Browse files Browse the repository at this point in the history
Patch "af_rose/x25: Sanity check the maximum user frame size"
(commit 83e0bbc) 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>
  • Loading branch information
jdelvare authored and davem330 committed Apr 22, 2009
1 parent 50b2ff1 commit cc29c70
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/netrom/af_netrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cc29c70

Please sign in to comment.