kernel_optimize_test/drivers
Taehee Yoo 161c4edeca net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
[ Upstream commit 1fa89ffbc04545b7582518e57f4b63e2a062870f ]

In the NIC ->probe() callback, ->mtd_probe() callback is called.
If NIC has 2 ports, ->probe() is called twice and ->mtd_probe() too.
In the ->mtd_probe(), which is efx_ef10_mtd_probe() it allocates and
initializes mtd partiion.
But mtd partition for sfc is shared data.
So that allocated mtd partition data from last called
efx_ef10_mtd_probe() will not be used.
Therefore it must be freed.
But it doesn't free a not used mtd partition data in efx_ef10_mtd_probe().

kmemleak reports:
unreferenced object 0xffff88811ddb0000 (size 63168):
  comm "systemd-udevd", pid 265, jiffies 4294681048 (age 348.586s)
  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:
    [<ffffffffa3767749>] kmalloc_order_trace+0x19/0x120
    [<ffffffffa3873f0e>] __kmalloc+0x20e/0x250
    [<ffffffffc041389f>] efx_ef10_mtd_probe+0x11f/0x270 [sfc]
    [<ffffffffc0484c8a>] efx_pci_probe.cold.17+0x3df/0x53d [sfc]
    [<ffffffffa414192c>] local_pci_probe+0xdc/0x170
    [<ffffffffa4145df5>] pci_device_probe+0x235/0x680
    [<ffffffffa443dd52>] really_probe+0x1c2/0x8f0
    [<ffffffffa443e72b>] __driver_probe_device+0x2ab/0x460
    [<ffffffffa443e92a>] driver_probe_device+0x4a/0x120
    [<ffffffffa443f2ae>] __driver_attach+0x16e/0x320
    [<ffffffffa4437a90>] bus_for_each_dev+0x110/0x190
    [<ffffffffa443b75e>] bus_add_driver+0x39e/0x560
    [<ffffffffa4440b1e>] driver_register+0x18e/0x310
    [<ffffffffc02e2055>] 0xffffffffc02e2055
    [<ffffffffa3001af3>] do_one_initcall+0xc3/0x450
    [<ffffffffa33ca574>] do_init_module+0x1b4/0x700

Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Fixes: 8127d661e7 ("sfc: Add support for Solarflare SFC9100 family")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Link: https://lore.kernel.org/r/20220512054709.12513-1-ap420073@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-05-18 10:23:45 +02:00
..
accessibility
acpi
amba
android
ata
atm
auxdisplay
base arch_topology: Do not set llc_sibling if llc_id is invalid 2022-05-09 09:04:59 +02:00
bcma
block block: drbd: drbd_nl: Make conversion to 'enum drbd_ret_code' explicit 2022-05-15 20:00:08 +02:00
bluetooth
bus bus: sunxi-rsb: Fix the return value of sunxi_rsb_device_create() 2022-05-09 09:05:04 +02:00
cdrom
char
clk clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource() 2022-05-09 09:05:04 +02:00
clocksource
connector
counter
cpufreq cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe 2022-05-09 09:05:03 +02:00
cpuidle
crypto
dax
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire firewire: core: extend card->lock in fw_core_handle_bus_reset 2022-05-12 12:25:32 +02:00
firmware
fpga
fsi
gnss
gpio gpio: pca953x: fix irq_stat not updated when irq is disabled (irq_mask not set) 2022-05-12 12:25:37 +02:00
gpu drm/nouveau: Fix a potential theorical leak in nouveau_get_backlight_name() 2022-05-18 10:23:43 +02:00
greybus
hid
hsi
hv
hwmon hwmon: (ltq-cputemp) restrict it to SOC_XWAY 2022-05-18 10:23:44 +02:00
hwspinlock
hwtracing
i2c
i3c
ide
idle
iio iio:imu:bmi160: disable regulator in error path 2022-05-09 09:05:00 +02:00
infiniband RDMA/siw: Fix a condition race issue in MPA request processing 2022-05-12 12:25:39 +02:00
input
interconnect
iommu iommu/vt-d: Calculate mask for non-aligned flushes 2022-05-12 12:25:30 +02:00
ipack
irqchip
isdn
leds
lightnvm lightnvm: disable the subsystem 2022-05-09 09:04:56 +02:00
macintosh
mailbox
mcb
md dm: interlock pending dm_io and dm_wait_for_bios_completion 2022-05-12 12:25:45 +02:00
media
memory memory: renesas-rpc-if: Fix HF/OSPI data transfer in Manual Mode 2022-05-09 09:05:02 +02:00
memstick
message
mfd
misc
mmc mmc: rtsx: add 74 Clocks in power on flow 2022-05-12 12:25:46 +02:00
most
mtd mtd: rawnand: Fix return value check of wait_for_completion_timeout 2022-05-09 09:05:02 +02:00
mux
net net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe() 2022-05-18 10:23:45 +02:00
nfc nfc: nfcmrvl: main: reorder destructive operations in nfcmrvl_nci_unregister_dev to avoid bugs 2022-05-12 12:25:36 +02:00
ntb
nubus
nvdimm
nvme
nvmem
of
opp
oprofile
parisc
parport
pci PCI: aardvark: Fix reading MSI interrupt number 2022-05-12 12:25:46 +02:00
pcmcia
perf arm_pmu: Validate single/group leader events 2022-04-27 13:53:55 +02:00
phy phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe 2022-05-09 09:05:01 +02:00
pinctrl pinctrl: pistachio: fix use of irq_of_parse_and_map() 2022-05-09 09:05:03 +02:00
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390 s390/lcs: fix variable dereferenced before check 2022-05-18 10:23:44 +02:00
sbus
scsi
sfi
sh
siox
slimbus
soc
soundwire
spi spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller 2022-04-27 13:53:57 +02:00
spmi
ssb
staging staging: ion: Prevent incorrect reference counting behavour 2022-04-27 13:53:57 +02:00
target
tc
tee
thermal thermal: int340x: Fix attr.show callback prototype 2022-05-09 09:05:07 +02:00
thunderbolt
tty tty: n_gsm: fix software flow control handling 2022-05-09 09:05:08 +02:00
uio
usb USB: Fix xhci event ring dequeue pointer ERDP update issue 2022-05-09 09:05:00 +02:00
vdpa
vfio
vhost
video video: fbdev: udlfb: properly check endpoint type 2022-05-09 09:05:00 +02:00
virt
virtio
visorbus
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile