Re: [PATCH 1/5] debugfs: Prevent NULL dereference reading from string property

From: Richard Fitzgerald
Date: Tue May 16 2023 - 13:14:26 EST


On 16/5/23 17:07, Richard Fitzgerald wrote:
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -878,6 +878,9 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf,
return ret;
str = *(char **)file->private_data;
+ if (!str)
+ return simple_read_from_buffer(user_buf, count, ppos, "\n", 1);
+

Oh, this isn't right. I've somehow sent an older version that is missing
the call to debugfs_file_put(). Sorry. I'll send a v2 chain.