Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Birger Koblitz" <mail@birger-koblitz.de>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net-next v18 07/13] ax88179_178a: Add VLAN offload support for AX88179A
Date: Fri, 09 Oct 2026 03:51:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-164793@kernel.org> (raw)
In-Reply-To: <20261008-ax88179a-v18-7-6fa1d4c40422@birger-koblitz.de>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] net: usb: ax88179a: missing WE command in VLAN filter table init loop
- [Medium] net: usb: ax88179a: ignored USB write errors in VLAN filter init
- [Medium] net: usb: ax88179a: uninitialized stack memory use on short USB read
--

commit 86960e6590c9a326bcedbb3ba8fde9f53c488e20
Author: Birger Koblitz <mail@birger-koblitz.de>

    ax88179_178a: Add VLAN offload support for AX88179A
    
    The AX88179A-based chips support VLAN offload. Add configuration
    support in netdev_ops. Features supported are:
    NETIF_F_HW_VLAN_CTAG_TX, NETIF_F_HW_VLAN_CTAG_RX
    and NETIF_F_HW_VLAN_CTAG_FILTER.

> diff --git a/drivers/net/usb/ax88179a_devices.c b/drivers/net/usb/ax88179a_devices.c
> index c41d9c2dc737a..bdc67cbc17287 100644
> --- a/drivers/net/usb/ax88179a_devices.c
> +++ b/drivers/net/usb/ax88179a_devices.c
> @@ -258,6 +258,88 @@ static const struct ethtool_ops ax88179a_ethtool_ops = {
>  	.get_ts_info		= ethtool_op_get_ts_info,
>  };
>  
> +static int ax88179a_vlan_rx_kill_vid(struct net_device *net, __be16 proto, u16 vid)
> +{
> +	struct usbnet *dev = netdev_priv(net);
> +	u8 vlan_ctrl;
> +	int ret = 0;
> +	u16 reg16;
> +	u8 reg8;
> +
> +	ret = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX88179A_VLAN_ID_CONTROL, 1, 1, &reg8);
> +	if (ret < 0)
> +		return ret;

[Severity: Medium]
If a malicious or buggy USB device responds to the read request with a
zero-length packet, ax88179_read_cmd() will return 0 and skip copying data,
leaving reg8 uninitialized.

Since the error check only verifies if ret < 0, does this allow uninitialized
stack memory to be used for hardware control and eventually written back to
the MAC? This also applies to the reads in ax88179a_vlan_rx_add_vid() and
ax88179a_set_features().

[ ... ]
> +static int ax88179a_set_features(struct net_device *net, netdev_features_t features)
> +{
> +	struct usbnet *dev = netdev_priv(net);
> +	netdev_features_t changed;
> +	int ret;
> +	u8 tmp;
> +
> +	changed = net->features ^ features;
> +
> +	ret = ax88179_set_features(net, features);
> +	if (ret)
> +		return ret;
> +
> +	if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) {
> +		if (features & NETIF_F_HW_VLAN_CTAG_FILTER) {
> +			for (int i = 0; i < 256; i++) {
> +				/* Address */
> +				tmp = i;
> +				ax88179_write_cmd(dev, AX_ACCESS_MAC, AX88179A_VLAN_ID_ADDRESS,
> +						  1, 1, &tmp);
> +				/* Data */
> +				ax88179_write_u16(dev, AX_ACCESS_MAC, AX88179A_VLAN_ID_DATA0,
> +						  2, 0);
> +			}

[Severity: Medium]
These ax88179_write_cmd() and ax88179_write_u16() calls lack error checking.
Could this prevent an early abort on device disconnect or hardware failure,
resulting in the thread blocking through 512 failing USB control transfers?

[Severity: High]
Does this loop fail to actually initialize the hardware filter table for the
first 255 entries?

The write enable command (AX_VLAN_CONTROL_WE) is only sent once after the
loop finishes, which suggests that only the last address (255) is written
to the SRAM while the first 255 entries are ignored. Should the WE trigger be
included inside the loop?

> +			ret = ax88179_read_cmd(dev, AX_ACCESS_MAC,
> +					       AX88179A_VLAN_ID_CONTROL, 1, 1, &tmp);
> +			if (ret < 0)
> +				return ret;
> +			tmp |= AX_VLAN_CONTROL_VFE | AX_VLAN_CONTROL_WE;
> +			ret = ax88179_write_cmd(dev, AX_ACCESS_MAC,
> +						AX88179A_VLAN_ID_CONTROL, 1, 1, &tmp);
> +			if (ret < 0)
> +				return ret;
> +		} else {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-ax88179a-v18-0-6fa1d4c40422@birger-koblitz.de?part=7

  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
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 [this message]
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-164793@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