From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: andrew.hendry@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH] X25: Replace BKL in sockopts calls
Date: Mon, 10 May 2010 06:50:40 +0200 [thread overview]
Message-ID: <1273467040.2325.78.camel@edumazet-laptop> (raw)
In-Reply-To: <20100509.184658.170123822.davem@davemloft.net>
Le dimanche 09 mai 2010 à 18:46 -0700, David Miller a écrit :
> From: Andrew Hendry <andrew.hendry@gmail.com>
> Date: Sun, 09 May 2010 22:45:23 +1000
>
> > @@ -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);
>
> This is completely bogus.
>
> A store is always atomic on an SMP system, and "opt" is in a local variable
> rather than being computed based upon some memory values.
>
> There is no reason to require locking for this operation.
Well, its probably better than lock_kernel() ;)
qbitincl is a char, I suspect some arches cant store a char in an atomic
way ? Alpha comes to mind.
We now have lock_sock_bh()/unlock_sock_bh() for this kind of very short
sections, where we cant sleep.
next prev parent reply other threads:[~2010-05-10 4:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 12:45 [PATCH] X25: Replace BKL in sockopts calls Andrew Hendry
2010-05-10 1:46 ` David Miller
2010-05-10 4:50 ` Eric Dumazet [this message]
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=1273467040.2325.78.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=andrew.hendry@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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