From: Jakub Kicinski Date: Wed, 22 May 2019 02:02:01 +0000 (-0700) Subject: net/tls: fix state removal with feature flags off X-Git-Tag: Ubuntu-5.0.0-26.27~38 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=b668d0662a46900ae30248f84e54800dd6c2adc3;p=mirror_ubuntu-disco-kernel.git net/tls: fix state removal with feature flags off BugLink: https://bugs.launchpad.net/bugs/1837518 [ 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 Signed-off-by: Khalid Elmously Signed-off-by: Stefan Bader --- diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c index 7d5136ecee78..89a9b513e134 100644 --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -923,12 +923,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk) 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);