From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9957C3A5A6 for ; Tue, 27 Aug 2019 07:55:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0B88206BF for ; Tue, 27 Aug 2019 07:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892531; bh=K/v6Np4sOJa32/RlJpWwjxEDUOraGmXXGtCaFA1miD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ChYIvztRqXO9J5MyWWSnFb5vxbwPvtWt9RNEpJj0BiwoE+QWoDTSHcP0lCZfUdgsQ 0W2aegxTFrwQAF3p7tTOzjv1KyV0iEhp64lQgoBGk0RmOa2VioFH6JFFix6SDsYCXK TTrZe36JpE5KsyzcKUStzzlwRsl6PPBBcyxY4oxA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730360AbfH0Hza (ORCPT ); Tue, 27 Aug 2019 03:55:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:47346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729819AbfH0Hza (ORCPT ); Tue, 27 Aug 2019 03:55:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 236842173E; Tue, 27 Aug 2019 07:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892529; bh=K/v6Np4sOJa32/RlJpWwjxEDUOraGmXXGtCaFA1miD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ZEkl4OKuZKgMRYeAja0aNyy72Cg/T7t6ONToy4cssoij5pv4ZgpgRHT6iegrTXaV 9C/79BHaw6L8E+Csc+TtepYJ2gaN+StTtOnCcR98pD9nWeBUuz0pL1kI5JYPnrdDsI XLlteh/WIgw8Gmtz7G+0EAwvmgGxut1XZdOKFQwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shijie Luo , Jozsef Kadlecsik , Sasha Levin Subject: [PATCH 4.19 25/98] netfilter: ipset: Fix rename concurrency with listing Date: Tue, 27 Aug 2019 09:50:04 +0200 Message-Id: <20190827072719.573553910@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072718.142728620@linuxfoundation.org> References: <20190827072718.142728620@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit 6c1f7e2c1b96ab9b09ac97c4df2bd9dc327206f6 ] Shijie Luo reported that when stress-testing ipset with multiple concurrent create, rename, flush, list, destroy commands, it can result ipset : 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 Signed-off-by: Jozsef Kadlecsik Signed-off-by: Sasha Levin --- 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 1577f2f76060d..e2538c5786714 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -1157,7 +1157,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.20.1