Bluetooth: virtio_bt: fix memory leak in virtbt_rx_handle()
authorSoenke Huster <soenke.huster@eknoes.de>
Wed, 20 Oct 2021 08:14:44 +0000 (10:14 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 20 Oct 2021 12:58:46 +0000 (14:58 +0200)
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.

Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver")
Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/virtio_bt.c

index 57908ce..076e494 100644 (file)
@@ -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;
        }
 }