All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qianqiang Liu <qianqiang.liu@163.com>
To: krzk@kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, syzkaller-bugs@googlegroups.com,
	syzbot+3f8fa0edaa75710cd66e@syzkaller.appspotmail.com
Subject: [PATCH] nfc/nci: Fix uninit-value issue in nci_ntf_packet
Date: Sun, 13 Oct 2024 02:47:17 +0800	[thread overview]
Message-ID: <ZwrENfTGYG9wnap0@fedora> (raw)
In-Reply-To: <670ab923.050a0220.3e960.0029.GAE@google.com>

When an unsupported rf_tech_and_mode (0xe6) occurs in nci_rf_discover_ntf_packet,
the ntf.ntf_type may be assigned an uninitialized value.

To resolve this, use the __GFP_ZERO flag when calling alloc_skb(),
ensuring that skb->data is properly initialized.

Reported-by: syzbot+3f8fa0edaa75710cd66e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3f8fa0edaa75710cd66e
Tested-by: syzbot+3f8fa0edaa75710cd66e@syzkaller.appspotmail.com
Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
 drivers/nfc/virtual_ncidev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/virtual_ncidev.c b/drivers/nfc/virtual_ncidev.c
index 6b89d596ba9a..31da26287327 100644
--- a/drivers/nfc/virtual_ncidev.c
+++ b/drivers/nfc/virtual_ncidev.c
@@ -117,7 +117,7 @@ static ssize_t virtual_ncidev_write(struct file *file,
 	struct virtual_nci_dev *vdev = file->private_data;
 	struct sk_buff *skb;
 
-	skb = alloc_skb(count, GFP_KERNEL);
+	skb = alloc_skb(count, GFP_KERNEL | __GFP_ZERO);
 	if (!skb)
 		return -ENOMEM;
 
-- 
2.47.0


  reply	other threads:[~2024-10-12 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16 13:15 [syzbot] [net?] [nfc?] KMSAN: uninit-value in nci_ntf_packet (3) syzbot
2024-10-06 23:20 ` syzbot
2024-10-12 14:15 ` Qianqiang Liu
2024-10-12 18:00   ` syzbot
2024-10-12 18:47     ` Qianqiang Liu [this message]
2024-10-16  7:58       ` [PATCH] nfc/nci: Fix uninit-value issue in nci_ntf_packet Krzysztof Kozlowski
2024-10-16  8:35         ` Qianqiang Liu

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=ZwrENfTGYG9wnap0@fedora \
    --to=qianqiang.liu@163.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=krzk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+3f8fa0edaa75710cd66e@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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.