netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 7/8] netfilter: ipset: Fix rename concurrency with listing
Date: Wed, 31 Jul 2019 13:51:56 +0200	[thread overview]
Message-ID: <20190731115157.27020-8-pablo@netfilter.org> (raw)
In-Reply-To: <20190731115157.27020-1-pablo@netfilter.org>

From: Jozsef Kadlecsik <kadlec@netfilter.org>

Shijie Luo reported that when stress-testing ipset with multiple concurrent
create, rename, flush, list, destroy commands, it can result

ipset <version>: Broken LIST kernel message: missing DATA part!

error messages and broken list results. The problem was the rename operation
was not properly handled with respect of listing. The patch fixes the issue.

Reported-by: Shijie Luo <luoshijie1@huawei.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
---
 net/netfilter/ipset/ip_set_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 2e151856ad99..e64d5f9a89dd 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1161,7 +1161,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl,
 		return -ENOENT;
 
 	write_lock_bh(&ip_set_ref_lock);
-	if (set->ref != 0) {
+	if (set->ref != 0 || set->ref_netlink != 0) {
 		ret = -IPSET_ERR_REFERENCED;
 		goto out;
 	}
-- 
2.11.0


  parent reply	other threads:[~2019-07-31 11:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 11:51 [PATCH 0/8] netfilter fixes for net Pablo Neira Ayuso
2019-07-31 11:51 ` [PATCH 1/8] netfilter: ebtables: fix a memory leak bug in compat Pablo Neira Ayuso
2019-07-31 11:51 ` [PATCH 2/8] netfilter: nf_tables: Make nft_meta expression more robust Pablo Neira Ayuso
2019-07-31 11:51 ` [PATCH 3/8] netfilter: nft_meta_bridge: Eliminate 'out' label Pablo Neira Ayuso
2019-07-31 11:51 ` [PATCH 4/8] netfilter: add include guard to xt_connlabel.h Pablo Neira Ayuso
2019-07-31 11:51 ` [PATCH 5/8] netfilter: ipset: Actually allow destination MAC address for hash:ip,mac sets too Pablo Neira Ayuso
2019-07-31 11:51 ` [PATCH 6/8] netfilter: ipset: Copy the right MAC address in bitmap:ip,mac and hash:ip,mac sets Pablo Neira Ayuso
2019-07-31 11:51 ` Pablo Neira Ayuso [this message]
2019-07-31 11:51 ` [PATCH 8/8] netfilter: ebtables: also count base chain policies Pablo Neira Ayuso
2019-07-31 15:50 ` [PATCH 0/8] netfilter fixes for net David Miller

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=20190731115157.27020-8-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --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).