1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/net
Armin Wolf cbef9a83c5 wifi: rt2x00: Fix memory leak when handling surveys
When removing a rt2x00 device, its associated channel surveys
are not freed, causing a memory leak observable with kmemleak:

unreferenced object 0xffff9620f0881a00 (size 512):
  comm "systemd-udevd", pid 2290, jiffies 4294906974 (age 33.768s)
  hex dump (first 32 bytes):
    70 44 12 00 00 00 00 00 92 8a 00 00 00 00 00 00  pD..............
    00 00 00 00 00 00 00 00 ab 87 01 00 00 00 00 00  ................
  backtrace:
    [<ffffffffb0ed858b>] __kmalloc+0x4b/0x130
    [<ffffffffc1b0f29b>] rt2800_probe_hw+0xc2b/0x1380 [rt2800lib]
    [<ffffffffc1a9496e>] rt2800usb_probe_hw+0xe/0x60 [rt2800usb]
    [<ffffffffc1ae491a>] rt2x00lib_probe_dev+0x21a/0x7d0 [rt2x00lib]
    [<ffffffffc1b3b83e>] rt2x00usb_probe+0x1be/0x980 [rt2x00usb]
    [<ffffffffc05981e2>] usb_probe_interface+0xe2/0x310 [usbcore]
    [<ffffffffb13be2d5>] really_probe+0x1a5/0x410
    [<ffffffffb13be5c8>] __driver_probe_device+0x78/0x180
    [<ffffffffb13be6fe>] driver_probe_device+0x1e/0x90
    [<ffffffffb13be972>] __driver_attach+0xd2/0x1c0
    [<ffffffffb13bbc57>] bus_for_each_dev+0x77/0xd0
    [<ffffffffb13bd2a2>] bus_add_driver+0x112/0x210
    [<ffffffffb13bfc6c>] driver_register+0x5c/0x120
    [<ffffffffc0596ae8>] usb_register_driver+0x88/0x150 [usbcore]
    [<ffffffffb0c011c4>] do_one_initcall+0x44/0x220
    [<ffffffffb0d6134c>] do_init_module+0x4c/0x220

Fix this by freeing the channel surveys on device removal.

Tested with a RT3070 based USB wireless adapter.

Fixes: 5447626910 ("rt2x00: save survey for every channel visited")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330215637.4332-1-W_Armin@gmx.de
2023-04-03 16:44:27 +03:00
..
appletalk
arcnet arcnet: fix potential memory leak in com20020_probe() 2022-11-23 12:41:54 +00:00
bonding Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-02-09 12:25:40 -08:00
caif
can can: esd_usb: Improve readability on decoding ESD_EV_CAN_ERROR_EXT messages 2023-02-16 20:59:48 +01:00
dsa net: dsa: mt7530: permit port 5 to work without port 6 on MT7621 SoC 2023-03-08 23:14:28 -08:00
ethernet qede: remove linux/version.h and linux/compiler.h 2023-03-10 21:29:54 -08:00
fddi net: defxx: Fix missing err handling in dfx_init() 2022-12-09 10:44:27 +00:00
fjes ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
hamradio hamradio: baycom_epp: Do not use x86-specific rdtsc() 2022-12-19 09:27:10 +00:00
hippi
hyperv Networking changes for 6.3. 2023-02-21 18:24:12 -08:00
ieee802154 ca8210: fix mac_len negative array access 2023-03-02 14:39:48 +01:00
ipa ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
ipvlan ipvlan: use skb_ip_totlen in ipvlan_get_L3_hdr 2023-02-01 20:54:27 -08:00
mctp mctp: serial: Fix starting value for frame check sequence 2022-12-19 12:38:45 +00:00
mdio net: dsa: seville: ignore mscc-miim read errors from Lynx PCS 2023-02-26 18:31:37 +00:00
netdevsim bpf-next-for-netdev 2023-02-10 17:51:27 -08:00
pcs net: pcs: rzn1-miic: remove unused struct members and use miic variable 2023-02-09 22:47:16 -08:00
phy net: sfp: only use soft polling if we have A2h access 2023-03-10 18:12:48 -08:00
plip net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq() 2022-12-07 20:10:47 -08:00
ppp Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
pse-pd
slip
team Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf" 2023-01-18 20:32:44 -08:00
thunderbolt net: thunderbolt: Add tracepoints 2023-01-12 21:19:30 -08:00
usb net: usb: qmi_wwan: add Telit 0x1080 composition 2023-03-07 15:27:29 +01:00
vmxnet3 vmxnet3: move rss code block under eop descriptor 2023-02-09 22:50:46 -08:00
vxlan vxlan: Fix memory leaks in error path 2023-01-02 13:37:33 +00:00
wan net: wan: Add checks for NULL for utdm in undo_uhdlc_init and unmap_si_regs 2023-01-13 21:34:31 -08:00
wireguard cpumask: fix incorrect cpumask scanning result checks 2023-03-06 12:15:13 -08:00
wireless wifi: rt2x00: Fix memory leak when handling surveys 2023-04-03 16:44:27 +03:00
wwan net: wwan: t7xx: Fix Runtime PM initialization 2023-01-28 13:20:21 +00:00
xen-netback Including fixes from wireless and netfilter. 2023-02-27 14:05:08 -08:00
amt.c
bareudp.c
dummy.c ethtool: doc: clarify what drivers can implement in their get_drvinfo() 2022-11-17 19:26:02 -08:00
eql.c
geneve.c
gtp.c
ifb.c
Kconfig Networking changes for 6.3. 2023-02-21 18:24:12 -08:00
LICENSE.SRC
loopback.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-29 13:04:52 -08:00
macsec.c Networking changes for 6.3. 2023-02-21 18:24:12 -08:00
macvlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
macvtap.c
Makefile net: thunderbolt: Move into own directory 2023-01-12 21:19:30 -08:00
mdio.c
mhi_net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
mii.c
net_failover.c
netconsole.c netconsole: avoid CON_ENABLED misuse to track registration 2022-12-02 11:25:02 +01:00
nlmon.c
ntb_netdev.c ntb_netdev: Use dev_kfree_skb_any() in interrupt context 2022-12-12 12:56:37 -08:00
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c tap: add support for IOCB_NOWAIT 2023-03-10 16:48:32 -08:00
tun.c tun: flag the device as supporting FMODE_NOWAIT 2023-03-10 16:47:22 -08:00
veth.c drivers: net: turn on XDP features 2023-02-02 20:48:23 -08:00
virtio_net.c bpf-next-for-netdev 2023-02-10 17:51:27 -08:00
vrf.c net: vrf: determine the dst using the original ifindex for multicast 2022-12-21 17:47:37 -08:00
vsockmon.c
xen-netfront.c drivers: net: turn on XDP features 2023-02-02 20:48:23 -08:00