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 v2] aqc111: Fix rx/tx_fixup issues
Date: Mon, 23 Nov 2026 11:10:05 +0000	[thread overview]
Message-ID: <sashiko-outbox-229100@kernel.org> (raw)
In-Reply-To: <20261122-aqc111-v2-1-52d5ddb17a37@birger-koblitz.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: usb: aqc111: unnecessary skb_copy_expand() in
  aqc111_tx_fixup()
--

commit 72c72c17e1d18f31f018cbdd222d6325ba34956e
Author: Birger Koblitz <mail@birger-koblitz.de>

aqc111: Fix rx/tx_fixup issues

This commit uses unaligned little-endian helpers for RX and TX descriptors,
checks for cloned skbs in aqc111_tx_fixup(), and validates minimum packet
length in aqc111_rx_fixup().

> diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
> index 12a99df77f0d3..ee7c8bb858458 100644
> --- a/drivers/net/usb/aqc111.c
> +++ b/drivers/net/usb/aqc111.c
[ ... ]
> @@ -1224,7 +1225,8 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
>  	headroom = skb_headroom(skb);
>  	tailroom = skb_tailroom(skb);
>  
> -	if (!(headroom >= sizeof(tx_desc) && tailroom >= padding_size)) {
> +	if (skb_cloned(skb) ||
> +	    !(headroom >= sizeof(tx_desc) && tailroom >= padding_size)) {
>  		new_skb = skb_copy_expand(skb, sizeof(tx_desc),
>  					  padding_size, flags);
>  		dev_kfree_skb_any(skb);
> @@ -1236,7 +1238,7 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
>  		skb_put_zero(skb, padding_size);
>  	/* Copy TX header */
>  	tx_desc_ptr = skb_push(skb, sizeof(tx_desc));
> -	*tx_desc_ptr = cpu_to_le64(tx_desc);
> +	put_unaligned_le64(tx_desc, tx_desc_ptr);

[Severity: Medium]
Does checking skb_cloned(skb) unconditionally force skb_copy_expand() on
every TCP packet even when padding_size == 0?

Outgoing TCP skbs arrive cloned from __tcp_transmit_skb(), but
tcp_skb_entail() calls __skb_header_release(), so skb_header_cloned(skb)
is false and the headroom reserved via needed_headroom is unshared.  When
padding_size == 0, aqc111_tx_fixup() only pushes tx_desc into headroom and
never touches the tail, yet this check now copies and linearizes all such
TCP packets (including nonlinear SG/TSO packets when dev->can_dma_sg is
set) under GFP_ATOMIC instead of transmitting their fragments via
build_dma_sg().

Should this check skb_header_cloned(skb) || (padding_size &&
skb_cloned(skb)), matching asix_tx_fixup()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261122-aqc111-v2-1-52d5ddb17a37@birger-koblitz.de?part=1

      parent reply	other threads:[~2026-11-23 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 11:09 [PATCH net-next v2] aqc111: Fix rx/tx_fixup issues Birger Koblitz
2026-11-22 11:13 ` netdev-bot+sinfo
2026-11-23 11:10 ` sashiko-bot [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=sashiko-outbox-229100@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