Merge branch ‘net-tls-fix-device-surprise-removal-with-offload’ [Linux 5.2]

Merge branch ‘net-tls-fix-device-surprise-removal-with-offload’ [Linux 5.2]

This Linux kernel change "Merge branch ‘net-tls-fix-device-surprise-removal-with-offload’" is included in the Linux 5.2 release. This change is authored by David S. Miller <davem [at] davemloft.net> on Wed May 22 12:21:44 2019 -0700. The commit for this change in Linux stable tree is 8f07303 (patch). Other info about this change: Merge: 0d18c7b c3f4a6c

Merge branch 'net-tls-fix-device-surprise-removal-with-offload'

Jakub Kicinski says:

====================
net/tls: fix device surprise removal with offload

This series fixes two issues with device surprise removal.
First we need to take a read lock around resync, otherwise
netdev notifier handler may clear the structures from under
our feet.

Secondly we need to be careful about the interpretation
of device features.  Offload has to be properly cleaned
up even if the TLS device features got cleared after
connection state was installed.
====================

Signed-off-by: David S. Miller <[email protected]>

There is no are 0 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/tls/tls_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 0765044..b95c408 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -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) {

Leave a Reply

Your email address will not be published. Required fields are marked *