From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796362483; b=HosC72YO11Gc59Mlr7fBZFaP7vMtR7rZGClCEEbh8eRSd3hrGVxiEVGI3n73jKiokZ/t 1A/+FGQPrFW7trqUh+dIIxNcCnqgS+jpnOp2hzi47NwEXMXyTGxpuJGJyEnPJS+2FWKj6 0EsZBJ1delTwvIvc1+MXnDh2t2j6hHnz+FDd2YNqh4K+ahezUPxDKJMojLXdkKcY+ss5l D8XVl71OCFngNUpExILi74crU+KoiV6o4uEq+McclSY+Bcrgj8koC7Kk7pMJSsPDUvB/w 0eS9CmcEKn5WHv+eHduGat3l/R+PdP3pFOx5IfpHIeJpvwHdU7SH55yFGZKmUMjEW9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796362483; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=qClFS//21tMrd2JMcVFdrFSVNP90z3jPKt/RCBu6dfs=; b=jO55OpEv0psDw7n8U6dhiCNhfm67OpY72wceWP0q+UGGZbxPEApJc2Ccvu93vaWDCnH0 TaXmeSGGFfVySvnz82/cKW4y+HUg66n1aMQdL3DK8f7OobrCp3sjF/vM234+rQeP56T1l rzlY/lEaDM8v4Vmbq8OBtSq1gtU3U7MAXo7HTLkScYzaXuIUMfivGowGRMk79UGetPx3R Atv6BkHwrCE92LENbjTQrHC8pw4xpd5aBPJoLqBO2V3qU+RIfmzfWt1zeJyXaLDyjmPNN fW3kXjf+vvFArdxMWJsbLBVFOY8JtLqZlPEsgz3HbJfgAM0e+IWmHizmOGtA1AENcWw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RivXWfyX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 130B0606A322 for ; Fri, 4 Dec 2026 05:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RivXWfyX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43EB51F000C2; Fri, 4 Dec 2026 05:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796362482; bh=qClFS//21tMrd2JMcVFdrFSVNP90z3jPKt/RCBu6dfs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=RivXWfyXlXLX+G1+FAGL42kU5BrS8nfkPEB0QRNuekUZ2u+bqx3n4vp2dMohHLYTp uB1wF4EFhtMu5XnH4yuuJqIf9BJ9yuOALLOFjWj+SC8Za01Au2kbCjhh1cd2UyqxhI r0dmMpDRwkqm30xuqhJ9oIVCFGtxM73DJmFU6elCJ6C0e4x2Cqj0GDZ4b5E6plivS0 FRziAT8HqGqq2bkJt6tTMoa8f1wXWeThXSaX56Oecibnp5BxmwYUB1RRMG1KE8byoE LLQq0Qg6lTeUU1QcT96th9vHaQDqd4/R02EHzieT4f4j18/XOZhihjsFWxa4TdNrrJ ychBM29C3XrHA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v3 1/3] dm-bufio: support atomic publication of pre-filled buffers Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?5ZGo5Lyf5rGfIChXZWlqaWFuZyBaaG91KQ==?= , "Eric Biggers" , "Mikulas Patocka" Cc: =?utf-8?b?ZG0tZGV2ZWxAbGlzdHMubGludXguZGV2?= , =?utf-8?b?c2FtaXRvbHZhbmVuQGdvb2dsZS5jb20=?= , =?utf-8?b?YWdrQHJlZGhhdC5jb20=?= , =?utf-8?b?c25pdHpl?= =?utf-8?b?ckBrZXJuZWwub3Jn?= , =?utf-8?b?Ym1hcnpp?= =?utf-8?b?bnNAcmVkaGF0LmNvbQ==?= , =?utf-8?b?6YeR?= =?utf-8?b?57qi5a6HIChIb25neXUgSmluKQ==?= , =?utf-8?b?5ZC056Wl56aEIChYaWFuZ2x1IFd1KQ==?= , =?utf-8?b?5ZC05ZGo6ZWcIChKdXN0aW4gV3Up?= , =?utf-8?b?6IC/5oWI54aZIChDaXhpIEdlbmcvMTAwMzkp?= In-Reply-To: <617ee359326e4d033d876d4d3ef85c8d@zeshmbx08.spreadtrum.com> References: <5188c1e8-c08a-2a56-7e4c-1d84aba4df35@redhat.com> <179436615557.34024.8414792860115638345@unisoc.com> <20261113053639.GA76778@sol> <6b4ac19a42ce4297ae89ae0ae2fea674@zeshmbx08.spreadtrum.com> <20261202190429.GC338490@google.com> <35bcc428f6c0956f414a394d333e8e63@zeshmbx08.spreadtrum.com> <6e1ac631ecc44f41a38e8734cfffaca6@zeshmbx08.spreadtrum.com> <20261203184146.GC2267@sol> <617ee359326e4d033d876d4d3ef85c8d@zeshmbx08.spreadtrum.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 05:34:41 +0000 X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] dm-bufio: dm_bufio_new_filled() comment falsely claims unconditional release - [Low] dm-bufio: dm_bufio_new_filled() comment allows unsafe post-publish mutation -- commit 683375cb0012c1144d366252380e409571565027 Author: =E5=91=A8=E4=BC=9F=E6=B1=9F (Weijiang Zhou) dm-bufio: support atomic publication of pre-filled buffers This commit adds NF_FILLED and dm_bufio_new_filled() to copy caller data into a new buffer before inserting it into the cache. > diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c > index 3b66cf1cb9319..6cd81aaf8bd77 100644 > --- a/drivers/md/dm-bufio.c > +++ b/drivers/md/dm-bufio.c [ ... ] > @@ -1962,10 +1972,38 @@ void *dm_bufio_new(struct dm_bufio_client *c, sec= tor_t block, > if (WARN_ON_ONCE(dm_bufio_in_request())) > return ERR_PTR(-EINVAL); > =20 > - return new_read(c, block, NF_FRESH, bp, IOPRIO_DEFAULT); > + return new_read(c, block, NF_FRESH, bp, IOPRIO_DEFAULT, NULL); > } > EXPORT_SYMBOL_GPL(dm_bufio_new); > =20 > +/* > + * Publish a fully prepared block into the cache. Unlike dm_bufio_new(), > + * the buffer is populated with @data before it becomes visible to other > + * readers, so no one can observe uninitialized contents. If the block = is > + * already cached, the existing buffer is returned and @data is not used. > + * > + * The returned buffer is held and must be released with dm_bufio_releas= e(). > + * The caller may inspect or modify the data, but must not mark it dirty > + * unless it intends to write the block back to the device. [Severity: Low] Is it safe for this comment to tell callers they may modify the returned data? When dm_bufio_new_filled() returns, the buffer is already published in the cache with B_READING clear (or is an existing shared buffer), with no per-buffer lock held. Modifying b->data in place without external locking races with concurrent dm_bufio_get() and dm_bufio_read() readers. > + * > + * @data must not be NULL. On failure ERR_PTR is returned and *bp is se= t to > + * NULL, so that callers can release unconditionally. [Severity: Low] Can callers actually call dm_bufio_release() unconditionally when *bp is NULL? dm_bufio_release() immediately dereferences b->c without checking for NULL, so passing a NULL *bp on failure triggers a NULL pointer dereference. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/f55322e3a71277d9274= 76ddb372064e0@zeshmbx08.spreadtrum.com?part=3D1