Fix panic when prepare_batch_buffer() returns error.

This commit is contained in:
Alexander V. Chernikov 2015-05-06 07:53:43 +00:00
parent ea91ca92ba
commit b45fa3fad6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282521

View File

@ -597,19 +597,21 @@ add_table_entry(struct ip_fw_chain *ch, struct tid_info *ti,
/* 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;