Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp11410pxb; Fri, 15 Jan 2021 04:37:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOtuktU4PrMXPkf8dTKdlbUQnBYJ37OjFeTCur7PiKPK7ZfcQuPLCjEY8Gw/b/2LmvW3Wa X-Received: by 2002:a17:906:a48:: with SMTP id x8mr8554733ejf.444.1610714262566; Fri, 15 Jan 2021 04:37:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610714262; cv=none; d=google.com; s=arc-20160816; b=YwpXrCgDzeiSGaGTumrWSOJ78vztiiu5YM+/KALKikn/OcJPO7QU7ZRDhdZCEL/cs2 y6ZCwlk5OMo5fw8EeFIQcelyfWkV2LclMnS5Qb7xngYaV7fqLiNo9gs8ruK7WqdekyOA SB9cNL7Uc4yVDj7BMbHQg35cAbsJjIhDRSSIGtfWv6nnoX0kap/l/Mt7BV9mRTy/FRmt PrgikSIgUBpqjNt7XoZVH3Jw4MJwKm5nUJjon4SXjTzkxSxWzlr/cBsnBtriMtvTNoaK xWmiXpEC4tS8slDNeKT9aV/jCJO2XSBTmLJq/jMWblqsIBB/Y2IsnIKHD2ym9OLz8ZDR VwIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uL5bPsGcOIVmTDot7+l662uDgqO6z0QR56/35HV6Vew=; b=IJSV5lTTNk13u3S6vbqBJrCED7StR6y9UjUxmE9qe4diZaholhMob6snt8hL+qB2lK yo26N14zApQyl4Mk4/qEYpyQ7X9slJsveG3PEcoj0Tigt7ItyzNvsscKgW1Z5iDyf2/v YcRJDF1+1dEMShpeGpAn+D/BFVGReB6Am0JCBf0oRT2+ou8oVpNEFwRozVJIwll7FuSR E1aHq647gPzhZf2DcnwdEWXElCYadY5gVA4e8o+No0pqkh7/+FHp6HZuagFKhTDMxXjA 5sulCFfqcFctTro3Hsa5XjvhM+b1ACjr31i48RkG2k0gGP9rqhOIQigFs0XuzIFkpZwN MzGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tE6AJ6eX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si3918176ede.511.2021.01.15.04.37.17; Fri, 15 Jan 2021 04:37:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tE6AJ6eX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732283AbhAOMen (ORCPT + 99 others); Fri, 15 Jan 2021 07:34:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:41098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387478AbhAOMe1 (ORCPT ); Fri, 15 Jan 2021 07:34:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DA6FC2333E; Fri, 15 Jan 2021 12:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714052; bh=jcDxPuI8kFi/4vR0wJ+4fyZUtgphhDaIWa6HcUwqB2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tE6AJ6eX2x+OzCR7N7PFLR3YY8x0nr10EM/I+iwhfmgXciXf5QpZelUsU+X132Yu2 p8b4IU5lm6V57/choq0BAndNqoOdyE72e4du2MQgAxTrO3BrLRbGJOsORfddU48J28 W/mDuGRMzjU8G+zorAc4PU8dKxZosTxBxqGY2EpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vinay Kumar Yadav , Ayush Sawal , Jakub Kicinski Subject: [PATCH 5.4 25/62] chtls: Added a check to avoid NULL pointer dereference Date: Fri, 15 Jan 2021 13:27:47 +0100 Message-Id: <20210115121959.622586303@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ayush Sawal [ 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 Signed-off-by: Ayush Sawal Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -1453,6 +1453,11 @@ static int chtls_pass_establish(struct c 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);