Miquel asked me to forward Yousef's teardown fix after no v2 was posted.
Patch 1 preserves Yousef's authorship and existing Signed-off-by. It moves
the final PIB lookup and free after unregistering the hardware, uses
rcu_access_pointer() as requested, and corrects the Fixes tag after checking
the file history.
Patch 2 fixes the related error unwind issue reported by Sashiko. Once the
PHY is published, a callback can replace phy->pib and queue the original
object for RCU freeing. The unwind must therefore free the final published
PIB rather than the stale local pointer.
OpenAI Codex assisted with the lifetime analysis, the two-line second fix,
commit and cover letter drafting, and test automation. The Codex session was
prompted to trace PIB ownership through registration, callback replacement,
error unwind, and teardown; minimize the fixes; inspect history and credit;
and construct deterministic KASAN and failslab validation.
Testing:
- full KASAN W=1 bzImage and hwsim module build after patch 1, followed
by a successful incremental W=1 hwsim module rebuild after patch 2
- targeted W=1 allmodconfig and allyesconfig builds, with no hwsim
diagnostics
- patch 1 only: one deterministic fault-injection round reproduced the
KASAN double-free in hwsim_add_one()
- patch 1 plus patch 2: 100 deterministic fault-injection rounds, with no
sanitizer findings
- patch 1 plus patch 2: 200 teardown race rounds, with no sanitizer
findings
The fault-injection test used a temporary, unsubmitted module parameter to
pause the second probe after PHY publication. Both interfaces were opened to
replace their PIBs, then task-filtered failslab forced hwsim_alloc_edge() to
fail. An RCU barrier drained all deferred frees after every round.
v1:
https://lore.kernel.org/r/2026…@gmail.com/
Forwarding request:
https://lore.kernel.org/r/87wl…@bootlin.com/
Sashiko report:
https://lore.kernel.org/r/1794…@kernel.org/
Roshan Kumar (1):
ieee802154: hwsim: free the current PIB on registration failure
Yousef Alhouseen (1):
ieee802154: hwsim: free PIB after unregistering hardware
drivers/net/ieee802154/mac802154_hwsim.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
base-commit: bc10f5da3e77499a7024d4c2d263d3ca04f8481d
[PATCH net v2 0/2] ieee802154: hwsim: fix PIB lifetime during teardown and error unwind
- From
- rosh…@gmail.com (Roshan Kumar)
- Organization
- Usenet Network
- Message-ID
- <2026…@gmail.com>
- Date
- Newsgroups
- linux.kernel.netdev