From nobody Thu Apr 2 09:12:26 2026 Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) (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 E4EF6399011 for ; Mon, 30 Mar 2026 09:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774861466; cv=none; b=HueSUhlO9lTD8V+vJx6pLenAPZ/jmfHb7Un0RteInAL0K55QlXxWZb9uC36U0D5r+MQmiTtmT42cYz7mKC8Ayb9YdUvvp+0okgMVR+/P2NCKIhlDG/sdWUwq8vtZU2Dfesz2HDJFEeaDKvw1CIgMVbozmYxASchhkAxNFDSbhRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774861466; c=relaxed/simple; bh=Tmhd/gAJ2MXoxt33ofERvkC7IV2hsBuA13B5iW8Me/8=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=ieFsAcFWV1CcbmoUc1Vo3At7iQYld819jd7nkzzNuH8+Ml9BoTbuwh53zchWFJZHdIXDuoXsanuO8TTjO5J5AirkywJF+NK6/WYq/GuNoPWK5T6eYPR8Gt7w2dL0LkNzc3w1URz4ulI32UzjUnVk5UmrkirAV8rgoClx6VmPvqY= 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.160.70 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-oa1-f70.google.com with SMTP id 586e51a60fabf-40f192cf4b6so6306292fac.1 for ; Mon, 30 Mar 2026 02:04:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774861464; x=1775466264; 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=KxS9mlXRMQalKyjHkuCJzO5YIwyxR8DDZkT+RhyRcU8=; b=cO62c0oarV3jOlzvs0bWVr8ZkKi0Ycquh2q73SSZX/M7WxjujC6nCWNLADCIr6u52T 9YUxbNJyXhmOhWRdrz0mFutMHaXDrpbI3a0pzwPYHE2nHXn7mky/PQeOM3+Y3yTLzNCZ 8TaKabsbt6wIR5QAhNn9y20P4e2qEsvY0UTNAcsweK3jvcRo1uXViasDi8LRuvHdir91 0UJ50pf88JzUVVTx3a3AHNf9T970I6kvJ9O+d8EjkGApJwhZxUiL5KYQrS3pJfAQBvUb au7h4kkB2PXs8RJEccp2X17wmaK0SLb2oD1/7JMnDzVJ8JJE1m1Xd+XyCsIjxnygg0KQ fvMA== X-Gm-Message-State: AOJu0YwTnE6OJ1DxK80JpDZYdDMtFprDgImja4D6ZsIp2V6p5vQUuvas iPiWsWbEZ6qEjb8iUJ85+YyDmfENBsybGqPU+og9pMqs9XpdEVyagB+Sx9q6NPxpxvgihu5Xu1t x//9Xb165swXqFTuRpZZocl4VAHu+8yqMn/c4EmEZsfiggJgExOuGVCGbS88= 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:f029:b0:67c:24de:b377 with SMTP id 006d021491bc7-67e185f275dmr6485701eaf.2.1774861463828; Mon, 30 Mar 2026 02:04:23 -0700 (PDT) Date: Mon, 30 Mar 2026 02:04:23 -0700 In-Reply-To: <69ca049a.a70a0220.97f31.0127.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69ca3c97.050a0220.183828.0016.GAE@google.com> Subject: Forwarded: [PATCH] bfs: fix missing set_buffer_uptodate() in bfs_move_block() 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] bfs: fix missing set_buffer_uptodate() in bfs_move_block() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gi= t master bfs_move_block() uses sb_getblk() to obtain a buffer for the destination block, copies data into it via memcpy(), and then calls mark_buffer_dirty(). However, sb_getblk() only allocates a buffer head without reading the block from disk, leaving BH_Uptodate unset. This causes mark_buffer_dirty() to trigger a warning: WARNING: fs/buffer.c:1180 at mark_buffer_dirty+0x299/0x410 !buffer_uptodate(bh) Since bfs_move_block() fully overwrites the destination buffer via memcpy(), reading the block from disk is unnecessary. Instead, call set_buffer_uptodate() after the copy to indicate the buffer contains valid data before marking it dirty. Additionally, sb_getblk() can return NULL but the original code never checked for this, which would cause a NULL pointer dereference. Add a proper NULL check with cleanup of the source buffer on failure. Reported-by: syzbot+d083fd809394eab229a8@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Dd083fd809394eab229a8 Signed-off-by: Deepanshu Kartikey --- fs/bfs/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/bfs/file.c b/fs/bfs/file.c index d33d6bde992b..0a9b12b73324 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c @@ -40,7 +40,12 @@ static int bfs_move_block(unsigned long from, unsigned l= ong to, if (!bh) return -EIO; new =3D sb_getblk(sb, to); + if (!new) { + brelse(bh); + return -EIO; + } memcpy(new->b_data, bh->b_data, bh->b_size); + set_buffer_uptodate(new); mark_buffer_dirty(new); bforget(bh); brelse(new); --=20 2.43.0