Re: [PATCH v2 2/3] netfilter: log: protect nf_log_register against double registering

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

 



Hi Marcelo,

I just noticed another minor issue that I didn't notice in my previous
review.

On Fri, Oct 24, 2014 at 10:59:50AM -0200, Marcelo Ricardo Leitner wrote:
> diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
> index f1409d95f810c689ec70755eb8a85125d291ad47..e7c7439f48db590eba8f7f2eac61fafd9e571389 100644
> --- a/net/netfilter/nf_log.c
> +++ b/net/netfilter/nf_log.c
> @@ -82,10 +82,19 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
>  	mutex_lock(&nf_log_mutex);
>  
>  	if (pf == NFPROTO_UNSPEC) {
> +		for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++) {
> +			if (nft_log_dereference(loggers[i][logger->type])) {

Given that we're not dereferencing, I think you can use
rcu_access_pointer() instead here.

> +				mutex_unlock(&nf_log_mutex);
> +				return -EEXIST;
> +			}
> +		}
>  		for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++)
>  			rcu_assign_pointer(loggers[i][logger->type], logger);
>  	} else {
> -		/* register at end of list to honor first register win */
> +		if (nft_log_dereference(loggers[pf][logger->type])) {

Same thing here.
--
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