aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrew Hendry <andrew.hendry@gmail.com>2010-09-14 23:38:54 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-14 23:38:54 -0400
commit141646ce56735cedb2336b3cd21364287f0aa4c7 (patch)
tree204b0396a60a6954df2fe1dd654e47955c2c7533 /net
parent90c27297a9bfb8ea11c0e3f73ad90c4c66e8501e (diff)
X.25 remove bkl in accept
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>
Diffstat (limited to 'net')
-rw-r--r--net/x25/af_x25.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index bd6fce31a738..04321eec65e1 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -869,8 +869,7 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
869 struct sk_buff *skb; 869 struct sk_buff *skb;
870 int rc = -EINVAL; 870 int rc = -EINVAL;
871 871
872 lock_kernel(); 872 if (!sk)
873 if (!sk || sk->sk_state != TCP_LISTEN)
874 goto out; 873 goto out;
875 874
876 rc = -EOPNOTSUPP; 875 rc = -EOPNOTSUPP;
@@ -878,6 +877,10 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
878 goto out; 877 goto out;
879 878
880 lock_sock(sk); 879 lock_sock(sk);
880 rc = -EINVAL;
881 if (sk->sk_state != TCP_LISTEN)
882 goto out2;
883
881 rc = x25_wait_for_data(sk, sk->sk_rcvtimeo); 884 rc = x25_wait_for_data(sk, sk->sk_rcvtimeo);
882 if (rc) 885 if (rc)
883 goto out2; 886 goto out2;
@@ -897,7 +900,6 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
897out2: 900out2:
898 release_sock(sk); 901 release_sock(sk);
899out: 902out:
900 unlock_kernel();
901 return rc; 903 return rc;
902} 904}
903 905