linux-stable/drivers
Li Nan f3a1787dc4 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:51:06 +02:00
..
accessibility speakup: Avoid crash on very long word 2024-04-27 17:05:28 +02:00
acpi ACPI: CPPC: Fix access width used for PCC registers 2024-05-17 11:51:01 +02:00
amba
android binder: check offset alignment in binder_get_object() 2024-04-27 17:05:28 +02:00
ata ata: sata_gemini: Check clk_enable() result 2024-05-17 11:50:53 +02:00
atm atm: idt77252: fix a memleak in open_card_ubr0 2024-02-23 08:54:57 +01:00
auxdisplay
base driver core: Introduce device_link_wait_removal() 2024-04-10 16:19:42 +02:00
bcma
block aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:21:15 -04:00
bluetooth Bluetooth: qca: fix firmware check error path 2024-05-17 11:51:06 +02:00
bus bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-03-26 18:21:19 -04:00
cdrom
char hwrng: core - Fix page fault dead lock on mmap-ed hwrng 2024-02-23 08:54:24 +01:00
clk clk: Don't hold prepare_lock when calling kref_put() 2024-05-17 11:50:55 +02:00
clocksource clocksource/drivers/arm_global_timer: Fix maximum prescaler value 2024-04-10 16:18:46 +02:00
comedi comedi: vmk80xx: fix incomplete endpoint checking 2024-04-27 17:05:26 +02:00
connector
counter counter: microchip-tcb-capture: Fix the use of internal GCLK logic 2023-10-19 23:05:37 +02:00
cpufreq cpufreq: brcmstb-avs-cpufreq: fix up "add check for cpufreq_cpu_get's return value" 2024-04-10 16:18:44 +02:00
cpuidle cpuidle: Avoid potential overflow in integer multiplication 2024-04-13 13:01:43 +02:00
crypto crypto: qat - resolve race condition during AER recovery 2024-04-10 16:18:35 +02:00
cxl cxl/mem: Fix shutdown order 2023-11-20 11:08:27 +01:00
dax
dca
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2024-02-23 08:54:38 +01:00
dio
dma dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state" 2024-05-17 11:50:43 +02:00
dma-buf dma-buf: add dma_fence_timestamp helper 2024-02-23 08:55:10 +01:00
edac EDAC/thunderx: Fix possible out-of-bounds string access 2024-01-25 14:52:32 -08:00
eisa
extcon
firewire firewire: nosy: ensure user_length is taken into account when fetching packet contents 2024-05-17 11:51:01 +02:00
firmware efivarfs: Request at most 512 bytes for variable names 2024-04-10 16:19:30 +02:00
fpga
fsi
gnss
gpio gpio: crystalcove: Use -ENOTSUPP consistently 2024-05-17 11:50:55 +02:00
gpu drm/vmwgfx: Fix invalid reads in fence signaled events 2024-05-17 11:51:05 +02:00
greybus
hid HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up 2024-05-02 16:24:50 +02:00
hsi
hv
hwmon hwmon: (pmbus/ucd9000) Increase delay from 250 to 500us 2024-05-17 11:51:05 +02:00
hwspinlock
hwtracing coresight: etm4x: Fix width of CCITMIN field 2024-01-25 14:52:32 -08:00
i2c i2c: smbus: fix NULL function pointer dereference 2024-05-02 16:24:50 +02:00
i3c i3c: master: cdns: Update maximum prescaler value for i2c clock 2024-02-23 08:54:50 +01:00
idle
iio iio: accel: mxc4005: Interrupt handling fixes 2024-05-17 11:51:04 +02:00
infiniband qibfs: fix dentry leak 2024-05-17 11:50:57 +02:00
input Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails 2024-04-13 13:01:44 +02:00
interconnect Revert "interconnect: Teach lockdep about icc_bw_lock order" 2024-03-06 14:38:50 +00:00
iommu iommu: mtk: fix module autoloading 2024-05-17 11:50:55 +02:00
ipack
irqchip irqchip/gic-v3-its: Prevent double free on error 2024-05-02 16:24:48 +02:00
isdn
leds leds: sgm3140: Add missing timer cleanup and flash gpio control 2024-03-26 18:21:31 -04:00
macintosh
mailbox mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt 2024-02-23 08:54:50 +01:00
mcb mcb: fix error handling for different scenarios when parsing 2023-11-28 16:56:31 +00:00
md md: fix kmemleak of rdev->serial 2024-05-17 11:51:06 +02:00
media media: cec: core: remove length check of Timer Status 2024-04-17 11:15:13 +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:29 -04:00
misc mei: me: add lunar lake point M DID 2024-05-17 11:51:05 +02:00
mmc mmc: sdhci-msm: pervent access to suspended controller 2024-05-02 16:24:48 +02:00
most
mtd mtd: diskonchip: work around ubsan link failure 2024-05-02 16:24:49 +02:00
mux
net net: bcmgenet: synchronize use of bcmgenet_set_rx_mode() 2024-05-17 11:51:04 +02:00
nfc NFC: trf7970a: disable all regulators on removal 2024-05-02 16:24:45 +02:00
ntb NTB: fix possible name leak in ntb_register_device() 2024-03-26 18:21:28 -04:00
nubus
nvdimm nd_btt: Make BTT lanes preemptible 2023-11-20 11:08:22 +01:00
nvme drivers/nvme: Add quirks for device 126f:2262 2024-04-13 13:01:46 +02:00
nvmem nvmem: meson-efuse: fix function pointer type mismatch 2024-04-10 16:18:40 +02:00
of of: dynamic: Synchronize of_changeset_destroy() with the devlink removals 2024-04-10 16:19:42 +02:00
opp OPP: debugfs: Fix warning around icc_get_name() 2024-03-26 18:21:23 -04:00
parisc
parport parport: parport_serial: Add Brainboxes device IDs and geometry 2024-01-25 14:52:31 -08:00
pci PCI/DPC: Quirk PIO log size for Intel Ice Lake Root Ports 2024-04-10 16:19:34 +02:00
pcmcia pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:08:27 +01:00
perf perf: hisi: Fix use-after-free when register pmu fails 2023-11-20 11:08:21 +01:00
phy phy: tegra: xusb: Add API to retrieve the port number of phy 2024-04-10 16:18:40 +02:00
pinctrl pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map() 2024-05-17 11:50:46 +02:00
platform platform/x86: intel-vbtn: Update tablet mode switch at end of probe 2024-04-13 13:01:48 +02:00
pnp PNP: ACPI: fix fortify warning 2024-02-23 08:54:38 +01:00
power power: supply: mt6360_charger: Fix of_match for usb-otg-vbus regulator 2024-05-17 11:50:46 +02:00
powercap
pps
ps3
ptp ptp: annotate data-race around q->head and q->tail 2023-11-28 16:56:23 +00:00
pwm pwm: sti: Fix capture for st,pwm-num-chan < st,capture-num-chan 2024-03-26 18:21:18 -04:00
rapidio
ras
regulator regulator: core: fix debugfs creation regression 2024-05-17 11:51:05 +02:00
remoteproc remoteproc: stm32: fix incorrect optional pointers 2024-03-26 18:21:37 -04:00
reset reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning 2024-01-25 14:52:30 -08:00
rpmsg rpmsg: virtio: Free driver_override when rpmsg_remove() 2024-02-23 08:54:24 +01:00
rtc rtc: mt6397: select IRQ_DOMAIN instead of depending on it 2024-03-26 18:21:34 -04:00
s390 s390/qeth: Fix kernel panic after setting hsuid 2024-05-17 11:50:51 +02:00
sbus
scsi scsi: bnx2fc: Remove spin_lock_bh while releasing resources after upload 2024-05-17 11:50:52 +02:00
sh
siox
slimbus slimbus: qcom-ngd-ctrl: Add timeout for wait operation 2024-05-17 11:51:04 +02:00
soc soc: fsl: qbman: Use raw spinlock for cgr_lock 2024-04-10 16:18:42 +02:00
soundwire soundwire: stream: fix NULL pointer dereference for multi_link 2023-12-20 15:17:41 +01:00
spi spi: hisi-kunpeng: Delete the dump interface of data registers in debugfs 2024-05-17 11:50:47 +02:00
spmi
ssb
staging staging: vc04_services: fix information leak in create_component() 2024-04-10 16:19:32 +02:00
target scsi: target: Fix SELinux error when systemd-modules loads the target module 2024-05-17 11:50:54 +02:00
tc
tee tee: optee: Fix kernel panic caused by incorrect error handling 2024-04-10 16:18:46 +02:00
thermal thermal: devfreq_cooling: Fix perf state when calculate dfc res_util 2024-04-10 16:19:37 +02:00
thunderbolt thunderbolt: Fix wake configurations after device unplug 2024-04-27 17:05:26 +02:00
tty serial: mxs-auart: add spinlock around changing cts state 2024-05-02 16:24:47 +02:00
uio uio: Fix use-after-free in uio_open 2024-01-25 14:52:31 -08:00
usb usb: dwc3: core: Prevent phy suspend during init 2024-05-17 11:51:03 +02:00
vdpa vdpa/mlx5: Allow CVQ size changes 2024-03-26 18:21:36 -04:00
vfio vfio/fsl-mc: Block calling interrupt handler without trigger 2024-04-10 16:19:30 +02:00
vhost vhost: Add smp_rmb() in vhost_vq_avail_empty() 2024-04-17 11:15:16 +02:00
video fbdev: fix incorrect address computation in deferred IO 2024-05-02 16:24:50 +02:00
virt
virtio virtio: reenable config if freezing device failed 2024-04-13 13:01:47 +02:00
visorbus
vlynq
vme
w1
watchdog watchdog: stm32_iwdg: initialize default timeout 2024-03-26 18:21:33 -04:00
xen xen/events: close evtchn after mapping cleanup 2024-04-10 16:18:46 +02:00
zorro
Kconfig
Makefile