]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dpaa2-switch: fix the error path in dpaa2_switch_rx()
authorIoana Ciornei <ioana.ciornei@nxp.com>
Thu, 28 May 2026 17:34:49 +0000 (20:34 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Jun 2026 02:13:18 +0000 (19:13 -0700)
commit74c1c9f5c0c30bbd0c2cf87b6e3507e7ea46c13d
tree2d2cca62bd6ff2265d5f4d3b7efb745dbfb6b79d
parentefc1d92eacf03afa6f4d53bf7120e059b6f961f2
dpaa2-switch: fix the error path in dpaa2_switch_rx()

In case of an error in dpaa2_switch_rx(), the dpaa2_switch_free_fd()
function is called in order to free the FD. This is incorrect since the
dpaa2_switch_free_fd() is intended to be used on Tx frame descriptors,
meaning that it expects in the software annotation area of the FD data
to find a valid skb pointer on which to call dev_kfree_skb().

Fix this by extracting the dma_unmap_page() from
dpaa2_switch_build_linear_skb() directly into the dpaa2_switch_rx()
function. This allows us to directly use free_pages() in case of an
error before an SKB was created and kfree_skb() afterwards.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://patch.msgid.link/20260528173452.1953102-3-ioana.ciornei@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c