Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5237221ybl; Tue, 27 Aug 2019 01:19:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyNXiVJD1mzaIoAIMFtcHtiVlcoJZo/DGY8Q8FQLQIt2cCf/fe0WpmgSlV/eyRvu38YVX/ X-Received: by 2002:a63:9249:: with SMTP id s9mr19574638pgn.356.1566893951114; Tue, 27 Aug 2019 01:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893951; cv=none; d=google.com; s=arc-20160816; b=H1I4NGPmU15f9Sw5BATQovN4PK82GvlwsioDAnj0CxmMScKjs6DEotA8qQ6NVyrMtg VePuHuCfyLV0Cbh/eF0WhIzvVrmB+FlVjj+16fGyP9sVkeeX6JIl+Vhyu8LWFse/SGJZ HAZzq0AFB87Ii0Nz56Qdl3x9chEOoyhDtJtWSzZacMoMjRYWGa3R0xG/bKYO8tmREpac 2eqTdx58NEQToH6GroDVjjxLSyKScVMTd9IiaA7MEw73VSStMHLTPyruuSsJHG0XCR2e OekxPUWHgV9tUXEneiEQbaFb6R9IGUWKZqUaqCOIZAV2t9kmeQBrzuc1GB3HO27MC9Ad xd8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bElWlzgHZo8+9EaByqi3izV05a8cE1LpQdJG8bx4wHI=; b=ZWS6k9uHzh36Gy2ta2a9gr0SjAtRPXKbow3UaSZADY/5SZx0OkIdFECHyv7gb3gKjR DMgNVLrbimBOn9onLgh6FSAOAdURplPp0ZPClVU2KqFyB9tLfkgZlifJxEPTRh1oKPMC /PDbtQPVdDoPqL7ercfIrZ2vb53QPI376fMhKirx/krsFeay7oAZctrkfoXtfO1Pw9JE 19jT0/tUTe24Il65yCuKZ6MkqQzJhZEcjcdDMXZfxi3ax15i0Umbx4QlcND2YmtrN798 PSvvAYeRh/mVJBAQmzxtfZUD7tmehzIm4l48gKG9bFbqUkjd5snVkGx47f63rF6ecYjh V7mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZqfwGY95; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si11191304pga.449.2019.08.27.01.18.55; Tue, 27 Aug 2019 01:19:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZqfwGY95; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729993AbfH0HyO (ORCPT + 99 others); Tue, 27 Aug 2019 03:54:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:45654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729967AbfH0HyE (ORCPT ); Tue, 27 Aug 2019 03:54:04 -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 BB25B206BF; Tue, 27 Aug 2019 07:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892444; bh=//oeRa0uJ7XUOu2d3wq+iG/HBwqW0QTZBAbPSgQ/FLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqfwGY95pO6MR4xpq+RMnr8wHv0W+TDC8MMOHBILoEqVc/u+5s65TLsqwgSeloCYv tCypPfBfWZMx1n7+hJzKXfOSlLbGGI42MY7bH7YIH+k17ZRlEZp25SSp/uhTCw7Zhz yN0oErMUDq85pwezzeSOK+xvDVqAx0aD/tlNP5mw= 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.14 15/62] netfilter: ipset: Fix rename concurrency with listing Date: Tue, 27 Aug 2019 09:50:20 +0200 Message-Id: <20190827072701.219477127@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@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 a3f1dc7cf5382..dbf17d3596a69 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -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; } -- 2.20.1