Florian Westphal
dc783ba4b9
lib: alloc_tag_module_unload must wait for pending kfree_rcu calls
Ben Greear reports following splat:
------------[ cut here ]------------
net/netfilter/nf_nat_core.c:1114 module nf_nat func:nf_nat_register_fn has 256 allocated at module unload
WARNING: CPU: 1 PID: 10421 at lib/alloc_tag.c:168 alloc_tag_module_unload+0x22b/0x3f0
Modules linked in: nf_nat(-) btrfs ufs qnx4 hfsplus hfs minix vfat msdos fat
...
Hardware name: Default string Default string/SKYBAY, BIOS 5.12 08/04/2020
RIP: 0010:alloc_tag_module_unload+0x22b/0x3f0
codetag_unload_module+0x19b/0x2a0
? codetag_load_module+0x80/0x80
nf_nat module exit calls kfree_rcu on those addresses, but the free
operation is likely still pending by the time alloc_tag checks for leaks.
Wait for outstanding kfree_rcu operations to complete before checking
resolves this warning.
Reproducer:
unshare -n iptables-nft -t nat -A PREROUTING -p tcp
grep nf_nat /proc/allocinfo # will list 4 allocations
rmmod nft_chain_nat
rmmod nf_nat # will WARN.
[akpm@linux-foundation.org: add comment]
Link: https://lkml.kernel.org/r/20241007205236.11847-1-fw@strlen.de
Fixes: a473573964e5 ("lib: code tagging module support")
Signed-off-by: Florian Westphal <fw@strlen.de>
Reported-by: Ben Greear <greearb@candelatech.com>
Closes: https://lore.kernel.org/netdev/bdaaef9d-4364-4171-b82b-bcfc12e207eb@candelatech.com/
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-10-17 00:28:07 -07:00
..
2024-10-02 17:23:23 -04:00
2024-10-02 17:23:23 -04:00
2024-09-01 20:43:40 -07:00
2024-06-24 13:18:02 +02:00
2024-09-23 15:01:48 -07:00
2024-10-02 17:23:23 -04:00
2024-10-02 17:23:23 -04:00
2024-09-21 08:20:50 -07:00
2024-10-02 17:23:23 -04:00
2024-05-19 14:36:18 -07:00
2022-11-18 02:15:15 +01:00
2024-08-15 09:26:02 -07:00
2024-09-13 17:28:35 +02:00
2024-10-02 17:23:23 -04:00
2024-07-04 23:43:11 -07:00
2024-07-03 19:30:23 -07:00
2023-02-02 22:50:09 -08:00
2024-10-02 17:23:23 -04:00
2024-08-15 09:26:02 -07:00
2024-07-16 14:24:29 -07:00
2023-09-19 13:21:33 -07:00
2019-05-24 17:39:02 +02:00
2019-05-24 17:39:02 +02:00
2020-11-18 14:15:17 -06:00
2024-06-24 22:25:06 -07:00
2024-03-12 13:09:23 -07:00
2024-06-24 22:25:06 -07:00
2021-12-13 10:56:09 +01:00
2021-10-01 16:52:48 -04:00
2022-08-02 17:14:47 -06:00
2024-09-01 20:43:33 -07:00
2024-07-12 16:39:53 -07:00
2024-06-24 22:25:06 -07:00
2023-10-14 20:25:22 -07:00
2024-02-01 13:06:40 +01:00
2019-05-21 10:50:45 +02:00
2022-04-26 17:58:51 -04:00
2024-07-12 08:55:02 +09:00
2020-06-11 15:14:53 +02:00
2024-07-28 15:49:18 -07:00
2018-08-16 12:14:42 -07:00
2023-01-31 15:01:45 +01:00
2024-07-06 11:39:51 -07:00
2024-09-11 09:58:31 -07:00
2022-09-01 16:55:35 +02:00
2017-11-02 11:10:55 +01:00
2024-09-01 20:43:30 -07:00
2020-08-20 15:45:14 -04:00
2024-09-01 20:43:29 -07:00
2023-08-25 13:22:10 -07:00
2017-11-02 11:10:55 +01:00
2024-06-24 22:25:06 -07:00
2022-09-11 21:55:06 -07:00
2019-05-24 17:39:02 +02:00
2024-04-09 22:06:00 -07:00
2024-10-17 00:28:07 -07:00
2021-10-01 16:52:48 -04:00
2023-06-07 21:25:00 -07:00
2024-06-18 10:40:52 -07:00
2023-11-03 07:08:36 -10:00
2019-06-19 17:09:06 +02:00
2021-01-21 14:06:00 -07:00
2021-05-06 19:24:12 -07:00
2019-06-19 17:09:06 +02:00
2022-01-31 11:21:43 +11:00
2018-07-27 19:04:33 +08:00
2022-01-31 11:21:43 +11:00
2022-03-07 12:48:35 -07:00
2022-03-07 12:48:35 -07:00
2023-12-29 12:22:26 -08:00
2022-06-07 10:27:38 +02:00
2020-06-18 17:26:43 +10:00
2017-11-02 11:10:55 +01:00
2021-08-19 09:02:55 +09:00
2021-06-22 13:56:43 +02:00
2024-09-09 16:40:26 +02:00
2023-01-31 20:37:18 +01:00
2024-07-26 14:33:09 -07:00
2023-06-09 17:44:17 -07:00
2024-10-02 17:23:23 -04:00
2024-07-28 15:49:18 -07:00
2024-10-02 17:23:23 -04:00
2024-09-01 20:43:27 -07:00
2023-06-09 17:44:17 -07:00
2020-07-31 11:49:08 +02:00
2023-06-09 17:44:15 -07:00
2024-04-25 21:07:06 -07:00
2024-02-22 15:38:52 -08:00
2023-02-02 22:50:01 -08:00
2024-06-24 22:25:11 -07:00
2023-02-02 22:50:01 -08:00
2020-11-20 14:45:33 +11:00
2024-07-30 09:30:11 -10:00
2024-09-01 20:43:29 -07:00
2024-04-15 11:19:53 -07:00
2022-09-11 21:55:10 -07:00
2023-11-25 09:43:18 +01:00
2023-08-18 10:18:55 -07:00
2020-12-15 22:46:15 -08:00
2021-01-03 20:05:18 -05:00
2020-10-16 11:11:22 -07:00
2024-09-01 20:43:33 -07:00
2020-01-08 16:59:19 +00:00
2024-06-18 10:40:52 -07:00
2024-05-21 15:29:01 -07:00
2024-02-22 15:38:52 -08:00
2024-09-01 20:25:44 -07:00
2024-03-13 00:03:21 -07:00
2018-07-27 19:04:33 +08:00
2022-03-07 12:48:35 -07:00
2023-08-30 17:04:28 -07:00
2024-09-09 09:41:47 -04:00
2024-09-09 16:47:41 -07:00
2017-02-24 17:46:57 -08:00
2023-12-06 16:12:46 -08:00
2024-06-24 22:25:06 -07:00
2024-10-02 17:23:23 -04:00
2019-05-13 11:07:33 +02:00
2023-12-21 10:02:28 -08:00
2017-11-02 11:10:55 +01:00
2019-05-21 10:50:45 +02:00
2022-11-29 16:34:15 -04:00
2024-04-22 17:11:20 -03:00
2022-10-03 14:03:21 -07:00
2018-05-09 06:55:44 +02:00
2024-10-01 11:49:57 +02:00
2024-08-20 17:13:40 +02:00
2019-05-30 11:26:32 -07:00
2024-06-24 22:25:06 -07:00
2019-05-24 17:27:11 +02:00
2021-08-19 09:02:55 +09:00
2024-06-25 17:15:06 -07:00
2024-09-24 13:02:06 -07:00
2024-02-22 15:38:51 -08:00
2023-02-25 13:02:20 -08:00
2023-12-05 11:14:40 +01:00
2024-04-25 21:07:05 -07:00
2023-12-05 11:14:40 +01:00
2024-08-06 13:42:40 +02:00
2024-05-22 11:53:02 -07:00
2019-06-19 17:09:08 +02:00
2024-06-12 13:24:05 +02:00
2024-02-08 16:39:25 +00:00
2023-08-21 13:46:25 -07:00
2021-05-19 15:05:11 +02:00
2024-09-12 12:20:21 +02:00
2023-04-17 18:01:23 +02:00
2021-08-13 18:37:38 +02:00
2023-08-15 14:57:25 -07:00
2021-07-08 11:48:20 -07:00
2024-09-26 14:01:44 -07:00
2023-10-16 12:44:06 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2023-07-26 12:29:13 +02:00
2023-01-13 14:35:38 -06:00
2022-03-11 10:42:56 +01:00
2023-08-24 16:20:18 -07:00
2024-09-01 20:43:29 -07:00
2019-05-24 17:39:02 +02:00
2023-10-16 12:44:06 -04:00
2024-09-21 08:20:50 -07:00
2024-09-21 07:29:05 -07:00
2018-10-16 13:45:44 +02:00
2024-06-24 22:25:05 -07:00
2019-05-21 10:50:45 +02:00
2020-09-26 10:33:57 -07:00
2017-11-02 11:10:55 +01:00
2019-05-24 17:39:02 +02:00
2023-06-06 13:18:32 +02:00
2019-05-21 10:50:45 +02:00
2024-02-22 19:01:55 -08:00
2023-08-18 10:19:00 -07:00
2023-08-18 10:18:55 -07:00
2017-11-02 11:10:55 +01:00
2024-06-10 11:14:52 +01:00
2024-05-01 23:18:48 +09:00
2019-05-21 10:50:45 +02:00
2022-11-18 13:55:06 -08:00
2022-10-03 17:34:32 -07:00
2024-08-15 09:24:55 -07:00
2023-03-09 23:08:04 -08:00
2021-04-16 16:10:37 -07:00
2023-03-02 21:54:22 -08:00
2024-09-01 20:43:34 -07:00
2019-05-21 10:50:45 +02:00
2022-11-30 13:16:40 -08:00
2024-06-24 22:25:10 -07:00
2019-05-21 10:50:45 +02:00
2022-05-22 11:32:30 -07:00
2023-08-21 13:07:22 -07:00
2023-06-12 11:31:50 -07:00
2024-10-02 17:23:23 -04:00
2022-08-24 13:46:57 +01:00
2019-09-25 17:51:39 -07:00
2024-07-04 23:43:10 -07:00
2023-10-10 10:14:27 +02:00
2023-06-05 15:28:42 -07:00
2021-07-08 11:48:20 -07:00
2024-09-01 20:43:32 -07:00
2024-09-20 00:20:06 -06:00
2024-09-12 12:20:21 +02:00
2024-02-15 12:17:28 -05:00
2022-09-23 16:46:19 +02:00
2019-08-08 07:45:01 -06:00
2024-06-24 22:25:07 -07:00
2024-10-02 17:23:23 -04:00
2024-10-02 16:28:46 +02:00
2022-07-17 17:31:41 -07:00
2024-06-24 22:25:03 -07:00
2024-05-19 14:40:44 -07:00
2024-06-24 22:25:06 -07:00
2019-05-30 11:26:32 -07:00
2024-06-28 08:54:55 -07:00
2024-08-15 09:26:02 -07:00
2024-06-28 08:54:55 -07:00
2024-10-02 17:23:23 -04:00
2024-08-19 11:31:18 -07:00
2024-08-19 11:31:18 -07:00
2021-06-18 11:43:09 +02:00
2024-06-18 10:40:52 -07:00
2024-05-09 09:25:08 -07:00
2024-08-28 06:54:39 -07:00
2024-06-24 22:25:11 -07:00
2024-09-03 11:36:43 +02:00
2019-05-21 10:50:45 +02:00
2024-06-04 17:40:02 +02:00
2024-06-24 22:25:11 -07:00
2023-06-06 21:39:55 +09:00
2024-09-01 20:43:40 -07:00
2024-05-19 14:36:20 -07:00
2024-05-19 14:36:20 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2022-10-12 18:51:50 -07:00
2024-09-01 20:25:52 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:07 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:07 -07:00
2024-06-24 22:25:11 -07:00
2022-02-25 09:36:06 +01:00
2024-07-03 19:30:05 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-06-10 11:14:52 +01:00
2024-09-01 20:43:23 -07:00
2017-02-26 11:03:38 -05:00
2024-09-03 21:15:42 -07:00
2024-06-24 22:25:11 -07:00
2024-06-03 18:51:18 -07:00
2024-06-12 13:26:28 +02:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2024-07-03 19:30:05 -07:00
2024-06-24 22:25:06 -07:00
2024-03-04 17:01:22 -08:00
2024-07-03 19:30:05 -07:00
2024-06-24 22:25:11 -07:00
2019-10-03 12:12:23 -04:00
2021-02-17 14:08:01 +01:00
2023-12-29 12:22:29 -08:00
2024-06-24 22:25:04 -07:00
2024-06-24 22:25:04 -07:00
2024-06-24 22:25:04 -07:00
2024-04-15 17:42:43 -07:00
2024-04-24 15:45:38 -07:00
2019-05-24 17:39:02 +02:00
2023-09-13 10:18:42 -07:00
2024-07-30 13:04:36 -10:00
2024-07-02 10:11:45 -06:00
2024-07-08 23:44:01 +02:00
2022-10-11 17:42:58 -06:00
2024-10-02 17:23:23 -04:00
2023-01-11 16:14:21 -08:00
2024-05-19 09:21:03 -07:00
2024-10-02 17:23:23 -04:00