Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1676893pxu; Sun, 6 Dec 2020 03:43:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZD68a/5jrTnKRKL33aGrxaYYuY2JX5fvLYPwJouYnnPRBAo6ZRAgvL2u8TfV8kDIOsqi1 X-Received: by 2002:a17:906:2612:: with SMTP id h18mr15054644ejc.469.1607255018268; Sun, 06 Dec 2020 03:43:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255018; cv=none; d=google.com; s=arc-20160816; b=j/LZKiFe+ZJJhaIhVaHvQM8xOWA8AU1sZIRaVXyOFQgQPQQ1UO7F2XJP+5vaSd4Rmx li+Yx1wA3yR4CNxMNbbjEtZdzO7VvtWzau7JkhwLgXahPyn+A2e/I5RZkJCSD6NYM42a wT2GArnUbj7RDnPOX37dMxyQiiOtYmCb8Sq94G20sENlV5C9/g5RsYWYmjMwiNX6zI3M 4hQI50Yoo/BooP6LIZoCCrD5xucfBz2Frno1c5+99O14w6eDon/FTn+PDYiN87rD0nbl iFFBaSiZarGfbx5CsLXAG4CTCcU72uN3e+4v29zGmMUyDpFTVGnSPNXseLwEPQRjlfty iJyA== 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=p5cCKVejQ/x4iadI9M6Joc8S9Xk7VOQpFX4AXH4R10o=; b=0QFaJ1BsJrLkIeV3oHE8vuM7lvmAQ8h/q6Tb37Kqjuf9OWxoqSVOopaA1JKJQY8QEZ 1RMmIuyg02bPGOY4Z98HhzudVwyJ9/QH6LZYWFpyrXE60rwxVABjvCtJxfxvrvoa+3dV raVFdeeSOUccOdR0EoJhpaNME2Qfcvt7W4Fu3MmUYIJ5J0XbLZ0Ox0fNaBC1KG2yRErc IZ5yQieBrJ+DBptsPrnMsqbVPK+UcjR1sHyXoaMbQ30RXKDdCUdEZRIyXPJhskvB+LUp HsItUr0w/JYGntuR7mOBF76URIJ1Dh1/wckyBD+KxywEyX91ZDDt0kk5KNNRAFtodbNm 20tA== 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 dn6si4394063ejc.234.2020.12.06.03.43.15; Sun, 06 Dec 2020 03:43:38 -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 S1728703AbgLFLkp (ORCPT + 99 others); Sun, 6 Dec 2020 06:40:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:37558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728692AbgLFLko (ORCPT ); Sun, 6 Dec 2020 06:40:44 -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 4.19 23/32] chelsio/chtls: fix a double free in chtls_setkey() Date: Sun, 6 Dec 2020 12:17:23 +0100 Message-Id: <20201206111556.882450922@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111555.787862631@linuxfoundation.org> References: <20201206111555.787862631@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 @@ -376,6 +376,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 */