Skip to contentSkip to conversation

Bluetooth: hci_bcsp: Fix memory leak in rx_skb

PATCH In review Tomas Bortoli 2 participants 2 messages May 28, 2019 – Jul 6, 2019 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci_bcsp: Fix memory leak in rx_skb

Syzkaller found that it is possible to provoke a memory leak by never freeing rx_skb in struct bcsp_struct.

Fix by freeing in bcsp_close()

---
 drivers/bluetooth/hci_bcsp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/bluetooth/hci_bcsp.c +4 -0
index 1a7f0c82fb36..550ab5b4c8be 100644
@@ -759,6 +759,10 @@ static int bcsp_close(struct hci_uart *hu)
 	skb_queue_purge(&bcsp->rel);
 	skb_queue_purge(&bcsp->unrel);
 
+	if (bcsp->rx_skb) {
+		kfree_skb(bcsp->rx_skb); bcsp->rx_skb = NULL;
+	}
+
 	kfree(bcsp);
 	return 0;
 }
Signature · 1 line
2.11.0
maintainer
#1 lore raw

Hi Tomas,

Quoted 10 lines

Syzkaller found that it is possible to provoke a memory leak by never freeing rx_skb in struct bcsp_struct.

Fix by freeing in bcsp_close()

---
drivers/bluetooth/hci_bcsp.c | 4 ++++

1 file changed, 4 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel