diff options
author | andre <andre@FreeBSD.org> | 2006-06-18 13:03:42 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-06-18 13:03:42 +0000 |
commit | 2e570176baec13bdc13b0630055e48f6d423c2a7 (patch) | |
tree | 0e48330f7e2688fc233436afcf4efcdb1452fcca /sys/netinet | |
parent | 0bf54ce0e0f19078ff8df34ba903149d79f09219 (diff) | |
download | FreeBSD-src-2e570176baec13bdc13b0630055e48f6d423c2a7.zip FreeBSD-src-2e570176baec13bdc13b0630055e48f6d423c2a7.tar.gz |
Do not access syncache entry before it was allocated for the TF_NOOPT case
in syncache_add().
Found by: Coverity Prevent
CID: 1473
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_syncache.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 224ff82..a46d220 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -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. |