[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0704240954200.20657@twin.jikos.cz>
Date: Tue, 24 Apr 2007 09:59:38 +0200 (CEST)
From: Jiri Kosina <jikos@...os.cz>
To: Herbert Xu <herbert@...dor.apana.org.au>
cc: jeremy@...p.org, Greg KH <gregkh@...e.de>,
Marcel Holtmann <marcel@...tmann.org>, maxk@...lcomm.com,
bluez-devel@...ts.sourceforge.net, clg@...ibm.com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: 2.6.21-rc7: BUG: sleeping function called from invalid context
at net/core/sock.c:1523
On Tue, 24 Apr 2007, Herbert Xu wrote:
> > Hmm, *sigh*. I guess the patch below fixes the problem, but it is a
> > masterpiece in the field of ugliness. And I am not sure whether it is
> > completely correct either. Are there any immediate ideas for better
> > solution with respect to how struct sock locking works?
> Please cc such patches to netdev. Thanks.
Hi Herbert,
well it's pretty much bluetooth-specific, and bluez-devel was CCed, but
OK.
> > diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
> > index 71f5cfb..c5c93cd 100644
> > --- a/net/bluetooth/hci_sock.c
> > +++ b/net/bluetooth/hci_sock.c
> > @@ -656,7 +656,10 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
> > /* Detach sockets from device */
> > read_lock(&hci_sk_list.lock);
> > sk_for_each(sk, node, &hci_sk_list.head) {
> > - lock_sock(sk);
> > + if (in_atomic())
> > + bh_lock_sock(sk);
> > + else
> > + lock_sock(sk);
>
> This doesn't do what you think it does. bh_lock_sock can still succeed
> even with lock_sock held by someone else.
I know, this was precisely the reason why I converted the bh_lock_sock()
to lock_sock() here some time ago (as it was racy with
l2cap_connect_cfm()).
> Does this need to occur immediately when an event occurs? If not I'd
> suggest moving this into a workqueue.
Will have to check whether this will be processed properly in time when
going to suspend.
Thanks,
--
Jiri Kosina
-
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