1
0
Fork 0
alistair23-linux/drivers/bluetooth
Hans de Goede 84d488719b Bluetooth: revert: hci_h5: close serdev device and free hu in h5_close
commit 5c3b579686 upstream.

There have been multiple revisions of the patch fix the h5->rx_skb
leak. Accidentally the first revision (which is buggy) and v5 have
both been merged:

v1 commit 70f259a3f4 ("Bluetooth: hci_h5: close serdev device and free
hu in h5_close");
v5 commit 855af2d74c ("Bluetooth: hci_h5: fix memory leak in h5_close")

The correct v5 makes changes slightly higher up in the h5_close()
function, which allowed both versions to get merged without conflict.

The changes from v1 unconditionally frees the h5 data struct, this
is wrong because in the serdev enumeration case the memory is
allocated in h5_serdev_probe() like this:

        h5 = devm_kzalloc(dev, sizeof(*h5), GFP_KERNEL);

So its lifetime is tied to the lifetime of the driver being bound
to the serdev and it is automatically freed when the driver gets
unbound. In the serdev case the same h5 struct is re-used over
h5_close() and h5_open() calls and thus MUST not be free-ed in
h5_close().

The serdev_device_close() added to h5_close() is incorrect in the
same way, serdev_device_close() is called on driver unbound too and
also MUST no be called from h5_close().

This reverts the changes made by merging v1 of the patch, so that
just the changes of the correct v5 remain.

Cc: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-12 20:16:17 +01:00
..
Kconfig Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices 2019-07-06 21:44:25 +02:00
Makefile Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices 2019-04-23 18:09:07 +02:00
ath3k.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
bcm203x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
bfusb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
bluecard_cs.c bluetooth: bluecard_cs: Replace GFP_ATOMIC with GFP_KERNEL in bluecard_hci_set_baud_rate() 2018-07-23 18:05:00 +02:00
bpa10x.c Bluetooth: bpa10x: change return value 2019-09-04 16:11:46 +02:00
bt3c_cs.c Bluetooth: bt3c_cs: Fix obsolete function 2018-09-27 12:57:39 +02:00
btbcm.c Bluetooth: btbcm: Add 2 missing models to subver tables 2020-06-22 09:30:59 +02:00
btbcm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
btintel.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
btintel.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
btmrvl_debugfs.c Bluetooth: btmrvl: Re-use kstrtol_from_user() 2018-05-30 08:16:05 +02:00
btmrvl_drv.h Bluetooth: btmrvl: Drop unused GPIO includes 2019-01-22 09:51:20 +01:00
btmrvl_main.c Bluetooth: btmrvl: support sysfs initiated firmware coredump 2018-05-29 15:59:50 +02:00
btmrvl_sdio.c btmrvl: Fix firmware filename for sd8997 chipset 2020-08-19 08:16:06 +02:00
btmrvl_sdio.h btmrvl: add platform specific wakeup interrupt support 2016-05-02 19:26:15 +02:00
btmtksdio.c Bluetooth: btmtksdio: Add the missed release_firmware() in mtk_setup_firmware() 2020-12-30 11:51:20 +01:00
btmtkuart.c Bluetooth: btmtkuart: Improve exception handling in btmtuart_probe() 2020-06-22 09:30:56 +02:00
btqca.c Bluetooth: hci_qca: wait for Pre shutdown complete event before sending the Power off pulse 2019-09-05 17:27:22 +02:00
btqca.h Bluetooth: hci_qca: Send VS pre shutdown command. 2019-08-12 18:23:50 +02:00
btqcomsmd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
btrsi.c Bluetooth: btrsi: fix bt tx timeout issue 2018-09-27 12:53:40 +02:00
btrtl.c Bluetooth: btrtl: Use kvmalloc for FW allocations 2020-10-01 13:17:29 +02:00
btrtl.h Bluetooth: btrtl: HCI reset on close for Realtek BT chip 2019-07-06 12:32:50 +02:00
btsdio.c Bluetooth: btsdio: Do not bind to non-removable BCM4356 2019-07-06 12:27:55 +02:00
btusb.c Bluetooth: btusb: Add the missed release_firmware() in btusb_mtk_setup_firmware() 2020-12-30 11:51:20 +01:00
btwilink.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
dtl1_cs.c networking: add and use skb_put_u8() 2017-06-16 11:48:40 -04:00
h4_recv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
hci_ag6xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
hci_ath.c Bluetooth: hci_uart: check for missing tty operations 2019-07-31 13:17:33 -07:00
hci_bcm.c Bluetooth: hci_bcm: fix freeing not-requested IRQ 2020-06-22 09:31:18 +02:00
hci_bcsp.c Bluetooth: Fix invalid-free in bcsp_close() 2019-11-29 10:09:39 +01:00
hci_h4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
hci_h5.c Bluetooth: revert: hci_h5: close serdev device and free hu in h5_close 2021-01-12 20:16:17 +01:00
hci_intel.c Bluetooth: hci_uart: check for missing tty operations 2019-07-31 13:17:33 -07:00
hci_ldisc.c Bluetooth: hci_uart: Cancel init work before unregistering 2020-10-29 09:57:35 +01:00
hci_ll.c Revert "Bluetooth: hci_ll: set operational frequency earlier" 2019-11-29 10:09:43 +01:00
hci_mrvl.c Bluetooth: hci_uart: check for missing tty operations 2019-07-31 13:17:33 -07:00
hci_nokia.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
hci_qca.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-09-15 14:17:27 +02:00
hci_serdev.c Bluetooth: hci_uart: Cancel init work before unregistering 2020-10-29 09:57:35 +01:00
hci_uart.h Bluetooth: hci_uart: check for missing tty operations 2019-07-31 13:17:33 -07:00
hci_vhci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00