Wang Yufen
064bc7312b
netdevsim: Fix memory leak of nsim_dev->fa_cookie
kmemleak reports this issue:
unreferenced object 0xffff8881bac872d0 (size 8):
comm "sh", pid 58603, jiffies 4481524462 (age 68.065s)
hex dump (first 8 bytes):
04 00 00 00 de ad be ef ........
backtrace:
[<00000000c80b8577>] __kmalloc+0x49/0x150
[<000000005292b8c6>] nsim_dev_trap_fa_cookie_write+0xc1/0x210 [netdevsim]
[<0000000093d78e77>] full_proxy_write+0xf3/0x180
[<000000005a662c16>] vfs_write+0x1c5/0xaf0
[<000000007aabf84a>] ksys_write+0xed/0x1c0
[<000000005f1d2e47>] do_syscall_64+0x3b/0x90
[<000000006001c6ec>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
The issue occurs in the following scenarios:
nsim_dev_trap_fa_cookie_write()
kmalloc() fa_cookie
nsim_dev->fa_cookie = fa_cookie
..
nsim_drv_remove()
The fa_cookie allocked in nsim_dev_trap_fa_cookie_write() is not freed. To
fix, add kfree(nsim_dev->fa_cookie) to nsim_drv_remove().
Fixes: d3cbb907ae ("netdevsim: add ACL trap reporting cookie as a metadata")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Link: https://lore.kernel.org/r/1668504625-14698-1-git-send-email-wangyufen@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-16 12:20:57 -08:00
..
2022-11-07 10:19:04 -08:00
2022-10-10 09:10:28 -07:00
2022-10-31 20:28:05 +09:00
2022-10-28 16:48:29 -07:00
2022-10-12 10:23:24 -07:00
2022-11-05 09:02:28 -07:00
2022-11-02 14:15:42 -07:00
2022-10-08 08:56:37 -07:00
2022-10-29 00:24:03 +02:00
2022-10-27 17:23:29 -07:00
2022-10-10 10:16:00 -07:00
2022-10-23 20:39:26 -04:00
2022-10-25 15:09:23 +02:00
2022-10-09 13:24:01 -07:00
2022-10-10 13:04:25 -07:00
2022-11-04 16:03:43 -07:00
2022-10-14 18:41:41 -07:00
2022-10-11 17:42:58 -06:00
2022-10-06 17:22:11 -07:00
2022-10-13 11:07:13 -07:00
2022-10-08 08:56:37 -07:00
2022-11-04 14:37:25 -07:00
2022-10-08 08:56:37 -07:00
2022-09-28 21:10:57 +09:30
2022-10-20 13:47:54 +02:00
2022-11-04 09:30:18 +10:00
2022-10-21 17:41:57 -07:00
2022-10-10 13:59:01 -07:00
2022-11-04 16:47:01 -07:00
2022-10-25 19:08:07 +02:00
2022-11-01 13:46:30 +01:00
2022-10-12 23:45:29 +02:00
2022-10-17 08:51:26 +01:00
2022-10-28 12:59:40 -03:00
2022-10-11 10:53:25 -07:00
2022-10-21 10:49:35 +02:00
2022-10-08 08:56:37 -07:00
2022-10-12 10:23:24 -07:00
2022-11-14 10:43:13 +00:00
2022-10-24 11:32:10 +02:00
2022-10-09 14:05:15 -07:00
2022-10-05 21:51:58 -05:00
2022-10-18 17:17:48 -04:00
2022-10-25 16:43:34 +01:00
2022-10-23 12:04:56 -07:00
2022-10-25 19:12:10 +02:00
2022-10-26 11:48:03 +02:00
2022-10-18 11:20:12 +02:00
2022-11-16 12:20:57 -08:00
2022-10-30 21:43:26 +00:00
2022-10-14 18:41:41 -07:00
2022-10-29 18:06:52 -07:00
2022-10-10 13:13:51 -07:00
2022-10-27 09:12:05 +02:00
2022-10-17 12:11:09 -05:00
2022-09-27 08:12:16 +02:00
2022-10-14 12:38:03 -07:00
2022-11-05 13:01:25 +05:30
2022-10-18 10:42:10 +02:00
2022-11-07 10:19:04 -08:00
2022-10-10 18:11:11 +02:00
2022-10-07 11:48:30 -07:00
2022-10-10 09:10:28 -07:00
2022-10-10 08:37:24 +01:00
2022-10-07 11:32:10 -07:00
2022-10-07 11:24:20 -07:00
2022-10-05 09:20:44 -06:00
2022-10-08 10:06:48 -07:00
2022-10-18 22:36:54 +02:00
2022-10-26 14:47:31 +02:00
2022-10-29 18:12:45 -07:00
2022-10-29 16:26:32 +08:00
2022-10-28 17:00:38 +05:30
2022-10-26 17:38:46 -07:00
2022-09-30 14:33:23 +02:00
2022-10-22 15:30:15 -07:00
2022-10-21 01:10:34 +00:00
2022-10-10 17:53:04 -07:00
2022-10-15 19:33:57 +02:00
2022-10-11 17:42:58 -06:00
2022-10-21 08:10:46 +02:00
2022-10-22 03:29:32 +00:00
2022-10-30 11:31:14 -07:00
2022-10-10 14:02:53 -07:00
2022-10-12 14:46:48 -07:00
2022-10-10 14:02:53 -07:00
2022-10-30 11:31:14 -07:00
2022-10-08 08:56:37 -07:00
2022-10-13 09:33:03 -04:00
2022-10-08 08:56:37 -07:00
2022-11-01 12:21:53 -07:00
2022-10-21 14:43:09 -07:00