Skip to contentSkip to conversation

Bluetooth: Fix inconsistent returns 'hdev->lock'

PATCH In review Luiz Augusto von Dentz 1 participant 2 messages Jan 27, 2020

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Fix inconsistent returns 'hdev->lock'

From: Luiz Augusto von Dentz <[email protected]>

If Set CIG Parameters fails the hdev->lock was left locked.

---
 net/bluetooth/hci_event.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +2 -1
index c40ae10e7b9a..bea39d5f6936 100644
@@ -3168,7 +3168,7 @@ static void hci_cc_le_set_cig_params(struct hci_dev *hdev, struct sk_buff *skb)
 			conn->state = BT_CLOSED;
 			hci_connect_cfm(conn, rp->status);
 			hci_conn_del(conn);
-			return;
+			goto unlock;
 		}
 
 		conn->handle = __le16_to_cpu(rp->handle[i++]);
@@ -3183,6 +3183,7 @@ static void hci_cc_le_set_cig_params(struct hci_dev *hdev, struct sk_buff *skb)
 			break;
 	}
 
+unlock:
 	rcu_read_unlock();
 
 	hci_dev_unlock(hdev);
Signature · 1 line
2.21.0
author maintainer
#1 lore raw

Hi,

Quoted 32 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

If Set CIG Parameters fails the hdev->lock was left locked.

---
 net/bluetooth/hci_event.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +2 -2
index c40ae10e7b9a..bea39d5f6936 100644
@@ -3168,7 +3168,7 @@ static void hci_cc_le_set_cig_params(struct hci_dev *hdev, struct sk_buff *skb)
                        conn->state = BT_CLOSED;
                        hci_connect_cfm(conn, rp->status);
                        hci_conn_del(conn);
-                       return;
+                       goto unlock;
                }
 
                conn->handle = __le16_to_cpu(rp->handle[i++]);
@@ -3183,6 +3183,7 @@ static void hci_cc_le_set_cig_params(struct hci_dev *hdev, struct sk_buff *skb)
                        break;
        }
 
+unlock:
        rcu_read_unlock();
 
        hci_dev_unlock(hdev);
--
Quoted 1 line

2.21.0

Please ignore this, the original patch is not in bluetooth-next yet.

Signature · 1 line
Luiz Augusto von Dentz