After checking for SO_ISDISCONNECTED in tcp_usr_accept(), return

immediately rather than jumping to the normal output handling, which
assumes we've pulled out the inpcb, which hasn't happened at this
point (and isn't necessary).

Return ECONNABORTED instead of EINVAL when the inpcb has entered
INP_TIMEWAIT or INP_DROPPED, as this is the documented error value.

This may correct the panic seen by Ganbold.

MFC after:	1 month
Reported by:	Ganbold <ganbold at micom dot mng dot net>
This commit is contained in:
Robert Watson 2006-04-03 09:52:55 +00:00
parent a34f6c1e1d
commit 3d2d3ef434
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157424

View File

@ -590,16 +590,14 @@ tcp_usr_accept(struct socket *so, struct sockaddr **nam)
in_port_t port = 0;
TCPDEBUG0;
if (so->so_state & SS_ISDISCONNECTED) {
error = ECONNABORTED;
goto out;
}
if (so->so_state & SS_ISDISCONNECTED)
return (ECONNABORTED);
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL"));
INP_LOCK(inp);
if (inp->inp_vflag & (INP_TIMEWAIT | INP_DROPPED)) {
error = EINVAL;
error = ECONNABORTED;
goto out;
}
tp = intotcpcb(inp);