Armin Wolf
bea3f8aa99
wifi: rt2x00: Fix memory leak when handling surveys
[ Upstream commit cbef9a83c5 ]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:03:20 +09:00
..
2023-01-24 07:24:37 +01:00
2023-05-11 23:03:16 +09:00
2023-03-10 09:32:32 +01:00
2023-03-30 12:49:09 +02:00
2023-03-11 13:55:16 +01:00
2023-05-11 23:03:01 +09:00
2023-04-20 12:35:11 +02:00
2023-04-20 12:35:06 +02:00
2023-05-11 23:03:05 +09:00
2023-05-11 23:03:06 +09:00
2023-04-20 12:35:08 +02:00
2023-03-10 09:33:03 +01:00
2023-01-24 07:24:35 +01:00
2023-04-13 16:55:31 +02:00
2023-05-11 23:03:16 +09:00
2023-05-11 23:03:04 +09:00
2023-05-11 23:03:20 +09:00
2023-05-11 23:03:05 +09:00
2023-03-10 09:34:25 +01:00
2023-01-07 11:11:40 +01:00
2022-12-31 13:32:38 +01:00
2023-04-20 12:35:08 +02:00
2023-02-09 11:28:23 +01:00
2023-05-11 23:03:08 +09:00
2022-12-31 13:32:39 +01:00
2023-02-09 11:27:59 +01:00
2023-05-11 23:03:11 +09:00
2023-04-26 14:28:43 +02:00
2023-02-09 11:28:04 +01:00
2023-05-01 08:26:27 +09:00
2023-05-11 23:03:16 +09:00
2023-04-20 12:35:13 +02:00
2022-12-31 13:32:45 +01:00
2023-04-13 16:55:18 +02:00
2023-05-11 23:03:16 +09:00
2023-04-13 16:55:30 +02:00
2023-05-11 23:03:04 +09:00
2023-04-06 12:10:58 +02:00
2023-05-11 23:03:01 +09:00
2023-05-11 23:03:19 +09:00
2023-04-26 14:28:43 +02:00
2023-03-30 12:48:59 +02:00
2023-05-11 23:03:04 +09:00
2023-03-10 09:33:07 +01:00
2023-02-09 11:28:04 +01:00
2023-04-13 16:55:18 +02:00
2023-03-17 08:50:31 +01:00
2023-05-11 23:03:12 +09:00
2022-12-31 13:32:41 +01:00
2023-05-11 23:03:00 +09:00
2023-05-11 23:03:16 +09:00
2023-03-22 13:33:56 +01:00
2023-04-26 14:28:39 +02:00
2023-03-11 13:55:32 +01:00
2023-03-11 13:55:39 +01:00
2023-05-11 23:03:11 +09:00
2023-05-11 23:03:05 +09:00
2023-05-11 23:03:20 +09:00
2023-03-22 13:33:46 +01:00
2023-03-10 09:34:20 +01:00
2023-04-26 14:28:37 +02:00
2023-02-09 11:28:25 +01:00
2023-02-22 12:59:46 +01:00
2023-03-10 09:33:01 +01:00
2023-01-07 11:11:55 +01:00
2023-05-11 23:02:59 +09:00
2023-05-11 23:03:16 +09:00
2023-05-11 23:02:59 +09:00
2023-05-11 23:03:02 +09:00
2023-05-11 23:03:16 +09:00
2022-12-31 13:31:56 +01:00
2023-04-20 12:35:10 +02:00
2023-03-10 09:32:56 +01:00
2023-04-06 12:10:44 +02:00
2023-05-11 23:03:02 +09:00
2022-12-31 13:32:00 +01:00
2023-05-11 23:03:16 +09:00
2023-03-10 09:34:26 +01:00
2023-02-01 08:34:05 +01:00
2023-05-11 23:03:16 +09:00
2023-03-11 13:55:30 +01:00
2023-04-06 12:10:46 +02:00
2023-05-11 23:03:20 +09:00
2023-05-11 23:03:12 +09:00
2023-05-11 23:03:02 +09:00
2023-04-26 14:28:34 +02:00
2023-05-11 23:03:14 +09:00
2023-05-11 23:03:19 +09:00
2023-03-30 12:49:29 +02:00
2023-03-11 13:55:32 +01:00
2023-04-06 12:10:33 +02:00
2023-05-11 23:03:01 +09:00
2023-03-30 12:49:17 +02:00
2022-12-31 13:32:38 +01:00
2023-05-11 23:03:19 +09:00
2023-03-22 13:34:03 +01:00
2023-03-10 09:34:32 +01:00
2023-03-22 13:33:44 +01:00
2023-04-20 12:35:07 +02:00
2023-05-11 23:03:10 +09:00
2023-01-24 07:24:31 +01:00
2023-02-01 08:34:26 +01:00
2023-03-11 13:55:24 +01:00
2023-05-11 23:03:11 +09:00