[PATCH v3 0/3] debugfs: make debugfs_create_str() read-only
From: Yichong Chen
Date: Fri Aug 07 2026 - 06:12:04 EST
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(-)
--
2.51.0