linux/drivers
Johannes Thumshirn 98e88750df scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer
[ Upstream commit 7ce3e61071 ]

We have two reports of failed memory allocation in btrfs' code which is
calling into report zones.

Both of these reports have the following signature coming from
__vmalloc_area_node():

 kworker/u17:5: vmalloc error: size 0, failed to allocate pages, mode:0x10dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NORETRY|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0

Further debugging showed these where allocations of one sector (512
bytes) and at least one of the reporter's systems where low on memory,
so going through the overhead of allocating a vm area failed.

Switching the allocation from __vmalloc() to kvzalloc() avoids the
overhead of vmalloc() on small allocations and succeeds.

Note: the buffer is already freed using kvfree() so there's no need to
adjust the free path.

Cc: Qu Wenru <wqu@suse.com>
Cc: Naohiro Aota <naohiro.aota@wdc.com>
Link: https://github.com/kdave/btrfs-progs/issues/779
Link: https://github.com/kdave/btrfs-progs/issues/915
Fixes: 23a50861ad ("scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer()")
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20241030110253.11718-1-jth@kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-11-14 13:13:37 +01:00
..
accessibility speakup: Fix sizeof() vs ARRAY_SIZE() bug 2024-06-16 13:39:11 +02:00
acpi ACPI: CPPC: Make rmw_lock a raw_spin_lock 2024-11-08 16:25:53 +01:00
amba amba: bus: fix refcount leak 2023-09-19 12:22:47 +02:00
android binder: fix UAF caused by offsets overwrite 2024-09-12 11:07:51 +02:00
ata ata: sata_sil: Rename sil_blacklist to sil_quirks 2024-10-17 15:11:29 +02:00
atm atm: idt77252: prevent use after free in dequeue_rx() 2024-09-04 13:23:18 +02:00
auxdisplay auxdisplay: hd44780: Fix potential memory leak in hd44780_remove() 2023-03-11 13:57:22 +01:00
base Revert "driver core: Fix uevent_show() vs driver detach race" 2024-11-08 16:25:54 +01:00
bcma Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
block aoe: fix the potential use-after-free problem in more places 2024-10-17 15:11:39 +02:00
bluetooth Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001 2024-10-22 15:40:45 +02:00
bus bus: integrator-lm: fix OF node leak in probe() 2024-10-17 15:11:12 +02:00
cdrom scsi: sr: cdrom: Move cdrom_read_cdda_bpc() into the sr driver 2021-07-30 22:13:09 -04:00
char virtio_console: fix misc probe bugs 2024-10-17 15:11:49 +02:00
clk clk: imx: Remove CLK_SET_PARENT_GATE for DRAM mux for i.MX7D 2024-10-17 15:11:52 +02:00
clocksource clocksource/drivers/qcom: Add missing iounmap() on errors in msm_dt_timer_init() 2024-10-17 15:10:49 +02:00
comedi comedi: ni_routing: tools: Check when the file could not be opened 2024-10-17 15:11:52 +02:00
connector net/connector: Add const qualifier to cb_id 2020-12-16 11:06:49 -08:00
counter counter: microchip-tcb-capture: Fix the use of internal GCLK logic 2023-10-19 23:05:37 +02:00
cpufreq cpufreq: ti-cpufreq: Introduce quirks to handle syscon fails appropriately 2024-10-17 15:10:45 +02:00
cpuidle cpuidle: Avoid potential overflow in integer multiplication 2024-04-13 13:01:43 +02:00
crypto crypto: ccp - Properly unregister /dev/sev on sev PLATFORM_STATUS failure 2024-10-17 15:11:13 +02:00
cxl cxl/mem: Fix shutdown order 2023-11-20 11:08:27 +01:00
dax dax/kmem: Pass valid argument to memory_group_register_static 2023-07-23 13:47:17 +02:00
dca dca: Use PTR_ERR_OR_ZERO() to simplify code 2020-05-15 16:25:20 +02:00
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2024-02-23 08:54:38 +01:00
dio drivers: dio: fix possible memory leak in dio_init() 2022-12-31 13:14:27 +01:00
dma dmaengine: dw: Add memory bus width verification 2024-09-04 13:23:40 +02:00
dma-buf dma-buf: heaps: Fix off-by-one in CMA heap fault handler 2024-10-17 15:10:37 +02:00
edac EDAC/igen6: Fix conversion of system address to physical memory address 2024-10-17 15:11:16 +02:00
eisa EISA: use DEVICE_ATTR_RO() helper macro 2021-06-04 15:28:34 +02:00
extcon extcon: max8997: select IRQ_DOMAIN instead of depending on it 2024-06-16 13:39:39 +02:00
firewire firewire: nosy: ensure user_length is taken into account when fetching packet contents 2024-05-17 11:51:01 +02:00
firmware firmware: arm_sdei: Fix the input parameter of cpuhp_remove_state() 2024-11-08 16:25:53 +01:00
fpga fpga: region: add owner module and take its refcount 2024-06-16 13:39:38 +02:00
fsi fsi: aspeed: Reset master errors after CFAM reset 2023-09-19 12:22:46 +02:00
gnss treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
gpio gpio: aspeed: Use devm_clk api to manage clock source 2024-10-17 15:11:55 +02:00
gpu drm/i915: Fix potential context UAFs 2024-11-08 16:25:56 +01:00
greybus greybus: Fix use-after-free bug in gb_interface_release due to race condition. 2024-07-05 09:14:23 +02:00
hid HID: core: zero-initialize the report buffer 2024-11-14 13:13:35 +01:00
hsi HSI: omap_ssi_core: Fix error handling in ssi_init() 2022-12-31 13:14:32 +01:00
hv Drivers: hv: vmbus: Fix rescind handling in uio_hv_generic 2024-09-12 11:07:51 +02:00
hwmon hwmon: (adt7470) Add missing dependency on REGMAP_I2C 2024-10-17 15:11:58 +02:00
hwspinlock hwspinlock: Introduce hwspin_lock_bust() 2024-09-12 11:07:41 +02:00
hwtracing coresight: tmc: sg: Do not leak sg_table 2024-10-17 15:11:06 +02:00
i2c i2c: smbus: Check for parent device before dereference 2024-10-17 15:12:01 +02:00
i3c i3c: mipi-i3c-hci: Error out instead on BUG_ON() in IBI DMA setup 2024-09-12 11:07:49 +02:00
idle intel_idle: Disable IBRS during long idle 2022-07-23 12:54:04 +02:00
iio iio: light: veml6030: fix microlux value calculation 2024-11-08 16:25:54 +01:00
infiniband RDMA/bnxt_re: synchronize the qp-handle table array 2024-11-08 16:25:52 +01:00
input Input: synaptics-rmi4 - fix UAF of IRQ domain on driver removal 2024-10-17 15:11:49 +02:00
interconnect interconnect: qcom: sm8250: Enable sync_state 2024-10-17 15:11:06 +02:00
iommu iommu/vt-d: Fix incorrect pci_for_each_dma_alias() for non-PCI devices 2024-10-22 15:40:42 +02:00
ipack ipack: ipoctal: fix module reference leak 2021-09-27 17:38:49 +02:00
irqchip irqchip/gic-v4: Don't allow a VMOVP on a dying VPE 2024-10-22 15:40:46 +02:00
isdn mISDN: Fix a use after free in hfcmulti_tx() 2024-08-19 05:45:25 +02:00
leds leds: spi-byte: Call of_node_put() on error path 2024-09-12 11:07:46 +02:00
macintosh macintosh/therm_windtunnel: fix module unload. 2024-08-19 05:45:06 +02:00
mailbox mailbox: bcm2835: Fix timeout during suspend mode 2024-10-17 15:11:19 +02:00
mcb mcb: fix error handling for different scenarios when parsing 2023-11-28 16:56:31 +00:00
md dm-crypt, dm-verity: disable tasklets 2024-10-22 15:40:41 +02:00
media media: adv7604: prevent underflow condition when reporting colorspace 2024-11-14 13:13:37 +01:00
memory memory: stm32-fmc2-ebi: check regmap_read return value 2024-09-04 13:23:25 +02:00
memstick memstick r592: make memstick_debug_get_tpc_name() static 2023-07-23 13:46:52 +02:00
message scsi: message: mptlan: Fix use after free bug in mptlan_remove() due to race condition 2023-05-24 17:36:45 +01:00
mfd mfd: omap-usb-tll: Use struct_size to allocate tll 2024-08-19 05:45:03 +02:00
misc misc: sgi-gru: Don't disable preemption in GRU driver 2024-11-08 16:25:53 +01:00
mmc mmc: cqhci: Fix checking of CQHCI_HALT state 2024-09-12 11:07:43 +02:00
most most: fix control-message timeouts 2021-11-18 19:16:08 +01:00
mtd mtd: powernv: Add check devm_kasprintf() returned value 2024-10-17 15:10:50 +02:00
mux mux: gpio: Simplify code by using dev_err_probe() 2021-04-02 16:28:53 +02:00
net net: arc: fix the device for dma_map_single/dma_unmap_single 2024-11-14 13:13:37 +01:00
nfc nfc: pn533: Add poll mod list filling check 2024-09-04 13:23:40 +02:00
ntb ntb: ntb_hw_switchtec: Fix use after free vulnerability in switchtec_ntb_remove due to race condition 2024-10-17 15:11:51 +02:00
nubus nubus: Partially revert proc_create_single_data() conversion 2023-07-05 18:25:05 +01:00
nvdimm virtio_pmem: Check device status before requesting flush 2024-10-17 15:11:52 +02:00
nvme nvme-pci: qdepth 1 quirk 2024-10-17 15:11:25 +02:00
nvmem nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc 2024-09-12 11:07:51 +02:00
of of/irq: Refer to actual buffer size in of_irq_parse_one() 2024-10-17 15:11:32 +02:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:21:23 -04:00
parisc parisc: iosapic.c: Fix sparse warnings 2023-10-06 13:18:15 +02:00
parport parport: Proper fix for array out-of-bounds access 2024-10-22 15:40:46 +02:00
pci PCI: Mark Creative Labs EMU20k2 INTx masking as broken 2024-10-17 15:11:51 +02:00
pcmcia pcmcia: Use resource_size function on resource object 2024-09-12 11:07:46 +02:00
perf perf: hisi: Fix use-after-free when register pmu fails 2023-11-20 11:08:21 +01:00
phy phy: zynqmp: Enable reference clock correctly 2024-09-04 13:23:42 +02:00
pinctrl pinctrl: ocelot: fix system hang on level based interrupts 2024-10-22 15:40:46 +02:00
platform platform/x86: dell-sysman: add support for alienware products 2024-11-01 01:52:36 +01:00
pnp PNP: ACPI: fix fortify warning 2024-02-23 08:54:38 +01:00
power power: supply: hwmon: Fix missing temp1_max_alarm attribute 2024-10-17 15:11:35 +02:00
powercap powercap: RAPL: fix invalid initialization for pl4_supported field 2024-10-17 15:11:09 +02:00
pps pps: add an error check in parport_attach 2024-10-17 15:11:17 +02:00
ps3 powerpc/ps3: Warn on PS3 device errors 2021-06-10 21:44:58 +10:00
ptp ptp: fix integer overflow in max_vclocks_store 2024-07-05 09:14:31 +02:00
pwm pwm: stm32: Always do lazy disabling 2024-08-19 05:44:51 +02:00
rapidio rapidio: devices: fix missing put_device in mport_cdev_open 2022-12-31 13:14:05 +01:00
ras RAS/CEC: Correct ce_add_elem()'s returned values 2021-04-07 11:52:26 +02:00
regulator regulator: bd71815: fix ramp values 2024-07-05 09:14:33 +02:00
remoteproc remoteproc: imx_rproc: Use imx specific hook for find_loaded_rsc_table 2024-10-17 15:11:51 +02:00
reset reset: k210: fix OF node leak in probe() error path 2024-10-17 15:10:49 +02:00
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-02-23 08:54:24 +01:00
rtc rtc: at91sam9: fix OF node leak in probe() error path 2024-10-17 15:11:41 +02:00
s390 s390/sclp_vt220: Convert newlines to CRLF instead of LFCR 2024-10-22 15:40:42 +02:00
sbus module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
scsi scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer 2024-11-14 13:13:37 +01:00
sh genirq: Add and use an irq_data_update_affinity helper 2023-03-11 13:57:31 +01:00
siox siox: fix possible memory leak in siox_device_add() 2022-11-26 09:24:36 +01:00
slimbus slimbus: qcom-ngd-ctrl: Add timeout for wait operation 2024-05-17 11:51:04 +02:00
soc soc: versatile: realview: fix soc_dev leak during device remove 2024-10-17 15:11:16 +02:00
soundwire soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps" 2024-10-17 15:10:37 +02:00
spi spi: bcm63xx: Fix missing pm_runtime_disable() 2024-10-17 15:11:44 +02:00
spmi spmi: hisi-spmi-controller: Do not override device identifier 2024-07-05 09:14:20 +02:00
ssb ssb: Fix division by zero issue in ssb_calc_clock_rate 2024-09-04 13:23:20 +02:00
staging staging: iio: frequency: ad9832: fix division by zero in ad9832_calc_freqreg() 2024-11-08 16:25:54 +01:00
target scsi: target: core: Fix null-ptr-deref in target_alloc_device() 2024-11-01 01:52:34 +01:00
tc The main MIPS changes for 5.6: 2020-01-31 11:28:31 -08:00
tee tee: optee: Fix kernel panic caused by incorrect error handling 2024-04-10 16:18:46 +02:00
thermal thermal: intel: int340x: processor: Fix warning during module unload 2024-10-17 15:11:54 +02:00
thunderbolt thunderbolt: Mark XDomain as unplugged when router is removed 2024-09-04 13:23:15 +02:00
tty vt: prevent kernel-infoleak in con_font_get() 2024-11-08 16:25:56 +01:00
uio Drivers: hv: vmbus: Fix rescind handling in uio_hv_generic 2024-09-12 11:07:51 +02:00
usb xhci: Use pm_runtime_get to prevent RPM on unsupported systems 2024-11-08 16:25:54 +01:00
vdpa vduse: Temporarily fail if control queue feature requested 2024-07-05 09:14:42 +02:00
vfio vfio/pci: fix potential memory leak in vfio_intx_enable() 2024-10-17 15:11:09 +02:00
vhost vhost/scsi: null-ptr-dereference in vhost_scsi_get_req() 2024-10-17 15:11:47 +02:00
video fbdev: sisfb: Fix strbuf array overflow 2024-10-17 15:11:53 +02:00
virt drivers/virt/acrn: fix PFNMAP PTE checks in acrn_vm_ram_map() 2024-06-16 13:39:32 +02:00
virtio vdpa: Add eventfd for the vdpa callback 2024-10-17 15:11:06 +02:00
visorbus visorbus: fix error return code in visorchipset_init() 2021-06-04 15:27:26 +02:00
vlynq bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
vme vme: Fix error not catched in fake_init() 2022-12-31 13:14:30 +01:00
w1 w1: fix loop in w1_fini() 2023-07-23 13:47:20 +02:00
watchdog watchdog: imx_sc_wdt: Don't disable WDT in suspend 2024-10-17 15:11:02 +02:00
xen xen/swiotlb: add alignment check for dma buffers 2024-10-17 15:10:55 +02:00
zorro zorro: Drop useless (and hardly used) .driver member in struct zorro_dev 2021-08-05 14:37:04 +02:00
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Makefile virtio: always enter drivers/virtio/ 2021-12-22 09:32:39 +01:00