[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1273409123.2727.387.camel@ibex>
Date: Sun, 09 May 2010 22:45:23 +1000
From: Andrew Hendry <andrew.hendry@...il.com>
To: netdev@...r.kernel.org
Subject: [PATCH] X25: Replace BKL in sockopts calls
x25_setsockopt only updates the socket
x25_get only reads
Signed-off-by: Andrew Hendry <andrew.hendry@...il.com>
---
net/x25/af_x25.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 296e65e..9f177a1 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -453,7 +453,6 @@ static int x25_setsockopt(struct socket *sock, int level, int optname,
struct sock *sk = sock->sk;
int rc = -ENOPROTOOPT;
- lock_kernel();
if (level != SOL_X25 || optname != X25_QBITINCL)
goto out;
@@ -465,20 +464,20 @@ static int x25_setsockopt(struct socket *sock, int level, int optname,
if (get_user(opt, (int __user *)optval))
goto out;
+ lock_sock(sk);
x25_sk(sk)->qbitincl = !!opt;
+ release_sock(sk);
rc = 0;
out:
- unlock_kernel();
return rc;
}
static int x25_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
- struct sock *sk = sock->sk;
+ struct x25_sock *sk = x25_sk(sock->sk);
int val, len, rc = -ENOPROTOOPT;
- lock_kernel();
if (level != SOL_X25 || optname != X25_QBITINCL)
goto out;
@@ -496,10 +495,9 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
if (put_user(len, optlen))
goto out;
- val = x25_sk(sk)->qbitincl;
+ val = sk->qbitincl;
rc = copy_to_user(optval, &val, len) ? -EFAULT : 0;
out:
- unlock_kernel();
return rc;
}
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists