]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/net-tls-don-t-ignore-netdev-notifications-if-no-tls-features.patch
40f442507cedc8b71d1232b6f8e8489c36256eed
[thirdparty/kernel/stable-queue.git] / queue-5.1 / net-tls-don-t-ignore-netdev-notifications-if-no-tls-features.patch
1 From foo@baz Fri 31 May 2019 03:16:39 PM PDT
2 From: Jakub Kicinski <jakub.kicinski@netronome.com>
3 Date: Tue, 21 May 2019 19:02:02 -0700
4 Subject: net/tls: don't ignore netdev notifications if no TLS features
5
6 From: Jakub Kicinski <jakub.kicinski@netronome.com>
7
8 [ Upstream commit c3f4a6c39cf269a40d45f813c05fa830318ad875 ]
9
10 On device surprise removal path (the notifier) we can't
11 bail just because the features are disabled. They may
12 have been enabled during the lifetime of the device.
13 This bug leads to leaking netdev references and
14 use-after-frees if there are active connections while
15 device features are cleared.
16
17 Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
18 Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
19 Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23 net/tls/tls_device.c | 3 ++-
24 1 file changed, 2 insertions(+), 1 deletion(-)
25
26 --- a/net/tls/tls_device.c
27 +++ b/net/tls/tls_device.c
28 @@ -1001,7 +1001,8 @@ static int tls_dev_event(struct notifier
29 {
30 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
31
32 - if (!(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
33 + if (!dev->tlsdev_ops &&
34 + !(dev->features & (NETIF_F_HW_TLS_RX | NETIF_F_HW_TLS_TX)))
35 return NOTIFY_DONE;
36
37 switch (event) {