Skip to content

Commit

Permalink
net/tls: don't ignore netdev notifications if no TLS features
Browse files Browse the repository at this point in the history
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: e8f6979 ("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>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed May 22, 2019
1 parent 3686637 commit c3f4a6c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/tls/tls_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,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) {
Expand Down

0 comments on commit c3f4a6c

Please sign in to comment.