tipc: fix NULL deref in tipc_named_node_up() on empty publication list
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v8 Latest3 patches 11 repliesIn review
- v73 patches 0 repliesSuperseded
- v63 patches 0 repliesSuperseded
Earlier versions · 5
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 | 2 patches | 0 replies | Superseded | |
| v4 | 2 patches | 4 replies | Superseded | |
| v3 | 2 patches | 2 replies | Superseded | |
| v2 | 1 patch | 3 replies | Superseded | |
| v1 | 1 patch | 2 replies | Superseded |
Changes in v8 from the cover letter
- Attribution text fix only, no code changes. The defer approach is Tung Nguyen's work; earlier versions wrongly credited Jon Maloy.
Patches in v8 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | tipc: fix NULL deref in tipc_named_node_up() on empty publication listnet/ net/ net/ +3 more | +83 | 9 replies | |
| 2/3 | tipc: fix NULL deref in deferred bulk distribution on publish failurenet/ net/ | +13 | 1 reply | |
| 3/3 | tipc: fix node reference leak when defer work is already pendingnet/ | +2 | 1 reply |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by.
| Patch | Weiming Shi |
|---|---|
| 1/3 | T-b T-b |
| 2/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net v8 0/3] tipc: fix NULL deref in tipc_named_node_up() on empty publication list
This series continues the fix for the NULL dereference in tipc_named_node_up() on an empty publication list.
Patch 1/3 carries Tung Nguyen's defer-to-workqueue approach, which he posted on the thread as the replacement for the item-less bulk from v2 and asked us to test. Tung's RFC only exists as an inline diff in the thread, so I folded it into this series, keeping his Signed-off-by. I tested it in our two-node QEMU setup (veth pair, UDP bearers, node-id addressing), both with an unprivileged user namespace and as root: the unpatched kernel panics on the first run of the same reproducer, the patched one distributes normally with a non-empty list.
While testing we found two residual issues in the approach, fixed by patches 2/3 and 3/3.
Patch 2/3: tipc_net_finalize() does not check the return value of tipc_nametbl_publish(). If the publish fails, for example on a GFP_ATOMIC allocation failure, the node is finalized but cluster_scope stays empty. The deferred worker then calls named_distribute() with an empty list and hits the same NULL dereference, this time on the workqueue. With this patch the worker re-checks the list and skips cleanly, no crash and no link flap. The tail stamp in named_distribute() also gets an empty-queue guard.
Patch 3/3: a repeated NODE_UP while the bulk work is pending takes a node reference that is never dropped, because schedule_work() returns false when the work is already queued. Found by flapping the bearer during the defer window. One reference is leaked per repeated NODE_UP.
Changes in v8:
- Attribution text fix only, no code changes. The defer approach is Tung Nguyen's work; earlier versions wrongly credited Jon Maloy.
Changes in v7:
- Patch 1/3: add the missing kernel-doc description for the new work member of struct tipc_node, fixing the W=1 build warning reported by the kernel test robot. No code change.
- https://lore.kernel.org/all/[email protected]/
Changes in v6:
- Make the series self-contained: fold Tung Nguyen's base patch into the series (1/3), keeping his Signed-off-by. The version sent as v5 only carried the two follow-ups and depended on his patch from the thread; the code changes in 2/3 and 3/3 are unchanged from that version.
- https://lore.kernel.org/all/[email protected]/
Changes in v5:
- Replace the item-less bulk approach with Tung Nguyen's defer-to-workqueue RFC, which fixes the reported bug in our testing.
- Fix two residual issues found during testing (patches 2/3, 3/3).
Weiming Shi (3):
tipc: fix NULL deref in tipc_named_node_up() on empty publication list
tipc: fix NULL deref in deferred bulk distribution on publish failure
tipc: fix node reference leak when defer work is already pending
net/tipc/core.c | 1 + net/tipc/core.h | 2 ++ net/tipc/name_distr.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++---- net/tipc/name_distr.h | 3 ++- net/tipc/net.c | 5 ++++- net/tipc/node.c | 35 ++++++++++++++++++++++++++++++-- 6 files changed, 97 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0