linux-stable/drivers
Li Nan fb5b347efd md: fix kmemleak of rdev->serial
commit 6cf3506587 upstream.

If kobject_add() is fail in bind_rdev_to_array(), 'rdev->serial' will be
alloc not be freed, and kmemleak occurs.

unreferenced object 0xffff88815a350000 (size 49152):
  comm "mdadm", pid 789, jiffies 4294716910
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace (crc f773277a):
    [<0000000058b0a453>] kmemleak_alloc+0x61/0xe0
    [<00000000366adf14>] __kmalloc_large_node+0x15e/0x270
    [<000000002e82961b>] __kmalloc_node.cold+0x11/0x7f
    [<00000000f206d60a>] kvmalloc_node+0x74/0x150
    [<0000000034bf3363>] rdev_init_serial+0x67/0x170
    [<0000000010e08fe9>] mddev_create_serial_pool+0x62/0x220
    [<00000000c3837bf0>] bind_rdev_to_array+0x2af/0x630
    [<0000000073c28560>] md_add_new_disk+0x400/0x9f0
    [<00000000770e30ff>] md_ioctl+0x15bf/0x1c10
    [<000000006cfab718>] blkdev_ioctl+0x191/0x3f0
    [<0000000085086a11>] vfs_ioctl+0x22/0x60
    [<0000000018b656fe>] __x64_sys_ioctl+0xba/0xe0
    [<00000000e54e675e>] do_syscall_64+0x71/0x150
    [<000000008b0ad622>] entry_SYSCALL_64_after_hwframe+0x6c/0x74

Fixes: 963c555e75 ("md: introduce mddev_create/destroy_wb_pool for the change of member device")
Signed-off-by: Li Nan <linan122@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240208085556.2412922-1-linan666@huaweicloud.com
[ mddev_destroy_serial_pool third parameter was removed in mainline,
  where there is no need to suspend within this function anymore. ]
