netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Chenyuan Yang <chenyuan0y@gmail.com>
Cc: jiawenwu@trustnetic.com, mengyuanlou@net-swift.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	jdamato@fastly.com, duanqiangwen@net-swift.com,
	dlemoal@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: libwx: handle page_pool_dev_alloc_pages error
Date: Mon, 7 Apr 2025 07:32:13 +0200	[thread overview]
Message-ID: <Z/NjXSRVFp9c/XmQ@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20250406192351.3850007-1-chenyuan0y@gmail.com>

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

  reply	other threads:[~2025-04-07  5:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-06 19:23 [PATCH] net: libwx: handle page_pool_dev_alloc_pages error Chenyuan Yang
2025-04-07  5:32 ` Michal Swiatkowski [this message]
2025-04-07 14:43   ` Chenyuan Yang
2025-04-07 17:33     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z/NjXSRVFp9c/XmQ@mev-dev.igk.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenyuan0y@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dlemoal@kernel.org \
    --cc=duanqiangwen@net-swift.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@kernel.org \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).