From: Chunhai Guo <guochunhai@vivo.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>,
"linux-erofs@lists.ozlabs.org" <linux-erofs@lists.ozlabs.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Chunhai Guo <guochunhai@vivo.com>
Subject: Re: [PATCH] erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails
Date: Tue, 20 Aug 2024 09:25:30 +0000 [thread overview]
Message-ID: <8481ec6f-9f8a-4f76-8ab7-b45e38cc8d40@vivo.com> (raw)
In-Reply-To: <20240820084224.1362129-1-hsiangkao@linux.alibaba.com>
在 2024/8/20 16:42, Gao Xiang 写道:
> If z_erofs_gbuf_growsize() partially fails on a global buffer due to
> memory allocation failure or fault injection (as reported by syzbot [1]),
> new pages need to be freed by comparing to the existing pages to avoid
> memory leaks.
>
> However, the old gbuf->pages[] array may not be large enough, which can
> lead to null-ptr-deref or out-of-bound access.
>
> Fix this by checking against gbuf->nrpages in advance.
>
> Fixes: d6db47e571dc ("erofs: do not use pagepool in z_erofs_gbuf_growsize()")
> Cc: <stable@vger.kernel.org> # 6.10+
> Cc: Chunhai Guo <guochunhai@vivo.com>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>
Reviewed-by: Chunhai Guo <guochunhai@vivo.com>
Thanks,
Chunhai Guo
next prev parent reply other threads:[~2024-08-20 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 7:57 [syzbot] [erofs?] general protection fault in z_erofs_gbuf_growsize syzbot
2024-08-20 8:42 ` [PATCH] erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails Gao Xiang
2024-08-20 9:25 ` Chunhai Guo [this message]
2024-08-20 9:27 ` Gao Xiang
2024-08-20 9:31 ` Chunhai Guo
2024-08-20 8:56 ` [PATCH RESEND] " Gao Xiang
2024-08-20 18:14 ` Sandeep Dhavale
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=8481ec6f-9f8a-4f76-8ab7-b45e38cc8d40@vivo.com \
--to=guochunhai@vivo.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®