Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet tcp(4): Bail early on sendoob if not connected.
details: https://anonhg.NetBSD.org/src/rev/b6f8486f7ede
branches: trunk
changeset: 368200:b6f8486f7ede
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Jun 28 01:44:19 2022 +0000
description:
tcp(4): Bail early on sendoob if not connected.
XXX Not sure if testing tp->t_template is the right way to discern
this -- I just reached for it because the downstream crash is a panic
on tp->t_template == NULL in tcp_output.
XXX In principle this could try connecting to the address, except
it's not passed down from the logic in uipc_socket.c to tcp_sendoob.
Reported-by: syzbot+a01f4cfec72790855ce2%syzkaller.appspotmail.com@localhost
diffstat:
sys/netinet/tcp_usrreq.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 0bb27909f69f -r b6f8486f7ede sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c Tue Jun 28 00:13:48 2022 +0000
+++ b/sys/netinet/tcp_usrreq.c Tue Jun 28 01:44:19 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $ */
+/* $NetBSD: tcp_usrreq.c,v 1.231 2022/06/28 01:44:19 riastradh 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.230 2021/08/04 08:47:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.231 2022/06/28 01:44:19 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1158,6 +1158,16 @@
m_freem(control);
return error;
}
+ if (tp->t_template == NULL) {
+ /*
+ * XXX FreeBSD appears to open the connection
+ * automagically in this case, but the socket address
+ * isn't passed through here so we can't do that.
+ */
+ m_freem(m);
+ m_freem(control);
+ return ENOTCONN;
+ }
ostate = tcp_debug_capture(tp, PRU_SENDOOB);
Home |
Main Index |
Thread Index |
Old Index