public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ssatyam@cse.iitk.ac.in
Cc: akpm@linux-foundation.org, marcel@holtmann.org, jikos@jikos.cz,
	gregkh@suse.de, jeremy@goop.org, maxk@qualcomm.com,
	clg@fr.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bluetooth: fix locking in hci_sock_dev_event()
Date: Wed, 16 May 2007 22:51:29 -0700 (PDT)	[thread overview]
Message-ID: <20070516.225129.74748893.davem@davemloft.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0705171106550.9262@cselinux1.cse.iitk.ac.in>

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Date: Thu, 17 May 2007 11:13:36 +0530 (IST)

> [PATCH] bluetooth: fix locking in hci_sock_dev_event()
> 
> We presently use lock_sock() to acquire a lock on a socket in
> hci_sock_dev_event(), but this goes BUG because lock_sock()
> can sleep and we're already holding a read-write spinlock at
> that point. So, we must use the non-sleeping BH version,
> bh_lock_sock().
> 
> However, hci_sock_dev_event() is called from user context and
> hence using simply bh_lock_sock() will deadlock against a
> concurrent softirq that tries to acquire a lock on the same
> socket. Hence, disabling BH's before acquiring the socket lock
> and enable them afterwards, is the proper solution to fix
> socket locking in hci_sock_dev_event().
> 
> Cc: David Miller <davem@davemloft.net>
> Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Thanks I'll merge this in.

  reply	other threads:[~2007-05-17  5:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17  5:43 [PATCH] bluetooth: fix locking in hci_sock_dev_event() Satyam Sharma
2007-05-17  5:51 ` David Miller [this message]
2007-05-17  6:51 ` David Miller
2007-05-17  7:11   ` Satyam Sharma

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=20070516.225129.74748893.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akpm@linux-foundation.org \
    --cc=clg@fr.ibm.com \
    --cc=gregkh@suse.de \
    --cc=jeremy@goop.org \
    --cc=jikos@jikos.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=maxk@qualcomm.com \
    --cc=ssatyam@cse.iitk.ac.in \
    /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