LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_bcsp: Fix memory leak in rx_skb
@ 2019-05-28 13:42 Tomas Bortoli
2019-07-06 11:03 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Tomas Bortoli @ 2019-05-28 13:42 UTC (permalink / raw)
To: marcel, johan.hedberg; +Cc: linux-bluetooth, linux-kernel, Tomas Bortoli
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()
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+98162c885993b72f19c4@syzkaller.appspotmail.com
---
drivers/bluetooth/hci_bcsp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 1a7f0c82fb36..550ab5b4c8be 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: hci_bcsp: Fix memory leak in rx_skb
2019-05-28 13:42 [PATCH] Bluetooth: hci_bcsp: Fix memory leak in rx_skb Tomas Bortoli
@ 2019-07-06 11:03 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2019-07-06 11:03 UTC (permalink / raw)
To: Tomas Bortoli; +Cc: Johan Hedberg, linux-bluetooth, linux-kernel
Hi Tomas,
> 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()
>
> Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
> Reported-by: syzbot+98162c885993b72f19c4@syzkaller.appspotmail.com
> ---
> drivers/bluetooth/hci_bcsp.c | 4 ++++
> 1 file changed, 4 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-06 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 13:42 [PATCH] Bluetooth: hci_bcsp: Fix memory leak in rx_skb Tomas Bortoli
2019-07-06 11:03 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).