Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Phong Tran <tranmanphong@gmail.com>
To: davem@davemloft.net
Cc: glider@google.com, gregkh@linuxfoundation.org,
	hslester96@gmail.com, kstewart@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org,
	syzbot+7dc7c28d4577bbe55b10@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com, tglx@linutronix.de,
	tranmanphong@gmail.com
Subject: [[Patch V2]] usb: asix: cleanup the buffer in asix_read_cmd
Date: Sun, 10 Nov 2019 21:07:16 +0700
Message-ID: <20191110140716.11996-1-tranmanphong@gmail.com> (raw)
In-Reply-To: <20191107.152118.922830217121663373.davem@davemloft.net>

This is for fixing KMSAN: uninit-value in asix_mdio_write
comes from syzbot.

Reported-by: syzbot+7dc7c28d4577bbe55b10@syzkaller.appspotmail.com

Tested by:

https://groups.google.com/d/msg/syzkaller-bugs/3H_n05x_sPU/07UIX_TUEgAJ

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
---
 drivers/net/usb/asix_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index e39f41efda3e..f3eeb7875a4d 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -22,6 +22,8 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
 	else
 		fn = usbnet_read_cmd_nopm;
 
+	memset(data, 0, size);
+
 	ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		 value, index, data, size);
 
-- 
2.20.1


  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 21:22 KMSAN: uninit-value in asix_mdio_write syzbot
2019-11-07  0:44 ` [PATCH] usb: asix: Fix " Phong Tran
2019-11-07 23:21   ` David Miller
2019-11-10 14:07     ` Phong Tran [this message]
2019-11-10 14:11     ` Phong Tran

Reply instructions:

You may reply publically 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=20191110140716.11996-1-tranmanphong@gmail.com \
    --to=tranmanphong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hslester96@gmail.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+7dc7c28d4577bbe55b10@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tglx@linutronix.de \
    /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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git