linux-stable/drivers/net
Taehee Yoo 1fa89ffbc0 net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
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>
2022-05-12 10:01:36 -07:00
..
appletalk
arcnet
bonding bonding: do not discard lowest hash bit for non layer3+4 hashing 2022-04-17 13:34:01 +01:00
caif
can can: grcan: only use the NAPI poll budget for RX 2022-04-29 12:09:32 +02:00
dsa net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down() 2022-05-12 10:01:36 -07:00
ethernet net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe() 2022-05-12 10:01:36 -07:00
fddi
fjes
hamradio hamradio: Fix wrong assignment of 'bbc->cfg.loopback' 2022-03-16 19:17:49 -07:00
hippi drivers: net: hippi: Fix deadlock in rr_close() 2022-04-21 10:30:45 +02:00
hyperv Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-03-17 13:56:58 -07:00
ieee802154 spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
ipa net: ipa: use struct_size() for the interconnect array 2022-03-11 22:50:07 -08:00
ipvlan net: add per-cpu storage and net->core_stats 2022-03-11 23:17:24 -08:00
mctp mctp i2c: correct mctp_i2c_header_create result 2022-04-01 12:04:15 +01:00
mdio net: mdio: Fix ENOMEM return value in BCM6368 mux bus controller 2022-04-29 17:58:41 -07:00
netdevsim devlink: hold the instance lock during eswitch_mode callbacks 2022-03-21 14:11:38 +00:00
pcs
phy net: phy: micrel: Fix incorrect variable type in micrel 2022-05-10 15:18:13 -07:00
plip
ppp
slip drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-06 23:00:16 -07:00
team
usb net: usb: aqc111: Fix out-of-bounds accesses in RX fixup 2022-04-06 15:22:49 +01:00
vmxnet3
vxlan vxlan: fix error return code in vxlan_fdb_append 2022-04-08 12:35:12 +01:00
wan net: cosa: fix error check return value of register_chrdev() 2022-04-22 10:20:43 +01:00
wireguard wireguard: device: check for metadata_dst with skb_valid_dst() 2022-04-22 15:59:05 -07:00
wireless wireless fixes for v5.18 2022-05-11 17:33:01 -07:00
wwan Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-03-23 10:53:49 -07:00
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c bareudp: use ipv6_mod_enabled to check if IPv6 enabled 2022-03-16 19:16:57 -07:00
dummy.c
eql.c
geneve.c net: geneve: add missing netlink policy and size for IFLA_GENEVE_INNER_PROTO_INHERIT 2022-03-22 22:19:46 -07:00
gtp.c gtp: Fix inconsistent indenting 2022-03-16 08:47:02 -07:00
ifb.c
loopback.c
macsec.c
macvlan.c macvlan: Fix leaking skb in source mode with nodst option 2022-04-13 12:25:02 +01:00
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c net: add per-cpu storage and net->core_stats 2022-03-11 23:17:24 -08:00
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c tun: annotate access to queue->trans_start 2022-04-14 08:30:09 +02:00
veth.c veth: Ensure eth header is in skb's linear part 2022-04-08 12:15:28 +01:00
virtio_net.c virtio_net: fix wrong buf address calculation when using xdp 2022-04-26 13:24:44 +02:00
vrf.c vrf: fix packet sniffing for traffic originating from ip tunnels 2022-04-01 11:56:55 +01:00
vsockmon.c
xen-netfront.c xen/grant-table: remove readonly parameter from functions 2022-03-15 20:34:40 -05:00