git: 453aa7fac989 - main - tcp: ensure the tcpcb is not NULL when logging an event
Date: Thu, 23 Feb 2023 01:04:35 UTC
The branch main has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=453aa7fac9894945282bcf6ef55c9ebaaa1d7e40
commit 453aa7fac9894945282bcf6ef55c9ebaaa1d7e40
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2023-02-23 01:01:53 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2023-02-23 01:04:17 +0000
tcp: ensure the tcpcb is not NULL when logging an event
When calling tcp_bblog_pru() on some error paths, tp is NULL,
therefore handle it.
Sponsored by: Netflix, Inc.
---
sys/netinet/tcp_usrreq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 878e5095eef2..f17285664ce5 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -136,6 +136,9 @@ tcp_bblog_pru(struct tcpcb *tp, uint32_t pru, int error)
{
struct tcp_log_buffer *lgb;
+ if (tp == NULL) {
+ return;
+ }
INP_WLOCK_ASSERT(tptoinpcb(tp));
if (tp->t_logstate != TCP_LOG_STATE_OFF) {
lgb = tcp_log_event_(tp, NULL, NULL, NULL, TCP_LOG_PRU, error,