public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
From: Enrico Mioso <mrkiko.rs@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	 syzbot <syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com>,
	 syzkaller-bugs@googlegroups.com, ntfs3@lists.linux.dev,
	 Kari Argillander <kari.argillander@gmail.com>
Subject: Re: [syzbot] WARNING in wnd_init
Date: Sun, 2 Oct 2022 18:04:45 +0200 (CEST)	[thread overview]
Message-ID: <d4dd5bd0-9f9c-a132-342f-c5a3b000c19f@gmail.com> (raw)
In-Reply-To: <771ac308-6a55-77b4-8335-b68cde369aae@I-love.SAKURA.ne.jp>

Hello all!

Is this the expected fix for the issue?
Shouldn't the value be sanitized somehow?
This is intended to be an "honest" question - I am not an experienced kernel nor filesystem programmer, just wondering...

Enrico


On Sun, 2 Oct 2022, Tetsuo Handa wrote:

> Date: Sun, 2 Oct 2022 16:37:34
> From: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
> To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
> Cc: syzbot <syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com>,
>     syzkaller-bugs@googlegroups.com, ntfs3@lists.linux.dev,
>     Kari Argillander <kari.argillander@gmail.com>
> Subject: Re: [syzbot] WARNING in wnd_init
> 
> syzbot is reporting too large allocation at wnd_init() [1], for a crafted
> filesystem can become wnd->nwnd close to UINT_MAX. Add __GFP_NOWARN in
> order to avoid too large allocation warning, than exhausting memory by
> using kvcalloc().
>
> Link: https://syzkaller.appspot.com/bug?extid=fa4648a5446460b7b963 [1]
> Reported-by: syzot <syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> fs/ntfs3/bitmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
> index 5d44ceac855b..90f3c4e84856 100644
> --- a/fs/ntfs3/bitmap.c
> +++ b/fs/ntfs3/bitmap.c
> @@ -661,7 +661,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits)
> 	if (!wnd->bits_last)
> 		wnd->bits_last = wbits;
>
> -	wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS);
> +	wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS | __GFP_NOWARN);
> 	if (!wnd->free_bits)
> 		return -ENOMEM;
>
> -- 
> 2.34.1
>
>
>

  parent reply	other threads:[~2022-10-02 16:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  8:15 [syzbot] WARNING in wnd_init syzbot
2022-10-02  7:07 ` syzbot
2022-10-02 21:52   ` Kari Argillander
2022-10-02 14:37 ` Tetsuo Handa
2022-10-02 14:39   ` [PATCH] ntfs3: use __GFP_NOWARN allocation at wnd_init() Tetsuo Handa
2022-11-12 18:08     ` Konstantin Komarov
2022-10-02 16:04   ` Enrico Mioso [this message]
2022-10-05 12:17     ` [syzbot] WARNING in wnd_init Tetsuo Handa
2022-10-04  3:15 ` [PATCH] fs/ntfs3: Validate attribute data and valid sizes Abdun Nihaal
2022-11-12 18:09   ` Konstantin Komarov

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=d4dd5bd0-9f9c-a132-342f-c5a3b000c19f@gmail.com \
    --to=mrkiko.rs@gmail.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=kari.argillander@gmail.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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