From: Andrew Hendry <andrew.hendry@gmail•com>
To: netdev@vger•kernel.org
Subject: [PATCH] X25: Replace BKL in sockopts calls
Date: Sun, 09 May 2010 22:45:23 +1000 [thread overview]
Message-ID: <1273409123.2727.387.camel@ibex> (raw)
x25_setsockopt only updates the socket
x25_get only reads
Signed-off-by: Andrew Hendry <andrew.hendry@gmail•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
next reply other threads:[~2010-05-09 12:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 12:45 Andrew Hendry [this message]
2010-05-10 1:46 ` [PATCH] X25: Replace BKL in sockopts calls David Miller
2010-05-10 4:50 ` Eric Dumazet
2010-05-10 11:44 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273409123.2727.387.camel@ibex \
--to=andrew.hendry@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox