]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
chelsio/chtls: fix a double free in chtls_setkey()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 3 Dec 2020 08:44:31 +0000 (11:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Dec 2020 09:42:03 +0000 (10:42 +0100)
commit2f8a3f6b2d4bf255b3852beda8561a1e76fc2d22
tree6d189178ed9e69a1cae8b5084f9048de6b9e2ce8
parent1f8846e3fd6ac328ea492ff17e3afd26ba9d5b2f
chelsio/chtls: fix a double free in chtls_setkey()

[ Upstream commit 391119fb5c5c4bdb4d57c7ffeb5e8d18560783d1 ]

The "skb" is freed by the transmit code in cxgb4_ofld_send() and we
shouldn't use it again.  But in the current code, if we hit an error
later on in the function then the clean up code will call kfree_skb(skb)
and so it causes a double free.

Set the "skb" to NULL and that makes the kfree_skb() a no-op.

Fixes: d25f2f71f653 ("crypto: chtls - Program the TLS session Key")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X8ilb6PtBRLWiSHp@mwanda
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/chelsio/chtls/chtls_hw.c