mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Lizhi Xu <lizhi.xu@windriver.com>,
	syzbot+c2ea94ae47cd7e3881ec@syzkaller.appspotmail.com,
	akpm <akpm@linux-foundation.org>
Cc: jlbec@evilplan.org, linux-kernel@vger.kernel.org,
	mark@fasheh.com, ocfs2-devel@lists.linux.dev,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] ocfs2: reset folio to NULL when get folio fails
Date: Tue, 17 Jun 2025 11:45:51 +0800	[thread overview]
Message-ID: <cc276140-8214-42d2-9224-619906364982@linux.alibaba.com> (raw)
In-Reply-To: <20250616013140.3602219-1-lizhi.xu@windriver.com>



On 2025/6/16 09:31, Lizhi Xu wrote:
> The reproducer uses FAULT_INJECTION to make memory allocation fail, which
> causes __filemap_get_folio() to fail, when initializing w_folios[i] in
> ocfs2_grab_folios_for_write(), it only returns an error code and the value
> of w_folios[i] is the error code, which causes ocfs2_unlock_and_free_folios()
> to recycle the invalid w_folios[i] when releasing folios.
> 
> Reported-by: syzbot+c2ea94ae47cd7e3881ec@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=c2ea94ae47cd7e3881ec
> Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>

Looks good.
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/aops.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index 40b6bce12951..89aadc6cdd87 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -1071,6 +1071,7 @@ static int ocfs2_grab_folios_for_write(struct address_space *mapping,
>  			if (IS_ERR(wc->w_folios[i])) {
>  				ret = PTR_ERR(wc->w_folios[i]);
>  				mlog_errno(ret);
> +				wc->w_folios[i] = NULL;
>  				goto out;
>  			}
>  		}


      reply	other threads:[~2025-06-17  3:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-15 17:07 [syzbot] [ocfs2?] BUG: unable to handle kernel paging request in ocfs2_unlock_and_free_folios syzbot
2025-06-15 19:20 ` [External] : " Mark Tinguely
2025-06-16 14:39   ` Mark Tinguely
2025-06-16  1:31 ` [PATCH] ocfs2: reset folio to NULL when get folio fails Lizhi Xu
2025-06-17  3:45   ` Joseph Qi [this message]

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=cc276140-8214-42d2-9224-619906364982@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.xu@windriver.com \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=syzbot+c2ea94ae47cd7e3881ec@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

all inboxes | Powered by JetHome®