netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <mleitner@redhat.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] netfilter: log: protect nf_log_register against double registering
Date: Tue, 28 Oct 2014 10:51:40 -0200	[thread overview]
Message-ID: <544F915C.7010608@redhat.com> (raw)
In-Reply-To: <20141027220908.GB5998@salvia>

On 27-10-2014 20:09, Pablo Neira Ayuso wrote:
> 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.

Right! I'll update it (this and the below one) and send in a few, thanks.

Marcelo

>> +				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.
>


  reply	other threads:[~2014-10-28 12:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 12:59 [PATCH 1/3] Introduce nft_log_dereference() macro Marcelo Ricardo Leitner
2014-10-24 12:59 ` [PATCH v2 2/3] netfilter: log: protect nf_log_register against double registering Marcelo Ricardo Leitner
2014-10-27 22:09   ` Pablo Neira Ayuso
2014-10-28 12:51     ` Marcelo Ricardo Leitner [this message]
2014-10-24 12:59 ` [PATCH 3/3] Make use of pr_fmt where applicable Marcelo Ricardo Leitner
2014-10-24 18:11   ` Marcelo Ricardo Leitner
2014-10-24 18:27     ` Marcelo Ricardo Leitner
     [not found]   ` <12a99ae77aa9969692d847d8d2929deb13485e72.1414175014.git.mleitner@redhat.com>
2014-10-24 18:46     ` [PATCH v2 " Marcelo Ricardo Leitner
2014-10-27 22:23       ` Pablo Neira Ayuso
2014-10-28 12:59         ` Marcelo Ricardo Leitner
2014-10-28 19:56           ` Marcelo Ricardo Leitner
2014-10-28 20:12             ` Pablo Neira Ayuso
2014-10-28 20:16               ` Marcelo Ricardo Leitner
2014-10-27 22:03 ` [PATCH 1/3] Introduce nft_log_dereference() macro Pablo Neira Ayuso
2014-10-28 12:47   ` Marcelo Ricardo Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=544F915C.7010608@redhat.com \
    --to=mleitner@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).