Commit 1a83f4a
net: avoid UAF on deleted altname
Altnames are accessed under RCU (dev_get_by_name_rcu())
but freed by kfree() with no synchronization point.
Each node has one or two allocations (node and a variable-size
name, sometimes the name is netdev->name). Adding rcu_heads
here is a bit tedious. Besides most code which unlists the names
already has rcu barriers - so take the simpler approach of adding
synchronize_rcu(). Note that the one on the unregistration path
(which matters more) is removed by the next fix.
Fixes: ff92741 ("net: introduce name_node struct to be used in hashlist")
Reviewed-by: Jiri Pirko <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>1 parent 7663d52 commit 1a83f4a
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
349 | 348 | | |
350 | 349 | | |
351 | 350 | | |
| |||
364 | 363 | | |
365 | 364 | | |
366 | 365 | | |
| 366 | + | |
| 367 | + | |
367 | 368 | | |
368 | 369 | | |
369 | 370 | | |
| |||
10941 | 10942 | | |
10942 | 10943 | | |
10943 | 10944 | | |
| 10945 | + | |
10944 | 10946 | | |
10945 | 10947 | | |
10946 | 10948 | | |
| |||
10968 | 10970 | | |
10969 | 10971 | | |
10970 | 10972 | | |
| 10973 | + | |
| 10974 | + | |
| 10975 | + | |
10971 | 10976 | | |
10972 | 10977 | | |
10973 | 10978 | | |
| |||
0 commit comments