From nobody Sun Feb 8 05:40:28 2026 Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 263592C15A2 for ; Fri, 24 Oct 2025 07:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761290125; cv=none; b=MGoNsR7jzz4hQvfwa6Llu3/hajlCaNa7t3dAPdHoyMXZZB111DuzEhDOTUQhrrwadfbxbnn3L6hzpJ084lG06K1wBkoK4uLlYLQ/cL73t7bO1F/xYbASnjyj15PI+tlF39D1NiLO/2rm46zbswIi/bdNw30n1lza31aS47ec1Rc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761290125; c=relaxed/simple; bh=vpjK0hE8YXRo0KuVf6oDc7peRJobCW/rH+1ac96XXxc=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=fc0xB688meX8A/4NcT9Ut9Zx2HzmnDsHNfxlarW1Iis39JCtDmAf1V3YuCQdrX1/McUEEhKXJeHc6nBb0c0SbP9shzKyhLdGs5lgNAadkEIIL/yzkUOq+YKkdlmNAnHcdArbkk9GCDokLF+hINXBDydG6BQskf+I+J4qQGM8rqQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.166.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-il1-f197.google.com with SMTP id e9e14a558f8ab-431d8643856so68417365ab.2 for ; Fri, 24 Oct 2025 00:15:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761290122; x=1761894922; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3W0XWln4jrXi/FR5HXl0w/n/mi429O4MQ0jEz2lDFVw=; b=ppy67NU44/neZ12h1fGfvdPd+Orwy1Ex+sXS73SieDjXUPugcRJU2lk7BtFFSblrPU iigEboD1/lyG80cB+9lZY4mjcMPA3NP5hBZOdijn1mfxuW6jN53ghbchqxwegbUM1tS5 xGykulagoY203gmJ2Yy3cbMsoNZWpiOUBufnxigN+os2YlIIrN97e019CUGBFaORC7v5 9XpZcYVF5BIsL0qnG3H5Xef+tTf8bKrAUfYYIrvLzsnvQjd1knipNXGbTGgasr1J6s/Q hNZaGJwNAO4h4ipy41DDp+2uBGGjnQviHNTDdSfKQlaOH98bcFXEN39u33jzFp5JlwJk TLqQ== X-Gm-Message-State: AOJu0YxRxLOSDbiE4wF/dxQqCXdINQrfa+e24WpYOLWC2cMXtJJceHec m8Z7MhMh0OCmWACRITFQigOa1g+GVcQ7rF+HBJ8a1s8xMPyNIX/eArUDA723LlP2koTtmJa+nLH 3DTrme9VbcPgalnJ5oXtjeQih58OJDdB+dwuPJoyH1wCqoSAWd073KBQEFJ0= X-Google-Smtp-Source: AGHT+IGhk6mqM+GThA7v2uNMs7WhXDp3zdWBZP3fdr7CeIyabCgNrHdT8z4KWO1GhQxz41SYiDPnkDT1a9xbiQhOg8++qXhp4Tmq Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a92:c263:0:b0:42e:2c30:285b with SMTP id e9e14a558f8ab-431dc1e2690mr53746985ab.20.1761290122262; Fri, 24 Oct 2025 00:15:22 -0700 (PDT) Date: Fri, 24 Oct 2025 00:15:22 -0700 In-Reply-To: <676c3718.050a0220.2f3838.037f.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <68fb278a.050a0220.346f24.009f.GAE@google.com> Subject: Forwarded: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-6.1.y From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/stable/l= inux.git linux-6.1.y Author: dmantipov@yandex.ru diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 7f11ffacc915..e606826045b5 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -6155,6 +6155,9 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_s= uper *osb, int status; struct inode *inode =3D NULL; struct buffer_head *bh =3D NULL; + struct ocfs2_dinode *di; + struct ocfs2_truncate_log *tl; + unsigned int tl_count, tl_used; =20 inode =3D ocfs2_get_system_file_inode(osb, TRUNCATE_LOG_SYSTEM_INODE, @@ -6172,6 +6175,19 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_= super *osb, goto bail; } =20 + di =3D (struct ocfs2_dinode *)bh->b_data; + tl =3D &di->id2.i_dealloc; + tl_used =3D le16_to_cpu(tl->tl_used); + tl_count =3D le16_to_cpu(tl->tl_count); + if (unlikely(tl_count > ocfs2_truncate_recs_per_inode(osb->sb) || + tl_count =3D=3D 0 || tl_used > tl_count)) { + status =3D -EFSCORRUPTED; + iput(inode); + brelse(bh); + mlog_errno(status); + goto bail; + } + *tl_inode =3D inode; *tl_bh =3D bh; bail: diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index de6fd4a09ffd..10d0618a0ddf 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -302,8 +302,21 @@ static int ocfs2_check_dir_entry(struct inode *dir, unsigned long offset) { const char *error_msg =3D NULL; - const int rlen =3D le16_to_cpu(de->rec_len); - const unsigned long next_offset =3D ((char *) de - buf) + rlen; + unsigned long next_offset; + int rlen; + + if (offset > size - OCFS2_DIR_REC_LEN(1)) { + /* Dirent is (maybe partially) beyond the buffer + * boundaries so touching 'de' members is unsafe. + */ + mlog(ML_ERROR, "directory entry (#%llu: offset=3D%lu) " + "too close to end or out-of-bounds", + (unsigned long long)OCFS2_I(dir)->ip_blkno, offset); + return 0; + } + + rlen =3D le16_to_cpu(de->rec_len); + next_offset =3D ((char *) de - buf) + rlen; =20 if (unlikely(rlen < OCFS2_DIR_REC_LEN(1))) error_msg =3D "rec_len is smaller than minimal"; @@ -778,6 +791,14 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, struct ocfs2_extent_block *eb; struct ocfs2_extent_rec *rec =3D NULL; =20 + if (le16_to_cpu(el->l_count) !=3D + ocfs2_extent_recs_per_dx_root(inode->i_sb)) { + ret =3D ocfs2_error(inode->i_sb, + "Inode %lu has invalid extent list length %u\n", + inode->i_ino, le16_to_cpu(el->l_count)); + goto out; + } + if (el->l_tree_depth) { ret =3D ocfs2_find_leaf(INODE_CACHE(inode), el, major_hash, &eb_bh); @@ -3416,6 +3437,14 @@ static int ocfs2_find_dir_space_id(struct inode *dir= , struct buffer_head *di_bh, offset +=3D le16_to_cpu(de->rec_len); } =20 + if (!last_de) { + ret =3D ocfs2_error(sb, "Directory entry (#%llu: size=3D%lld) " + "is unexpectedly short", + (unsigned long long)OCFS2_I(dir)->ip_blkno, + i_size_read(dir)); + goto out; + } + /* * We're going to require expansion of the directory - figure * out how many blocks we'll need so that a place for the diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index a1f3b25ce612..7115d2091cb9 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -1419,6 +1419,14 @@ int ocfs2_validate_inode_block(struct super_block *s= b, goto bail; } =20 + if ((le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL) && + le32_to_cpu(di->i_clusters)) { + rc =3D ocfs2_error(sb, "Invalid dinode %llu: %u clusters\n", + (unsigned long long)bh->b_blocknr, + le32_to_cpu(di->i_clusters)); + goto bail; + } + rc =3D 0; =20 bail: diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index b1e32ec4a9d4..6acf13adfb55 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c @@ -98,7 +98,13 @@ static int __ocfs2_move_extent(handle_t *handle, =20 rec =3D &el->l_recs[index]; =20 - BUG_ON(ext_flags !=3D rec->e_flags); + if (ext_flags !=3D rec->e_flags) { + ret =3D ocfs2_error(inode->i_sb, + "Inode %llu has corrupted extent %d with flags 0x%x at cpos %u\n", + (unsigned long long)ino, index, rec->e_flags, cpos); + goto out; + } + /* * after moving/defraging to new location, the extent is not going * to be refcounted anymore. @@ -1032,6 +1038,12 @@ int ocfs2_ioctl_move_extents(struct file *filp, void= __user *argp) if (range.me_threshold > i_size_read(inode)) range.me_threshold =3D i_size_read(inode); =20 + if (range.me_flags & ~(OCFS2_MOVE_EXT_FL_AUTO_DEFRAG | + OCFS2_MOVE_EXT_FL_PART_DEFRAG)) { + status =3D -EINVAL; + goto out_free; + } + if (range.me_flags & OCFS2_MOVE_EXT_FL_AUTO_DEFRAG) { context->auto_defrag =3D 1; =20 diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 166c8918c825..d11a0b83baba 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c @@ -645,6 +645,16 @@ ocfs2_block_group_alloc_discontig(handle_t *handle, return status ? ERR_PTR(status) : bg_bh; } =20 +static int ocfs2_check_chain_list(struct ocfs2_chain_list *cl, + struct super_block *sb) +{ + if (le16_to_cpu(cl->cl_count) !=3D ocfs2_chain_recs_per_inode(sb)) + return -EINVAL; + if (le16_to_cpu(cl->cl_next_free_rec) > le16_to_cpu(cl->cl_count)) + return -EINVAL; + return 0; +} + /* * We expect the block group allocator to already be locked. */ @@ -667,6 +677,10 @@ static int ocfs2_block_group_alloc(struct ocfs2_super = *osb, BUG_ON(ocfs2_is_cluster_bitmap(alloc_inode)); =20 cl =3D &fe->id2.i_chain; + status =3D ocfs2_check_chain_list(cl, alloc_inode->i_sb); + if (status) + goto bail; + status =3D ocfs2_reserve_clusters_with_limit(osb, le16_to_cpu(cl->cl_cpg), max_block, flags, &ac); @@ -1923,6 +1937,9 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_all= oc_context *ac, } =20 cl =3D (struct ocfs2_chain_list *) &fe->id2.i_chain; + status =3D ocfs2_check_chain_list(cl, ac->ac_inode->i_sb); + if (status) + goto bail; =20 victim =3D ocfs2_find_victim_chain(cl); ac->ac_chain =3D victim;