Skip to content

module/dups: Fix a use-after-free and improve the code

Petr Pavlu linux-modules lkml sashiko-reviews 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20260722-module-stats-rcu-ff0dfc986be6

Versions newest first

  1. v3 Latest6 patches 3 repliesIn review
  2. v26 patches 3 repliesSuperseded inferred link
  3. v15 patches 2 repliesSuperseded

Changes in v3 from the cover letter

- Add received Reviewed-by tags.
- Rebase the series on modules-next.
- Link to v2: https://patch.msgid.link/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6module/dups: Inform duplicate requests about the result directlykernel/module/dups.c+9 -341 reply
2/6module/dups: Fix use-after-free in kmod_dup_req lifetime handlingkernel/module/dups.c+40 -160 replies
3/6module/dups: Avoid unnecessary kmod_dup_req allocationskernel/module/dups.c+22 -161 reply
4/6module/dups: Use scope-based cleanup helperskernel/module/dups.c+23 -330 replies
5/6module/dups: Use strcmp() to compare module nameskernel/module/dups.c+2 -40 replies
6/6module/dups: Clean up includeskernel/module/dups.c+12 -200 replies

Reviews trailers per patch

3 of 6 patches have a Reviewed-by or Acked-by.

PatchAaron Tomlin
1/6
2/6R-b
3/6R-b
4/6
5/6R-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/6] module/dups: Fix a use-after-free and improve the code

Simplify how the kmod dups code informs duplicate requests about the result, fix a potential use-after-free when waiting on a duplicate request, and make several general improvements to the code.

Note that the use-after-free fix depends on the code simplification implemented in the first patch.

---
Changes in v3:
- Add received Reviewed-by tags.
- Rebase the series on modules-next.
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Fix handling of concurrent request_module_nowait() and request_module() calls.
- Avoid unnecessary kmod_dup_req allocations.
- Avoid mixing goto with scope-based cleanup.
- Link to v1: https://patch.msgid.link/[email protected]

---
Petr Pavlu (6):
module/dups: Inform duplicate requests about the result directly module/dups: Fix use-after-free in kmod_dup_req lifetime handling module/dups: Avoid unnecessary kmod_dup_req allocations module/dups: Use scope-based cleanup helpers module/dups: Use strcmp() to compare module names module/dups: Clean up includes

 kernel/module/dups.c | 169 +++++++++++++++++++++++----------------------------
 1 file changed, 77 insertions(+), 92 deletions(-)

---
base-commit: 2600d43b235b029d0ba4f2d3cc71e2137114fde3
change-id: 20260722-module-stats-rcu-ff0dfc986be6