]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
debugfs: check for NULL pointer in debugfs_create_str()
authorGui-Dong Han <hanguidong02@gmail.com>
Mon, 23 Mar 2026 08:58:44 +0000 (16:58 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 14:15:23 +0000 (16:15 +0200)
commit31de83980d3764d784f79ff1bc93c42b324f4013
tree52e36dd88ec09d7d5a715130b2f86cd81d3e455a
parent56e3ee721b33bdc4ce0765d370983aa4384f8a59
debugfs: check for NULL pointer in debugfs_create_str()

Passing a NULL pointer to debugfs_create_str() leads to a NULL pointer
dereference when the debugfs file is read. Following upstream
discussions, forbid the creation of debugfs string files with NULL
pointers. Add a WARN_ON() to expose offending callers and return early.

Fixes: 9af0440ec86e ("debugfs: Implement debugfs_create_str()")
Reported-by: yangshiguang <yangshiguang@xiaomi.com>
Closes: https://lore.kernel.org/lkml/2025122221-gag-malt-75ba@gregkh/
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Link: https://patch.msgid.link/20260323085930.88894-2-hanguidong02@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/debugfs/file.c