fanotify: don't write with zero size
Subsystems (3)
PATCH 7/9 fanotify: don't write with zero size
check count in fanotify_write() and return -EINVAL when 0
Signed-off-by Fabian Frederick <[email protected]>
--- fs/notify/fanotify/fanotify_user.c | 3 +++ 1 file changed, 3 insertions(+)
fs/notify/fanotify/fanotify_user.c +3 -0
@@ -485,6 +485,9 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_tif (!IS_ENABLED (CONFIG_FANOTIFY_ACCESS_PERMISSIONS ))return -EINVAL ; +if (!count) +return -EINVAL ; + group = file->private_data;if (count >sizeof (response))
Signature · 1 line
2.26.2
Amir Goldstein
reviewerQuoted 13 lines · Fabian Frederick
check count in
fanotify_write()and return-EINVALwhen 0Signed-off-by Fabian Frederick <[email protected]>--- fs/notify/fanotify/fanotify_user.c | 3 +++ 1 file changed, 3 insertions(+)fs/notify/fanotify/fanotify_user.c +0
-0
fs/notify/fanotify/fanotify_user.c static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t · line 490
Quoted 6 lines
fs/notify/fanotify/fanotify_user.c +3
-0@@ -485,6 +485,9 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_tif (!IS_ENABLED (CONFIG_FANOTIFY_ACCESS_PERMISSIONS ))return -EINVAL ; +if (!count) +return -EINVAL ; +
Maybe even (count < sizeof(response)) ?
Quoted 6 lines
fs/notify/fanotify/fanotify_user.c +0
-1group = file->private_data;if (count >sizeof (response)) --2.26.2