All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 7/9 linux-next] fanotify: don't write with zero size
@ 2020-05-11 18:02 Fabian Frederick
  2020-05-11 21:49 ` Amir Goldstein
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2020-05-11 18:02 UTC (permalink / raw)
  To: jack, amir73il; +Cc: linux-fsdevel, Fabian Frederick

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;
+
 	group = file->private_data;
 
 	if (count > sizeof(response))
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 7/9 linux-next] fanotify: don't write with zero size
  2020-05-11 18:02 [PATCH 7/9 linux-next] fanotify: don't write with zero size Fabian Frederick
@ 2020-05-11 21:49 ` Amir Goldstein
  0 siblings, 0 replies; 2+ messages in thread
From: Amir Goldstein @ 2020-05-11 21:49 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-fsdevel

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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-11 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 18:02 [PATCH 7/9 linux-next] fanotify: don't write with zero size Fabian Frederick
2020-05-11 21:49 ` Amir Goldstein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.