summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-05-22 05:02:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-04 08:59:45 +0300
commitf29b151310b68477a22c5703f33196f761b17bc8 (patch)
tree28a6e880b7c2ac88e7e36f2a234cc55b56e89790 /net
parent908dde88fc17d6da14a4026cfa3b87eed929aba0 (diff)
downloadlinux-f29b151310b68477a22c5703f33196f761b17bc8.tar.xz
net/tls: don't ignore netdev notifications if no TLS features
[ Upstream commit c3f4a6c39cf269a40d45f813c05fa830318ad875 ] On device surprise removal path (the notifier) we can't bail just because the features are disabled. They may have been enabled during the lifetime of the device. This bug leads to leaking netdev references and use-after-frees if there are active connections while device features are cleared. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/tls/tls_device.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index a0976efcbf24..0fd8f0997ff5 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1001,7 +1001,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event,
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
- if (!(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
+ if (!dev->tlsdev_ops &&
+ !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
return NOTIFY_DONE;
switch (event) {