Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B169315D49 for ; Sun, 11 Oct 2026 22:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791757199; cv=none; b=Yd8A9bp8xiCW24TmMxEq4/WOzNlC/okpiLGxNuwM9EWGBjgsXJTJfb0REp6mcJR893BSiaF+Du8mRRwoTD7HmG/d9SxIXnudULg7mId5XMsrMhKKBuztQ5vy7Kw5OrEdlu8p4NDUqLoMl6C6NVIMZWIaYpvw7zR06r6aiqji/sI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791757199; c=relaxed/simple; bh=PMLE78jcDBD12okF7l5vCcQ6WexJaJNRi77ZacomW8Q=; h=Date:To:From:Subject:Message-Id; b=JyGKSV7pamO77+eJgPrh1EWyT2/yhL0ObOyhTKipsGYhjIJNNu9qJygo9ywaeFnWqiPwPy8ub0sN9UVS5Ibsg4wzfVAY8/hpT0zjFvzAt4l1LEzEjIhUGoFi1Twa1pOoC4grot/pBUMmFL5oUFIa3KRfk0JThjeVstm65QRM1lw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=1JP4CcV1; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="1JP4CcV1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F9E81F0089C; Sun, 11 Oct 2026 22:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1791757198; bh=uhi1xTwIw7ddvRmcetc1MResdZkI8X8ABY7RRNdmyOo=; h=Date:To:From:Subject; b=1JP4CcV1/pTLLMNwn6/stf/QOPn0HkqEgdNpNDK1rlHKaO2qZh0KTpO0jP5IBjAci QjtMIAU38VttZnq5QF6T/el5u4J+T+LXmZrW3juBY8lkH14kijwSXE5i74kcZrIvrM 5hecEnCKW3DDSOMFXneSh5PtyOr+/uZe6Zm6UDto= Date: Sun, 11 Oct 2026 15:19:57 -0700 To: mm-commits@vger.kernel.org,syzbot+03aaa576f1daa1c1f2f0@syzkaller.appspotmail.com,mark@fasheh.com,junxiao.bi@oracle.com,joseph.qi@linux.alibaba.com,jlbec@evilplan.org,heming.zhao@suse.com,ngocthang2710.1999@gmail.com,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-nonmm-stable] ocfs2-validate-chunk-and-block-counts-of-the-local-quota-file.patch removed from -mm tree Message-Id: <20261011221958.5F9E81F0089C@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: ocfs2: validate chunk and block counts of the local quota file has been removed from the -mm tree. Its filename was ocfs2-validate-chunk-and-block-counts-of-the-local-quota-file.patch This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Nguyen Ngoc Thang Subject: ocfs2: validate chunk and block counts of the local quota file Date: Sun, 20 Sep 2026 21:07:10 +0700 ocfs2_local_read_info() trusts dqi_chunks and dqi_blocks from the local quota file header. If dqi_blocks is too small, ocfs2_extend_local_quota_file() computes a bogus chunk length, extends the file, and maps logical block dqi_blocks, which is already in the inode's metadata cache (the header or a chunk header read at mount). sb_getblk() returns that cached buffer and ocfs2_set_new_buffer_uptodate() hits BUG_ON(ocfs2_buffer_cached()): kernel BUG at fs/ocfs2/uptodate.c:509! ocfs2_extend_local_quota_file+0x45c/0x1100 ocfs2_create_local_dquot+0x8ac/0xb50 ocfs2_acquire_dquot+0x614/0xae0 ocfs2_get_init_inode+0xe9/0x1b0 ocfs2_mkdir+0x174/0x430 ocfs2_local_quota_add_chunk() has the same exposure. Reject a header whose counts don't fit the chunk layout or exceed i_size. Reproduced with a crafted image (dqi_blocks = 1, chunk 0 dqc_free = 0); syzbot has no reproducer for this report. Link: https://lore.kernel.org/20260920140710.43938-1-ngocthang2710.1999@gmail.com Fixes: 9e33d69f553a ("ocfs2: Implementation of local and global quota file handling") Signed-off-by: Nguyen Ngoc Thang Signed-off-by: Andrew Morton Reported-by: syzbot+03aaa576f1daa1c1f2f0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=03aaa576f1daa1c1f2f0 Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Heming Zhao --- fs/ocfs2/quota_local.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/fs/ocfs2/quota_local.c~ocfs2-validate-chunk-and-block-counts-of-the-local-quota-file +++ a/fs/ocfs2/quota_local.c @@ -245,6 +245,25 @@ static void ocfs2_release_local_quota_bi } } +/* Check that the on-disk chunk and block counts match the file layout */ +static int ocfs2_check_local_quota_info(struct inode *inode, + unsigned int chunks, + unsigned int blocks) +{ + u64 chunk_len = ol_chunk_blocks(inode->i_sb) + 1; + u64 min_blocks = chunks ? 1 + chunk_len * (chunks - 1) + 1 : 1; + u64 max_blocks = 1 + chunk_len * chunks; + + if (blocks >= min_blocks && blocks <= max_blocks && + blocks <= i_size_read(inode) >> inode->i_sb->s_blocksize_bits) + return 0; + + return ocfs2_error(inode->i_sb, + "Quota file %llu has bad info: %u chunks, %u blocks\n", + (unsigned long long)OCFS2_I(inode)->ip_blkno, + chunks, blocks); +} + /* Load quota bitmaps into memory */ static int ocfs2_load_local_quota_bitmaps(struct inode *inode, struct ocfs2_local_disk_dqinfo *ldinfo, @@ -733,6 +752,11 @@ static int ocfs2_local_read_info(struct oinfo->dqi_blocks = le32_to_cpu(ldinfo->dqi_blocks); oinfo->dqi_libh = bh; + status = ocfs2_check_local_quota_info(lqinode, oinfo->dqi_chunks, + oinfo->dqi_blocks); + if (status < 0) + goto out_err; + /* We crashed when using local quota file? */ if (!(oinfo->dqi_flags & OLQF_CLEAN)) { rec = OCFS2_SB(sb)->quota_rec; _ Patches currently in -mm which might be from ngocthang2710.1999@gmail.com are