mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: raoxu@uniontech.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, maciej.fijalkowski@intel.com,
	kuniyu@google.com, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net v2] net: usb: ipheth: stop RX URB on ndo_stop
Date: Fri,  4 Sep 2026 15:43:57 -0700	[thread overview]
Message-ID: <20260904224357.4041665-1-kuba@kernel.org> (raw)
In-Reply-To: <351B4C70CB12AE0F+20260901050604.2523039-1-raoxu@uniontech.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: usb: ipheth: stop RX URB on ndo_stop

ipheth_close() previously stopped the netdev queue and disabled the carrier
work but left the RX URB submitted, so an in-flight RX could still deliver
packets and re-arm itself after an administrative link down.  This commit
adds a usb_kill_urb() on the RX URB in ndo_stop, deliberately leaving an
in-flight TX URB to complete on its own.

> diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
> index 2b490114d2327..6b90fe1e0e382 100644
> --- a/drivers/net/usb/ipheth.c
> +++ b/drivers/net/usb/ipheth.c
> @@ -505,6 +505,7 @@ static int ipheth_close(struct net_device *net)
>  	 * it, so that such a schedule_delayed_work() is a no-op.
>  	 */
>  	disable_delayed_work_sync(&dev->carrier_work);
> +	usb_kill_urb(dev->rx_urb);
>  	return 0;
>  }

[Severity: Low]
Can this make a plain "ip link set ethN down" print a KERN_ERR line while
RX traffic is flowing?

usb_kill_urb() does atomic_inc(&urb->reject) before it unlinks and waits,
so a giveback that is already in progress can run ipheth_rcvbulk_callback()
with status 0 and fall through to the resubmit:

drivers/net/usb/ipheth.c:ipheth_rcvbulk_callback() {
	...
rx_submit:
	dev->confirmed_pairing = true;
	ipheth_rx_submit(dev, GFP_ATOMIC);
}

That resubmit then hits the reject check in usb_hcd_submit_urb():

drivers/usb/core/hcd.c:usb_hcd_submit_urb() {
	...
	/* Check that the URB isn't being killed */
	if (unlikely(atomic_read(&urb->reject))) {
		rc = -EPERM;
		goto done;
	}

and ipheth_rx_submit() logs that unconditionally:

drivers/net/usb/ipheth.c:ipheth_rx_submit() {
	...
	retval = usb_submit_urb(dev->rx_urb, mem_flags);
	if (retval)
		dev_err(&dev->intf->dev, "%s: usb_submit_urb: %d\n",
			__func__, retval);

Before this change urb->reject was never raised on the close path, so this
-EPERM branch was not reachable from ndo_stop.

The two sites also seem to disagree about what -EPERM means: ipheth_close()
treats the blocked resubmit as the intended outcome, while
ipheth_rx_submit() reports it as a device error.  Would it be worth teaching
ipheth_rx_submit() (or the rx_submit path in ipheth_rcvbulk_callback()) to
skip the dev_err() for -EPERM?

Related to that, ipheth_rcvbulk_callback() discards the return value of
ipheth_rx_submit(), so the now-expected -EPERM and a genuine failure such
as -ENOMEM, which leaves RX dead until the next ipheth_open(), are treated
identically.  Should the callback distinguish them?

Should the commit message also mention the new log output on the close path?
-- 
pw-bot: cr

      reply	other threads:[~2026-09-04 22:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  5:06 raoxu
2026-09-04 22:43 ` Jakub Kicinski [this message]

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=20260904224357.4041665-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=raoxu@uniontech.com \
    --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

all inboxes | Powered by JetHome®