Skip to content

Commit c3b26fd

Browse files
Linyu Yuandavem330
authored andcommitted
net: cdc_eem: fix tx fixup skb leak
when usbnet transmit a skb, eem fixup it in eem_tx_fixup(), if skb_copy_expand() failed, it return NULL, usbnet_start_xmit() will have no chance to free original skb. fix it by free orginal skb in eem_tx_fixup() first, then check skb clone status, if failed, return NULL to usbnet. Fixes: 9f722c0 ("usbnet: CDC EEM support (v5)") Signed-off-by: Linyu Yuan <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bc39f67 commit c3b26fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/usb/cdc_eem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
123123
}
124124

125125
skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
126+
dev_kfree_skb_any(skb);
126127
if (!skb2)
127128
return NULL;
128129

129-
dev_kfree_skb_any(skb);
130130
skb = skb2;
131131

132132
done:

0 commit comments

Comments
 (0)