Skip to contentSkip to conversation

Fix rfcomm might_sleep issue

PATCH New Ville Tervo 1 participant 1 message Dec 30, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix rfcomm might_sleep issue

Hi,

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

Signature · 1 line
Ville
Quoted 1 line

From a9bcfd0886bd6f54486a277b74247b32fd60f02f Mon Sep 17 00:00:00 2001

From: Ville Tervo <[email protected]>
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).

---
 net/bluetooth/rfcomm/core.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
net/bluetooth/rfcomm/core.c +3 -8
index ba537fa..5aad9c7 100644
@@ -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;
 
Signature · 1 line
1.6.0.4