Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp26910pxb; Fri, 15 Jan 2021 05:03:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo54OoL5HDZqdKgWRGxGutRibN68Msz9K7G0rZILnFP0AxZRf479Hu1/blCw5DoJAn29bQ X-Received: by 2002:a50:a684:: with SMTP id e4mr9406968edc.148.1610715812585; Fri, 15 Jan 2021 05:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715812; cv=none; d=google.com; s=arc-20160816; b=uD4VJrphzNI8Z3hAGfoAAvNcpQNtySU9dUQFoN3twbgW+H+7R157xEkmkRHU8qTKY+ fsmyC93LINRhV9nxXa2eqKIN2EtTKYm5Fy4VGgNq/4K6CSJxrn1/H5Q4JB09ym6A4Gy+ eqXqy8W0OiGKVfAWMribGEGQvjoNqcG2uDKQ3zbRM8VidK+KMCkzHjZTn80fCZFFwdQy JxKdSplXa4RzZ4ERejLP/PJAFMnN4mD7ItFc10c8K8tj4WBreg50z1e3pP1UZyliiDB5 gNsfB//1ZjyWJH5AgkqnEtxrWREUAwwSKmyzvcL/g98cw5XcUPz801YYEatk2O/qxLHb b6Fw== 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=7U3B9j8S5jgaIAFzjNRIXVQKCtgJfcqrCJ4WE/rpqAI=; b=1EEAb6DRej6ozCoOEqi8A28O7eoE+2699BbmI7sFoiupnHTFh++swhNRyggQhAlM+J +vYphArHyt55FzPqKP7nsaD879I02kzK8iP3RXFFrOdGZvFmSpdcJ70igJzw0g/oqq4J HOOqUCISd/qRAtkdQAvCy63FmoC05p88KzNghFaA/TpUPFQJuRq08vIjXhI0SusAe4na qVAq5mY2CNkkCwV4w77ssLVB7lr3n7tqH7uSUSz2qfHMmwT7RIwHjlXcqBrFo4QsKvN9 8gwVdqoyW3jIn2ZI9CqSlS+iZ1gas9/Lyg81ZnHg9dmt6fZs0+Sl/dpBmPu4j/flLlhW 0W0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wxvI6G8p; 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 m1si3630532eja.95.2021.01.15.05.03.08; Fri, 15 Jan 2021 05:03:32 -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=wxvI6G8p; 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 S1733033AbhAOMcy (ORCPT + 99 others); Fri, 15 Jan 2021 07:32:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:39656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733017AbhAOMcw (ORCPT ); Fri, 15 Jan 2021 07:32:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 52EB8235F8; Fri, 15 Jan 2021 12:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713931; bh=earb/xTFB38cqQE7OvLBkid4oTdP+Gzcbt67FueACao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wxvI6G8pmfuAK2Y5raGEiSJu/wmw0rr1235FliVEia6EvPG2vemvZxWHs54APb/P6 oDTeOpp9ODk1XjbhEFW7z7N7OWxXITd1kdA/K5u5SDILcX1g4Os/B4SIN4r/wD37h/ 9Wr93OOAxKHdTou+NHAKJ2BQR5H++f2GHnx7qQzA= 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 4.19 14/43] chtls: Added a check to avoid NULL pointer dereference Date: Fri, 15 Jan 2021 13:27:44 +0100 Message-Id: <20210115121957.733857231@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121957.037407908@linuxfoundation.org> References: <20210115121957.037407908@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 @@ -1432,6 +1432,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);