Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet tcp: restore NULL checks for inp
details: https://anonhg.NetBSD.org/src/rev/036c9aa7a88d
branches: trunk
changeset: 372184:036c9aa7a88d
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Sat Oct 29 15:35:16 2022 +0000
description:
tcp: restore NULL checks for inp
diffstat:
sys/netinet/tcp_usrreq.c | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diffs (156 lines):
diff -r 454b9d49257b -r 036c9aa7a88d sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c Sat Oct 29 15:13:27 2022 +0000
+++ b/sys/netinet/tcp_usrreq.c Sat Oct 29 15:35:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_usrreq.c,v 1.234 2022/10/28 05:25:36 ozaki-r Exp $ */
+/* $NetBSD: tcp_usrreq.c,v 1.235 2022/10/29 15:35:16 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.234 2022/10/28 05:25:36 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.235 2022/10/29 15:35:16 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -502,6 +502,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return;
tp = intotcpcb(inp);
s = splsoftnet();
@@ -518,6 +520,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_ACCEPT);
@@ -556,6 +560,8 @@
int ostate = 0;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_BIND);
@@ -597,6 +603,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_LISTEN);
@@ -636,6 +644,8 @@
int ostate = 0;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_CONNECT);
@@ -719,6 +729,8 @@
KASSERT(solocked(so));
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_CONNECT2);
@@ -738,6 +750,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_DISCONNECT);
@@ -771,6 +785,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_SHUTDOWN);
@@ -798,6 +814,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_ABORT);
@@ -846,6 +864,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_PEERADDR);
@@ -874,6 +894,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_SOCKADDR);
@@ -902,6 +924,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_RCVD);
@@ -934,6 +958,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_RCVOOB);
@@ -976,6 +1002,8 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL)
+ return EINVAL;
tp = intotcpcb(inp);
ostate = tcp_debug_capture(tp, PRU_SEND);
@@ -1011,6 +1039,11 @@
int s;
inp = sotoinpcb(so);
+ if (inp == NULL) {
+ m_freem(m);
+ m_freem(control);
+ return EINVAL;
+ }
tp = intotcpcb(inp);
if (tp->t_template == NULL) {
/*
Home |
Main Index |
Thread Index |
Old Index