diff options
| author | Gui-Dong Han <hanguidong02@gmail.com> | 2026-03-18 10:48:15 +0800 |
|---|---|---|
| committer | Georgi Djakov <djakov@kernel.org> | 2026-04-02 10:39:01 +0300 |
| commit | 028f3d0168f83be903f34a8b52cd6254d9695a57 (patch) | |
| tree | 6f017eb9e4e3b843ecc642c290e10a9852bc7cbe /include/linux | |
| parent | be0df73d5fa059d4e39b7903f71291576b3e4a05 (diff) | |
interconnect: debugfs: fix devm_kstrdup and kfree mismatch
debugfs_write_file_str() uses standard kfree() to release old strings.
Initializing src_node and dst_node with devm_kstrdup() creates a memory
management mismatch. If a user writes to these debugfs nodes, the
devm-allocated memory is freed via kfree(), leaving a dangling pointer
in the device resource list that can lead to a double free.
Fix this by using standard kstrdup() instead. Since the interconnect
subsystem is strictly built-in and cannot be unloaded as a module, there
is no exit path requiring manual cleanup of these strings. The error
handling path is also simplified by taking advantage of the fact that
kfree(NULL) is a safe no-op.
Fixes: 8cc27f5c6dd1 ("interconnect: debugfs: initialize src_node and dst_node to empty strings")
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Link: https://msgid.link/20260318024815.7655-1-hanguidong02@gmail.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
