mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: Nicolai Buchwitz <nb@tipi-net.de>
Cc: Sunil Goutham <sgoutham@marvell.com>,
	Geetha sowjanya <gakula@marvell.com>,
	Subbaraya Sundeep <sbhatta@marvell.com>,
	Bharat Bhushan <bbhushan2@marvell.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 2/2] octeontx2-pf: pass the skb to otx2_dma_unmap_skb_frags()
Date: Wed, 28 Oct 2026 08:08:04 +0530	[thread overview]
Message-ID: <auFgDIyangziDH4V@rkannoth-OptiPlex-7090> (raw)
In-Reply-To: <20261027-nb-otx2-ipsec-tx-fixes-net-v1-2-2114c4f10c36@tipi-net.de>

On 2026-10-28 at 01:24:07, Nicolai Buchwitz (nb@tipi-net.de) wrote:
> After a DMA mapping error, the unmap reads an skb pointer that is not
> set yet. It can be NULL or left over from an earlier packet.
>
> Fixes: 195c3d463181 ("octeontx2-pf: map skb data as device writeable")
> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c |  2 +-
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c |  5 ++---
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h |  3 ++-
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c   | 10 +++++-----
>  4 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c
> index 3920cd0985831..4434356087814 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c
> @@ -1037,7 +1037,7 @@ bool cn10k_ipsec_transmit(struct otx2_nic *pf, struct netdev_queue *txq,
>  	cn10k_cpt_inst_flush(pf, &inst, sizeof(struct cpt_inst_s));
>  	return true;
>  drop:
> -	otx2_dma_unmap_skb_frags(pf, &sq->sg[sq->head]);
> +	otx2_dma_unmap_skb_frags(pf, &sq->sg[sq->head], skb);
>  	sq->sg[sq->head].skb = (u64)NULL;
>  	atomic_long_inc(&pf->hw.dev_stats.tx_discards);
>  	dev_kfree_skb_any(skb);
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> index c441c0161dbf4..c85436457286e 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> @@ -2132,13 +2132,12 @@ dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,
>  	return otx2_dma_map_page(pfvf, page, offset, *len, dir);
>  }
>
> -void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg)
> +void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg,
> +			      struct sk_buff *skb)
>  {
>  	enum dma_data_direction dir = DMA_TO_DEVICE;
> -	struct sk_buff *skb = NULL;
>  	int seg;
>
> -	skb = (struct sk_buff *)sg->skb;
>  	if (unlikely(xfrm_offload(skb)))
>  		dir = DMA_BIDIRECTIONAL;
>
Acked-by: Ratheesh Kannoth <rkannoth@marvell.com>

      reply	other threads:[~2026-10-28  2:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 19:54 [PATCH net 0/2] octeontx2-pf: fix ipsec transmit error paths Nicolai Buchwitz
2026-10-27 19:54 ` [PATCH net 1/2] octeontx2-pf: fix skb use-after-free on ipsec transmit drop Nicolai Buchwitz
2026-10-28  2:26   ` Ratheesh Kannoth
2026-10-27 19:54 ` [PATCH net 2/2] octeontx2-pf: pass the skb to otx2_dma_unmap_skb_frags() Nicolai Buchwitz
2026-10-28  2:38   ` Ratheesh Kannoth [this message]

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=auFgDIyangziDH4V@rkannoth-OptiPlex-7090 \
    --to=rkannoth@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bbhushan2@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gakula@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@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

all inboxes | Powered by JetHome®