From nobody Sun Feb 8 00:49:24 2026 Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (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 EFEC738FF13 for ; Tue, 13 Jan 2026 13:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768309557; cv=none; b=BKC3TiINtHuvyalTF2WAGVjEBRm4Vg5bq+eDHc+LN5tFqPF6Z2/x5Zpmae3xerBb0ggWjK4fz6vLLnrWhb28FWdp8eVWb7W6ajU3WAFOT711qiT4SZlneD4QbkcjIz/UpCLZFYAl6R8YM0of1d4vRDbjrCuykwoU+8PigZedOVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768309557; c=relaxed/simple; bh=HxIn+JN7p0yWwG57tBQo9roGNwQhdqTfh+mhtxPwAEk=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=ngleirXg1JEdNsvUUbIfm3UhpMK03xWTK5c5wnSiFFHnTEXub8oQieox74sW7ZwueGgIDtDAI+kgk7HBrH6ZoFalO8CJGhgKVtoOFB0njOzrxsmSMAk/nIyt3eVJfZnhfzYAe3zNh3VDCseQomxhpa2PyAAXtPy+RhygKEU/gbc= 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.210.72 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-ot1-f72.google.com with SMTP id 46e09a7af769-7c70930bdf4so12949746a34.2 for ; Tue, 13 Jan 2026 05:05:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768309545; x=1768914345; 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=aMaffMYsLJwbcs3AVZPSs/bd70DNJ++016j8aZBp6rk=; b=nyy3+Gp41hSY9b8CCzcQ0cDpVTLcysFzibjTQlCvBMjIHgtt4YT0hOh1ySMBb4YNMt +XRpCZYGyvpYSq3J7b1SdaQ+ekYQ01pzN2BEoXHQVbr3SOxoKPvqNys1B7mIG7T4aOH4 7dDe0BRUK8yCyFERYnq9FUBRTX1D1NoXLWyGE0FX/TIkAAQdrUAwHu93qE5cz4QW31x1 vT2r9d+DF1AQYAEQu0nDrU3WAkuc6PWPM3fnEuZh7KhekQO4KHaSOvGWesrpp6CyfH8o PUUpUYg8zB2Kci8goKovpvifEi23lTHonODJUP5bE3PvUgsAUori5Z254b3ZW5tWxOoi dfNg== X-Gm-Message-State: AOJu0Yz8IGWAHYuSGoFll6BAlnxogJs5j8YnTPna3qHyvDae9j0lkVZE ifEAG7CIrvAW1AyZol+3dW69s42RMgeD1D6rmMPvwSLC5gFXYVYn4yDIkht+WNqW3fY2hJ5+wSB NqE1A/7m10S8fZD06uL1yfZSBRJVqMQSy+9C8RcIxUcSBHugOONXpL0wvbaQ= X-Google-Smtp-Source: AGHT+IERYskU1zEAevBmna+/w1dc+7qstP9pSYvXBZyAcUoCWReh9gzwM5+r9p8me3P/wlFuB55QIp68VRgDcU46xGNcF/QJozRK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:d418:0:b0:65f:599b:ef52 with SMTP id 006d021491bc7-65f599bf606mr6373421eaf.82.1768309544978; Tue, 13 Jan 2026 05:05:44 -0800 (PST) Date: Tue, 13 Jan 2026 05:05:44 -0800 In-Reply-To: <6965a06e.050a0220.38aacd.0005.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69664328.050a0220.2e06c6.000d.GAE@google.com> Subject: Forwarded: [PATCH] ext4: hold buffer reference in ext4_read_inline_dir to prevent UAF 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] ext4: hold buffer reference in ext4_read_inline_dir to pre= vent UAF Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master Hold an additional buffer reference during ext4_read_inline_data() to prevent use-after-free. The iloc buffer_head could be freed by another thread while ext4_read_inline_data() is accessing it, leading to a use-after-free read. The fix ensures the buffer remains valid during the critical section: - get_bh() before calling ext4_read_inline_data() increments refcount - Even if another thread calls brelse(), refcount stays above zero - Buffer cannot be freed while we hold the reference - brelse() after ext4_read_inline_data() decrements refcount safely Reported-by: syzbot+6986a30df88382d1f7bf@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D6986a30df88382d1f7bf Signed-off-by: Deepanshu Kartikey --- fs/ext4/inline.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 1f6bc05593df..b7dcbef4d5aa 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1395,14 +1395,25 @@ int ext4_read_inline_dir(struct file *file, } =20 inline_size =3D ext4_get_inline_size(inode); + + /* + * Hold an additional reference to the iloc buffer to prevent + * use-after-free. The buffer could be freed by another thread + * during ext4_read_inline_data() if we don't hold a reference. + */ + get_bh(iloc.bh); + dir_buf =3D kmalloc(inline_size, GFP_NOFS); if (!dir_buf) { ret =3D -ENOMEM; + brelse(iloc.bh); up_read(&EXT4_I(inode)->xattr_sem); goto out; } =20 ret =3D ext4_read_inline_data(inode, dir_buf, inline_size, &iloc); + brelse(iloc.bh); + up_read(&EXT4_I(inode)->xattr_sem); if (ret < 0) goto out; --=20 2.43.0