Module Name: src Committed By: riastradh Date: Tue Jun 28 01:44:19 UTC 2022
Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: 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+a01f4cfec72790855...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.230 -r1.231 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.230 src/sys/netinet/tcp_usrreq.c:1.231 --- src/sys/netinet/tcp_usrreq.c:1.230 Wed Aug 4 08:47:10 2021 +++ src/sys/netinet/tcp_usrreq.c Tue Jun 28 01:44:19 2022 @@ -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 @@ tcp_sendoob(struct socket *so, struct mb 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);