Message ID | 20200511180227.215152-1-fabf@skynet.be (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fs/notify: cleanup | expand |
On Mon, May 11, 2020 at 9:02 PM Fabian Frederick <fabf@skynet.be> wrote: > > check count in fanotify_write() and return -EINVAL when 0 > > Signed-off-by: Fabian Frederick <fabf@skynet.be> > --- > fs/notify/fanotify/fanotify_user.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c > index 02a314acc757..6e19dacb2475 100644 > --- a/fs/notify/fanotify/fanotify_user.c > +++ b/fs/notify/fanotify/fanotify_user.c > @@ -485,6 +485,9 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t > if (!IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) > return -EINVAL; > > + if (!count) > + return -EINVAL; > + Maybe even (count < sizeof(response)) ? > group = file->private_data; > > if (count > sizeof(response)) > -- > 2.26.2 >
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 02a314acc757..6e19dacb2475 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -485,6 +485,9 @@ static ssize_t fanotify_write(struct file *file, const char __user *buf, size_t if (!IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) return -EINVAL; + if (!count) + return -EINVAL; + group = file->private_data; if (count > sizeof(response))
check count in fanotify_write() and return -EINVAL when 0 Signed-off-by: Fabian Frederick <fabf@skynet.be> --- fs/notify/fanotify/fanotify_user.c | 3 +++ 1 file changed, 3 insertions(+)