linux-stable/drivers
Li Nan 9fd0198f7e 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 12:02:39 +02:00
..
accel accel/ivpu: Fix deadlock in context_xa 2024-04-17 11:19:34 +02:00
accessibility speakup: Avoid crash on very long word 2024-04-27 17:11:40 +02:00
acpi ACPI: CPPC: Fix access width used for PCC registers 2024-05-02 16:32:46 +02:00
amba
android binder: check offset alignment in binder_get_object() 2024-04-27 17:11:38 +02:00
ata ata: sata_gemini: Check clk_enable() result 2024-05-17 12:02:13 +02:00
atm atm: idt77252: fix a memleak in open_card_ubr0 2024-02-16 19:10:49 +01:00
auxdisplay
base regmap: Add regmap_read_bypassed() 2024-05-17 12:01:59 +02:00
bcma
block aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:19:19 -04:00
bluetooth Bluetooth: qca: fix firmware check error path 2024-05-17 12:02:38 +02:00
bus bus: mhi: host: Add MHI_PM_SYS_ERR_FAIL state 2024-04-13 13:07:38 +02:00
cache cache: ax45mp_cache: Align end size to cache boundary in ax45mp_dma_cache_wback() 2024-03-01 13:35:08 +01:00
cdrom
cdx
char random: handle creditable entropy from atomic process context 2024-04-27 17:11:30 +02:00
clk clk: sunxi-ng: a64: Set minimum and maximum rate for PLL-MIPI 2024-05-17 12:02:33 +02:00
clocksource clocksource/drivers/arm_global_timer: Fix maximum prescaler value 2024-04-03 15:28:50 +02:00
comedi comedi: vmk80xx: fix incomplete endpoint checking 2024-04-27 17:11:39 +02:00
connector connector/cn_proc: revert "connector: Fix proc_event_num_listeners count not cleared" 2024-02-23 09:25:01 +01:00
counter
cpufreq cpufreq: Don't unregister cpufreq cooling on CPU hotplug 2024-04-13 13:07:32 +02:00
cpuidle cpuidle: Avoid potential overflow in integer multiplication 2024-04-13 13:07:29 +02:00
crypto crypto: sun8i-ce - Fix use after free in unprepare 2024-04-03 15:28:40 +02:00
cxl cxl/core: Fix potential payload size confusion in cxl_mem_get_poison() 2024-05-02 16:32:35 +02:00
dax
dca
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2024-02-05 20:14:15 +00:00
dio
dma dmaengine: idxd: add a write() method for applications to submit work 2024-05-17 12:02:39 +02:00
dma-buf dma-buf: Fix NULL pointer dereference in sanitycheck() 2024-04-10 16:35:40 +02:00
edac
eisa
extcon extcon: fix possible name leak in extcon_dev_register() 2024-02-05 20:14:31 +00:00
firewire firewire: ohci: fulfill timestamp for some local asynchronous transaction 2024-05-17 12:02:30 +02:00
firmware firmware: arm_scmi: Make raw debugfs entries non-seekable 2024-04-17 11:19:27 +02:00
fpga
fsi
gnss
gpio gpiolib: cdev: fix uninitialised kfifo 2024-05-17 12:02:26 +02:00
gpu drm/amd/display: Fix incorrect DSC instance for MST 2024-05-17 12:02:35 +02:00
greybus
hid HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up 2024-05-02 16:32:44 +02:00
hsi
hte
hv Drivers: hv: vmbus: Don't free ring buffers that couldn't be re-encrypted 2024-05-17 12:02:17 +02:00
hwmon hwmon: (pmbus/ucd9000) Increase delay from 250 to 500us 2024-05-17 12:02:35 +02:00
hwspinlock
hwtracing hwtracing: hisi_ptt: Move type check to the beginning of hisi_ptt_pmu_event_init() 2024-03-26 18:20:06 -04:00
i2c i2c: smbus: fix NULL function pointer dereference 2024-05-02 16:32:49 +02:00
i3c i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling 2024-03-26 18:20:01 -04:00
idle
iio iio: accel: mxc4005: Interrupt handling fixes 2024-05-17 12:02:31 +02:00
infiniband qibfs: fix dentry leak 2024-05-17 12:02:20 +02:00
input Input: xpad - add support for Snakebyte GAMEPADs 2024-04-13 13:07:37 +02:00
interconnect interconnect: Don't access req_list while it's being manipulated 2024-04-27 17:11:37 +02:00
iommu iommu: mtk: fix module autoloading 2024-05-17 12:02:17 +02:00
ipack
irqchip irqchip/gic-v3-its: Prevent double free on error 2024-05-02 16:32:45 +02:00
isdn
leds leds: trigger: netdev: Fix kernel panic on interface rename trig notify 2024-04-03 15:28:27 +02:00
macintosh
mailbox mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt 2024-02-05 20:14:31 +00:00
mcb
md md: fix kmemleak of rdev->serial 2024-05-17 12:02:39 +02:00
media media: videobuf2: request more buffers for vb2_read 2024-04-27 17:11:30 +02:00
memory memory: tegra: Correct DLA client names 2024-03-26 18:19:32 -04:00
memstick
message
mfd mfd: cs42l43: Fix wrong GPIO_FN_SEL and SPI_CLK_CONFIG1 defaults 2024-03-26 18:19:55 -04:00
misc mei: me: add lunar lake point M DID 2024-05-17 12:02:33 +02:00
mmc mmc: sdhci-msm: pervent access to suspended controller 2024-05-02 16:32:43 +02:00
most
mtd mtd: limit OTP NVMEM cell parse to non-NAND devices 2024-05-17 12:01:55 +02:00
mux
net net: bcmgenet: synchronize UMAC_CMD access 2024-05-17 12:02:32 +02:00
nfc NFC: trf7970a: disable all regulators on removal 2024-05-02 16:32:36 +02:00
ntb NTB: fix possible name leak in ntb_register_device() 2024-03-26 18:19:48 -04:00
nubus
nvdimm
nvme nvme-pci: Add quirk for broken MSIs 2024-05-17 12:02:36 +02:00
nvmem nvmem: add explicit config option to read old syntax fixed OF cells 2024-05-17 12:01:55 +02:00
of of: module: prevent NULL pointer dereference in vsnprintf() 2024-04-10 16:36:06 +02:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:19:40 -04:00
parisc parisc/power: Fix power soft-off button emulation on qemu 2024-01-31 16:18:52 -08:00
parport
pci PCI/ASPM: Fix deadlock when enabling ASPM 2024-04-27 17:11:44 +02:00
pcmcia
peci
perf drivers/perf: hisi: Enable HiSilicon Erratum 162700402 quirk for HIP09 2024-04-13 13:07:36 +02:00
phy phy: qcom: qmp-combo: fix VCO div offset on v5_5nm and v6 2024-05-02 16:32:49 +02:00
pinctrl pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map() 2024-05-17 12:01:58 +02:00
platform platform/x86: ISST: Add Granite Rapids-D to HPM CPU list 2024-05-17 12:02:19 +02:00
pmdomain pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix domain 2024-04-13 13:07:30 +02:00
pnp PNP: ACPI: fix fortify warning 2024-02-05 20:14:15 +00:00
power power: supply: mt6360_charger: Fix of_match for usb-otg-vbus regulator 2024-05-17 12:01:58 +02:00
powercap powercap: intel_rapl_tpmi: Fix System Domain probing 2024-04-03 15:28:19 +02:00
pps
ps3
ptp
pwm pwm: img: fix pwm clock lookup 2024-04-03 15:28:52 +02:00
rapidio
ras
regulator regulator: core: fix debugfs creation regression 2024-05-17 12:02:36 +02:00
remoteproc remoteproc: virtio: Fix wdg cannot recovery remote processor 2024-04-03 15:28:16 +02:00
reset
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-01-31 16:18:50 -08:00
rtc nvmem: add explicit config option to read old syntax fixed OF cells 2024-05-17 12:01:55 +02:00
s390 s390/qeth: Fix kernel panic after setting hsuid 2024-05-17 12:02:06 +02:00
sbus
scsi scsi: hisi_sas: Handle the NCQ error returned by D2H frame 2024-05-17 12:02:15 +02:00
sh
siox
slimbus slimbus: qcom-ngd-ctrl: Add timeout for wait operation 2024-05-17 12:02:33 +02:00
soc soc: fsl: qbman: Use raw spinlock for cgr_lock 2024-04-03 15:28:32 +02:00
soundwire soundwire: amd: fix for wake interrupt handling for clockstop mode 2024-05-02 16:32:47 +02:00
spi spi: microchip-core-qspi: fix setting spi bus clock rate 2024-05-17 12:02:36 +02:00
spmi spmi: mediatek: Fix UAF on device remove 2024-02-05 20:14:32 +00:00
ssb
staging staging: vc04_services: fix information leak in create_component() 2024-04-03 15:28:59 +02:00
target scsi: target: Fix SELinux error when systemd-modules loads the target module 2024-05-17 12:02:15 +02:00
tc
tee tee: optee: Fix kernel panic caused by incorrect error handling 2024-04-03 15:28:44 +02:00
thermal thermal/of: Assume polling-delay(-passive) 0 when absent 2024-04-13 13:07:39 +02:00
thunderbolt thunderbolt: Reset only non-USB4 host routers in resume 2024-04-27 17:11:44 +02:00
tty serial: core: Fix missing shutdown and startup for serial base port 2024-04-27 17:11:39 +02:00
ufs scsi: ufs: core: Fix MCQ mode dev command timeout 2024-05-17 12:02:12 +02:00
uio uio_hv_generic: Don't free decrypted memory 2024-05-17 12:02:17 +02:00
usb usb: typec: tcpm: Check for port partner validity before consuming it 2024-05-17 12:02:29 +02:00
vdpa vdpa/mlx5: Allow CVQ size changes 2024-03-26 18:20:10 -04:00
vfio VFIO: Add the SPR_DSA and SPR_IAX devices to the denylist 2024-05-17 12:02:38 +02:00
vhost vhost: Add smp_rmb() in vhost_enable_notify() 2024-04-17 11:19:35 +02:00
video fbdev: fix incorrect address computation in deferred IO 2024-05-02 16:32:46 +02:00
virt
virtio virtio: reenable config if freezing device failed 2024-04-03 15:28:36 +02:00
vlynq
w1 nvmem: add explicit config option to read old syntax fixed OF cells 2024-05-17 12:01:55 +02:00
watchdog watchdog: stm32_iwdg: initialize default timeout 2024-03-26 18:20:02 -04:00
xen x86/xen: attempt to inflate the memory balloon on PVH 2024-04-13 13:07:39 +02:00
zorro
Kconfig
Makefile