Skip to content

s390/debug: Fix several s390dbf issues reported by AI scan

Mikhail Zaslonko linux-s390 sashiko-reviews 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest3 patches 2 repliesApplied

Changes in v3 from the cover letter

- Patch 3: put back !id->areas check under lock in debug_flush() and remove existing !id->areas check before the lock (Peter Oberparleiter)

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3s390/debug: Fix NULL pointer dereference in debug_set_level()arch/s390/kernel/debug.c+3 -30 replies
2/3s390/debug: Do not repeat parameter override notice on debug_set_level()arch/s390/kernel/debug.c+13 -80 replies
3/3s390/debug: Fix race between debug area resize and event loggingarch/s390/kernel/debug.c+20 -71 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPeter Oberparleiter
1/3R-b
2/3R-b
3/3R-b

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/3] s390/debug: Fix several s390dbf issues reported by AI scan

The s390dbf kernel parameter was added in commit a2cec6863709 ("s390/debug: Add s390dbf kernel parameter"). This series fixes three issues found in the surrounding code.

Patch 1 fixes a NULL pointer dereference in debug_set_level() introduced by that commit: the NULL check for the id argument was moved into the _debug_set_level() helper, but the newly added debug_get_param() call was left in the wrapper ahead of it.

Patch 2 eliminates a duplicate override notice that appears when drivers call debug_set_level() right after debug_register(), which is the common pattern. With the s390dbf= parameter active and many devices (e.g. many DASDs), this produced a lot of redundant log lines during boot.

Patch 3 fixes a pre-existing race between debug area resize and event logging. Setting pages to zero via the debugfs interface races with concurrent event writers: the unlocked id->areas check passes, but by the time the lock is acquired debug_areas_swap() may have published a NULL pointer, which get_active_entry() then dereferences. The race was confirmed to hang the system in testing by running concurrent debug area resize (pages 0->4 in a tight loop) against parallel DASD I/O.

Changes in v3:
- Patch 3: put back !id->areas check under lock in debug_flush() and remove existing !id->areas check before the lock (Peter Oberparleiter)

Changes in v2:
- Patch 1: Trimmed commit message; !id check removed from _debug_set_level() (Peter Oberparleiter)
- Patch 3: Trimmed commit message; !id->areas check removed from debug_flush() (Peter Oberparleiter)

Mikhail Zaslonko (3):
s390/debug: Fix NULL pointer dereference in debug_set_level() s390/debug: Do not repeat parameter override notice on
debug_set_level()
s390/debug: Fix race between debug area resize and event logging

 arch/s390/kernel/debug.c | 54 ++++++++++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 18 deletions(-)
Signature · 1 line
2.55.0