timewait state memory leak

Huang, Yusheng yusheng.huang at bluecoat.com
Mon May 5 18:53:16 UTC 2008


Hi,

 

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

 

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

 

-yusheng

 



More information about the freebsd-net mailing list