From: Greg Kroah-Hartman Date: Tue, 26 Nov 2019 08:20:30 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v4.4.204~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dafdf62f313493bab4d526d125e6724ef0b33847;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: bluetooth-fix-invalid-free-in-bcsp_close.patch --- diff --git a/queue-4.4/bluetooth-fix-invalid-free-in-bcsp_close.patch b/queue-4.4/bluetooth-fix-invalid-free-in-bcsp_close.patch new file mode 100644 index 00000000000..d052ab6e000 --- /dev/null +++ b/queue-4.4/bluetooth-fix-invalid-free-in-bcsp_close.patch @@ -0,0 +1,50 @@ +From cf94da6f502d8caecabd56b194541c873c8a7a3c Mon Sep 17 00:00:00 2001 +From: Tomas Bortoli +Date: Fri, 1 Nov 2019 21:42:44 +0100 +Subject: Bluetooth: Fix invalid-free in bcsp_close() + +From: Tomas Bortoli + +commit cf94da6f502d8caecabd56b194541c873c8a7a3c upstream. + +Syzbot reported an invalid-free that I introduced fixing a memleak. + +bcsp_recv() also frees bcsp->rx_skb but never nullifies its value. +Nullify bcsp->rx_skb every time it is freed. + +Signed-off-by: Tomas Bortoli +Reported-by: syzbot+a0d209a4676664613e76@syzkaller.appspotmail.com +Signed-off-by: Marcel Holtmann +Cc: Alexander Potapenko +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/bluetooth/hci_bcsp.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/bluetooth/hci_bcsp.c ++++ b/drivers/bluetooth/hci_bcsp.c +@@ -566,6 +566,7 @@ static int bcsp_recv(struct hci_uart *hu + if (*ptr == 0xc0) { + BT_ERR("Short BCSP packet"); + kfree_skb(bcsp->rx_skb); ++ bcsp->rx_skb = NULL; + bcsp->rx_state = BCSP_W4_PKT_START; + bcsp->rx_count = 0; + } else +@@ -581,6 +582,7 @@ static int bcsp_recv(struct hci_uart *hu + bcsp->rx_skb->data[2])) != bcsp->rx_skb->data[3]) { + BT_ERR("Error in BCSP hdr checksum"); + kfree_skb(bcsp->rx_skb); ++ bcsp->rx_skb = NULL; + bcsp->rx_state = BCSP_W4_PKT_DELIMITER; + bcsp->rx_count = 0; + continue; +@@ -615,6 +617,7 @@ static int bcsp_recv(struct hci_uart *hu + bscp_get_crc(bcsp)); + + kfree_skb(bcsp->rx_skb); ++ bcsp->rx_skb = NULL; + bcsp->rx_state = BCSP_W4_PKT_DELIMITER; + bcsp->rx_count = 0; + continue; diff --git a/queue-4.4/series b/queue-4.4/series index cacadc47080..00b9a865ee8 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -96,3 +96,4 @@ pinctrl-zynq-use-define-directive-for-pin_config_io_.patch pci-keystone-use-quirk-to-limit-mrrs-for-k2g.patch spi-omap2-mcspi-fix-dma-and-fifo-event-trigger-size-.patch ib-hfi1-ensure-full-gen3-speed-in-a-gen4-system.patch +bluetooth-fix-invalid-free-in-bcsp_close.patch