netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] enic: do not overwrite error code
@ 2018-06-18 17:01 Govindarajulu Varadarajan
  2018-06-19 23:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Govindarajulu Varadarajan @ 2018-06-18 17:01 UTC (permalink / raw)
  To: davem, netdev, ben.hutchings, benve, gregkh, alexander.levin
  Cc: Govindarajulu Varadarajan

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 <ben.hutchings@codethink.co.uk>
Fixes: e8588e268509 ("enic: enable rq before updating rq descriptors")
Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
---
 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 30d2eaa18c04..d3962fb0d32d 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1920,7 +1920,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) {
@@ -1977,10 +1977,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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] enic: do not overwrite error code
  2018-06-18 17:01 [PATCH net] enic: do not overwrite error code Govindarajulu Varadarajan
@ 2018-06-19 23:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-19 23:10 UTC (permalink / raw)
  To: gvaradar; +Cc: netdev, ben.hutchings, benve, gregkh, alexander.levin

From: Govindarajulu Varadarajan <gvaradar@cisco.com>
Date: Mon, 18 Jun 2018 10:01:05 -0700

> 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 <ben.hutchings@codethink.co.uk>
> Fixes: e8588e268509 ("enic: enable rq before updating rq descriptors")
> Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-19 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-18 17:01 [PATCH net] enic: do not overwrite error code Govindarajulu Varadarajan
2018-06-19 23:10 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).