Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1426830pxb; Tue, 26 Oct 2021 08:49:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6ApJ/pt9/AQZ8NU6qaNBjGxCrOr8yg9dvGu4uwXPK4ZgFY3cdDZK+DCnFWE5HTIVGRS4A X-Received: by 2002:aa7:8652:0:b0:47b:e2f1:96e1 with SMTP id a18-20020aa78652000000b0047be2f196e1mr18739512pfo.74.1635263371245; Tue, 26 Oct 2021 08:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635263371; cv=none; d=google.com; s=arc-20160816; b=aRDuPe0+0po16rpSCXRD+PtvuvpM8wOJjV8aQMTGshZSp6N6O7sOQhVA/YjKF06LXY I8xuXkoxuKoGRfAMMYzyPd4gwfeaeRL9Ma+nvcU+ws0Aze41PzWuPnbIydaNfCoaNqJz 7Suobg7XlWComRc4eyC0QminOv3Rk6RSFmrzJS4SwDTCGxNcSn1E9ShOIpkI+7RLHMIN VP3PI/QRb30ftePWjqUoa2zOMCOaSscJWfX/GEOruDnWLZOd/yfmK7n8JpXXqn/mTuix mbzHi5ljO7/5LG4xgnIcnc2n0nX7JclAfgr8cWtW/eg3BID7CLa/jLpWdMSqwAD2D1PL ioiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hd4nzs+gaOEH/COuZ83UAXkHLpSgVyMWmDo97dbNvEM=; b=WAZWLz9biC5zO8WPkM5Z743/VyHyGjm01Yw/nlTjponX2Kd24FVReROjk17eOrF/I1 gB3jpRMfHW1ntvO/9GTGkdT/w5R8Zz4HyK0uudHy/NdavjNf+uEZC/nMPfXqJWs+GY8y iv1S3Lidmg6KEaAW3mEHbgiNTiRz3puapmVdd6mt4ZPtNberRMHL4OZ0iVfNZJvxa4u7 qHePV4lLfu81xbMnaUdmeRbBZ3E8w+ge/BPeMDZptHZMWnXuMec/c/4rlGJ0qKt40qwI PYZacezAbGW8LMgidRfM+X7srK1zOiibyl7M5Nyc9K9Boxw6/9SY7VaMVNM2DJ1by17J d+Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tEkfaVF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si27838566pgh.13.2021.10.26.08.49.17; Tue, 26 Oct 2021 08:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tEkfaVF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235641AbhJZL5U (ORCPT + 99 others); Tue, 26 Oct 2021 07:57:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:60316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235562AbhJZL5H (ORCPT ); Tue, 26 Oct 2021 07:57:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9791C60F90; Tue, 26 Oct 2021 11:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635249283; bh=oNSlDUAVFsAGdDzC+G3y987AE6R4DUYBIDH8CkjX7u8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tEkfaVF8DXq9/rDNDqEmbZycNVNPvS3OcVsETd0T+dlU9wAKVXuY9bL6FgznS+qzU R6jo72dh72H8p5xEr6yGXeKoyg/sX13NW67k4sLuHwvPl4puwR18Ir7V7spzUENDsQ XoHdoWQwyUr60wgyBJpTSdVIDppgtz3iv+IsftdU9P6wHUNS05oOsytnZdrWumT0DI Alpc54Gju4Ux8MDOygNfE/UZSLfRJeSRRxjbDqizv5+v/uarYXGguUmk9xXoPTlmCB uyFOQkI9VPgMBbohhHquRSKzop5zOVnw9z1Rg5JwPN0F4nhgj327iIUoF8SebcYPVy ngnMS8n2rSx+A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1mfL2A-0001dQ-S9; Tue, 26 Oct 2021 13:54:27 +0200 Date: Tue, 26 Oct 2021 13:54:26 +0200 From: Johan Hovold To: Wang Hai Cc: oneukum@suse.com, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] usbnet: fix error return code in usbnet_probe() Message-ID: References: <20211026112526.2878177-1-wanghai38@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211026112526.2878177-1-wanghai38@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 26, 2021 at 07:25:26PM +0800, Wang Hai wrote: > Return error code if usb_maxpacket() returns 0 in usbnet_probe(). > > Fixes: 397430b50a36 ("usbnet: sanity check for maxpacket") > Reported-by: Hulk Robot > Signed-off-by: Wang Hai > --- Good catch. This is embarrassing. I double checked the error path but failed to notice the missing return value. > drivers/net/usb/usbnet.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c > index 80432ee0ce69..fb5bf7d36d50 100644 > --- a/drivers/net/usb/usbnet.c > +++ b/drivers/net/usb/usbnet.c > @@ -1790,6 +1790,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) > dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); > if (dev->maxpacket == 0) { > /* that is a broken device */ > + status = -EINVAL; But please use -ENODEV here. -EINVAL is typically reserved for bad user input. > goto out4; > } Johan