]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
X.25 remove bkl in accept
authorAndrew Hendry <andrew.hendry@gmail.com>
Wed, 15 Sep 2010 03:38:54 +0000 (20:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Sep 2010 03:38:54 +0000 (20:38 -0700)
Accept already has socket locking.

[ Extend socket locking over TCP_LISTEN state test. -DaveM ]

Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/x25/af_x25.c

index bd6fce31a7386e182a4d177dfe2d9fed3388219f..04321eec65e15ecabf146c461ecff55a1f5e470e 100644 (file)
@@ -869,8 +869,7 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
        struct sk_buff *skb;
        int rc = -EINVAL;
 
-       lock_kernel();
-       if (!sk || sk->sk_state != TCP_LISTEN)
+       if (!sk)
                goto out;
 
        rc = -EOPNOTSUPP;
@@ -878,6 +877,10 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
                goto out;
 
        lock_sock(sk);
+       rc = -EINVAL;
+       if (sk->sk_state != TCP_LISTEN)
+               goto out2;
+
        rc = x25_wait_for_data(sk, sk->sk_rcvtimeo);
        if (rc)
                goto out2;
@@ -897,7 +900,6 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
 out2:
        release_sock(sk);
 out:
-       unlock_kernel();
        return rc;
 }