From: sashiko-bot@kernel.org
To: "Birger Koblitz" <mail@birger-koblitz.de>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net-next v18 03/13] ax88179_178a: Split driver into library and device specific code
Date: Fri, 09 Oct 2026 03:51:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-164792@kernel.org> (raw)
In-Reply-To: <20261008-ax88179a-v18-3-6fa1d4c40422@birger-koblitz.de>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] net: incomplete locking of AX_MEDIUM_STATUS_MODE using medium_status_mutex
- [Medium] net: logic error evaluating old MTU value for jumbo frame config
- [Medium] net: ax88179: data race on rxctl between set_multicast and link_reset
--
commit c3c28c1c33511966acdb47b60e1d21464314591e
Author: Birger Koblitz <mail@birger-koblitz.de>
Subject: ax88179_178a: Split driver into library and device specific code
This commit splits the ax88179_178a module code into a common library for the
AX88179/178a/179a and 279 controllers, and device-specific code. The module
is renamed to ax88179 to reflect the broader scope.
> diff --git a/drivers/net/usb/ax88179_lib.c b/drivers/net/usb/ax88179_lib.c
> --- /dev/null
> +++ b/drivers/net/usb/ax88179_lib.c
[ ... ]
> +void ax88179_set_multicast(struct net_device *net)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + struct ax88179_data *data = dev->driver_priv;
[ ... ]
> + if (net->flags & IFF_PROMISC) {
> + data->rxctl |= AX_RX_CTL_PRO;
> + } else if (net->flags & IFF_ALLMULTI ||
[ ... ]
> + data->rxctl |= AX_RX_CTL_AM;
> + }
> +
> + ax88179_write_cmd_async(dev, AX_ACCESS_MAC, AX_RX_CTL,
> + 2, 2, &data->rxctl);
> +}
[Severity: Medium]
Can a data race occur on rxctl between this asynchronous write and the
synchronous write in ax88179_link_reset()?
The ax88179_link_reset() function runs in a workqueue and reads
ax179_data->rxctl to write it synchronously to the hardware. Since
ax88179_set_multicast() runs in softirq context, it can preempt
ax88179_link_reset().
If ax88179_set_multicast() interrupts ax88179_link_reset() after the
latter has read ax179_data->rxctl but before its synchronous USB
control message is submitted:
1. ax88179_set_multicast() updates ax179_data->rxctl and enqueues an
asynchronous write URB.
2. ax88179_link_reset() resumes and submits a synchronous write URB
with the old rxctl value.
The host controller will execute the async URB first and the sync URB
second. Could this revert the hardware to the old multicast configuration
while the driver state retains the new configuration, potentially causing
dropped multicast packets until the configuration is changed again?
[ ... ]
> +int ax88179_change_mtu(struct net_device *net, int new_mtu)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + struct ax88179_data *data;
> + u16 tmp16;
> + int err;
> +
> + data = dev->driver_priv;
> + mutex_lock(&data->medium_status_mutex);
[Severity: High]
Is this mutex fully protecting the AX_MEDIUM_STATUS_MODE register?
This newly added medium_status_mutex correctly serializes accesses to
the AX_MEDIUM_STATUS_MODE register in ax88179_change_mtu(). However,
other functions like ax88179_link_reset(), ax88179_net_reset(), and
ax88179_stop() perform read-modify-write operations on the exact same
register without acquiring this mutex.
Since ax88179_link_reset() is executed asynchronously from the
usbnet_deferred_kevent workqueue, could it overlap with
ax88179_change_mtu() and cause concurrent lockless modifications
to clobber the MTU or link duplex settings in the hardware?
> + if (net->mtu > 1500) {
[Severity: Medium]
Does this check the old MTU value instead of the new one?
Because WRITE_ONCE(net->mtu, new_mtu) was moved to the end of
ax88179_change_mtu(), this condition evaluates the old net->mtu value.
If the MTU is being increased from 1500 to 9000, jumbo frames would
be incorrectly left disabled in hardware. Conversely, if it is being
decreased from 9000 to 1500, they would be incorrectly left enabled.
> + err = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
> + 2, 2, &tmp16);
[ ... ]
> + tmp16 &= ~AX_MEDIUM_JUMBO_EN;
> + err = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
> + 2, 2, &tmp16);
> + if (err < 0)
> + goto err_out;
> + }
> + WRITE_ONCE(net->mtu, new_mtu);
> + dev->hard_mtu = net->mtu + net->hard_header_len;
> + mutex_unlock(&data->medium_status_mutex);
> +
> + /* max qlen depend on hard_mtu and rx_urb_size */
> + usbnet_update_max_qlen(dev);
> +
> + return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-ax88179a-v18-0-6fa1d4c40422@birger-koblitz.de?part=3
next prev parent reply other threads:[~2026-10-09 3:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 3:51 [PATCH net-next v18 00/13] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-10-08 3:51 ` [PATCH net-next v18 01/13] phylink: Add phylink_mac_interrupt Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 02/13] phylib: Add support for PHYs with broken forced mode Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 03/13] ax88179_178a: Split driver into library and device specific code Birger Koblitz
2026-10-09 3:51 ` sashiko-bot [this message]
2026-10-08 3:51 ` [PATCH net-next v18 04/13] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 05/13] ax88179_178a: Add EEE configuration support for AX88179A MACs Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 06/13] ax88179_178a: Add EEE configuration support for AX88179A PHYs Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 07/13] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 08/13] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 09/13] ax88179_178a: Add Suspend/resume support for AX88179A/772D/279 Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 10/13] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 11/13] ax88179_178a: Update driver name and information Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 12/13] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
2026-10-08 3:51 ` [PATCH net-next v18 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279 Birger Koblitz
2026-10-09 3:51 ` sashiko-bot
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=sashiko-outbox-164792@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mail@birger-koblitz.de \
--cc=sashiko-reviews@lists.linux.dev \
/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