* [PATCH net] chelsio/chtls: fix a double free in chtls_setkey()
@ 2020-12-03 8:44 Dan Carpenter
2020-12-03 18:55 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-12-03 8:44 UTC (permalink / raw)
To: Ayush Sawal, Atul Gupta
Cc: Vinay Kumar Yadav, Rohit Maheshwari, David S. Miller,
Jakub Kicinski, Herbert Xu, netdev, kernel-janitors
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>
---
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c
index 62c829023da5..a4fb463af22a 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c
@@ -391,6 +391,7 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen,
csk->wr_unacked += DIV_ROUND_UP(len, 16);
enqueue_wr(csk, skb);
cxgb4_ofld_send(csk->egress_dev, skb);
+ skb = NULL;
chtls_set_scmd(csk);
/* Clear quiesce for Rx key */
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] chelsio/chtls: fix a double free in chtls_setkey()
2020-12-03 8:44 [PATCH net] chelsio/chtls: fix a double free in chtls_setkey() Dan Carpenter
@ 2020-12-03 18:55 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-12-03 18:55 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ayush Sawal, Atul Gupta, Vinay Kumar Yadav, Rohit Maheshwari,
David S. Miller, Herbert Xu, netdev, kernel-janitors
On Thu, 3 Dec 2020 11:44:31 +0300 Dan Carpenter wrote:
> 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>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-03 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 8:44 [PATCH net] chelsio/chtls: fix a double free in chtls_setkey() Dan Carpenter
2020-12-03 18:55 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).