Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2008 11:53:11 -0700
From:      "Huang, Yusheng" <yusheng.huang@bluecoat.com>
To:        <freebsd-net@freebsd.org>
Subject:   timewait state memory leak
Message-ID:  <B583FBF374231F4A89607B4D08578A43B0F8F4@bcs-mail03.internal.cacheflow.com>

next in thread | raw e-mail | index | archive | help
Hi,

=20

I am looking at the tcp_tw_2msl_scan() code and it looks like there is a
bug in there.

=20

struct tcptw *
tcp_tw_2msl_scan(int reuse)
{
         struct tcptw *tw;
=20
         INP_INFO_WLOCK_ASSERT(&tcbinfo);
         for (;;) {
                 tw =3D TAILQ_FIRST(&twq_2msl);
                 if (tw =3D=3D NULL || (!reuse && tw->tw_time > ticks))
                                               ^^^^^^^^^^^^^^^^^^
                          break;
                 INP_WLOCK(tw->tw_inpcb);
                 tcp_twclose(tw, reuse);
                 if (reuse)
                          return (tw);
         }
         return (NULL);
}
=20
Shouldn't the comparison be TSTMP_GT(tw->tw_time, ticks)?=20

=20

-yusheng

=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B583FBF374231F4A89607B4D08578A43B0F8F4>