Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2578963pxb; Mon, 19 Apr 2021 08:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2/iy1Y6s2Gh6kEPkIRabhwSYAR6yoqb6qVAVjB06e3wfYjjb/i7BWYAoFNTXaSFfm20G4 X-Received: by 2002:a65:6407:: with SMTP id a7mr1306033pgv.352.1618847439375; Mon, 19 Apr 2021 08:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618847439; cv=none; d=google.com; s=arc-20160816; b=bLJnoLvuVsuCZValK0ZVi4uf4Kn5yG28pEC+JLTe7dO1YvHbSoDgLB4Kjce9EJ6hio lb69JvB6XKFxyvnVBLrdsRwA357HX6r8P2C13QsMqjvj6/37IQsuVqi5PAfhYPvfTz+W dk2npdkjlT0ytBAsADVpD+g98gr1DGgNAy1r5IU6e2TasEAEcshpa1nmwEKnHmTEArFj tPz2+wbfLmOm5vMQQY9+tQohCtfZwDD3F6M1QD2Rwao6iI7fAfFI5QFytl6MNdQg06HU sT80nHM4iG0GcJC+LnFsgwrC+HE3AYZgGlwY11hQljfE2WZTzLLig08MqMuzYWkDtO85 6XNg== 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=DLnG6efUqeHtA+fuWX650SzHjjZHkldrv5d4NIlHOiE=; b=e1HbhH+mY/+AzDy6z2wK+7nnCKLNEYzny3UxOJIXC5c1CN5Jg0F/iRKOLWO1nuDkgV DNl6CLmFOoPSpUXHC5IFZCp5zcx05ciB8NFdds2uoPxfJ0qCWkWOObs64REoxIPkZHUB LzaWKKq5Cq+VLqI4wHbxctXSKoMgsqu2osLLz3wtAzV7KcMp6Yp8IPoMSJVqbgyNsHdx ipT/D80NS46CXOmy+xgsIOpN0fVMQiFiWv7gH2Ht4SYk4t0XpPHQrI6c+UQL3FRwalU9 ohx0ShqYoZn6H/YwT2gaI5QXY+fcRSxj+iNOfkjljv/l22cnFC07sq9+WVu8PvLuhG/y PUag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SxaS8Q+R; 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 ha13si17373285pjb.92.2021.04.19.08.50.26; Mon, 19 Apr 2021 08:50:39 -0700 (PDT) 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=SxaS8Q+R; 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 S241000AbhDSNbP (ORCPT + 99 others); Mon, 19 Apr 2021 09:31:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:56216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240529AbhDSNVx (ORCPT ); Mon, 19 Apr 2021 09:21:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 11C5F6128C; Mon, 19 Apr 2021 13:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838283; bh=xyS2wI06VzGPR+Aw78dfF5hpx6vN0vfMR0ox2HqmImI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SxaS8Q+RoQZYi5K4BMydmWKdw8F+NV73DmgtZuIspMtpnVg7HEDUBeEmDQ0njXpVz 6twIOLzTpt0+G6aw2sUP799VSWvfnqkJj45NPVA4mGoGdMaiiw8W6bcc3HuQdQK0KY ArdfOwkkpbnA/sOScjFGZsOhne0iqYb4Wu5t9OJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" Subject: [PATCH 5.10 082/103] ch_ktls: fix device connection close Date: Mon, 19 Apr 2021 15:06:33 +0200 Message-Id: <20210419130530.618914240@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@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: Vinay Kumar Yadav commit bc16efd2430652f894ae34b1de5eccc3bf0d2810 upstream. When sge queue is full and chcr_ktls_xmit_wr_complete() returns failure, skb is not freed if it is not the last tls record in this skb, causes refcount never gets freed and tls_dev_del() never gets called on this connection. Fixes: 5a4b9fe7fece ("cxgb4/chcr: complete record tx handling") Signed-off-by: Vinay Kumar Yadav Signed-off-by: Rohit Maheshwari Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c @@ -1740,7 +1740,9 @@ static int chcr_end_part_handler(struct struct sge_eth_txq *q, u32 skb_offset, u32 tls_end_offset, bool last_wr) { + bool free_skb_if_tx_fails = false; struct sk_buff *nskb = NULL; + /* check if it is a complete record */ if (tls_end_offset == record->len) { nskb = skb; @@ -1763,6 +1765,8 @@ static int chcr_end_part_handler(struct if (last_wr) dev_kfree_skb_any(skb); + else + free_skb_if_tx_fails = true; last_wr = true; @@ -1774,6 +1778,8 @@ static int chcr_end_part_handler(struct record->num_frags, (last_wr && tcp_push_no_fin), mss)) { + if (free_skb_if_tx_fails) + dev_kfree_skb_any(skb); goto out; } tx_info->prev_seq = record->end_seq;