Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: mengyuanlou@net-swift.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, jiawenwu@trustnetic.com,
	duanqiangwen@net-swift.com
Subject: Re: [PATCH net-next 1/3] net: libwx: add support for set_ringparam in wx_ethtool_ops_vf
Date: Fri, 15 May 2026 18:07:43 -0700	[thread overview]
Message-ID: <20260516010743.1855097-1-kuba@kernel.org> (raw)
In-Reply-To: <20260514103405.42175-2-mengyuanlou@net-swift.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: libwx: add support for set_ringparam in wx_ethtool_ops_vf

This commit adds support for the set_ringparam callback in wx_ethtool_ops_vf,
allowing the ring sizes for ngbevf and txgbevf to be configured.

> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c b/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
> index 5df971aca9e35..31034cd208703 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c

[ ... ]

> @@ -775,6 +776,64 @@ static int wx_get_link_ksettings_vf(struct net_device *netdev,
>  	return 0;
>  }
>  
> +static int wx_set_ringparam_vf(struct net_device *netdev,
> +			       struct ethtool_ringparam *ring,
> +			       struct kernel_ethtool_ringparam *kernel_ring,
> +			       struct netlink_ext_ack *extack)
> +{

[ ... ]

> +	wxvf_down(wx);
> +	wx_free_irq(wx);
> +
> +	wx_set_ring(wx, new_tx_count, new_rx_count, temp_ring);

wx_set_ring() returns void, so memory allocation failures inside it (like in
wx_setup_tx_resources()) are not passed back to the caller. Does this mean
wx_set_ringparam_vf() will falsely return success (0) to userspace even if
the ring sizes could not be changed due to memory exhaustion?

> +	kvfree(temp_ring);
> +
> +	wx_configure_vf(wx);
> +	wx_request_msix_irqs_vf(wx);

Is it safe to ignore the return value of wx_request_msix_irqs_vf() here?

If request_irq() fails, wx_request_msix_irqs_vf() cleans up and sets
wx->msix_q_entries to null. Because the error is not handled here, execution
continues to wxvf_up_complete(), which starts NAPI and the transmit queues
without hardware interrupts. Could this result in a silent network stall?

Additionally, if the interface is later brought up via wxvf_open(), it will
call wx_request_msix_irqs_vf() again. This loop calculates
entry = &wx->msix_q_entries[vector] and dereferences entry->vector. Could
this cause a null pointer dereference if wx->msix_q_entries was previously
freed and left as null?

> +	wxvf_up_complete(wx);
> +
> +clear_reset:
> +	clear_bit(WX_STATE_RESETTING, wx->state);
> +	mutex_unlock(&wx->reset_lock);
> +	return err;
> +}
-- 
pw-bot: cr

  reply	other threads:[~2026-05-16  1:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 10:34 [PATCH net-next 0/3] net: libwx: improve VF ethtool support Mengyuan Lou
2026-05-14 10:34 ` [PATCH net-next 1/3] net: libwx: add support for set_ringparam in wx_ethtool_ops_vf Mengyuan Lou
2026-05-16  1:07   ` Jakub Kicinski [this message]
2026-05-14 10:34 ` [PATCH net-next 2/3] net: libwx: add support for set_coalesce " Mengyuan Lou
2026-05-14 10:34 ` [PATCH net-next 3/3] net: libwx: support vf hardware statistics Mengyuan Lou
2026-05-16  1:07   ` 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=20260516010743.1855097-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=duanqiangwen@net-swift.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    /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