From: Jia Zhu <zhujia.zj@bytedance.com>
To: Jingbo Xu <jefflexu@linux.alibaba.com>,
xiang@kernel.org, chao@kernel.org, yinxin.x@bytedance.com,
linux-erofs@lists.ozlabs.org
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [Phishing Risk] [External] [PATCH] erofs: fix missing xas_retry() in fscache mode
Date: Mon, 14 Nov 2022 14:27:50 +0800 [thread overview]
Message-ID: <1bcb11ad-e2e0-6c0d-659e-1b20b6b99fb1@bytedance.com> (raw)
In-Reply-To: <20221111090813.72068-1-jefflexu@linux.alibaba.com>
在 2022/11/11 17:08, Jingbo Xu 写道:
> The xarray iteration only holds RCU and thus may encounter
> XA_RETRY_ENTRY if there's process modifying the xarray concurrently.
> This will cause oops when referring to the invalid entry.
>
> Fix this by adding the missing xas_retry(), which will make the
> iteration wind back to the root node if XA_RETRY_ENTRY is encountered.
>
> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
> Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Jia Zhu <zhujia.zj@bytedance.com>
> ---
> fs/erofs/fscache.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
> index fe05bc51f9f2..458c1c70ef30 100644
> --- a/fs/erofs/fscache.c
> +++ b/fs/erofs/fscache.c
> @@ -75,11 +75,15 @@ static void erofs_fscache_rreq_unlock_folios(struct netfs_io_request *rreq)
>
> rcu_read_lock();
> xas_for_each(&xas, folio, last_page) {
> - unsigned int pgpos =
> - (folio_index(folio) - start_page) * PAGE_SIZE;
> - unsigned int pgend = pgpos + folio_size(folio);
> + unsigned int pgpos, pgend;
> bool pg_failed = false;
>
> + if (xas_retry(&xas, folio))
> + continue;
> +
> + pgpos = (folio_index(folio) - start_page) * PAGE_SIZE;
> + pgend = pgpos + folio_size(folio);
> +
> for (;;) {
> if (!subreq) {
> pg_failed = true;
next prev parent reply other threads:[~2022-11-14 6:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 9:08 Jingbo Xu
2022-11-14 4:42 ` Gao Xiang
2022-11-14 6:27 ` Jia Zhu [this message]
2022-11-14 11:44 ` David Howells
2022-11-14 12:11 ` Jingbo Xu
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=1bcb11ad-e2e0-6c0d-659e-1b20b6b99fb1@bytedance.com \
--to=zhujia.zj@bytedance.com \
--cc=chao@kernel.org \
--cc=dhowells@redhat.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=yinxin.x@bytedance.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
all inboxes | Powered by JetHome®