* [PATCH net] dpaa2-eth: fix xdp_rxq_info leak in dpaa2_eth_setup_rx_flow
@ 2025-06-24 14:42 Fushuai Wang
2025-06-25 10:43 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Fushuai Wang @ 2025-06-24 14:42 UTC (permalink / raw)
To: ioana.ciornei, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, Fushuai Wang
When xdp_rxq_info_reg_mem_model() fails after a successful
xdp_rxq_info_reg(), the kernel may leaks the registered RXQ
info structure. Fix this by calling xdp_rxq_info_unreg() in
the error path, ensuring proper cleanup when memory model
registration fails.
Fixes: d678be1dc1ec ("dpaa2-eth: add XDP_REDIRECT support")
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 2ec2c3dab250..b4a62eae4719 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -3939,6 +3939,7 @@ static int dpaa2_eth_setup_rx_flow(struct dpaa2_eth_priv *priv,
MEM_TYPE_PAGE_ORDER0, NULL);
if (err) {
dev_err(dev, "xdp_rxq_info_reg_mem_model failed\n");
+ xdp_rxq_info_unreg(&fq->channel->xdp_rxq);
return err;
}
--
2.36.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] dpaa2-eth: fix xdp_rxq_info leak in dpaa2_eth_setup_rx_flow
2025-06-24 14:42 [PATCH net] dpaa2-eth: fix xdp_rxq_info leak in dpaa2_eth_setup_rx_flow Fushuai Wang
@ 2025-06-25 10:43 ` Simon Horman
2025-06-25 12:55 ` Fushuai Wang
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2025-06-25 10:43 UTC (permalink / raw)
To: Fushuai Wang
Cc: ioana.ciornei, andrew+netdev, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
On Tue, Jun 24, 2025 at 10:42:35PM +0800, Fushuai Wang wrote:
> When xdp_rxq_info_reg_mem_model() fails after a successful
> xdp_rxq_info_reg(), the kernel may leaks the registered RXQ
> info structure. Fix this by calling xdp_rxq_info_unreg() in
> the error path, ensuring proper cleanup when memory model
> registration fails.
>
> Fixes: d678be1dc1ec ("dpaa2-eth: add XDP_REDIRECT support")
> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
Thanks, I agree this is needed.
Reviewed-by: Simon Horman <horms@kernel.org>
But I wonder how these resources are released in the following cases:
* Error in dpaa2_eth_bind_dpni() after at least one
successful call to dpaa2_eth_setup_rx_flow()
* Error in dpaa2_eth_probe() after a successful call to
dpaa2_eth_bind_dpni()
* Driver removal (dpaa2_eth_remove())
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] dpaa2-eth: fix xdp_rxq_info leak in dpaa2_eth_setup_rx_flow
2025-06-25 10:43 ` Simon Horman
@ 2025-06-25 12:55 ` Fushuai Wang
2025-06-25 17:00 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Fushuai Wang @ 2025-06-25 12:55 UTC (permalink / raw)
To: horms
Cc: andrew+netdev, davem, edumazet, ioana.ciornei, kuba, linux-kernel,
netdev, pabeni, wangfushuai
>> When xdp_rxq_info_reg_mem_model() fails after a successful
>> xdp_rxq_info_reg(), the kernel may leaks the registered RXQ
>> info structure. Fix this by calling xdp_rxq_info_unreg() in
>> the error path, ensuring proper cleanup when memory model
>> registration fails.
>>
>> Fixes: d678be1dc1ec ("dpaa2-eth: add XDP_REDIRECT support")
>> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
>
> Thanks, I agree this is needed.
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
> But I wonder how these resources are released in the following cases:
>
> * Error in dpaa2_eth_bind_dpni() after at least one
> successful call to dpaa2_eth_setup_rx_flow()
>
> * Error in dpaa2_eth_probe() after a successful call to
> dpaa2_eth_bind_dpni()
>
> * Driver removal (dpaa2_eth_remove())
Hi, Simon
I think these paths also leak xdp_rxq_info.
I'll add cleanup for them and send v2 shortly.
--
Regards,
Wang
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] dpaa2-eth: fix xdp_rxq_info leak in dpaa2_eth_setup_rx_flow
2025-06-25 12:55 ` Fushuai Wang
@ 2025-06-25 17:00 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-06-25 17:00 UTC (permalink / raw)
To: Fushuai Wang
Cc: andrew+netdev, davem, edumazet, ioana.ciornei, kuba, linux-kernel,
netdev, pabeni
On Wed, Jun 25, 2025 at 08:55:47PM +0800, Fushuai Wang wrote:
> >> When xdp_rxq_info_reg_mem_model() fails after a successful
> >> xdp_rxq_info_reg(), the kernel may leaks the registered RXQ
> >> info structure. Fix this by calling xdp_rxq_info_unreg() in
> >> the error path, ensuring proper cleanup when memory model
> >> registration fails.
> >>
> >> Fixes: d678be1dc1ec ("dpaa2-eth: add XDP_REDIRECT support")
> >> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
> >
> > Thanks, I agree this is needed.
> >
> > Reviewed-by: Simon Horman <horms@kernel.org>
> >
> > But I wonder how these resources are released in the following cases:
> >
> > * Error in dpaa2_eth_bind_dpni() after at least one
> > successful call to dpaa2_eth_setup_rx_flow()
> >
> > * Error in dpaa2_eth_probe() after a successful call to
> > dpaa2_eth_bind_dpni()
> >
> > * Driver removal (dpaa2_eth_remove())
>
> Hi, Simon
>
> I think these paths also leak xdp_rxq_info.
> I'll add cleanup for them and send v2 shortly.
Great, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-25 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 14:42 [PATCH net] dpaa2-eth: fix xdp_rxq_info leak in dpaa2_eth_setup_rx_flow Fushuai Wang
2025-06-25 10:43 ` Simon Horman
2025-06-25 12:55 ` Fushuai Wang
2025-06-25 17:00 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).