mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
sctp: further improve shutting down the read side of a socket
Deal with the case that the association is already gone. Reported by: syzbot+e256d42e9b390564530a@syzkaller.appspotmail.com MFC after: 3 days
This commit is contained in:
parent
d2c839eee0
commit
bb56b36d71
|
@ -806,11 +806,9 @@ sctp_flush(struct socket *so, int how)
|
|||
return (0);
|
||||
}
|
||||
stcb = LIST_FIRST(&inp->sctp_asoc_list);
|
||||
if (stcb == NULL) {
|
||||
SCTP_INP_WUNLOCK(inp);
|
||||
return (ENOTCONN);
|
||||
if (stcb != NULL) {
|
||||
SCTP_TCB_LOCK(stcb);
|
||||
}
|
||||
SCTP_TCB_LOCK(stcb);
|
||||
SCTP_INP_READ_LOCK(inp);
|
||||
inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ;
|
||||
SOCK_LOCK(so);
|
||||
|
@ -836,7 +834,7 @@ sctp_flush(struct socket *so, int how)
|
|||
}
|
||||
SOCK_UNLOCK(so);
|
||||
SCTP_INP_READ_UNLOCK(inp);
|
||||
if (need_to_abort) {
|
||||
if (need_to_abort && (stcb != NULL)) {
|
||||
inp->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6;
|
||||
SCTP_INP_WUNLOCK(inp);
|
||||
op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, "");
|
||||
|
@ -845,7 +843,9 @@ sctp_flush(struct socket *so, int how)
|
|||
NET_EPOCH_EXIT(et);
|
||||
return (ECONNABORTED);
|
||||
}
|
||||
SCTP_TCB_UNLOCK(stcb);
|
||||
if (stcb != NULL) {
|
||||
SCTP_TCB_UNLOCK(stcb);
|
||||
}
|
||||
SCTP_INP_WUNLOCK(inp);
|
||||
return (0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue