[PPPoE]: move lock_sock() in pppoe_sendmsg() to the right location
authorFlorian Zumbiehl <florz@florz.de>
Tue, 31 Jul 2007 00:49:13 +0000 (17:49 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 31 Jul 2007 09:28:23 +0000 (02:28 -0700)
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>
drivers/net/pppoe.c

index f75aeaa..35a7385 100644 (file)
@@ -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;
@@ -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;