From: Evgeny Novikov Date: Wed, 5 Aug 2020 09:06:43 +0000 (+0300) Subject: USB: lvtest: return proper error code in probe X-Git-Tag: v4.9.235~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e9edff8ddc917eaa58112f1a305b4c1273582af;p=platform%2Fkernel%2Flinux-amlogic.git USB: lvtest: return proper error code in probe commit 531412492ce93ea29b9ca3b4eb5e3ed771f851dd upstream. lvs_rh_probe() can return some nonnegative value from usb_control_msg() when it is less than "USB_DT_HUB_NONVAR_SIZE + 2" that is considered as a failure. Make lvs_rh_probe() return -EINVAL in this case. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov Cc: stable Link: https://lore.kernel.org/r/20200805090643.3432-1-novikov@ispras.ru Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c index bd6e06ef88ac..5dfc58ac97f3 100644 --- a/drivers/usb/misc/lvstest.c +++ b/drivers/usb/misc/lvstest.c @@ -392,7 +392,7 @@ static int lvs_rh_probe(struct usb_interface *intf, USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT); if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) { dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret); - return ret; + return ret < 0 ? ret : -EINVAL; } /* submit urb to poll interrupt endpoint */