Skip to content

Commit 4ce62d5

Browse files
edumazetkuba-moo
authored andcommitted
net: usb: ax88179_178a: stop lying about skb->truesize
Some usb drivers try to set small skb->truesize and break core networking stacks. In this patch, I removed one of the skb->truesize overide. I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c611 ("net: cdc_ncm: reduce skb truesize in rx path") Fixes: f8ebb3a ("net: usb: ax88179_178a: Fix packet receiving") Reported-by: shironeko <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Signed-off-by: Eric Dumazet <[email protected]> Cc: Jose Alonso <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 58a4c9b commit 4ce62d5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/net/usb/ax88179_178a.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,21 +1456,16 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
14561456
/* Skip IP alignment pseudo header */
14571457
skb_pull(skb, 2);
14581458

1459-
skb->truesize = SKB_TRUESIZE(pkt_len_plus_padd);
14601459
ax88179_rx_checksum(skb, pkt_hdr);
14611460
return 1;
14621461
}
14631462

1464-
ax_skb = skb_clone(skb, GFP_ATOMIC);
1463+
ax_skb = netdev_alloc_skb_ip_align(dev->net, pkt_len);
14651464
if (!ax_skb)
14661465
return 0;
1467-
skb_trim(ax_skb, pkt_len);
1466+
skb_put(ax_skb, pkt_len);
1467+
memcpy(ax_skb->data, skb->data + 2, pkt_len);
14681468

1469-
/* Skip IP alignment pseudo header */
1470-
skb_pull(ax_skb, 2);
1471-
1472-
skb->truesize = pkt_len_plus_padd +
1473-
SKB_DATA_ALIGN(sizeof(struct sk_buff));
14741469
ax88179_rx_checksum(ax_skb, pkt_hdr);
14751470
usbnet_skb_return(dev, ax_skb);
14761471

0 commit comments

Comments
 (0)