From patchwork Tue Sep 1 15:10:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 310266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F615C433E6 for ; Tue, 1 Sep 2020 16:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5501206C0 for ; Tue, 1 Sep 2020 16:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598979233; bh=f6lO3xg2CEAK8IFQzL3VVhnmLwv5uiETfBxCMqaaiKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UBnypU6vJ+Yl2AvlOhLalUlL/euQTnfoFmGelGDRrk/yx7K9Peb2Rk3W5PZ3c25oP ZRCFaca2lsoWqQ/Yo2+Sy3w7qSOj5zFY6z1svIURE7loFHGHThT3kd/rHSl4Tz61cg aWJInfIgCc8JOYtYj/XqidHvZUDWFaG/GubZ2/aM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbgIAQxm (ORCPT ); Tue, 1 Sep 2020 12:53:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:48840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729978AbgIAPYv (ORCPT ); Tue, 1 Sep 2020 11:24:51 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 551432137B; Tue, 1 Sep 2020 15:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973886; bh=f6lO3xg2CEAK8IFQzL3VVhnmLwv5uiETfBxCMqaaiKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJQUlxVTHSpEluvuUAti7eL/XZSLP7+1IuwNdYJRAf0A/L+ISeYtz5IDARX2hKnMV qsRWxZ0iiTv5HUzqxw/O8w2XW4p/wmIbeC/Njdm19a5mD/jYpn/p1uBI6zUIGWcnGY sIpXJlQtkFNqg5RlFYKEshsYlE5DUm1GYz8dI63Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evgeny Novikov Subject: [PATCH 4.19 086/125] USB: lvtest: return proper error code in probe Date: Tue, 1 Sep 2020 17:10:41 +0200 Message-Id: <20200901150938.791800840@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150934.576210879@linuxfoundation.org> References: <20200901150934.576210879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Evgeny Novikov 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 --- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/misc/lvstest.c +++ b/drivers/usb/misc/lvstest.c @@ -429,7 +429,7 @@ static int lvs_rh_probe(struct usb_inter 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 */