* [PATCH v2] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle()
@ 2021-10-20 8:14 Soenke Huster
2021-10-20 12:59 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Soenke Huster @ 2021-10-20 8:14 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
Cc: Soenke Huster, linux-bluetooth, linux-kernel
On the reception of packets with an invalid packet type, the memory of
the allocated socket buffers is never freed. Add a default case that frees
these to avoid a memory leak.
Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
---
Changes in v2:
- Add break; to default case
drivers/bluetooth/virtio_bt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c
index 57908ce4fae8..076e4942a3f0 100644
--- a/drivers/bluetooth/virtio_bt.c
+++ b/drivers/bluetooth/virtio_bt.c
@@ -202,6 +202,9 @@ static void virtbt_rx_handle(struct virtio_bluetooth *vbt, struct sk_buff *skb)
hci_skb_pkt_type(skb) = pkt_type;
hci_recv_frame(vbt->hdev, skb);
break;
+ default:
+ kfree_skb(skb);
+ break;
}
}
--
2.33.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle()
2021-10-20 8:14 [PATCH v2] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() Soenke Huster
@ 2021-10-20 12:59 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2021-10-20 12:59 UTC (permalink / raw)
To: Soenke Huster
Cc: Johan Hedberg, Luiz Augusto von Dentz, linux-bluetooth, linux-kernel
Hi Soenke,
> On the reception of packets with an invalid packet type, the memory of
> the allocated socket buffers is never freed. Add a default case that frees
> these to avoid a memory leak.
>
> Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
> ---
> Changes in v2:
> - Add break; to default case
>
> drivers/bluetooth/virtio_bt.c | 3 +++
> 1 file changed, 3 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:[~2021-10-20 12:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 8:14 [PATCH v2] Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle() Soenke Huster
2021-10-20 12:59 ` 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).