From: Oliver Neukum <oneukum@suse.com>
To: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>, greg@kroah.com
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
netdev@vger.kernel.org, oneukum@suse.com, pabeni@redhat.com,
stern@rowland.harvard.edu, stable@vger.kernel.org
Subject: Re: [PATCH v3] net: usb: ax88179_178a: avoid failed operations when device is disconnected
Date: Fri, 1 Dec 2023 21:14:46 +0100 [thread overview]
Message-ID: <4ce32363-378c-4ea3-9a4e-d7274d4f7787@suse.com> (raw)
In-Reply-To: <20231201132647.178979-1-jtornosm@redhat.com>
On 01.12.23 14:26, Jose Ignacio Tornos Martinez wrote:
Hi,
this is much better.
> @@ -1661,14 +1668,19 @@ static int ax88179_reset(struct usbnet *dev)
>
> static int ax88179_stop(struct usbnet *dev)
> {
> + struct ax88179_data *ax179_data = dev->driver_priv;
> u16 tmp16;
>
> + ax179_data->stopping_unbinding = 1;
This is problematic. ndo_stop() is not limited to disconnection.
It is also used whenever an interface transitions from up to down.
> +
> ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
> 2, 2, &tmp16);
> tmp16 &= ~AX_MEDIUM_RECEIVE_EN;
> ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
> 2, 2, &tmp16);
>
> + ax179_data->stopping_unbinding = 0;
> +
> return 0;
> }
>
On a general note, you are going for a belt and suspenders approach.
It seems to me that you have two options.
1. Do as Alan suggested and ignore ENODEV. You'd be acknowledging that
these devices are hotpluggable and therefore -ENODEV is not an error
2. Use only a flag. But if you do that, you are setting it in the wrong
place. It should be set in usbnet_disconnect()
O and, well, this is a very mior issue, but you've introduced a memory
ordering issue. You ought to use smp_wmb() after setting the flag and
smp_rmb() before reading it.
Regards
Oliver
next prev parent reply other threads:[~2023-12-01 20:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 15:16 [PATCH] net: usb: ax88179_178a: avoid failed operations when device is disconnected Jose Ignacio Tornos Martinez
2023-11-29 15:33 ` Oliver Neukum
2023-11-29 15:40 ` Alan Stern
2023-11-30 8:41 ` Jose Ignacio Tornos Martinez
2023-11-30 15:50 ` Alan Stern
2023-11-30 17:25 ` Jose Ignacio Tornos Martinez
2023-11-30 18:13 ` Alan Stern
2023-12-01 10:46 ` Jose Ignacio Tornos Martinez
2023-12-01 11:51 ` [PATCH v2] " Jose Ignacio Tornos Martinez
2023-12-01 12:25 ` Greg KH
2023-12-01 13:26 ` [PATCH v3] " Jose Ignacio Tornos Martinez
2023-12-01 16:13 ` Alan Stern
2023-12-01 17:27 ` Jose Ignacio Tornos Martinez
2023-12-01 20:14 ` Oliver Neukum [this message]
2023-12-04 11:31 ` Jose Ignacio Tornos Martinez
2023-12-05 13:51 ` [PATCH v4] " Jose Ignacio Tornos Martinez
2023-12-05 18:07 ` Alan Stern
2023-12-06 12:17 ` Jose Ignacio Tornos Martinez
2023-12-07 11:42 ` [PATCH v5] " Jose Ignacio Tornos Martinez
2023-12-07 16:41 ` Alan Stern
2023-12-07 17:50 ` [PATCH v6] " Jose Ignacio Tornos Martinez
2023-12-07 20:23 ` Alan Stern
2023-12-07 20:32 ` Jakub Kicinski
2023-12-08 4:56 ` Greg KH
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=4ce32363-378c-4ea3-9a4e-d7274d4f7787@suse.com \
--to=oneukum@suse.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=greg@kroah.com \
--cc=jtornosm@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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