Do not access syncache entry before it was allocated for the TF_NOOPT case

in syncache_add().

Found by:	Coverity Prevent
CID:		1473
This commit is contained in:
Andre Oppermann 2006-06-18 13:03:42 +00:00
parent 42ccd54fec
commit 2f1a4ccfc1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159727

View File

@ -832,7 +832,7 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
struct syncache_head *sch;
struct mbuf *ipopts = NULL;
u_int32_t flowtmp;
int win, sb_hiwat, ip_ttl, ip_tos;
int win, sb_hiwat, ip_ttl, ip_tos, noopt;
#ifdef INET6
int autoflowlabel = 0;
#endif
@ -856,8 +856,7 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
ip_tos = inp->inp_ip_tos;
win = sbspace(&so->so_rcv);
sb_hiwat = so->so_rcv.sb_hiwat;
if (tp->t_flags & TF_NOOPT)
sc->sc_flags = SCF_NOOPT;
noopt = (tp->t_flags & TF_NOOPT);
so = NULL;
tp = NULL;
@ -1008,6 +1007,8 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
if (to->to_flags & TOF_SACK)
sc->sc_flags |= SCF_SACK;
if (noopt)
sc->sc_flags |= SCF_NOOPT;
/*
* Do a standard 3-way handshake.