kernel-fxtec-pro1x/drivers/bluetooth
Maxim Mikityanskiy 4d04a4da59 Bluetooth: btrtl: Use kvmalloc for FW allocations
[ Upstream commit 268d3636dfb22254324774de1f8875174b3be064 ]

Currently, kmemdup is applied to the firmware data, and it invokes
kmalloc under the hood. The firmware size and patch_length are big (more
than PAGE_SIZE), and on some low-end systems (like ASUS E202SA) kmalloc
may fail to allocate a contiguous chunk under high memory usage and
fragmentation:

Bluetooth: hci0: RTL: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8821
Bluetooth: hci0: RTL: rom_version status=0 version=1
Bluetooth: hci0: RTL: loading rtl_bt/rtl8821a_fw.bin
kworker/u9:2: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0
<stack trace follows>

As firmware load happens on each resume, Bluetooth will stop working
after several iterations, when the kernel fails to allocate an order-4
page.

This patch replaces kmemdup with kvmalloc+memcpy. It's not required to
have a contiguous chunk here, because it's not mapped to the device
directly.

Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-01 13:14:31 +02:00
..
ath3k.c
bcm203x.c
bfusb.c
bluecard_cs.c
bpa10x.c
bt3c_cs.c
btbcm.c Bluetooth: btbcm: Add 2 missing models to subver tables 2020-06-22 09:05:13 +02:00
btbcm.h
btintel.c
btintel.h
btmrvl_debugfs.c
btmrvl_drv.h
btmrvl_main.c
btmrvl_sdio.c
btmrvl_sdio.h
btmtkuart.c
btqca.c
btqca.h
btqcomsmd.c
btrsi.c
btrtl.c Bluetooth: btrtl: Use kvmalloc for FW allocations 2020-10-01 13:14:31 +02:00
btrtl.h
btsdio.c
btusb.c Bluetooth: btusb: fix PM leak in error case of setup 2020-01-09 10:19:04 +01:00
btwilink.c
dtl1_cs.c
h4_recv.h
hci_ag6xx.c
hci_ath.c
hci_bcm.c Bluetooth: hci_bcm: fix freeing not-requested IRQ 2020-06-22 09:05:26 +02:00
hci_bcsp.c
hci_h4.c
hci_h5.c Bluetooth: hci_h5: Set HCI_UART_RESET_ON_INIT to correct flags 2020-08-19 08:15:00 +02:00
hci_intel.c
hci_ldisc.c
hci_ll.c
hci_mrvl.c
hci_nokia.c
hci_qca.c
hci_serdev.c Bluetooth: hci_serdev: Only unregister device if it was registered 2020-08-19 08:15:00 +02:00
hci_uart.h
hci_vhci.c
Kconfig
Makefile