From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40A9863DE for ; Tue, 27 Dec 2022 20:34:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A066C433EF; Tue, 27 Dec 2022 20:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672173246; bh=Vb8RiWBMxQV4H05t02dokiGTlYCLPTWcdvROdyTRgpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i+kDOP50rPIYgjXcdZ1SyHgriYLcFYpj8CBov0drf1R7NV802ldsKT6U9Xz/39Zuw OvlRhsigep8sBE3msA3fzPmHi1rviS7TcRIf0YAKFLASR0ggShSBbReO/02r5tQRK0 F+aFRcl5g23cj4yEQYXlfrgw3R33h2+KF2ffQ4RPYQO8OjjOUA9fJa+TAQ1EefC0Q0 KqY7dkHFMpGe4Zftm8HJPj7eedX54MhFf+kissVwFAQIGIpGL+d++ZsFMSI5RouRMY pGPjZiLI3fYdR3eoKdY7Vqqck72Rp+E26S09UY2P0U+joRbqj9hdc90B1invWKo0fM JpGBjuslGjt2A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tetsuo Handa , syzot , Konstantin Komarov , Sasha Levin , ntfs3@lists.linux.dev Subject: [PATCH AUTOSEL 6.0 15/27] fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init() Date: Tue, 27 Dec 2022 15:33:30 -0500 Message-Id: <20221227203342.1213918-15-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221227203342.1213918-1-sashal@kernel.org> References: <20221227203342.1213918-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Tetsuo Handa [ Upstream commit 0d0f659bf713662fabed973f9996b8f23c59ca51 ] 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 Signed-off-by: Tetsuo Handa Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- 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.35.1