Ensure that an stcb is not dereferenced when it is about to be
freed. This issue was found by SYZKALLER. MFC after: 3 days
This commit is contained in:
parent
8d3361e9e5
commit
daf143413a
@ -164,6 +164,9 @@ sctp_build_readq_entry(struct sctp_tcb *stcb,
|
||||
read_queue_e->data = dm;
|
||||
read_queue_e->stcb = stcb;
|
||||
read_queue_e->port_from = stcb->rport;
|
||||
if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
|
||||
read_queue_e->do_not_ref_stcb = 1;
|
||||
}
|
||||
failed_build:
|
||||
return (read_queue_e);
|
||||
}
|
||||
@ -775,6 +778,7 @@ sctp_build_readq_entry_from_ctl(struct sctp_queued_to_read *nc, struct sctp_queu
|
||||
atomic_add_int(&nc->whoFrom->ref_count, 1);
|
||||
nc->stcb = control->stcb;
|
||||
nc->port_from = control->port_from;
|
||||
nc->do_not_ref_stcb = control->do_not_ref_stcb;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -68,6 +68,9 @@ sctp_build_readq_entry(struct sctp_tcb *stcb,
|
||||
(_ctl)->data = dm; \
|
||||
(_ctl)->stcb = (in_it); \
|
||||
(_ctl)->port_from = (in_it)->rport; \
|
||||
if ((in_it)->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { \
|
||||
(_ctl)->do_not_ref_stcb = 1; \
|
||||
}\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user