]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: cdc_eem: fix tx fixup skb leak
authorLinyu Yuan <linyyuan@codeaurora.org>
Wed, 16 Jun 2021 23:32:32 +0000 (07:32 +0800)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:48:21 +0000 (08:48 -0400)
commitf4e6a7f19c82f39b1803e91c54718f0d7143767d
treecd0032b97c5866f5c6ea9685b4328f5c8e93e799
parentc16c4716a1b5ba4f83c7e00da457cba06761f119
net: cdc_eem: fix tx fixup skb leak

[ Upstream commit c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7 ]

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: 9f722c0978b0 ("usbnet: CDC EEM support (v5)")
Signed-off-by: Linyu Yuan <linyyuan@codeaurora.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/cdc_eem.c