Subject: CVE-2021-47236: net: cdc_eem: fix tx fixup skb leak

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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.

The Linux kernel CVE team has assigned CVE-2021-47236 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 4.4.274 with commit f12554b0ff63
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 4.9.274 with commit 14184ec5c958
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 4.14.238 with commit 1bcacd6088d6
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 4.19.196 with commit f4e6a7f19c82
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 5.4.128 with commit 81de2ed06df8
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 5.10.46 with commit 05b2b9f7d24b
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 5.12.13 with commit b4f7a9fc9d09
	Issue introduced in 2.6.30 with commit 9f722c0978b0 and fixed in 5.13 with commit c3b26fdf1b32

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47236
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/net/usb/cdc_eem.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/f12554b0ff639e74612cc01b3b4a049e098d2d65
	https://git.kernel.org/stable/c/14184ec5c958b589ba934da7363a2877879204df
	https://git.kernel.org/stable/c/1bcacd6088d61c0ac6a990d87975600a81f3247e
	https://git.kernel.org/stable/c/f4e6a7f19c82f39b1803e91c54718f0d7143767d
	https://git.kernel.org/stable/c/81de2ed06df8b5451e050fe6a318af3263dbff3f
	https://git.kernel.org/stable/c/05b2b9f7d24b5663d9b47427fe1555bdafd3ea02
	https://git.kernel.org/stable/c/b4f7a9fc9d094c0c4a66f2ad7c37b1dbe9e78f88
	https://git.kernel.org/stable/c/c3b26fdf1b32f91c7a3bc743384b4a298ab53ad7