* [PATCH] net: libwx: handle page_pool_dev_alloc_pages error
@ 2025-04-06 19:23 Chenyuan Yang
2025-04-07 5:32 ` Michal Swiatkowski
0 siblings, 1 reply; 4+ messages in thread
From: Chenyuan Yang @ 2025-04-06 19:23 UTC (permalink / raw)
To: jiawenwu, mengyuanlou, andrew+netdev, davem, edumazet, kuba,
pabeni, horms, jdamato, duanqiangwen, dlemoal
Cc: netdev, Chenyuan Yang
page_pool_dev_alloc_pages could return NULL. There was a WARN_ON(!page)
but it would still proceed to use the NULL pointer and then crash.
This is similar to commit 001ba0902046
("net: fec: handle page_pool_dev_alloc_pages error").
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
---
drivers/net/ethernet/wangxun/libwx/wx_lib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
index 00b0b318df27..d567443b1b20 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
+++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
@@ -310,7 +310,8 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring,
return true;
page = page_pool_dev_alloc_pages(rx_ring->page_pool);
- WARN_ON(!page);
+ if (unlikely(!page))
+ return false;
dma = page_pool_get_dma_addr(page);
bi->page_dma = dma;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] net: libwx: handle page_pool_dev_alloc_pages error
2025-04-06 19:23 [PATCH] net: libwx: handle page_pool_dev_alloc_pages error Chenyuan Yang
@ 2025-04-07 5:32 ` Michal Swiatkowski
2025-04-07 14:43 ` Chenyuan Yang
0 siblings, 1 reply; 4+ messages in thread
From: Michal Swiatkowski @ 2025-04-07 5:32 UTC (permalink / raw)
To: Chenyuan Yang
Cc: jiawenwu, mengyuanlou, andrew+netdev, davem, edumazet, kuba,
pabeni, horms, jdamato, duanqiangwen, dlemoal, netdev
On Sun, Apr 06, 2025 at 02:23:51PM -0500, Chenyuan Yang wrote:
> page_pool_dev_alloc_pages could return NULL. There was a WARN_ON(!page)
> but it would still proceed to use the NULL pointer and then crash.
>
> This is similar to commit 001ba0902046
> ("net: fec: handle page_pool_dev_alloc_pages error").
>
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> ---
> drivers/net/ethernet/wangxun/libwx/wx_lib.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> index 00b0b318df27..d567443b1b20 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> @@ -310,7 +310,8 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring,
> return true;
>
> page = page_pool_dev_alloc_pages(rx_ring->page_pool);
> - WARN_ON(!page);
> + if (unlikely(!page))
> + return false;
> dma = page_pool_get_dma_addr(page);
>
> bi->page_dma = dma;
Thanks for fixing, it is fine, however you need to add fixes tag.
Probably:
Fixes: 3c47e8ae113a ("net: libwx: Support to receive packets in NAPI")
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] net: libwx: handle page_pool_dev_alloc_pages error
2025-04-07 5:32 ` Michal Swiatkowski
@ 2025-04-07 14:43 ` Chenyuan Yang
2025-04-07 17:33 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Chenyuan Yang @ 2025-04-07 14:43 UTC (permalink / raw)
To: Michal Swiatkowski
Cc: jiawenwu, mengyuanlou, andrew+netdev, davem, edumazet, kuba,
pabeni, horms, jdamato, duanqiangwen, dlemoal, netdev
Hi Michal,
Thank you for your reply and suggestions.
Would you like me to send a new patch (for example, [Patch v2]) with
the "Fix" tag included?
-Chenyuan
On Mon, Apr 7, 2025 at 12:32 AM Michal Swiatkowski
<michal.swiatkowski@linux.intel.com> wrote:
>
> On Sun, Apr 06, 2025 at 02:23:51PM -0500, Chenyuan Yang wrote:
> > page_pool_dev_alloc_pages could return NULL. There was a WARN_ON(!page)
> > but it would still proceed to use the NULL pointer and then crash.
> >
> > This is similar to commit 001ba0902046
> > ("net: fec: handle page_pool_dev_alloc_pages error").
> >
> > Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> > ---
> > drivers/net/ethernet/wangxun/libwx/wx_lib.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> > index 00b0b318df27..d567443b1b20 100644
> > --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> > +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> > @@ -310,7 +310,8 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring,
> > return true;
> >
> > page = page_pool_dev_alloc_pages(rx_ring->page_pool);
> > - WARN_ON(!page);
> > + if (unlikely(!page))
> > + return false;
> > dma = page_pool_get_dma_addr(page);
> >
> > bi->page_dma = dma;
>
> Thanks for fixing, it is fine, however you need to add fixes tag.
> Probably:
> Fixes: 3c47e8ae113a ("net: libwx: Support to receive packets in NAPI")
>
> > --
> > 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] net: libwx: handle page_pool_dev_alloc_pages error
2025-04-07 14:43 ` Chenyuan Yang
@ 2025-04-07 17:33 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-04-07 17:33 UTC (permalink / raw)
To: Chenyuan Yang
Cc: Michal Swiatkowski, jiawenwu, mengyuanlou, andrew+netdev, davem,
edumazet, pabeni, horms, jdamato, duanqiangwen, dlemoal, netdev
On Mon, 7 Apr 2025 09:43:56 -0500 Chenyuan Yang wrote:
> Hi Michal,
>
> Thank you for your reply and suggestions.
> Would you like me to send a new patch (for example, [Patch v2]) with
> the "Fix" tag included?
Yes, and please don't top post.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-07 17:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-06 19:23 [PATCH] net: libwx: handle page_pool_dev_alloc_pages error Chenyuan Yang
2025-04-07 5:32 ` Michal Swiatkowski
2025-04-07 14:43 ` Chenyuan Yang
2025-04-07 17:33 ` Jakub Kicinski
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).