Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1934221ima; Thu, 25 Oct 2018 07:14:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5choUwCPUcwRGnWCqV+kD2nprbuiIphFZgAwvs6bF4yaEJYv2FXKstb6BqzLFxbnRTWqZWa X-Received: by 2002:a65:51c6:: with SMTP id i6-v6mr1601865pgq.227.1540476886278; Thu, 25 Oct 2018 07:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540476886; cv=none; d=google.com; s=arc-20160816; b=iVRNDVQfRo36J7CI81hPlwb6j5sTrrtkmal43rO89AUf8JTJQBzEKspLGRFX5hwoCq tERJXzPOw+QXFPJGIXY1NGcjISpJbL2ANBMqjYzaNJj5AOseOx8UmrfwyizfWVLlXyvw CUI4EAL4YfoQaaRgFK+PTmhQwl+t4TcVwSmDSbHWxkypE7jtHeHzn+LJHmhYnRiZo6JV XwX3g193+Vcdj+dJDNvcGtBAFtjvAtqcWPjIBjoJTefODzGgKQUC4uuL2A5Hb7mJxS6F WtI02gwpyL5TOLmmOu5vsoOOlMdGr2zWv026Sbiy9saw0VXntf5q7oqsOcK+ZzxW3F/b 4bOw== 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=Ti1yp9KpZmmZd2//2uxQP1QiDvYcyvG2yuDVHRrdn2A=; b=C/PBb4OM8U/aqvN2Z9Mb/hPe27fnRq+kAukmlnhmi2JUFguI2CWYXV/Ua6VU8eupbw YP3dQ9ASHE3NUmgVKVRSt+4RHDv4160BwGnCJp3xHm/fnzniMRtm3KeROHNN+G4BmPew OJm9yEYRnxJmmiEAlFH9d5pc+DD2Dp9+iV354YfYY5y1epVTIyd60dJWbxYQKCb2I7Da 961p4yDNt6DVRzXWZk67foVaSh+NN9umtN+29j4aPcw4/cEj4jGkKqioEcxoxHWlikiG Ah/75q3kxuXGQgXs1wZiEVaqLDipLtczU/Fihw0DT8UrtmjkE/9wO8JSTGYeFkKuqErZ vhMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QOZC2Vn9; 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 w6-v6si8543157pgw.316.2018.10.25.07.14.00; Thu, 25 Oct 2018 07:14:46 -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=QOZC2Vn9; 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 S1728344AbeJYWok (ORCPT + 99 others); Thu, 25 Oct 2018 18:44:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:53634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728299AbeJYWoj (ORCPT ); Thu, 25 Oct 2018 18:44:39 -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 2A39C2084A; Thu, 25 Oct 2018 14:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476704; bh=HKN3oNuGracI+/5GQOIxkiZhHbjLwgVnFvBpx4CA0VY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOZC2Vn91Tlf4TZqgGJKjyOJ4HBS7ExEMQsOsoE4Dwsnx1XIx1qdlVGHOXSTKWZ1J evE4ofWV2YEyNux8eAok7UDrtqEV3bj2otktrTfdtxtmjCOe6lzyfETN6ezIezRhLe BHZ3ABv8ut3NFJ1QlvNEbHQOvZG1NxEijoHRuak8= 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.14 35/46] enic: do not overwrite error code Date: Thu, 25 Oct 2018 10:10:42 -0400 Message-Id: <20181025141053.213330-35-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141053.213330-1-sashal@kernel.org> References: <20181025141053.213330-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 2bfaf3e118b1..03f4fee1bbc9 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -1879,7 +1879,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) { @@ -1936,10 +1936,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