From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 476AFC28CC6 for ; Mon, 3 Jun 2019 09:14:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B61727EE4 for ; Mon, 3 Jun 2019 09:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559553259; bh=dYttiehfkk88Cug34rZINtJ77ZlqTj1hqrTI2sLLz/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tXOUNjpDkOwUaG1Fn7437jXhLxpRD+fhOywXtRNnjLSJGik5GNjh+/+GkgMgjU/4y 4kpu/ms8yPzGJJjw7lQL/i3b/eXY1E4lIp35ra9X5irnqEFou4J+lvSoqjNM+pwJia 5xOHAAOTmT1cnfJY4tVFaxcU2+vo6m61USZ129Gk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728954AbfFCJOS (ORCPT ); Mon, 3 Jun 2019 05:14:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:34946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728981AbfFCJOQ (ORCPT ); Mon, 3 Jun 2019 05:14:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A8B3527EE4; Mon, 3 Jun 2019 09:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559553256; bh=dYttiehfkk88Cug34rZINtJ77ZlqTj1hqrTI2sLLz/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDcVR09aXLuxOgIyRYfjRRizOIA757otEKpONWRth+q8WkFkFSjEmsRhjuzjInXLe Kf5cIOrq7YwWzLk6TRIp1salN+eBJ8wQ3ODDeKk7MwElcvgCIbz4RoPHJH2KMf17uu vXglhgrGo1UTVg2itxtkTJZdQQvmk4XUPE2RQ15w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Dirk van der Merwe , "David S. Miller" Subject: [PATCH 5.1 34/40] net/tls: fix state removal with feature flags off Date: Mon, 3 Jun 2019 11:09:27 +0200 Message-Id: <20190603090524.607098473@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190603090522.617635820@linuxfoundation.org> References: <20190603090522.617635820@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jakub Kicinski [ Upstream commit 3686637e507b48525fcea6fb91e1988bdbc14530 ] TLS offload drivers shouldn't (and currently don't) block the TLS offload feature changes based on whether there are active offloaded connections or not. This seems to be a good idea, because we want the admin to be able to disable the TLS offload at any time, and there is no clean way of disabling it for active connections (TX side is quite problematic). So if features are cleared existing connections will stay offloaded until they close, and new connections will not attempt offload to a given device. However, the offload state removal handling is currently broken if feature flags get cleared while there are active TLS offloads. RX side will completely bail from cleanup, even on normal remove path, leaving device state dangling, potentially causing issues when the 5-tuple is reused. It will also fail to release the netdev reference. Remove the RX-side warning message, in next release cycle it should be printed when features are disabled, rather than when connection dies, but for that we need a more efficient method of finding connection of a given netdev (a'la BPF offload code). Fixes: 4799ac81e52a ("tls: Add rx inline crypto offload") Signed-off-by: Jakub Kicinski Reviewed-by: Dirk van der Merwe Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tls/tls_device.c | 6 ------ 1 file changed, 6 deletions(-) --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -943,12 +943,6 @@ void tls_device_offload_cleanup_rx(struc if (!netdev) goto out; - if (!(netdev->features & NETIF_F_HW_TLS_RX)) { - pr_err_ratelimited("%s: device is missing NETIF_F_HW_TLS_RX cap\n", - __func__); - goto out; - } - netdev->tlsdev_ops->tls_dev_del(netdev, tls_ctx, TLS_OFFLOAD_CTX_DIR_RX);