netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Pavel Belous <pbelous@marvell.com>,
	Igor Russkikh <irusskikh@marvell.com>,
	Dmitry Bogdanov <dbogdanov@marvell.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 10/22] net: atlantic: fix potential error handling
Date: Mon,  2 Mar 2020 21:49:21 -0500	[thread overview]
Message-ID: <20200303024933.10371-10-sashal@kernel.org> (raw)
In-Reply-To: <20200303024933.10371-1-sashal@kernel.org>

From: Pavel Belous <pbelous@marvell.com>

[ Upstream commit 380ec5b9af7f0d57dbf6ac067fd9f33cff2fef71 ]

Code inspection found that in case of mapping error we do return current
'ret' value. But beside error, it is used to count number of descriptors
allocated for the packet. In that case map_skb function could return '1'.

Changing it to return zero (number of mapped descriptors for skb)

Fixes: 018423e90bee ("net: ethernet: aquantia: Add ring support code")
Signed-off-by: Pavel Belous <pbelous@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index a69f5f1ad32a8..7a900f76c9ac3 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -519,8 +519,10 @@ static unsigned int aq_nic_map_skb(struct aq_nic_s *self,
 				     dx_buff->len,
 				     DMA_TO_DEVICE);
 
-	if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa)))
+	if (unlikely(dma_mapping_error(aq_nic_get_dev(self), dx_buff->pa))) {
+		ret = 0;
 		goto exit;
+	}
 
 	first = dx_buff;
 	dx_buff->len_pkt = skb->len;
-- 
2.20.1


  parent reply	other threads:[~2020-03-03  2:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200303024933.10371-1-sashal@kernel.org>
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 03/22] selftests: fix too long argument Sasha Levin
2020-03-03  2:49 ` Sasha Levin [this message]
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 11/22] net: phy: restore mdio regs in the iproc mdio driver Sasha Levin
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 12/22] net: ks8851-ml: Remove 8-bit bus accessors Sasha Levin
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 13/22] net: ks8851-ml: Fix 16-bit data access Sasha Levin
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 14/22] net: ks8851-ml: Fix 16-bit IO operation Sasha Levin
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 20/22] nfc: pn544: Fix occasional HW initialization failure Sasha Levin
2020-03-03  2:49 ` [PATCH AUTOSEL 4.14 22/22] net: thunderx: workaround BGX TX Underflow issue Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200303024933.10371-10-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dbogdanov@marvell.com \
    --cc=irusskikh@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pbelous@marvell.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).