netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Igor Russkikh <irusskikh@marvell.com>
To: <netdev@vger.kernel.org>
Cc: <dbogdanov@marvell.com>, <pbelous@marvell.com>,
	<ndanilov@marvell.com>, <davem@davemloft.net>,
	Igor Russkikh <irusskikh@marvell.com>
Subject: [PATCH net 6/8] net: atlantic: fix potential error handling
Date: Fri, 14 Feb 2020 18:44:56 +0300	[thread overview]
Message-ID: <1b9d327bd6278af27e121951d50d58c798f3625c.1580299250.git.irusskikh@marvell.com> (raw)
In-Reply-To: <cover.1580299250.git.irusskikh@marvell.com>

From: Pavel Belous <pbelous@marvell.com>

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>
---
 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 263beea1859c..e95f6a6bef73 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -533,8 +533,10 @@ unsigned int aq_nic_map_skb(struct aq_nic_s *self, struct sk_buff *skb,
 				     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.17.1


  parent reply	other threads:[~2020-02-14 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 15:44 [PATCH net 0/8] Marvell atlantic 2020/02 updates Igor Russkikh
2020-02-14 15:44 ` [PATCH net 1/8] net: atlantic: checksum compat issue Igor Russkikh
2020-02-14 15:44 ` [PATCH net 2/8] net: atlantic: check rpc result and wait for rpc address Igor Russkikh
2020-02-14 15:44 ` [PATCH net 3/8] net: atlantic: ptp gpio adjustments Igor Russkikh
2020-02-14 15:44 ` [PATCH net 4/8] net: atlantic: better loopback mode handling Igor Russkikh
2020-02-14 15:44 ` [PATCH net 5/8] net: atlantic: fix use after free kasan warn Igor Russkikh
2020-02-14 15:44 ` Igor Russkikh [this message]
2020-02-14 15:44 ` [PATCH net 7/8] net: atlantic: possible fault in transition to hibernation Igor Russkikh
2020-02-17  3:03 ` [PATCH net 0/8] Marvell atlantic 2020/02 updates David Miller

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=1b9d327bd6278af27e121951d50d58c798f3625c.1580299250.git.irusskikh@marvell.com \
    --to=irusskikh@marvell.com \
    --cc=davem@davemloft.net \
    --cc=dbogdanov@marvell.com \
    --cc=ndanilov@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pbelous@marvell.com \
    /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).