]> git.baikalelectronics.ru Git - kernel.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)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 Jan 2021 01:06:02 +0000 (17:06 -0800)
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: d389a7c785e7 ("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>
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c

index ff3969a24d749ce56a3d3d5d75d6f7622786675b..1c6d3c93a0c828ce0761cbbf6406722e6a862002 100644 (file)
@@ -1597,6 +1597,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);