From nobody Fri Apr 17 00:17:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 31FCF2EB10; Tue, 24 Feb 2026 19:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771960004; cv=none; b=iWM2OQjtEBM5hJnCmkxQKZljoZegyApzd8rIRLAVLv2mJvrXIQp266gSUw4/1xC21AgmSgTQ63VVJAxHzZ96MfaPLxTTOVWROunqNxGgh20K5eUxR8PcIv6IGZDkMfSaakt3YYfxGcjm0iHccHQ2jrIwRfNorBfSidWKfHsk18w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771960004; c=relaxed/simple; bh=jPL0Oz8WvtKYQ8MUmItOvJNN4AFs6kAsTxdIYPhQS84=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n6o7H6ARwqD8Ohlu2HZiu+kgW2QmTVCrimaUcAdm5t6ig3mP0BHq3hJJLKCv/LrCd3Jg0TuIWN3cmkwksTNgnjlRXKCU527sm0SScj4eXjtXruugwZ9zbs9cq2NI31/FQ6bAjSOsvnSeEcZzbryHEH1S+NRAv1S5fxfhbzPiJyE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i7q1KkJB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i7q1KkJB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F17C116D0; Tue, 24 Feb 2026 19:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771960003; bh=jPL0Oz8WvtKYQ8MUmItOvJNN4AFs6kAsTxdIYPhQS84=; h=From:To:Cc:Subject:Date:From; b=i7q1KkJBwfpN7QYUbtFx8UbpOMs1aW19E9XKCmAAYmwUC0Ch1LpY7T42X/BMDma59 6YCwdkernIuLTdNqvXBzGl9xMHlhobNf28zAxe3+wVypmqt34wTwrwHZkEzpTqKxYv hySwOGkXOQxQzGFEzV07r7Y5Ln0pnoZ6qg6EPpgHr4lwOcKu97RGnFRbUMnCTYEDAu wWfOm0fQgNqnYfNyAThO+bqTLwAG/06p7KnwFi6e/nqjmpao2TXWPBmUbxI6DgbdDS xhSqft/L0UZJfT0WOcQbKMtrZqkXK1Bb6Nkpd849Ij8NJim+pqSrottydpyoP+bMFA 3U/V7G9zHwJwA== From: Sasha Levin To: viro@zeniv.linux.org.uk, brauner@kernel.org Cc: jack@suse.cz, axboe@kernel.dk, changfengnan@bytedance.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Levin Subject: [PATCH] buffer: fix kmemleak false positive in submit_bh_wbc Date: Tue, 24 Feb 2026 14:06:37 -0500 Message-ID: <20260224190637.3279019-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Bios allocated in submit_bh_wbc are properly freed via their end_io handler. Since commit 48f22f80938d, bio_put() caches them in a per-CPU bio cache for reuse rather than freeing them back to the mempool. While cached bios are reachable by kmemleak via the per-CPU cache pointers, once recycled for new I/O they are only referenced by block layer internals that kmemleak does not scan, causing false positive leak reports. Mark the bio allocation with kmemleak_not_leak() to suppress the false positive. Fixes: 48f22f80938d ("block: enable per-cpu bio cache by default") Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Sasha Levin --- fs/buffer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/buffer.c b/fs/buffer.c index 22b43642ba574..c298df6c7f8c6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include =20 @@ -2799,6 +2800,7 @@ static void submit_bh_wbc(blk_opf_t opf, struct buffe= r_head *bh, opf |=3D REQ_PRIO; =20 bio =3D bio_alloc(bh->b_bdev, 1, opf, GFP_NOIO); + kmemleak_not_leak(bio); =20 fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO); =20 --=20 2.51.0