linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
@ 2024-10-01  6:31 Chang Yu
  2024-10-01 12:54 ` David Howells
  2024-10-01 14:03 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Chang Yu @ 2024-10-01  6:31 UTC (permalink / raw)
  To: dhowells; +Cc: jlayton, netfs, linux-fsdevel, linux-kernel, skhan, marcus.yu.56

Use folioq_count instead of folioq_nr_slots to fix a KMSAN uninit-value
error in netfs_clear_buffer

Signed-off-by: Chang Yu <marcus.yu.56@gmail.com>
Reported-by: syzbot+921873345a95f4dae7e9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=921873345a95f4dae7e9
Fixes: cd0277ed0c18 ("netfs: Use new folio_queue data type and iterator instead of xarray iter")
---
Changes since v2:
  - Use folioq_count when putting pointers. This avoids touching
    uninitialized pointer and is a deeper fix than just using
    kzalloc.

 fs/netfs/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c
index 63280791de3b..78fe5796b2b2 100644
--- a/fs/netfs/misc.c
+++ b/fs/netfs/misc.c
@@ -102,7 +102,7 @@ void netfs_clear_buffer(struct netfs_io_request *rreq)
 
 	while ((p = rreq->buffer)) {
 		rreq->buffer = p->next;
-		for (int slot = 0; slot < folioq_nr_slots(p); slot++) {
+		for (int slot = 0; slot < folioq_count(p); slot++) {
 			struct folio *folio = folioq_folio(p, slot);
 			if (!folio)
 				continue;
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
  2024-10-01  6:31 [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer Chang Yu
@ 2024-10-01 12:54 ` David Howells
  2024-10-01 14:03 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2024-10-01 12:54 UTC (permalink / raw)
  To: Christian Brauner
  Cc: dhowells, Chang Yu, jlayton, netfs, linux-fsdevel, linux-kernel,
	skhan

Chang Yu <marcus.yu.56@gmail.com> wrote:

> Use folioq_count instead of folioq_nr_slots to fix a KMSAN uninit-value
> error in netfs_clear_buffer
> 
> Signed-off-by: Chang Yu <marcus.yu.56@gmail.com>
> Reported-by: syzbot+921873345a95f4dae7e9@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=921873345a95f4dae7e9
> Fixes: cd0277ed0c18 ("netfs: Use new folio_queue data type and iterator instead of xarray iter")

Acked-by: David Howells <dhowells@redhat.com>

Christian: Can you pick this up?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
  2024-10-01  6:31 [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer Chang Yu
  2024-10-01 12:54 ` David Howells
@ 2024-10-01 14:03 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-10-01 14:03 UTC (permalink / raw)
  To: dhowells, Chang Yu
  Cc: Christian Brauner, jlayton, netfs, linux-fsdevel, linux-kernel,
	skhan

On Mon, 30 Sep 2024 23:31:52 -0700, Chang Yu wrote:
> Use folioq_count instead of folioq_nr_slots to fix a KMSAN uninit-value
> error in netfs_clear_buffer
> 
> 

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
      https://git.kernel.org/vfs/vfs/c/f6023535b52f

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-01 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01  6:31 [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer Chang Yu
2024-10-01 12:54 ` David Howells
2024-10-01 14:03 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).