dpaa2-eth: fix memory leak in XDP_REDIRECT
authorIoana Ciornei <ioana.ciornei@nxp.com>
Thu, 11 Feb 2021 19:51:22 +0000 (21:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:31 +0000 (11:37 +0100)
commita5ff8b798a368ecb108969eba10f7f4257729144
treec64440d3f23433c16903218e79eef52ac106bbce
parent3cf0490625c88692856770f07ccb65e700994d85
dpaa2-eth: fix memory leak in XDP_REDIRECT

[ Upstream commit e12be9139cca26d689fe1a9257054b76752f725b ]

If xdp_do_redirect() fails, the calling driver should handle recycling
or freeing of the page associated with the frame. The dpaa2-eth driver
didn't do either of them and just incremented a counter.
Fix this by trying to DMA map back the page and recycle it or, if the
mapping fails, just free it.

Fixes: d678be1dc1ec ("dpaa2-eth: add XDP_REDIRECT support")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c