net: enetc: fix the off-by-one issue in enetc_map_tx_tso_buffs()
authorWei Fang <wei.fang@nxp.com>
Mon, 24 Feb 2025 11:12:51 +0000 (19:12 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 26 Feb 2025 03:10:59 +0000 (19:10 -0800)
commit249df695c3ffe8c8d36d46c2580ce72410976f96
tree9e70251c8c04e843f39a41f794fc2d49753d3ead
parent119049b66b883c7e7e575a0b69dc6e3d211662cc
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 increment of 'i' and 'count' remain in sync
and enetc_unwind_tx_frame() is called for error handling.

Fixes: fb8629e2cbfc ("net: enetc: add support for software TSO")
Cc: stable@vger.kernel.org
Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Link: https://patch.msgid.link/20250224111251.1061098-9-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.c