Author: attilio
Date: Tue Jun 30 15:23:16 2009
New Revision: 195196
URL: http://svn.freebsd.org/changeset/base/195196

Log:
  If the table is empty we can end up with a NULL pointer.
  Handle that case trying to free and re-allocate a new object for the
  timerqueue, managing unallocations.
  This is not an issue on 7 and further branches.
  
  Submitted by: emaste
  Sponsored by: Sandvine Incorporated
  Reported by:  Kyle Larose <no e-mail available>

Modified:
  stable/6/sys/netinet/tcp_syncache.c

Modified: stable/6/sys/netinet/tcp_syncache.c
==============================================================================
--- stable/6/sys/netinet/tcp_syncache.c Tue Jun 30 14:34:06 2009        
(r195195)
+++ stable/6/sys/netinet/tcp_syncache.c Tue Jun 30 15:23:16 2009        
(r195196)
@@ -891,13 +891,15 @@ syncache_add(inc, to, th, sop, m)
                /* NB: guarded by INP_INFO_WLOCK(&tcbinfo) */
                for (i = SYNCACHE_MAXREXMTS; i >= 0; i--) {
                        sc = TAILQ_FIRST(&tcp_syncache.timerq[i]);
-                       if (sc != NULL)
+                       if (sc != NULL) {
+                               sc->sc_tp->ts_recent = ticks;
+                               syncache_drop(sc, NULL);
+                               tcpstat.tcps_sc_zonefail++;
+                               sc = uma_zalloc(tcp_syncache.zone, M_NOWAIT |
+                                   M_ZERO);
                                break;
+                       }
                }
-               sc->sc_tp->ts_recent = ticks;
-               syncache_drop(sc, NULL);
-               tcpstat.tcps_sc_zonefail++;
-               sc = uma_zalloc(tcp_syncache.zone, M_NOWAIT | M_ZERO);
                if (sc == NULL) {
                        if (ipopts)
                                (void) m_free(ipopts);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to