]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netfilter: ipset: Fix rename concurrency with listing
authorJozsef Kadlecsik <kadlec@netfilter.org>
Tue, 23 Jul 2019 08:25:55 +0000 (10:25 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 20:23:24 +0000 (16:23 -0400)
BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit 6c1f7e2c1b96ab9b09ac97c4df2bd9dc327206f6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/netfilter/ipset/ip_set_core.c

index a3f1dc7cf5382c4a16a77b385b57b447140c9aab..dbf17d3596a691784d88067716862865aaa8f078 100644 (file)
@@ -1128,7 +1128,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;
        }