Commit f9a4300
committed
netfilter: nf_tables: double hook unregistration in netns path
__nft_release_hooks() is called from pre_netns exit path which
unregisters the hooks, then the NETDEV_UNREGISTER event is triggered
which unregisters the hooks again.
[ 565.221461] WARNING: CPU: 18 PID: 193 at net/netfilter/core.c:495 __nf_unregister_net_hook+0x247/0x270
[...]
[ 565.246890] CPU: 18 PID: 193 Comm: kworker/u64:1 Tainted: G E 5.18.0-rc7+ #27
[ 565.253682] Workqueue: netns cleanup_net
[ 565.257059] RIP: 0010:__nf_unregister_net_hook+0x247/0x270
[...]
[ 565.297120] Call Trace:
[ 565.300900] <TASK>
[ 565.304683] nf_tables_flowtable_event+0x16a/0x220 [nf_tables]
[ 565.308518] raw_notifier_call_chain+0x63/0x80
[ 565.312386] unregister_netdevice_many+0x54f/0xb50
Unregister and destroy netdev hook from netns pre_exit via kfree_rcu
so the NETDEV_UNREGISTER path see unregistered hooks.
Fixes: 767d121 ("netfilter: nftables: fix possible UAF over chains from packet path in netns")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>1 parent 3923b1e commit f9a4300
1 file changed
+41
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
| 226 | + | |
226 | 227 | | |
227 | | - | |
| 228 | + | |
228 | 229 | | |
229 | | - | |
| 230 | + | |
230 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
231 | 237 | | |
232 | 238 | | |
233 | 239 | | |
| |||
253 | 259 | | |
254 | 260 | | |
255 | 261 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
| |||
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | | - | |
| 280 | + | |
| 281 | + | |
274 | 282 | | |
275 | 283 | | |
276 | 284 | | |
277 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
278 | 293 | | |
279 | 294 | | |
280 | 295 | | |
| |||
7307 | 7322 | | |
7308 | 7323 | | |
7309 | 7324 | | |
7310 | | - | |
7311 | | - | |
| 7325 | + | |
| 7326 | + | |
| 7327 | + | |
7312 | 7328 | | |
7313 | | - | |
| 7329 | + | |
7314 | 7330 | | |
7315 | | - | |
| 7331 | + | |
7316 | 7332 | | |
| 7333 | + | |
| 7334 | + | |
| 7335 | + | |
| 7336 | + | |
| 7337 | + | |
| 7338 | + | |
| 7339 | + | |
| 7340 | + | |
| 7341 | + | |
| 7342 | + | |
| 7343 | + | |
7317 | 7344 | | |
7318 | 7345 | | |
7319 | 7346 | | |
| |||
9755 | 9782 | | |
9756 | 9783 | | |
9757 | 9784 | | |
9758 | | - | |
| 9785 | + | |
9759 | 9786 | | |
9760 | | - | |
| 9787 | + | |
| 9788 | + | |
9761 | 9789 | | |
9762 | 9790 | | |
9763 | 9791 | | |
| |||
0 commit comments