Skip to content

Commit

Permalink
X.25 remove bkl in accept
Browse files Browse the repository at this point in the history
Accept already has socket locking.

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

Signed-off-by: Andrew Hendry <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
AndrewHendry authored and davem330 committed Sep 15, 2010
1 parent 90c2729 commit 141646c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/x25/af_x25.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,18 @@ 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;
if (sk->sk_type != SOCK_SEQPACKET)
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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 141646c

Please sign in to comment.