All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Tervo <ville.tervo@nokia.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org
Subject: [patch] Fix rfcomm might_sleep issue
Date: Tue, 30 Dec 2008 13:12:37 +0200	[thread overview]
Message-ID: <495A0225.7050007@nokia.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

Hi,

Here is a patch to fix might_sleep issue that was found during testing.

-- 
Ville

[-- Attachment #2: 20081230-0001--BLUETOOTH-Remove-sleeping-functions-from-__rfcomm_.patch --]
[-- Type: text/x-patch, Size: 1471 bytes --]

>From a9bcfd0886bd6f54486a277b74247b32fd60f02f Mon Sep 17 00:00:00 2001
From: Ville Tervo <ville.tervo@nokia.com>
Date: Tue, 30 Dec 2008 12:59:01 +0200
Subject: [PATCH] [BLUETOOTH] Remove sleeping functions from __rfcomm_dlc_close

This patch removes code paths that uses functions
that might sleep. In case of rfcomm_send_disc sock_lock()
in l2cap_sock_sendmsg() and in case of rfcomm_queue_disc()
alloc_skb(size, GFP_KERNEL).


Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
---
 net/bluetooth/rfcomm/core.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index ba537fa..5aad9c7 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -430,13 +430,8 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
 	case BT_CONFIG:
 	case BT_CONNECT:
 		d->state = BT_DISCONN;
-		if (skb_queue_empty(&d->tx_queue)) {
-			rfcomm_send_disc(s, d->dlci);
-			rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT);
-		} else {
-			rfcomm_queue_disc(d);
-			rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT * 2);
-		}
+		rfcomm_queue_disc(d);
+		rfcomm_dlc_set_timer(d, RFCOMM_DISC_TIMEOUT * 2);
 		break;
 
 	default:
@@ -746,7 +741,7 @@ static int rfcomm_queue_disc(struct rfcomm_dlc *d)
 
 	BT_DBG("dlc %p dlci %d", d, d->dlci);
 
-	skb = alloc_skb(sizeof(*cmd), GFP_KERNEL);
+	skb = alloc_skb(sizeof(*cmd), GFP_ATOMIC);
 	if (!skb)
 		return -ENOMEM;
 
-- 
1.6.0.4


                 reply	other threads:[~2008-12-30 11:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=495A0225.7050007@nokia.com \
    --to=ville.tervo@nokia.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.