- Fixes cstatic issues found by cisco sa tool (missing frees and such

on error legs)
- align sctp_sockstore to 64 bit boundary ..
This commit is contained in:
Randall Stewart 2007-06-18 21:59:15 +00:00
parent f0d8df7bb2
commit eacc51c5b6
6 changed files with 23 additions and 5 deletions

View File

@ -2590,6 +2590,8 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
if (inp->laddr_count < 2) {
/* can't delete the last local address */
SCTP_FREE(asc, SCTP_M_ASC_IT);
SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_laddr, wi);
return (EINVAL);
}
LIST_FOREACH(laddr, &inp->sctp_addr_list,

View File

@ -3532,7 +3532,7 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
/* fix counts and things */
if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND,
tp1->whoTo->flight_size,
(tp1->whoTo ? (tp1->whoTo->flight_size) : 0),
tp1->book_size,
(uintptr_t) tp1->whoTo,
tp1->rec.data.TSN_seq);

View File

@ -339,12 +339,13 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
#endif
return (NULL);
}
memset(sctp_ifnp, 0, sizeof(struct sctp_ifn));
sctp_ifnp->ifn_index = ifn_index;
sctp_ifnp->ifn_p = ifn;
sctp_ifnp->ifn_type = ifn_type;
sctp_ifnp->ifa_count = 0;
sctp_ifnp->refcount = 1;
sctp_ifnp->vrf = vrf;
atomic_add_int(&vrf->refcount, 1);
sctp_ifnp->ifn_mtu = SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, addr->sa_family);
if (if_name != NULL) {
@ -3456,10 +3457,10 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
asoc->mapping_array = NULL;
}
SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb);
SCTP_DECR_ASOC_COUNT();
SCTP_TCB_LOCK_DESTROY(stcb);
SCTP_TCB_SEND_LOCK_DESTROY(stcb);
SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, stcb);
SCTP_INP_WUNLOCK(inp);
*error = ENOBUFS;
return (NULL);
@ -4831,7 +4832,8 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
net_tmp->dest_state &= ~SCTP_ADDR_NOT_IN_ASSOC;
} else if (stcb_tmp != stcb) {
/* It belongs to another association? */
SCTP_TCB_UNLOCK(stcb_tmp);
if (stcb_tmp)
SCTP_TCB_UNLOCK(stcb_tmp);
return (-3);
}
}

View File

@ -913,6 +913,8 @@ struct sctpstat {
#define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)
#define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)
#define SCTP_ALIGN_64_SA 36
union sctp_sockstore {
#if defined(INET) || !defined(_KERNEL)
struct sockaddr_in sin;
@ -921,6 +923,7 @@ union sctp_sockstore {
struct sockaddr_in6 sin6;
#endif
struct sockaddr sa;
uint8_t reserved[SCTP_ALIGN_64_SA];
};
struct xsctp_inpcb {

View File

@ -1294,7 +1294,8 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
/* Already have or am bring up an association */
SCTP_ASOC_CREATE_UNLOCK(inp);
creat_lock_on = 0;
SCTP_TCB_UNLOCK(stcb);
if (stcb)
SCTP_TCB_UNLOCK(stcb);
if (bad_addresses == 0)
error = EALREADY;
goto out_now;

View File

@ -1074,6 +1074,10 @@ sctp_init_asoc(struct sctp_inpcb *m, struct sctp_tcb *stcb,
asoc->timoshutdownack = 0;
(void)SCTP_GETTIME_TIMEVAL(&asoc->start_time);
asoc->discontinuity_time = asoc->start_time;
/*
* sa_ignore MEMLEAK {memory is put in the assoc mapping array and
* freed later whe the association is freed.
*/
return (0);
}
@ -1415,11 +1419,17 @@ sctp_timeout_handler(void *t)
/* call the handler for the appropriate timer type */
switch (tmr->type) {
case SCTP_TIMER_TYPE_ZERO_COPY:
if (inp == NULL) {
break;
}
if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) {
SCTP_ZERO_COPY_EVENT(inp, inp->sctp_socket);
}
break;
case SCTP_TIMER_TYPE_ZCOPY_SENDQ:
if (inp == NULL) {
break;
}
if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) {
SCTP_ZERO_COPY_SENDQ_EVENT(inp, inp->sctp_socket);
}