Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3270004iob; Mon, 16 May 2022 17:43:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrT0fcqb9JuC3OVmg1w+MNCeMwREukGn/kUDmgRmCqDazEK64mLbe8ij6eL70J5zz/pMzX X-Received: by 2002:a05:6a00:1c5c:b0:505:7469:134a with SMTP id s28-20020a056a001c5c00b005057469134amr20074928pfw.16.1652748218060; Mon, 16 May 2022 17:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652748218; cv=none; d=google.com; s=arc-20160816; b=t17Xzo12wf28mHoz/eM247LPFlPwGbuFqtxZG/+p54zNJYqL+EBerOqoKzyfUVV16q KCr/vxP0yhMN71oLVNwNDztS6xNUSpMuJWksTyJi8oK1vvBviDF094/p94EGMEcnzyNB iRcHiDEjM45rY/0Ag84qjqRTbC0sP7SR1tx85aYRl3Gktk2JSH9J0iUtaheEmitIoVxr ZdfMUscJNJ3sqOLu+X49QKTnkoBZ4Ckaew7Fg4Yi7ctJCoH+xH0D3Fk3jTVqVx7oh12V 0H6LS0LUgXnDsyqaPRQoWuKCipjg3ZvYkejE4jMmUvsDRxy6K7xLAwGgPI6X5b9xeFgQ k+hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jP1XFWN/FWJ+lsbAZMfRgA420j38JBVPQPzm7AuTCe8=; b=ZyYxJP4bskpp8MyDKkhZLm3Er4p0wnhmr/8gj5q6R04yjRk/2FqXPp6dXecykDpg+Y roTG67drVJy9FrJRBGnunOxJ71h1sCWq+MBIQt3NBLzAWF53Fk487ADc6+Ju4CfjQzQR wHqUFgLPLUkCSoj82uPMJzvMK4i6iHOMo0FleFsddoDArK2piGGi2OVhoNkT0uB27z6l UA+s8llY+XTVbV4TafL6cAKUN3gzZVwC09v172qFzmwVxWSVqXYVK5Kf5KngY/8UXIfV 43Pka+okpDYD3ajIry8jTqO9MhQU0IoLpUKhnL9jIf1Cm5Of6MGw2X9Nz4wh33s4ZyED YJIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l5rAc7KK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a170902a38b00b0015f48a8b66esi13247717pla.78.2022.05.16.17.43.27; Mon, 16 May 2022 17:43:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l5rAc7KK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236352AbiEPTbI (ORCPT + 99 others); Mon, 16 May 2022 15:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345479AbiEPTbG (ORCPT ); Mon, 16 May 2022 15:31:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6BA32B1A0; Mon, 16 May 2022 12:31:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 298AD614FC; Mon, 16 May 2022 19:31:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1246BC34100; Mon, 16 May 2022 19:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652729463; bh=yeLKZJHgwtKyYalDbvtHzvDVJBp8BddUkRB8jSjYmvk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l5rAc7KKzPIJ5XgwaXvyndiN4iGjm3znK/7LgNlPxvRwvkGO3WTpCFqvSj0RF1b2K dworej4sH9GS4G5mBbnPNSk2nTXp/UG99pjDqVHzvvg3wONppB634PmCh1wKxm1ftE UbHTgZ9PcLqy/bidEY6GfAWnew4NmXMYqA0HJb3kTGY7pZo3EPnWv1NyFV6D635dpm V7RwNH8RUz/rLgig0xAZyXQ4ssgC9EQzO6EOv61lpdyws3sdk00YEZNApqeZX15Czy LJzfMloi2TFl42c/scsHb3gUbNS9ZRaCJLTarD+5WA89RK0bhmPm8rvufa1BXroqN+ QMqFd8SdetJiw== Date: Mon, 16 May 2022 12:31:01 -0700 From: Jakub Kicinski To: David Kahurani Cc: netdev@vger.kernel.org, syzbot+d3dbdf31fbe9d8f5f311@syzkaller.appspotmail.com, davem@davemloft.net, jgg@ziepe.ca, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, phil@philpotter.co.uk, syzkaller-bugs@googlegroups.com, arnd@arndb.de, dan.carpenter@oracle.com Subject: Re: [PATCH] net: ax88179: add proper error handling of usb read errors Message-ID: <20220516123101.467ad206@kernel.org> In-Reply-To: <20220514133234.33796-1-k.kahurani@gmail.com> References: <20220514133234.33796-1-k.kahurani@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 14 May 2022 16:32:34 +0300 David Kahurani wrote: > - ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD, > - 1, 1, &buf); > + ret = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD, > + 1, 1, &buf); > + if (ret) { > + netdev_dbg(dev->net, > + "Failed to read SROM_CMD: %d\n", > + ret); > + return ret; > + } > > if (time_after(jiffies, jtimeout)) > return -EINVAL; > > } while (buf & EEP_BUSY); I agree with Pavel, this seems unnecessarily strict. If the error is not ENODEV we can keep looping. > @@ -1581,7 +1731,13 @@ static int ax88179_link_reset(struct usbnet *dev) > &ax179_data->rxctl); > > /*link up, check the usb device control TX FIFO full or empty*/ > - ax88179_read_cmd(dev, 0x81, 0x8c, 0, 4, &tmp32); > + ret = ax88179_read_cmd(dev, 0x81, 0x8c, 0, 4, &tmp32); > + > + if (ret) { > + netdev_dbg(dev->net, "Failed to read TX FIFO: %d\n", > + ret); > + return ret; > + } Please don't add any empty lines within the error checking. Empty lines are supposed to separate logically separate blocks of code. Error checking is very much logically part of the call. And no empty line betwee netdev_dbg() and return ret; either. In this submission you have all possible configurations of having or not having empty lines before the if or before the return. None of them should be there, and please be consistent.