Author: melifaro
Date: Wed May  6 07:53:43 2015
New Revision: 282521
URL: https://svnweb.freebsd.org/changeset/base/282521

Log:
  Fix panic when prepare_batch_buffer() returns error.

Modified:
  head/sys/netpfil/ipfw/ip_fw_table.c

Modified: head/sys/netpfil/ipfw/ip_fw_table.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_table.c Wed May  6 05:40:20 2015        
(r282520)
+++ head/sys/netpfil/ipfw/ip_fw_table.c Wed May  6 07:53:43 2015        
(r282521)
@@ -597,19 +597,21 @@ restart:
        /* Pass stack buffer by default */
        ta_buf_m = ta_buf;
        error = prepare_batch_buffer(ch, ta, tei, count, OP_ADD, &ta_buf_m);
-       if (error != 0)
-               goto cleanup;
 
        IPFW_UH_WLOCK(ch);
+       del_toperation_state(ch, &ts);
        /* Drop reference we've used in first search */
        tc->no.refcnt--;
 
+       /* Check prepare_batch_buffer() error */
+       if (error != 0)
+               goto cleanup;
+
        /*
         * Check if table swap has happened.
         * (so table algo might be changed).
         * Restart operation to achieve consistent behavior.
         */
-       del_toperation_state(ch, &ts);
        if (ts.modified != 0)
                goto restart;
 
_______________________________________________
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