public inbox for gwml@vger.gnuweeb.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Cc: Oliver Neukum <oneukum@suse.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux Netdev Mailing List <netdev@vger.kernel.org>,
	Linux USB Mailing List <linux-usb@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Armando Budianto <sprite@gnuweeb.org>,
	gwml@vger.gnuweeb.org, stable@vger.kernel.org,
	John Ernberg <john.ernberg@actia.se>
Subject: Re: [PATCH net v2] net: usbnet: Fix the wrong netif_carrier_on() call placement
Date: Mon, 4 Aug 2025 11:00:50 +0100	[thread overview]
Message-ID: <20250804100050.GQ8494@horms.kernel.org> (raw)
In-Reply-To: <20250801190310.58443-1-ammarfaizi2@gnuweeb.org>

+ John Ernberg

On Sat, Aug 02, 2025 at 02:03:10AM +0700, Ammar Faizi wrote:
> The commit in the Fixes tag breaks my laptop (found by git bisect).
> My home RJ45 LAN cable cannot connect after that commit.
> 
> The call to netif_carrier_on() should be done when netif_carrier_ok()
> is false. Not when it's true. Because calling netif_carrier_on() when
> __LINK_STATE_NOCARRIER is not set actually does nothing.
> 
> Cc: Armando Budianto <sprite@gnuweeb.org>
> Cc: stable@vger.kernel.org
> Closes: https://lore.kernel.org/netdev/0752dee6-43d6-4e1f-81d2-4248142cccd2@gnuweeb.org
> Fixes: 0d9cfc9b8cb1 ("net: usbnet: Avoid potential RCU stall on LINK_CHANGE event")
> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
> ---
> 
> v2:
>   - Rebase on top of the latest netdev/net tree. The previous patch was
>     based on 0d9cfc9b8cb1. Line numbers have changed since then.
> 
>  drivers/net/usb/usbnet.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index a38ffbf4b3f0..a1827684b92c 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -1114,31 +1114,31 @@ static const struct ethtool_ops usbnet_ethtool_ops = {
>  };
>  
>  /*-------------------------------------------------------------------------*/
>  
>  static void __handle_link_change(struct usbnet *dev)
>  {
>  	if (!test_bit(EVENT_DEV_OPEN, &dev->flags))
>  		return;
>  
>  	if (!netif_carrier_ok(dev->net)) {
> +		if (test_and_clear_bit(EVENT_LINK_CARRIER_ON, &dev->flags))
> +			netif_carrier_on(dev->net);
> +
>  		/* kill URBs for reading packets to save bus bandwidth */
>  		unlink_urbs(dev, &dev->rxq);
>  
>  		/*
>  		 * tx_timeout will unlink URBs for sending packets and
>  		 * tx queue is stopped by netcore after link becomes off
>  		 */
>  	} else {
> -		if (test_and_clear_bit(EVENT_LINK_CARRIER_ON, &dev->flags))
> -			netif_carrier_on(dev->net);
> -
>  		/* submitting URBs for reading packets */
>  		queue_work(system_bh_wq, &dev->bh_work);
>  	}
>  
>  	/* hard_mtu or rx_urb_size may change during link change */
>  	usbnet_update_max_qlen(dev);
>  
>  	clear_bit(EVENT_LINK_CHANGE, &dev->flags);
>  }
>  
> -- 
> Ammar Faizi
> 
> 

  reply	other threads:[~2025-08-04 10:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 19:03 [PATCH net v2] net: usbnet: Fix the wrong netif_carrier_on() call placement Ammar Faizi
2025-08-04 10:00 ` Simon Horman [this message]
2025-08-05 20:28   ` Simon Horman
2025-08-05 21:16     ` Ammar Faizi
2025-08-05 22:40     ` Linus Torvalds
2025-08-05 23:47       ` Jakub Kicinski
2025-08-05 23:57         ` Ammar Faizi
2025-08-12 20:57         ` John Ernberg
2025-08-05 23:56       ` Ammar Faizi
2025-08-06  0:05         ` Ammar Faizi
2025-08-06  1:11       ` Linus Torvalds
2025-08-06  1:54         ` Linus Torvalds
2025-08-07  1:37           ` Ammar Faizi

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=20250804100050.GQ8494@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gwml@vger.gnuweeb.org \
    --cc=john.ernberg@actia.se \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.com \
    --cc=pabeni@redhat.com \
    --cc=sprite@gnuweeb.org \
    --cc=stable@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