git: 0e391a3197f5 - main - ktls: Add missing NULL pointer check for TLS RX hardware offload.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 06 Sep 2022 11:50:03 UTC
The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=0e391a3197f5b4d7a48e26f5cb313548bd663ffc

commit 0e391a3197f5b4d7a48e26f5cb313548bd663ffc
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-09-06 10:56:19 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-09-06 11:49:23 +0000

    ktls: Add missing NULL pointer check for TLS RX hardware offload.
    
    The send tag pointer may be NULL when the ktls_reset_receive_tag()
    function is invoked. Add check for this.
    
    Reviewed by:    gallatin @
    Sponsored by:   NVIDIA Networking
---
 sys/kern/uipc_ktls.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c
index ff20b3652407..bf91b774c0dc 100644
--- a/sys/kern/uipc_ktls.c
+++ b/sys/kern/uipc_ktls.c
@@ -1631,8 +1631,10 @@ ktls_reset_receive_tag(void *context, int pending)
 	}
 
 	SOCKBUF_LOCK(&so->so_rcv);
-	m_snd_tag_rele(tls->snd_tag);
+	mst = tls->snd_tag;
 	tls->snd_tag = NULL;
+	if (mst != NULL)
+		m_snd_tag_rele(mst);
 
 	ifp = tls->rx_ifp;
 	if_ref(ifp);