Skip to contentSkip to conversation

X.25 remove bkl in accept

PATCH Applied Andrew Hendry 2 participants 2 messages Sep 14, 2010 – Sep 15, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/4 X.25 remove bkl in accept

Accept already has socket locking.

---
 net/x25/af_x25.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
net/x25/af_x25.c +0 -2
index ab959d0..4ebde0d 100644
@@ -867,7 +867,6 @@ 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)
 		goto out;
 
@@ -895,7 +894,6 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
 out2:
 	release_sock(sk);
 out:
-	unlock_kernel();
 	return rc;
 }
 
Signature · 1 line
1.7.0.4
maintainer Applied
#1 lore raw

From: Andrew Hendry <[email protected]>
Date: Wed, 15 Sep 2010 09:31:50 +1000

Quoted 3 lines

Accept already has socket locking.

Applied, but I took the liberty of moving the socket locking above the TCP_LISTEN state check as follows:

--------------------
X.25 remove bkl in accept

Accept already has socket locking.

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

---
 net/x25/af_x25.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/x25/af_x25.c +5 -3
index bd6fce3..04321ee 100644
@@ -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;
 }
 
Signature · 1 line
1.7.2.2