From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Marcelo Ricardo Leitner <mleitner@redhat.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] netfilter: log: protect nf_log_register against double registering
Date: Mon, 27 Oct 2014 23:09:08 +0100 [thread overview]
Message-ID: <20141027220908.GB5998@salvia> (raw)
In-Reply-To: <dad1a3c1e30a676f3d17244ec74acef4dd0c9ca9.1414155204.git.mleitner@redhat.com>
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.
next prev parent reply other threads:[~2014-10-27 22:07 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 [this message]
2014-10-28 12:51 ` Marcelo Ricardo Leitner
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=20141027220908.GB5998@salvia \
--to=pablo@netfilter.org \
--cc=mleitner@redhat.com \
--cc=netfilter-devel@vger.kernel.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).