Skip to content

debugfs: make debugfs_create_str() read-only

Yichong Chen driver-core linux-pm linux-sound lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 4 repliesIn review
  2. v23 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Use scoped mutex guards in the interconnect and SoundWire conversions.
- Clarify why GFP_KERNEL is safe in the interconnect conversion after the RCU read-side critical section is removed.
- Drop the unnecessary firmware_file = NULL assignment in the SoundWire exit path.
- Use WARN() instead of WARN_ONCE() so each writable debugfs_create_str() caller can be reported.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3interconnect: debugfs: replace writable string helperdrivers/interconnect/debugfs-client.c+64 -170 replies
2/3soundwire: debugfs: replace writable string helperdrivers/soundwire/debugfs.c+55 -80 replies
3/3debugfs: make debugfs_create_str() read-onlyfs/debugfs/file.c+10 -710 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] debugfs: make debugfs_create_str() read-only

debugfs_create_str() has a generic write implementation that replaces the backing string. Concurrent writers can race and free the same old string twice.

Instead of adding more locking to the generic helper, convert the existing writable in-tree users to local file operations and make debugfs_create_str() read-only.

Changes since v2:
- Use scoped mutex guards in the interconnect and SoundWire conversions.
- Clarify why GFP_KERNEL is safe in the interconnect conversion after the RCU read-side critical section is removed.
- Drop the unnecessary firmware_file = NULL assignment in the SoundWire exit path.
- Use WARN() instead of WARN_ONCE() so each writable debugfs_create_str() caller can be reported.

Changes since v1:
- Follow Greg's suggestion to avoid adding locking to the generic debugfs_create_str() write path.
- Convert the existing writable in-tree users to local file operations.
- Make debugfs_create_str() read-only and refuse writable modes.
- Split the change into a 3-patch series.

Yichong Chen (3):
interconnect: debugfs: replace writable string helper
soundwire: debugfs: replace writable string helper
debugfs: make debugfs_create_str() read-only

 drivers/interconnect/debugfs-client.c | 81 +++++++++++++++++++++------
 drivers/soundwire/debugfs.c           | 63 ++++++++++++++++++---
 fs/debugfs/file.c                     | 81 ++++-----------------------
 3 files changed, 129 insertions(+), 96 deletions(-)
Signature · 1 line
2.51.0