archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <>
	Willem de Bruijn <>,
	syzbot <>
Subject: [PATCH] media: gp8psk: check return value in gp8psk_power_ctrl
Date: Thu, 27 Jun 2019 18:20:20 -0400	[thread overview]
Message-ID: <> (raw)

From: Willem de Bruijn <>

One caller of gp8psk_power_ctrl fails to check the return value.

Syzbot KMSAN found a use of uninitialized data. This path is also
exercised when no such device exists, as in this cloud environment.

Argument status is not set if gp8psk_power_ctrl returns early.

Tests its return value in this case, too.

BUG: KMSAN: uninit-value in gp8psk_power_ctrl+0x33e/0xca0 drivers/media/usb/dvb-usb/gp8psk.c:193
CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.1.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x191/0x1f0 lib/dump_stack.c:113
 kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622
 __msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310
 gp8psk_power_ctrl+0x33e/0xca0 drivers/media/usb/dvb-usb/gp8psk.c:193
 dvb_usb_device_power_ctrl drivers/media/usb/dvb-usb/dvb-usb-init.c:226 [inline]
 dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:160 [inline]
 dvb_usb_device_init+0x15ad/0x2cc0 drivers/media/usb/dvb-usb/dvb-usb-init.c:277
 gp8psk_usb_probe+0xa2/0x190 drivers/media/usb/dvb-usb/gp8psk.c:307
 usb_probe_interface+0xd66/0x1320 drivers/usb/core/driver.c:361
 really_probe+0xdae/0x1d80 drivers/base/dd.c:513
 driver_probe_device+0x1b3/0x4f0 drivers/base/dd.c:671
 __device_attach_driver+0x5b8/0x790 drivers/base/dd.c:778
 bus_for_each_drv+0x28e/0x3b0 drivers/base/bus.c:454
 __device_attach+0x454/0x730 drivers/base/dd.c:844
 device_initial_probe+0x4a/0x60 drivers/base/dd.c:891
 bus_probe_device+0x137/0x390 drivers/base/bus.c:514
 device_add+0x288d/0x30e0 drivers/base/core.c:2106
 usb_set_configuration+0x30dc/0x3750 drivers/usb/core/message.c:2027
 generic_probe+0xe7/0x280 drivers/usb/core/generic.c:210
 usb_probe_device+0x14c/0x200 drivers/usb/core/driver.c:266

Reported-by: syzbot <>
Signed-off-by: Willem de Bruijn <>
 drivers/media/usb/dvb-usb/gp8psk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c
index 1282f701f1857..b666644f06d7b 100644
--- a/drivers/media/usb/dvb-usb/gp8psk.c
+++ b/drivers/media/usb/dvb-usb/gp8psk.c
@@ -184,9 +184,13 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
 	u8 status, buf;
 	int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct);
+	int ret;
 	if (onoff) {
-		gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1);
+		ret = gp8psk_usb_in_op(d, GET_8PSK_CONFIG, 0, 0, &status, 1);
+		if (ret)
+			return ret;
 		if (! (status & bm8pskStarted)) {  /* started */
 			if(gp_product_id == USB_PID_GENPIX_SKYWALKER_CW3K)
 				gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0);

                 reply	other threads:[~2019-06-27 22:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

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

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] media: gp8psk: check return value in gp8psk_power_ctrl' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).