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=unavailable 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 D50B3C3A5A3 for ; Tue, 27 Aug 2019 08:02:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A231020828 for ; Tue, 27 Aug 2019 08:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892920; bh=NauF0gTceaO42fNrWrKjuS0JXxFtntFaONx+aShP3Ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=O/TEei2MshmeK+pJ1rw6Wgh/pkTQWR5Ks8NXh1+ZQZrMN1b/JJAWB+x2tRKbNsu76 qjaGmnokibahvk2NIVQlQnLkRT4Gd0E/vwG9vP9EAR+lsY9cCs+99LolvmY9p2nvKK PEYrdgeUCZ9uh/Wkq5K+NSch7pqtrD2b2coOHBCs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731857AbfH0IB7 (ORCPT ); Tue, 27 Aug 2019 04:01:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731819AbfH0IBo (ORCPT ); Tue, 27 Aug 2019 04:01:44 -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 3CCEA206BA; Tue, 27 Aug 2019 08:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892903; bh=NauF0gTceaO42fNrWrKjuS0JXxFtntFaONx+aShP3Ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uiydOkDFAX40aci9Uxvd/UlW4IHBaPVQqYNgD38AJubRNEqljFZHaC88mm0SA+ewO m5FzN3oY1XjkU7Bm4vNz66ZMj2rdDJfz7VNRtGx5iDO4SDt33P2XgYyU536/uPt7cD v7wHs2dJUOVWZ2xS06vvjepCuHX6ETk0UDBn6p7s= 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 5.2 052/162] netfilter: ipset: Fix rename concurrency with listing Date: Tue, 27 Aug 2019 09:49:40 +0200 Message-Id: <20190827072740.023277554@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 16afa0df4004d..e103c875383a5 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.20.1