From: Greg KH <gregkh@linuxfoundation.org>
To: George Saad <geoo115@gmail.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix use-after-free of sbi in f2fs_compress_write_end_io()
Date: Mon, 23 Mar 2026 10:32:57 +0100 [thread overview]
Message-ID: <2026032340-proposal-sedation-7225@gregkh> (raw)
In-Reply-To: <20260323090306.757911-1-geoo115@gmail.com>
On Mon, Mar 23, 2026 at 09:03:06AM +0000, George Saad wrote:
> In f2fs_compress_write_end_io(), dec_page_count(sbi, type) at line 1492
> can bring the F2FS_WB_CP_DATA counter to zero, unblocking
> f2fs_wait_on_all_pages() in f2fs_put_super() on a concurrent unmount
> CPU. The unmount path then proceeds to call
> f2fs_destroy_page_array_cache(sbi) and kfree(sbi). Meanwhile, the bio
> completion callback is still executing: when it reaches
> page_array_free(sbi, ...), it dereferences sbi->page_array_slab_size
> and sbi->page_array_slab within the now-freed f2fs_sb_info structure.
>
> This is the same class of bug as CVE-2026-23234 (which fixed the
> equivalent race in f2fs_write_end_io() in data.c), but in the
> compressed writeback completion path that was not covered by that fix.
>
> Fix this by caching sbi->page_array_slab and sbi->page_array_slab_size
> into local variables at function entry, before dec_page_count(). At
> function entry, sbi is guaranteed valid because the F2FS_WB_CP_DATA
> counter is still nonzero (this invocation has not yet decremented it),
> preventing the unmount path from proceeding past
> f2fs_wait_on_all_pages(). The cached values are then used in place of
> the post-decrement sbi dereference.
>
> Fixes: 4c8ff709c6 ("f2fs: support data compression")
This commit id is not in Linus's tree, are you sure it is correct?
thanks,
greg k-h
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-03-23 9:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 21:31 [f2fs-dev] [PATCH] f2fs: fix use-after-free in f2fs_compress_write_end_io() G S
2026-03-23 7:46 ` Greg KH
2026-03-23 9:03 ` [f2fs-dev] [PATCH] f2fs: fix use-after-free of sbi " George Saad
2026-03-23 9:32 ` Greg KH [this message]
2026-03-23 9:38 ` [f2fs-dev] [PATCH v2] " George Saad
2026-03-23 10:38 ` Greg KH
2026-03-23 10:44 ` [f2fs-dev] [PATCH v3] " George Saad
2026-03-23 11:06 ` Chao Yu via Linux-f2fs-devel
2026-03-23 11:21 ` [f2fs-dev] [PATCH v4] " George Saad
2026-03-23 11:30 ` Chao Yu via Linux-f2fs-devel
2026-03-24 17:32 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
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=2026032340-proposal-sedation-7225@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=geoo115@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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