From nobody Fri Dec 19 11:32:55 2025 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (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 644A52C027B for ; Mon, 8 Dec 2025 08:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765181339; cv=none; b=TZaJCUuWtjAJQMImnBqKrAPXCwTzfV+LVmqv2ACU/5wTCo+sHJNIm5DPih/db+6jSPoVNbLwf6uuUZWgH0O0bPWoLMnkqDgDZ/QRekgWGt40ihX6AlC2bwq8bsCqsZiaf2UszEYSyeZzjXskS07jtW2OqU4r5p6AeFZjQE7oY/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765181339; c=relaxed/simple; bh=0k7BWoLgAZXORODCFKgDvsJ6K+5dPiMhEbunsycw3FQ=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=WGIfWhIMRnw8mvl8MJ42ANScFgBl2G10SYte1XCAjhvDxPfKEScUBYKQncoBnzyj8xRq+U9669fvd7dWjofoR0pgltePo5Z9tHMNX6iy7CMPXge9tJ7NO9IB9cU75m5eXbg7wHNVgUB/522CoQka/oLIO0rYkUu2NDMTjvmgKiI= 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.161.71 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-oo1-f71.google.com with SMTP id 006d021491bc7-657a467228eso6464362eaf.0 for ; Mon, 08 Dec 2025 00:08:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765181337; x=1765786137; 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=/FLQUEVAXa/9vTzkT0M+mS1bJP1VSSvZsOvvzdgb9+g=; b=fwyGcwUze/oQvwAX8SeQzZukiLzZgmzVzHNMUCLFqnPmJTtN2vnbXJmLlGBPhtU6mP btBajccsteXBG3cQaBRxdu+rZxMw4RfrVtNegl/IOB59mPo2MrYy1AQmHMmicD5GNo5C H6ZJn6/J2A7fst+0MJ2ZilwauC4+D/e8p5RCQqxGSwgkSYyoYeezEJEVCY3q410QwmAX P3lrU99WB7jTiEiLk7+oBhQi/g/q6PD+Ka3rAisYQh0svKNOr5juD7i//NM0O39heHGx X/1UoAg4HeeKcDhnTcfYP48UhRflTu4UrYxBme4oVjRBwvNxrDHbYBbMEA0Jnp+cuE4p rXrw== X-Gm-Message-State: AOJu0YwnXbojRIsVQ1dp+zc/lVid930HxBOtnZjXfzidLoNTKCguaseo pW+x6fGrpTNpW4EdE9O0dObBvvCE3UE682d68U5sG1aBe0Vi7OsIoCx5dqSpda9jUTMzebeJ82w 7HrnmYNUue1b1i+RGBfYBvYJ32F2HK6N5NMd69VZt9vZmmxjCI+dZWxq3k1E= X-Google-Smtp-Source: AGHT+IFRcvkSMYIFccMvl3xRSV6X5zf0rXsUNA5HnUV5y+Y9WreCR3YUEdjveomVvkzlZL5EjL/AqgiNUGGIe8N/EHqdi6zGInou Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:1691:b0:659:9a49:8fd1 with SMTP id 006d021491bc7-6599a983107mr3022995eaf.74.1765181337609; Mon, 08 Dec 2025 00:08:57 -0800 (PST) Date: Mon, 08 Dec 2025 00:08:57 -0800 In-Reply-To: <69368129.a70a0220.38f243.008e.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69368799.a70a0220.38f243.0094.GAE@google.com> Subject: Forwarded: [PATCH] ocfs2: validate i_refcount_loc when refcount flag is set 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: [PATCH] ocfs2: validate i_refcount_loc when refcount flag is set Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master Add validation in ocfs2_validate_inode_block() to check that if an inode has OCFS2_HAS_REFCOUNT_FL set, it must also have a valid i_refcount_loc. A corrupted filesystem image can have this inconsistent state, which later triggers a BUG_ON in ocfs2_remove_refcount_tree() when the inode is being wiped during unlink. Catch this corruption early during inode validation to fail gracefully instead of crashing the kernel. Reported-by: syzbot+6d832e79d3efe1c46743@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D6d832e79d3efe1c46743 Signed-off-by: Deepanshu Kartikey --- fs/ocfs2/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 78f81950c9ee..dd56407fc056 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -1484,6 +1484,13 @@ int ocfs2_validate_inode_block(struct super_block *s= b, goto bail; } =20 + if ((di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) && + !di->i_refcount_loc) { + rc =3D ocfs2_error(sb, "Invalid dinode #%llu: refcount flag set but i_re= fcount_loc is zero\n", + (unsigned long long)bh->b_blocknr); + goto bail; + } + rc =3D 0; =20 bail: --=20 2.43.0