Browse Source

[PPPoE]: move lock_sock() in pppoe_sendmsg() to the right location

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>
Florian Zumbiehl 18 years ago
parent
commit
8aeca8fea5
1 changed files with 1 additions and 2 deletions
  1. 1 2
      drivers/net/pppoe.c

+ 1 - 2
drivers/net/pppoe.c

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