Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3565209pxf; Mon, 5 Apr 2021 15:59:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0JDQWspARSycSxqUTCwoLNcXYmLpjd4pFbBB7T+V25yJBGclWxn4leEDagoDkueUkZ1D3 X-Received: by 2002:a92:d404:: with SMTP id q4mr2138069ilm.21.1617663576467; Mon, 05 Apr 2021 15:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617663576; cv=none; d=google.com; s=arc-20160816; b=YcC2xRs2Ug5sopSg0CrkvZErg/L3/GKXclqCn5lJLWEtu3Mvu7KQ6f4wLHMoLMO2cn hVjh+Qb5/EhvR4AapMYlnLvRMbM/JSn66EdY9VXoT01DVP9m9380Og0BOpnbwm7Ui/cM 3kc4WX9L0kcoEduhVCsQPSjQfpqSOrtyr2LnS92LN2mVKo4VyFdnompqn+9NVcXsNQwp LkIZOB/Lytd8ckVRP3dv6pMNbvH7waPYuxpb1OVff2T1UHF7ver0rlPUsNapcbtCFvIt pcdHoFc4Q4tOxIAAUEapPoeez4zgZVkYMmVkVBANF3hXB47rJPmg65iVVo8SjpfOWruL HMDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=s2SlWMC93ticvsMrIo8kqhd8F3VfF/AcGWW41CnLuZM=; b=C8WjYSHhPr5uItAR8ddUtxSJpXkuAUmx8jCcGeqwSdxcUZ1G/9UskwQ+1DgZwUsVqb 1iMqDyEHX9aaRbrtyChbi/Du0Bt8fohd32S63dfN4gIowpGhSSQazdSJmMHU8CQgsg8E DtUCMRDmUEn30HnfYn+hZNO6ADcKPgw1J/5zgl46LvN2HUc6u8cnEYx5AmDUpXllETo9 wx8rKMvzoKk5uBMfaTkt+1Jy8l6p8SnuIImZZY5m7ZiOGeLcCmkV55IEam++jGxmb1VK nmUEPP+pbx2sOgpDVmTrp2gRhUvOiLkTDdHWsR9U7wFyzScAjEnt40KLt+HZvq7MRu8R QyaQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si16814255jat.120.2021.04.05.15.59.24; Mon, 05 Apr 2021 15:59:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238434AbhDEPhx (ORCPT + 99 others); Mon, 5 Apr 2021 11:37:53 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:48518 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238086AbhDEPhw (ORCPT ); Mon, 5 Apr 2021 11:37:52 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 71B081C0B7D; Mon, 5 Apr 2021 17:37:44 +0200 (CEST) Date: Mon, 5 Apr 2021 17:37:43 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Nathan Rossi , Igor Russkikh , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 5.10 048/126] net: ethernet: aquantia: Handle error cleanup of start on open Message-ID: <20210405153743.GA305@amd> References: <20210405085031.040238881@linuxfoundation.org> <20210405085032.625044515@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <20210405085032.625044515@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Nathan Rossi >=20 > [ Upstream commit 8a28af7a3e85ddf358f8c41e401a33002f7a9587 ] >=20 > The aq_nic_start function can fail in a variety of cases which leaves > the device in broken state. >=20 > An example case where the start function fails is the > request_threaded_irq which can be interrupted, resulting in a EINTR > result. This can be manually triggered by bringing the link up (e.g. ip > link set up) and triggering a SIGINT on the initiating process (e.g. > Ctrl+C). This would put the device into a half configured state. > Subsequently bringing the link up again would cause the napi_enable to > BUG. >=20 > In order to correctly clean up the failed attempt to start a device call > aq_nic_stop. No. > +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c > @@ -71,8 +71,10 @@ static int aq_ndev_open(struct net_device *ndev) > goto err_exit; > =20 > err =3D aq_nic_start(aq_nic); > - if (err < 0) > + if (err < 0) { > + aq_nic_stop(aq_nic); > goto err_exit; > + } > =20 > err_exit: > if (err < 0) First, take a look at the goto. Does not need to be there. Second check the crazy calling convention. If nic_start() fails, it should clean up after itself. Then, check the code. nic_stop() undoes initialization that was not even done in the nic_start(). This introduces more problems than it solves. Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmBrLscACgkQMOfwapXb+vJaaQCeLCWHqYP6YA09DF4mZXy41bEv fCQAn1h+otGje5XyHMhK0COV2koYdQyA =+H7e -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--