]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
chtls: Added a check to avoid NULL pointer dereference
authorAyush Sawal <ayush.sawal@chelsio.com>
Wed, 6 Jan 2021 04:29:11 +0000 (09:59 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Jan 2021 13:04:20 +0000 (14:04 +0100)
[ Upstream commit eade1e0a4fb31d48eeb1589d9bb859ae4dd6181d ]

In case of server removal lookup_stid() may return NULL pointer, which
is used as listen_ctx. So added a check before accessing this pointer.

Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/chelsio/chtls/chtls_cm.c

index 385bb5eb9531e26edd1b9a236021fc901e2ae499..050c7ebf6a4f4f6b3df683bbc4b0de9578d65fcd 100644 (file)
@@ -1432,6 +1432,11 @@ static int chtls_pass_establish(struct chtls_dev *cdev, struct sk_buff *skb)
                        sk_wake_async(sk, 0, POLL_OUT);
 
                data = lookup_stid(cdev->tids, stid);
+               if (!data) {
+                       /* listening server close */
+                       kfree_skb(skb);
+                       goto unlock;
+               }
                lsk = ((struct listen_ctx *)data)->lsk;
 
                bh_lock_sock(lsk);