nfnetlink_log: Fix instance_create() failure path
Subsystems (2)
PATCH 4/5 nfnetlink_log: Fix instance_create() failure path
Fix memory leak on instance_create() while module is being unloaded.
Signed-off-by Michał Mirosław <[email protected]>
net/netfilter/nfnetlink_log.c +5 -5
@@ -153,6 +153,11 @@if (!inst) goto out_unlock; +if (!try_module_get (THIS_MODULE )) { +kfree (inst); + goto out_unlock; + } +INIT_HLIST_NODE (&inst->hlist);spin_lock_init (&inst->lock);/* needs to be two, since we _put() after creation */
@@ -169,9 +174,6 @@ inst->copy_mode =NFULNL_COPY_PACKET ; inst->copy_range =0xffff ; -if (!try_module_get (THIS_MODULE )) - goto out_free; -hlist_add_head (&inst->hlist, &instance_table[instance_hashfn (group_num)]);
@@ -182,8 +184,6 @@return inst; -out_free: -instance_put (inst); out_unlock:write_unlock_bh (&instances_lock);return NULL ;
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Micha³ Miros³aw
Fix memory leak on
instance_create()while module is being unloaded.
Applied, thanks.
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html