Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1679554pxu; Sun, 6 Dec 2020 03:50:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfk58pAegsf0JXwpFLPaPWR2QjCRskDARt84bI/VkDsHfAOx8BNUEI4jgY6OR3DoudJBpY X-Received: by 2002:a17:906:2806:: with SMTP id r6mr13864623ejc.130.1607255408098; Sun, 06 Dec 2020 03:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255408; cv=none; d=google.com; s=arc-20160816; b=GP4uvXEImh4Ds/zCAgObCtL4ofy+sn5dmdZrxcdms4nzRiBd3TWOyIwyMsQr4gvoCk MdlfVJDz3QajK7f/cWIEW8wYgNG7AEOljdWxl85TeayQqORziDg/WCTKTROluwtpObGl pwlYrUX1fnAti62oXkiDsiuSGBujURHb7QxEbfp5ruMmBr+xl5V1CnJZ3yYDuqX5os8a IweYalxNK0wI0xjL3C5AR4sRfNMukLp/2zj+20sg+7zt2+fzU++LQhFaq2cc0si2KSQd I7558broWSls00xTJbYTQgtTSZKbnHrDOoniK6+ttydUN4+gH9BW9idzOHh7NXHe5w77 C88g== 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; bh=zlR8LnNdBB5UIpKJavT7FfBlYRwQfuQ34wSH1X2xa68=; b=M/tJeC9g0y/lFoIHfoeTQn5AEaYCdffz9DPLbVCB5ZJhFxqK7Ij2CCEKUTzbDbnUJt gWKKbYZmsJI5b7Npj4YQVnHQgCch4ESPC9HF8Q+h64EKkPqNyHc9cdMmYoPdu/hMqDgC 0B9A3NB9h24jVgAMbti3jSMn59TMx62qn+jJrewUggNLSYXcf5pfcj5YHD7HbzRIBDzD d2GBmSHCF7/fWQApeK3UMRKWVWs/p6pWFIA5MMngsN2dBXOCOstDobHLI7zI3ETksa7A auWTOWX/u9DJc4DUiyzVHoQexAIl5bUJ7618Wdv+Qm1EYlDfeWlTO+nZbjvXM6HAzVrf 2VFQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 v4si7986084edj.57.2020.12.06.03.49.45; Sun, 06 Dec 2020 03:50:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728025AbgLFLrb (ORCPT + 99 others); Sun, 6 Dec 2020 06:47:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:42336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729083AbgLFLnG (ORCPT ); Sun, 6 Dec 2020 06:43:06 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jakub Kicinski Subject: [PATCH 5.4 28/39] chelsio/chtls: fix a double free in chtls_setkey() Date: Sun, 6 Dec 2020 12:17:32 +0100 Message-Id: <20201206111556.034502192@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111554.677764505@linuxfoundation.org> References: <20201206111554.677764505@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: Dan Carpenter [ Upstream commit 391119fb5c5c4bdb4d57c7ffeb5e8d18560783d1 ] The "skb" is freed by the transmit code in cxgb4_ofld_send() and we shouldn't use it again. But in the current code, if we hit an error later on in the function then the clean up code will call kfree_skb(skb) and so it causes a double free. Set the "skb" to NULL and that makes the kfree_skb() a no-op. Fixes: d25f2f71f653 ("crypto: chtls - Program the TLS session Key") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/X8ilb6PtBRLWiSHp@mwanda Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_hw.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/crypto/chelsio/chtls/chtls_hw.c +++ b/drivers/crypto/chelsio/chtls/chtls_hw.c @@ -365,6 +365,7 @@ int chtls_setkey(struct chtls_sock *csk, csk->wr_unacked += DIV_ROUND_UP(len, 16); enqueue_wr(csk, skb); cxgb4_ofld_send(csk->egress_dev, skb); + skb = NULL; chtls_set_scmd(csk); /* Clear quiesce for Rx key */