Commit 0f9ea71
net: shaper: protect late read accesses to the hierarchy
We look up a netdev during prep of Netlink ops (pre- callbacks)
and take a ref to it. Then later in the body of the callback
we take its lock or RCU which are the actual protections.
This is not proper, a conversion from a ref to a locked netdev
must include a liveness check (a check if the netdev hasn't been
unregistered already). Fix the read cases (those under RCU).
Writes needs a separate change to protect from creating the
hierarchy after flush has already run.
Fixes: 4b623f9 ("net-shapers: implement NL get operation")
Reported-by: Paul Moses <[email protected]>
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>1 parent 8a63baa commit 0f9ea71
1 file changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
68 | 83 | | |
69 | 84 | | |
70 | 85 | | |
| |||
251 | 266 | | |
252 | 267 | | |
253 | 268 | | |
254 | | - | |
255 | 269 | | |
| 270 | + | |
256 | 271 | | |
| 272 | + | |
257 | 273 | | |
258 | 274 | | |
259 | 275 | | |
| |||
778 | 794 | | |
779 | 795 | | |
780 | 796 | | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | 797 | | |
785 | 798 | | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
786 | 803 | | |
787 | 804 | | |
788 | 805 | | |
789 | 806 | | |
790 | 807 | | |
791 | 808 | | |
| 809 | + | |
792 | 810 | | |
793 | 811 | | |
794 | 812 | | |
| |||
0 commit comments