Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=aace57e054e9322e20af52cede7de46ade64a5e2 Commit: aace57e054e9322e20af52cede7de46ade64a5e2 Parent: c6a8f648362a5d8b934f4267b0ab9f255c130ab0 Author: Michal Miroslaw <[EMAIL PROTECTED]> AuthorDate: Fri Sep 28 14:45:27 2007 -0700 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Oct 10 16:53:39 2007 -0700
[NETFILTER]: nfnetlink_log: fix instance_create() failure path Fix memory leak on instance_create() while module is being unloaded. Signed-off-by: Michal Miroslaw <[EMAIL PROTECTED]> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/netfilter/nfnetlink_log.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index d2e811f..16ae539 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -152,6 +152,11 @@ instance_create(u_int16_t group_num, int pid) 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 */ @@ -168,9 +173,6 @@ instance_create(u_int16_t group_num, int pid) 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)]); @@ -181,8 +183,6 @@ instance_create(u_int16_t group_num, int pid) 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 git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html