All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kang Chen <void0red@gmail.com>
To: borisp@nvidia.com
Cc: john.fastabend@gmail.com, kuba@kernel.org, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com,
	dirk.vandermerwe@netronome.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Kang Chen <void0red@gmail.com>
Subject: [PATCH] net/tls: refine the branch condition in tls_dev_event
Date: Fri, 17 Mar 2023 15:16:36 +0800	[thread overview]
Message-ID: <20230317071636.1028488-1-void0red@gmail.com> (raw)

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@gmail.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


             reply	other threads:[~2023-03-17  7:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  7:16 Kang Chen [this message]
2023-03-17  8:15 ` [PATCH] net/tls: refine the branch condition in tls_dev_event Horatiu Vultur
2023-03-17  8:33   ` [PATCH net v2] " Kang Chen
2023-03-17  9:56     ` Horatiu Vultur
2023-03-17 19:54     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230317071636.1028488-1-void0red@gmail.com \
    --to=void0red@gmail.com \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dirk.vandermerwe@netronome.com \
    --cc=edumazet@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.