Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Bin Lan <lanbincn@139.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org, stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, lanbincn@139.com,
	zhiguo.niu@unisoc.com, baocong.liu@unisoc.com, chao@kernel.org,
	jaegeuk@kernel.org, daehojeong@google.com
Subject: [PATCH 6.1.y 0/2] f2fs: compress: fix UAF of f2fs_inode_info in f2fs_free_dic
Date: Tue, 12 May 2026 15:50:08 +0800	[thread overview]
Message-ID: <20260512075010.29584-1-lanbincn@139.com> (raw)

Hi,

This series backports a fix, a use-after-free vulnerability
in the F2FS compressed file decompression path, to linux-6.1.y.

The fix stores the sbi pointer and compress_algorithm directly in the
dic struct at allocation time, eliminating the need to dereference the
inode during asynchronous cleanup.

Patch 1 is a preparatory cleanup that changes page_array_alloc/free to
take sbi as the first parameter instead of the inode.

Patch 2 is the actual UAF fix that adds sbi and compress_algorithm
fields to decompress_io_ctx and replaces all late inode dereferences.

Both patches apply cleanly to linux-6.1.170. No logic changes are
needed beyond replacing F2FS_I_SB(dic->inode) with dic->sbi for v6.1.

Testing:
  - Verified on a 6.1.170-yocto-standard kernel with F2FS compression
    enabled (lzo, lz4, zstd).
  - Ran stress tests exercising concurrent read+unlink races, multi-reader
    unlink, and forced inode eviction during deferred dic free.
  - All 15 test cases passed with no crashes or errors.

Zhiguo Niu (2):
  f2fs: compress: change the first parameter of page_array_{alloc,free}
    to sbi
  f2fs: compress: fix UAF of f2fs_inode_info in f2fs_free_dic

 fs/f2fs/compress.c | 76 +++++++++++++++++++++++-----------------------
 fs/f2fs/f2fs.h     |  2 ++
 2 files changed, 40 insertions(+), 38 deletions(-)

-- 
2.43.0



             reply	other threads:[~2026-05-12  7:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  7:50 Bin Lan [this message]
2026-05-12  7:50 ` [PATCH 6.1.y 1/2] f2fs: compress: change the first parameter of page_array_{alloc,free} to sbi Bin Lan
2026-05-12  7:50 ` [PATCH 6.1.y 2/2] f2fs: compress: fix UAF of f2fs_inode_info in f2fs_free_dic Bin Lan
2026-05-12 14:45 ` [PATCH 6.1.y 0/2] " Sasha Levin

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=20260512075010.29584-1-lanbincn@139.com \
    --to=lanbincn@139.com \
    --cc=baocong.liu@unisoc.com \
    --cc=chao@kernel.org \
    --cc=daehojeong@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zhiguo.niu@unisoc.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