> > -----Original Message----- > > From: Wei Fang <wei.fang@xxxxxxx> > > Sent: Wednesday, February 19, 2025 7:43 AM > [...] > > Subject: [PATCH v2 net 9/9] net: enetc: fix the off-by-one issue in > > enetc_map_tx_tso_buffs() > > > > There is an off-by-one issue for the err_chained_bd path, it will free > > one more tx_swbd than expected. But there is no such issue for the > > err_map_data path. To fix this off-by-one issue and make the two error > > handling consistent, the loop condition of error handling is modified > > and the 'count++' operation is moved before enetc_map_tx_tso_data(). > > > > Fixes: fb8629e2cbfc ("net: enetc: add support for software TSO") > > Cc: stable@xxxxxxxxxxxxxxx > > Signed-off-by: Wei Fang <wei.fang@xxxxxxx> > > --- > > drivers/net/ethernet/freescale/enetc/enetc.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c > > b/drivers/net/ethernet/freescale/enetc/enetc.c > > index 9a24d1176479..fe3967268a19 100644 > > --- a/drivers/net/ethernet/freescale/enetc/enetc.c > > +++ b/drivers/net/ethernet/freescale/enetc/enetc.c > > @@ -832,6 +832,7 @@ static int enetc_map_tx_tso_buffs(struct enetc_bdr > > *tx_ring, struct sk_buff *skb > > txbd = ENETC_TXBD(*tx_ring, i); > > tx_swbd = &tx_ring->tx_swbd[i]; > > prefetchw(txbd); > > + count++; > > > > /* Compute the checksum over this segment of data and > > * add it to the csum already computed (over the L4 > > @@ -848,7 +849,6 @@ static int enetc_map_tx_tso_buffs(struct enetc_bdr > > *tx_ring, struct sk_buff *skb > > goto err_map_data; > > > > data_len -= size; > > - count++; > > Hi Wei, > > My issue is that: > enetc_map_tx_tso_hdr() not only updates the current tx_swbd (so 1 count++ > needed), but in case of extension flag it advances 'tx_swbd' and 'i' with > another > position so and extra 'count++' would be needed in that case. > I think the patch 2 (net: enetc: correct the tx_swbd statistics) is to resolve your issue.