[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1273467040.2325.78.camel@edumazet-laptop>
Date: Mon, 10 May 2010 06:50:40 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: andrew.hendry@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH] X25: Replace BKL in sockopts calls
Le dimanche 09 mai 2010 à 18:46 -0700, David Miller a écrit :
> From: Andrew Hendry <andrew.hendry@...il.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.
--
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