Skip to content

Commit

Permalink
[PPPoE]: move lock_sock() in pppoe_sendmsg() to the right location
Browse files Browse the repository at this point in the history
and the last one for now: Acquire the sock lock in pppoe_sendmsg()
before accessing the sock - and in particular avoid releasing the lock
even though it hasn't been acquired.

Signed-off-by: Florian Zumbiehl <florz@florz.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Zumbiehl authored and David S. Miller committed Jul 31, 2007
1 parent 86c1dcf commit 8aeca8f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/pppoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
struct net_device *dev;
char *start;

lock_sock(sk);
if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) {
error = -ENOTCONN;
goto end;
Expand All @@ -784,8 +785,6 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
hdr.code = 0;
hdr.sid = po->num;

lock_sock(sk);

dev = po->pppoe_dev;

error = -EMSGSIZE;
Expand Down

0 comments on commit 8aeca8f

Please sign in to comment.