From: Jonas Suhr Christensen <jsc@umbraculum.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, michal.simek@xilinx.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, esben@geanix.com,
Jonas Suhr Christensen <jsc@umbraculum.org>
Subject: [PATCH 2/2] net: ll_temac: improve reset of buffer on dma mapping
Date: Thu, 26 Jan 2023 11:16:07 +0100 [thread overview]
Message-ID: <20230126101607.88407-2-jsc@umbraculum.org> (raw)
In-Reply-To: <20230126101607.88407-1-jsc@umbraculum.org>
Free buffer and set pointer to null on dma mapping error.
Signed-off-by: Jonas Suhr Christensen <jsc@umbraculum.org>
---
drivers/net/ethernet/xilinx/ll_temac_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 66c04027f230..5595ba57a126 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -376,8 +376,11 @@ static int temac_dma_bd_init(struct net_device *ndev)
skb_dma_addr = dma_map_single(ndev->dev.parent, skb->data,
XTE_MAX_JUMBO_FRAME_SIZE,
DMA_FROM_DEVICE);
- if (dma_mapping_error(ndev->dev.parent, skb_dma_addr))
+ if (dma_mapping_error(ndev->dev.parent, skb_dma_addr)) {
+ dev_kfree_skb(lp->rx_skb[i]);
+ lp->rx_skb[i] = NULL;
goto out;
+ }
lp->rx_bd_v[i].phys = cpu_to_be32(skb_dma_addr);
lp->rx_bd_v[i].len = cpu_to_be32(XTE_MAX_JUMBO_FRAME_SIZE);
lp->rx_bd_v[i].app0 = cpu_to_be32(STS_CTRL_APP0_IRQONEND);
--
2.39.1
next prev parent reply other threads:[~2023-01-26 10:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 10:16 [PATCH 1/2] net: ll_temac: fix DMA resources leak Jonas Suhr Christensen
2023-01-26 10:16 ` Jonas Suhr Christensen [this message]
2023-01-28 7:13 ` [PATCH 2/2] net: ll_temac: improve reset of buffer on dma mapping Jakub Kicinski
2023-01-30 12:40 ` esben
2023-01-30 20:42 ` Jakub Kicinski
2023-01-28 7:20 ` [PATCH 1/2] net: ll_temac: fix DMA resources leak Jakub Kicinski
2023-01-30 12:30 ` esben
2023-01-30 21:56 ` Christophe JAILLET
2023-01-31 0:20 ` Jakub Kicinski
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=20230126101607.88407-2-jsc@umbraculum.org \
--to=jsc@umbraculum.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=esben@geanix.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®