[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230317071636.1028488-1-void0red@gmail.com>
Date: Fri, 17 Mar 2023 15:16:36 +0800
From: Kang Chen <void0red@...il.com>
To: borisp@...dia.com
Cc: john.fastabend@...il.com, kuba@...nel.org, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com,
dirk.vandermerwe@...ronome.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Kang Chen <void0red@...il.com>
Subject: [PATCH] net/tls: refine the branch condition in tls_dev_event
dev->tlsdev_ops may be null and cause null pointer dereference later.
Fixes: eeb2efaf36c7 ("net/tls: generalize the resync callback")
Signed-off-by: Kang Chen <void0red@...il.com>
---
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 a7cc4f9faac2..f30a8fe373c2 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1449,7 +1449,8 @@ static int tls_dev_event(struct notifier_block *this, unsigned long event,
if (netif_is_bond_master(dev))
return NOTIFY_DONE;
if ((dev->features & NETIF_F_HW_TLS_RX) &&
- !dev->tlsdev_ops->tls_dev_resync)
+ (!dev->tlsdev_ops || (dev->tlsdev_ops &&
+ !dev->tlsdev_ops->tls_dev_resync)))
return NOTIFY_BAD;
if (dev->tlsdev_ops &&
--
2.34.1
Powered by blists - more mailing lists