remoteproc: avoid array index out of bounds in debugfs file
Subsystems (2)
PATCH 1/1 remoteproc: avoid array index out of bounds in debugfs file
There is a negative offset of an on-stack array that causes an out of bounds issue when someone called with a zero 'count' argument to syswrite().
buf[count - 1]
We should add an extra check in rproc_coredump_write() to prevent the access.
Signed-off-by Xiaobing shi <[email protected]>
--- drivers/remoteproc/remoteproc_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/remoteproc_debugfs.c +1 -1
@@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp,int ret, err =0 ;char buf[20 ]; -if (count >sizeof (buf)) +if (count <1 || count >sizeof (buf))return -EINVAL ; ret =copy_from_user (buf, user_buf, count);
Signature · 1 line
2.18.0
Hi Xiaobing,
Quoted 10 lines
There is a negative offset of an on-stack array that causes an out of bounds issue when someone called with a zero 'count' argument to
syswrite().buf[count - 1]We should add an extra check in
rproc_coredump_write()to prevent the access.Signed-off-by Xiaobing shi <[email protected]>
Thanks for the patch.
However, Alistair has fixed this issue:
https://lore.kernel.org/all/[email protected]/
Thanks,
Miles