From patchwork Tue Sep 1 15:10:38 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: 264608 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 41B1BC433E6 for ; Tue, 1 Sep 2020 16:15:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05D0D2078B for ; Tue, 1 Sep 2020 16:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598976911; bh=/6sOBbcwvDM9RTeLa3xY3Md8dh6xf16alzMSmHCraCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=q724RTS5gaF7LawpOBJ0WTsPbWWIaVaoMYASoGCRXKlDmlZHqg4VZBMxrJANuKtGx jRiPxPtQFarNYYjSHg5clX14x8iSBZATnk0RbK/+cF94NixPNBtGI4YaHN4t6U21Ai onIESMHcYHY8qXIg9PqY2bsn03J1VYGkb8FH+nqI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731645AbgIAQPI (ORCPT ); Tue, 1 Sep 2020 12:15:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:40252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728531AbgIAPe4 (ORCPT ); Tue, 1 Sep 2020 11:34:56 -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 4DA21205F4; Tue, 1 Sep 2020 15:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974495; bh=/6sOBbcwvDM9RTeLa3xY3Md8dh6xf16alzMSmHCraCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xomj/vXdifhMKmUNJS59iQX2/gMXka7PEdxNDPg6scJAsoDJPjoiiI+rMieOsOc8u +viGgpx0v/Dmzvy2Vy7ohZzkvquAs9xZxYkHpq14jU6m05nisqIJEXuWb/Y/BqOLOl CfxI5solZQkK/HQxJt43yPE2Q6dYUPziDpvBO9uU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evgeny Novikov Subject: [PATCH 5.4 158/214] USB: lvtest: return proper error code in probe Date: Tue, 1 Sep 2020 17:10:38 +0200 Message-Id: <20200901151000.542520839@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@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 @@ -426,7 +426,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 */