From: Amir Goldstein <amir73il@gmail.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 7/9 linux-next] fanotify: don't write with zero size
Date: Tue, 12 May 2020 00:49:58 +0300 [thread overview]
Message-ID: <CAOQ4uxhyjPD=Q7e-v1LWH3b7kcT-R+UCF6RaU11CTs+2+B5RKw@mail.gmail.com> (raw)
In-Reply-To: <20200511180227.215152-1-fabf@skynet.be>
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
>
prev parent reply other threads:[~2020-05-11 21:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOQ4uxhyjPD=Q7e-v1LWH3b7kcT-R+UCF6RaU11CTs+2+B5RKw@mail.gmail.com' \
--to=amir73il@gmail.com \
--cc=fabf@skynet.be \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).