Re: [PATCH 1/2] netfilter: add extended accounting infrastructure over nfnetlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le vendredi 23 décembre 2011 à 15:10 +0100, Eric Dumazet a écrit :
> Le vendredi 23 décembre 2011 à 14:42 +0100, pablo@xxxxxxxxxxxxx a
> écrit :
> > From: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
> > 
> 
> 
> > +struct nf_acct *nfnl_acct_find_get(const char *acct_name)
> > +{
> > +	struct nf_acct *cur, *acct = NULL;
> > +
> > +	rcu_read_lock();
> > +	list_for_each_entry(cur, &nfnl_acct_list, head) {
> > +		if (strncmp(cur->name, acct_name, NFACCT_NAME_MAX)!= 0)
> > +			continue;
> > +
> > +		if (!try_module_get(THIS_MODULE))
> > +			return NULL;
> > +
> > +		if (!atomic_inc_not_zero(&cur->refcnt))
> 
> 	You leak the module reference here.
> 
> 
> > +			return NULL;
> > +
> > +		acct = cur;
> > +		break;
> > +	}
> > +	rcu_read_unlock();
> > +	return acct;
> > +}
> > +EXPORT_SYMBOL_GPL(nfnl_acct_find_get);
> 


Also make sure you add missing "rcu_read_unlock();" before return
NULL ;)



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux