All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+921873345a95f4dae7e9@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
Date: Mon, 30 Sep 2024 22:46:37 -0700	[thread overview]
Message-ID: <66fb8cbd.050a0220.6bad9.004e.GAE@google.com> (raw)
In-Reply-To: <66edaa30.050a0220.25340c.0006.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH v2] netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
Author: marcus.yu.56@gmail.com

#syz test

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


      parent reply	other threads:[~2024-10-01  5:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20 17:00 [syzbot] [netfs?] KMSAN: uninit-value in netfs_clear_buffer syzbot
2024-09-21  0:23 ` [syzbot] [PATCH] netfs: Fix a KMSAN uninit-value error " syzbot
2024-10-01  5:46 ` syzbot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66fb8cbd.050a0220.6bad9.004e.GAE@google.com \
    --to=syzbot+921873345a95f4dae7e9@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.