Signed-off-by: Jeremy Bongio <jbongio@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-17 11:48:11 +02:00
..
accessibility speakup: Avoid crash on very long word 2024-05-02 16:23:39 +02:00
acpi Revert "ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default" 2024-04-13 12:59:48 +02:00
amba
android binder: check offset alignment in binder_get_object() 2024-05-02 16:23:38 +02:00
ata ata: sata_gemini: Check clk_enable() result 2024-05-17 11:48:03 +02:00
atm atm: idt77252: fix a memleak in open_card_ubr0 2024-02-23 08:42:19 +01:00
auxdisplay
base driver core: Introduce device_link_wait_removal() 2024-04-13 12:59:34 +02:00
bcma
block aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:21:48 -04:00
bluetooth Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0bda:0x4853 2024-05-02 16:23:44 +02:00
bus bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-03-26 18:21:50 -04:00
cdrom
char hwrng: core - Fix page fault dead lock on mmap-ed hwrng 2024-02-23 08:41:52 +01:00
clk clk: Don't hold prepare_lock when calling kref_put() 2024-05-17 11:48:05 +02:00
clocksource clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware 2023-11-28 16:54:49 +00:00
connector
counter counter: microchip-tcb-capture: Fix the use of internal GCLK logic 2023-10-25 11:54:16 +02:00
cpufreq cpufreq: brcmstb-avs-cpufreq: fix up "add check for cpufreq_cpu_get's return value" 2024-04-13 12:58:47 +02:00
cpuidle
crypto crypto: qat - resolve race condition during AER recovery 2024-04-13 12:58:05 +02:00
dax
dca
devfreq PM / devfreq: Fix buffer overflow in trans_stat_show 2024-05-02 16:23:44 +02:00
dio
dma dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state" 2024-05-17 11:47:57 +02:00
dma-buf
edac EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 14:37:39 -08:00
eisa
extcon
firewire firewire: nosy: ensure user_length is taken into account when fetching packet contents 2024-05-17 11:48:08 +02:00
firmware efivarfs: Request at most 512 bytes for variable names 2024-04-13 12:59:00 +02:00
fpga
fsi
gnss
gpio gpio: crystalcove: Use -ENOTSUPP consistently 2024-05-17 11:48:05 +02:00
gpu drm/vmwgfx: Fix invalid reads in fence signaled events 2024-05-17 11:48:10 +02:00
greybus
hid HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up 2024-05-02 16:23:46 +02:00
hsi
hv Drivers: hv: vmbus: Drop error message when 'No request id available' 2024-03-15 10:48:22 -04:00
hwmon hwmon: (pmbus/ucd9000) Increase delay from 250 to 500us 2024-05-17 11:48:10 +02:00
hwspinlock
hwtracing coresight: etm4x: Fix width of CCITMIN field 2024-01-25 14:37:39 -08:00
i2c i2c: smbus: fix NULL function pointer dereference 2024-05-02 16:23:45 +02:00
i3c i3c: master: cdns: Update maximum prescaler value for i2c clock 2024-02-23 08:42:13 +01:00
ide
idle
iio iio: accel: mxc4005: Interrupt handling fixes 2024-05-17 11:48:09 +02:00
infiniband RDMA/mlx5: Fix port number for counter query in multi-port configuration 2024-05-02 16:23:37 +02:00
input Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails 2024-04-13 12:59:44 +02:00
interconnect interconnect: Treat xlate() returning NULL node as an error 2024-01-05 15:12:26 +01:00
iommu iommu/vt-d: Allocate local memory for page request queue 2024-05-02 16:23:35 +02:00
ipack
irqchip irqchip/gic-v3-its: Prevent double free on error 2024-05-02 16:23:44 +02:00
isdn
leds leds: sgm3140: Add missing timer cleanup and flash gpio control 2024-03-26 18:22:00 -04:00
lightnvm
macintosh
mailbox mailbox: imx: fix suspend failue 2024-05-02 16:23:35 +02:00
mcb mcb: fix error handling for different scenarios when parsing 2023-11-28 16:54:58 +00:00
md md: fix kmemleak of rdev->serial 2024-05-17 11:48:11 +02:00
media media: cec: core: remove length check of Timer Status 2024-05-02 16:23:33 +02:00
memory
memstick
message
mfd mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref 2024-03-26 18:21:58 -04:00
misc mei: me: add lunar lake point M DID 2024-05-17 11:48:10 +02:00
mmc mmc: core: Avoid negative index with array access 2024-04-13 12:59:04 +02:00
most
mtd mtd: diskonchip: work around ubsan link failure 2024-05-02 16:23:45 +02:00
mux
net net: bcmgenet: synchronize use of bcmgenet_set_rx_mode() 2024-05-17 11:48:10 +02:00
nfc NFC: trf7970a: disable all regulators on removal 2024-05-02 16:23:41 +02:00
ntb ntb: Fix calculation ntb_transport_tx_free_entry() 2023-09-19 12:20:22 +02:00
nubus
nvdimm nd_btt: Make BTT lanes preemptible 2023-11-20 11:06:50 +01:00
nvme drivers/nvme: Add quirks for device 126f:2262 2024-04-13 12:59:53 +02:00
nvmem nvmem: meson-efuse: fix function pointer type mismatch 2024-04-13 12:58:28 +02:00
of of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-13 12:59:35 +02:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:21:53 -04:00
oprofile
parisc parisc: iosapic.c: Fix sparse warnings 2023-10-10 21:53:32 +02:00
parport parport: parport_serial: Add Brainboxes device IDs and geometry 2024-01-25 14:37:39 -08:00
pci PCI/DPC: Quirk PIO log size for Intel Ice Lake Root Ports 2024-04-13 12:59:13 +02:00
pcmcia pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:06:54 +01:00
perf perf/arm-cmn: Fix the unhandled overflow status of counter 4 to 7 2023-10-25 11:54:13 +02:00
phy phy: tegra: xusb: Add API to retrieve the port number of phy 2024-04-13 12:58:29 +02:00
pinctrl pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map() 2024-05-17 11:47:59 +02:00
platform platform/x86: touchscreen_dmi: Add an extra entry for a variant of the Chuwi Vi8 tablet 2024-04-13 12:59:50 +02:00
pnp PNP: ACPI: fix fortify warning 2024-02-23 08:42:03 +01:00
power power: rt9455: hide unused rt9455_boost_voltage_values 2024-05-17 11:47:59 +02:00
powercap
pps
ps3
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 16:54:54 +00:00
pwm pwm: jz4740: Don't use dev_err_probe() in .request() 2024-01-25 14:37:52 -08:00
rapidio
ras
regulator regulator: core: fix debugfs creation regression 2024-05-17 11:48:11 +02:00
remoteproc remoteproc: stm32: fix phys_addr_t format string 2024-03-26 18:22:04 -04:00
reset reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning 2024-01-25 14:37:37 -08:00
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-02-23 08:41:53 +01:00
rtc rtc: mt6397: select IRQ_DOMAIN instead of depending on it 2024-03-26 18:22:02 -04:00
s390 s390/zcrypt: fix reference counting on zcrypt card objects 2024-04-13 12:58:36 +02:00
sbus
scsi scsi: bnx2fc: Remove spin_lock_bh while releasing resources after upload 2024-05-17 11:48:03 +02:00
sfi
sh
siox
slimbus slimbus: core: Remove usage of the deprecated ida_simple_xx() API 2024-04-13 12:58:29 +02:00
soc soc: fsl: qbman: Use raw spinlock for cgr_lock 2024-04-13 12:58:36 +02:00
soundwire soundwire: stream: fix NULL pointer dereference for multi_link 2023-12-20 15:44:36 +01:00
spi spi: spi-mt65xx: Fix NULL pointer access in interrupt handler 2024-03-26 18:22:04 -04:00
spmi
ssb
staging comedi: vmk80xx: fix incomplete endpoint checking 2024-05-02 16:23:38 +02:00
target scsi: target: Fix SELinux error when systemd-modules loads the target module 2024-05-17 11:48:04 +02:00
tc
tee tee: optee: Fix kernel panic caused by incorrect error handling 2024-04-13 12:58:53 +02:00
thermal thermal: core: prevent potential string overflow 2023-11-20 11:06:45 +01:00
thunderbolt thunderbolt: Fix wake configurations after device unplug 2024-05-02 16:23:38 +02:00
tty serial: mxs-auart: add spinlock around changing cts state 2024-05-02 16:23:43 +02:00
uio uio: Fix use-after-free in uio_open 2024-01-25 14:37:38 -08:00
usb usb: dwc3: core: Prevent phy suspend during init 2024-05-17 11:48:09 +02:00
vdpa
vfio vfio/fsl-mc: Block calling interrupt handler without trigger 2024-04-13 12:59:21 +02:00
vhost vhost: Add smp_rmb() in vhost_vq_avail_empty() 2024-05-02 16:23:35 +02:00
video fbmon: prevent division by zero in fb_videomode_from_videomode() 2024-04-13 12:59:53 +02:00
virt
virtio virtio: reenable config if freezing device failed 2024-04-13 12:59:55 +02:00
visorbus
vlynq
vme
w1
watchdog watchdog: stm32_iwdg: initialize default timeout 2024-03-26 18:22:01 -04:00
xen xen/events: close evtchn after mapping cleanup 2024-04-13 12:58:54 +02:00
zorro
Kconfig
Makefile