summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNicolai Buchwitz <nb@tipi-net.de>2026-10-27 20:54:07 +0100
committerPaolo Abeni <pabeni@redhat.com>2026-10-29 11:41:08 +0100
commit92cb8653970e4efaa7d2c2e2819c6d050b25e462 (patch)
treebc87107457cb574799e1bd75c6f2daeb612cdaf4 /drivers
parent14d01ff1a4952198abae713a4ad428e07819b4aa (diff)
octeontx2-pf: pass the skb to otx2_dma_unmap_skb_frags()
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> Acked-by: Ratheesh Kannoth <rkannoth@marvell.com> Link: https://patch.msgid.link/20261027-nb-otx2-ipsec-tx-fixes-net-v1-2-2114c4f10c36@tipi-net.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c2
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c5
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h3
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c10
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 3920cd098583..443435608781 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 4e418c7456b7..16f73797739d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -2134,13 +2134,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;
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index 3c7275d545bb..8417af94a02a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -1252,7 +1252,8 @@ static inline int mcam_entry_cmp(const void *a, const void *b)
dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,
struct sk_buff *skb, int seg, int *len);
-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);
int otx2_read_free_sqe(struct otx2_nic *pfvf, u16 qidx);
void otx2_queue_vf_work(struct mbox *mw, struct workqueue_struct *mbox_wq,
int first, int mdevs, u64 intr);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 8d2d607bc92f..66dc8cc15486 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
@@ -160,7 +160,7 @@ static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
*tx_bytes += skb->len;
(*tx_pkts)++;
- otx2_dma_unmap_skb_frags(pfvf, sg);
+ otx2_dma_unmap_skb_frags(pfvf, sg, skb);
napi_consume_skb(skb, budget);
sg->skb = (u64)NULL;
}
@@ -872,7 +872,7 @@ static int otx2_dma_map_tso_skb(struct otx2_nic *pfvf,
}
return 0;
unmap:
- otx2_dma_unmap_skb_frags(pfvf, sg);
+ otx2_dma_unmap_skb_frags(pfvf, sg, skb);
return -EINVAL;
}
@@ -1252,7 +1252,7 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
ret = otx2_sqe_add_sg(pfvf, sq, skb, num_segs, &offset);
if (!ret) {
- otx2_dma_unmap_skb_frags(pfvf, &sq->sg[sq->head]);
+ otx2_dma_unmap_skb_frags(pfvf, &sq->sg[sq->head], skb);
return false;
}
@@ -1344,7 +1344,7 @@ void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
if (skb) {
tx_bytes += skb->len;
tx_pkts++;
- otx2_dma_unmap_skb_frags(pfvf, sg);
+ otx2_dma_unmap_skb_frags(pfvf, sg, skb);
dev_kfree_skb_any(skb);
sg->skb = (u64)NULL;
}
@@ -1399,7 +1399,7 @@ void otx2_free_pending_sqe(struct otx2_nic *pfvf)
if (skb) {
tx_bytes += skb->len;
tx_pkts++;
- otx2_dma_unmap_skb_frags(pfvf, sg);
+ otx2_dma_unmap_skb_frags(pfvf, sg, skb);
dev_kfree_skb_any(skb);
sg->skb = (u64)NULL;
}