staging: rtl8192e: fix potential use after free
authorPan Bian <bianpan2016@163.com>
Tue, 5 Nov 2019 14:49:11 +0000 (22:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:35:20 +0000 (15:35 +0100)
commit401bc84ec5dcc05375045169937b7446fcd70395
treed3d2768a40daba535ab4f33d81520058a557e3a8
parent6d4cfd72ff5639e5c5e7735ecff2fa17ffc5c556
staging: rtl8192e: fix potential use after free

commit b7aa39a2ed0112d07fc277ebd24a08a7b2368ab9 upstream.

The variable skb is released via kfree_skb() when the return value of
_rtl92e_tx is not zero. However, after that, skb is accessed again to
read its length, which may result in a use after free bug. This patch
fixes the bug by moving the release operation to where skb is never
used later.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1572965351-6745-1-git-send-email-bianpan2016@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/rtl_core.c