[PATCH net-next] aqc111: Correct endianness handling in rx/tx_fixup

From: Birger Koblitz

Date: Tue Nov 17 2026 - 13:29:05 EST


The MAC supported by the aqc111 driver is very similar
to the AX88179A. During the development of the driver for
the AX88179A, the following issues in endianness-handling
were found, which are also present in the aqc111 driver:
CHECK drivers/net/usb/aqc111.c
drivers/net/usb/aqc111.c:1094:34: warning: incorrect type in argument 1 (different base types)
drivers/net/usb/aqc111.c:1094:34: expected restricted __le64 const [usertype] *p
drivers/net/usb/aqc111.c:1094:34: got unsigned long long [usertype] *
drivers/net/usb/aqc111.c:1122:45: warning: incorrect type in argument 1 (different base types)
drivers/net/usb/aqc111.c:1122:45: expected restricted __le64 const [usertype] *p
drivers/net/usb/aqc111.c:1122:45: got unsigned long long [usertype] *[assigned] pkt_desc_ptr
drivers/net/usb/aqc111.c:1235:22: warning: incorrect type in assignment (different base types)
drivers/net/usb/aqc111.c:1235:22: expected unsigned long long [usertype]
drivers/net/usb/aqc111.c:1235:22: got restricted __le64 [usertype]

Fix these problems and additionally also make sure that cloned
skbs are always copied for expansion.

Signed-off-by: Birger Koblitz <mail@xxxxxxxxxxxxxxxxx>
---
The MAC supported by the aqc111 driver is very similar
to the AX88179A. During the development of the driver for
the AX88179A, the following issues in endianness-handling
were found, which are also present in the aqc111 driver:
CHECK drivers/net/usb/aqc111.c
drivers/net/usb/aqc111.c:1094:34: warning: incorrect type in argument 1 (different base types)
drivers/net/usb/aqc111.c:1094:34: expected restricted __le64 const [usertype] *p
drivers/net/usb/aqc111.c:1094:34: got unsigned long long [usertype] *
drivers/net/usb/aqc111.c:1122:45: warning: incorrect type in argument 1 (different base types)
drivers/net/usb/aqc111.c:1122:45: expected restricted __le64 const [usertype] *p
drivers/net/usb/aqc111.c:1122:45: got unsigned long long [usertype] *[assigned] pkt_desc_ptr
drivers/net/usb/aqc111.c:1235:22: warning: incorrect type in assignment (different base types)
drivers/net/usb/aqc111.c:1235:22: expected unsigned long long [usertype]
ddrivers/net/usb/aqc111.c:1235:22: got restricted __le64 [usertype]

Fix these problems and additionally also make sure that cloned
skbs are always copied for expansion.
---
drivers/net/usb/aqc111.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index dd53f413c38f6035c18f9922fd4e90d66a73ae53..39d8755ca8e7bff484100f82863cc2ac8582fcc9 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -1074,7 +1074,7 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
struct aqc111_data *aqc111_data = dev->driver_priv;
struct sk_buff *new_skb = NULL;
u32 pkt_total_offset = 0;
- u64 *pkt_desc_ptr = NULL;
+ __le64 *pkt_desc_ptr = NULL;
u32 start_of_descs = 0;
u32 desc_offset = 0; /*RX Header Offset*/
u16 pkt_count = 0;
@@ -1091,7 +1091,7 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)

/* RX Descriptor Header */
skb_trim(skb, skb_len - sizeof(desc_hdr));
- desc_hdr = le64_to_cpup((u64 *)skb_tail_pointer(skb));
+ desc_hdr = get_unaligned_le64((__le64 *)skb_tail_pointer(skb));

/* Check these packets */
desc_offset = (desc_hdr & AQ_RX_DH_DESC_OFFSET_MASK) >>
@@ -1116,10 +1116,10 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
goto err;

/* Get the first RX packet descriptor */
- pkt_desc_ptr = (u64 *)(skb->data + desc_offset);
+ pkt_desc_ptr = (__le64 *)(skb->data + desc_offset);

while (pkt_count--) {
- u64 pkt_desc = le64_to_cpup(pkt_desc_ptr);
+ u64 pkt_desc = get_unaligned_le64(pkt_desc_ptr);
u32 pkt_len_with_padd = 0;
u32 pkt_len = 0;

@@ -1220,7 +1220,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);
@@ -1232,7 +1233,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);

usbnet_set_skb_tx_stats(skb, 1, 0);


---
base-commit: 805185b7c7a1069e407b6f7b3bc98e44d415f484
change-id: 20261117-aqc111-b0cf408d776b

Best regards,
--
Birger Koblitz <mail@xxxxxxxxxxxxxxxxx>