mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
interconnect: debugfs: initialize src_node and dst_node to empty strings
[ Upstream commit8cc27f5c6d] The debugfs_create_str() API assumes that the string pointer is either NULL or points to valid kmalloc() memory. Leaving the pointer uninitialized can cause problems. Initialize src_node and dst_node to empty strings before creating the debugfs entries to guarantee that reads and writes are safe. Fixes:770c69f037("interconnect: Add debugfs test client") Signed-off-by: Georgi Djakov <djakov@kernel.org> Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com> Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com> Link: https://lore.kernel.org/r/20260109122523.125843-1-djakov@kernel.org Signed-off-by: Georgi Djakov <djakov@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bcb9803aa1
commit
5d7c7e1fb3
@@ -150,6 +150,11 @@ int icc_debugfs_client_init(struct dentry *icc_dir)
|
||||
return ret;
|
||||
}
|
||||
|
||||
src_node = devm_kstrdup(&pdev->dev, "", GFP_KERNEL);
|
||||
dst_node = devm_kstrdup(&pdev->dev, "", GFP_KERNEL);
|
||||
if (!src_node || !dst_node)
|
||||
return -ENOMEM;
|
||||
|
||||
client_dir = debugfs_create_dir("test_client", icc_dir);
|
||||
|
||||
debugfs_create_str("src_node", 0600, client_dir, &src_node);
|
||||
|
||||
Reference in New Issue
Block a user