aboutsummaryrefslogtreecommitdiffstats
path: root/net/x25
diff options
context:
space:
mode:
Diffstat (limited to 'net/x25')
-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