[PATCH 4.19 26/32] chelsio/chtls: fix panic during unload reload chtls

From: Greg Kroah-Hartman
Date: Sun Dec 06 2020 - 06:41:23 EST


From: Vinay Kumar Yadav <vinay.yadav@xxxxxxxxxxx>

[ Upstream commit e3d5e971d2f83d8ddd4b91a50cea4517fb488383 ]

there is kernel panic in inet_twsk_free() while chtls
module unload when socket is in TIME_WAIT state because
sk_prot_creator was not preserved on connection socket.

Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
Signed-off-by: Udai Sharma <udai.sharma@xxxxxxxxxxx>
Signed-off-by: Vinay Kumar Yadav <vinay.yadav@xxxxxxxxxxx>
Link: https://lore.kernel.org/r/20201125214913.16938-1-vinay.yadav@xxxxxxxxxxx
Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/crypto/chelsio/chtls/chtls_cm.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
+++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
@@ -1079,6 +1079,7 @@ static struct sock *chtls_recv_sock(stru

oreq->ts_recent = PASS_OPEN_TID_G(ntohl(req->tos_stid));
sk_setup_caps(newsk, dst);
+ newsk->sk_prot_creator = lsk->sk_prot_creator;
csk->sk = newsk;
csk->passive_reap_next = oreq;
csk->tx_chan = cxgb4_port_chan(ndev);