summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAyush Sawal <ayush.sawal@chelsio.com>2021-01-06 09:59:11 +0530
committerJakub Kicinski <kuba@kernel.org>2021-01-07 17:06:02 -0800
commiteade1e0a4fb31d48eeb1589d9bb859ae4dd6181d (patch)
tree93b01c5cf2261ebe22f652ae2e554b0e9afb6c5c /drivers
parenta84b2c0d5fa23da6d6c8c0d5f5c93184a2744d3e (diff)
downloadlinux-eade1e0a4fb31d48eeb1589d9bb859ae4dd6181d.tar.bz2
chtls: Added a check to avoid NULL pointer dereference
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
index ff3969a24d74..1c6d3c93a0c8 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c
@@ -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);