Skip to content

Commit

Permalink
Bluetooth: hci_bcsp: Fix memory leak in rx_skb
Browse files Browse the repository at this point in the history
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
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Tomas Bortoli authored and holtmann committed Jul 6, 2019
1 parent 6c595ea commit 4ce9146
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/bluetooth/hci_bcsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ 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;
}
Expand Down

0 comments on commit 4ce9146

Please sign in to comment.