From patchwork Tue Sep 1 15:10:33 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: 310445 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 4B149C433E2 for ; Tue, 1 Sep 2020 15:43:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 222BA208CA for ; Tue, 1 Sep 2020 15:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598975026; bh=/6sOBbcwvDM9RTeLa3xY3Md8dh6xf16alzMSmHCraCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YEEf9mMpvS70Uh79DNqP/SoysQlESwG0pl4f9ToHFLTX8eZkI0OeXi+Tijz8gF2QD v2Mwq0a3twq/G8sBm4RXMeepivcKdB+ALsWWqFBLZ7lnWdCr2t1h5yJ3LxTP5mJRjR Zjuf3w/lGK96I778WxNNdNzDbzWv5V0rW4vUFhqc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731330AbgIAPno (ORCPT ); Tue, 1 Sep 2020 11:43:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:58044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731523AbgIAPnl (ORCPT ); Tue, 1 Sep 2020 11:43:41 -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 1FA302064B; Tue, 1 Sep 2020 15:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598975020; bh=/6sOBbcwvDM9RTeLa3xY3Md8dh6xf16alzMSmHCraCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zMOIK9gyz2+RNwWjW6kQQ598+scoO0LLdat2/jZO2hjo+8ZJ3ljcucVByyEpJvQNh B8Atw/jLigzXWPdQHbtEKaWHPwBRkoYtC+SZ6Glz+NgehYqSAFDJPFu4sII7PrrBFQ 1u1jUW5vvTwzd5bXz/nAiN9TpqixXqekVcSfLQ74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evgeny Novikov Subject: [PATCH 5.8 177/255] USB: lvtest: return proper error code in probe Date: Tue, 1 Sep 2020 17:10:33 +0200 Message-Id: <20200901151009.170078996@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901151000.800754757@linuxfoundation.org> References: <20200901151000.800754757@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 */