public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: syzbot <syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com>,
	<syzkaller-bugs@googlegroups.com>, <ntfs3@lists.linux.dev>,
	Kari Argillander <kari.argillander@gmail.com>
Subject: Re: [PATCH] ntfs3: use __GFP_NOWARN allocation at wnd_init()
Date: Sat, 12 Nov 2022 21:08:21 +0300	[thread overview]
Message-ID: <f5607633-e8e6-0467-7fe5-4883bd6988f4@paragon-software.com> (raw)
In-Reply-To: <c9dbfd5f-5dad-8432-e24f-74fbf88f709e@I-love.SAKURA.ne.jp>



On 10/2/22 17:39, Tetsuo Handa wrote:
> 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>
> ---
> Sorry, forgot to update subject line.
> 
>   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;
>   

Applied, thanks!

  reply	other threads:[~2022-11-12 18:08 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 [this message]
2022-10-02 16:04   ` [syzbot] WARNING in wnd_init Enrico Mioso
2022-10-05 12:17     ` 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=f5607633-e8e6-0467-7fe5-4883bd6988f4@paragon-software.com \
    --to=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