Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1964870ima; Thu, 25 Oct 2018 07:40:12 -0700 (PDT) X-Google-Smtp-Source: AJdET5fX5YJtsUStrRSJw87KfXHipFCBBPsivYEaftMAj99Yw/WliJHM7M3KYML+qLU7QUfNHghw X-Received: by 2002:a63:e943:: with SMTP id q3-v6mr1739536pgj.42.1540478412643; Thu, 25 Oct 2018 07:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478412; cv=none; d=google.com; s=arc-20160816; b=ly1+UV/wDWyhIVBbtoqXq/mJzjQ3iwTHfcYLPyRyiDVhOEPmykiK4jsO181PcTRAxL DPJXYsy7zQL8ad4fTGXZWURDcUZXIJMAGALMMZpLs/ch+X+nshCJy/2JQUD/DdCR2a2N ibZHsCISNg3/HKUC5IgJjfNLpACr7AIR3/GfPLOzK77Tkq4NWDyZRWDiAIEl4YCC7OQ8 KNPTYeACUTeThnIBLOP3A3GMuudOzDpa4rmkCMmM40AvlG7VfPaq5bLZ7MdB49qZPjvF kuMyssJJpPv2I8odKW2UVe8x8VpIuJhnMq3dYXYVtX3UV/2fY+q3/npWj57ljAdIhmsc G+Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cHAJtTST4cKuGJ4IBvfv6GYXvAuN3PuQjppCVf5of2g=; b=eibM+CUBrV4Evz2XPfLpqScG1qvk0W8XeK//UEdG+OX11EGVwwev5MFjP4QZN7DII4 aPs5dC7Cp8/Iz0hc0OZLfBIWp5eo8tEG0wxGMeE77biZ6jlbN359yryt/o3dhJGh95cB /b7PXxilyNVsor9GldDdwDIkFnp1MeEbcSE/qF1yXG4m8OZ+ZWRvcM6a5rdy9vtdMDlN vhTosizenQMh/Y8CBdM3aS+SqsFVldfEwArl4cJRaV1+mw/Fk598GD2JsEre0x75Ae6D uSjiWRVIpkF1LJwscFEbQC2fWKuL2M6r8gVJfMUgtnNg2ZCoSzaWYRSKH1YaiabBmPPY UIaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q1o2Fx0U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id ca17-v6si8198302plb.406.2018.10.25.07.39.56; Thu, 25 Oct 2018 07:40:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q1o2Fx0U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729433AbeJYWtb (ORCPT + 99 others); Thu, 25 Oct 2018 18:49:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:58694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729416AbeJYWtb (ORCPT ); Thu, 25 Oct 2018 18:49:31 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 362D520870; Thu, 25 Oct 2018 14:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476994; bh=34D94Huvn+P5praEaJLOPftD5F0hxuqyBiHY3z80K24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q1o2Fx0UATnPknQMvDjE/gkC28YYwVM8kbmQrmUdzQ+piCdb19ts8ir+5kh8MU6ib DyPSPNBL9yNiZMcL8331L+cy63FT/F5Cy//1nGZubfyf1ElTC/J+zp6xOTwADx76o2 Tv/ptvQyvhzQu5YZWKqkQRfkmDbuRn7ZXR+tcXXQ= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Govindarajulu Varadarajan , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.9 89/98] enic: do not overwrite error code Date: Thu, 25 Oct 2018 10:14:14 -0400 Message-Id: <20181025141423.213774-89-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Govindarajulu Varadarajan [ Upstream commit 56f772279a762984f6e9ebbf24a7c829faba5712 ] In failure path, we overwrite err to what vnic_rq_disable() returns. In case it returns 0, enic_open() returns success in case of error. Reported-by: Ben Hutchings Fixes: e8588e268509 ("enic: enable rq before updating rq descriptors") Signed-off-by: Govindarajulu Varadarajan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/cisco/enic/enic_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index f314be07ec58..07282eb76867 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -1708,7 +1708,7 @@ static int enic_open(struct net_device *netdev) { struct enic *enic = netdev_priv(netdev); unsigned int i; - int err; + int err, ret; err = enic_request_intr(enic); if (err) { @@ -1766,10 +1766,9 @@ static int enic_open(struct net_device *netdev) err_out_free_rq: for (i = 0; i < enic->rq_count; i++) { - err = vnic_rq_disable(&enic->rq[i]); - if (err) - return err; - vnic_rq_clean(&enic->rq[i], enic_free_rq_buf); + ret = vnic_rq_disable(&enic->rq[i]); + if (!ret) + vnic_rq_clean(&enic->rq[i], enic_free_rq_buf); } enic_dev_notify_unset(enic); err_out_free_intr: -- 2.17.1