Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2384441ybi; Sun, 9 Jun 2019 10:23:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7yuOgcuL0F+Ktpklp4ORH964yD/tpqxVC0R6uhW1OQgGJrniQL04L6o3zDQ7SJz5CoJ5v X-Received: by 2002:a17:902:7883:: with SMTP id q3mr65749802pll.89.1560101009071; Sun, 09 Jun 2019 10:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560101009; cv=none; d=google.com; s=arc-20160816; b=mwmwxeHMbAYgs5oYKKt/ifywySg9JcOFxXqNd2dephvxLXmSz+7++5UhZLMB1JuC65 g9M+NEeCoZpnKX1R+18zS0JFUlb/ESPiVujgVdEDqbnjF85HXg8z+dl7cDUsjXTm+6wO Qa5PbA3+UIMJXkFoHwtQlAldQo2rXlA7SHkm7SPWeorkvP5is/8fI2ljfhExNBcu4+7i u5HY5TVBv+rT+JxAOPZK5vy6Wa7TIVtloNQtU9+XhO0YCBKlCJSQiijtxWBonw8YHemb v0xeS1VS/NGnKeHvUDxMET259Tiu1IuGUz3KQryogMVtNJiN2WZLyKgZr/QJOa3M+DCq UJYA== 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=6trJ+jncl/C5gVFVwuyZ98ECkfijZ1DidjNbd5+K5NQ=; b=HWZEmy1KH79Nc/aKK+p6ZfNDA4/IWyVKfpl0BY1xPjcr76xfjRlFaUMd4K4GdDVFBF EcEixWC729vDY/l/ulVLjnBnKq96pfHxStP4VZ/FHWSJwed3FTSKueT7SKWf+wnavBQE MNtbEQYxoVV3eBIO1iwpPReiZA9EP4SVluuZ4kxm9Xy8zNAMnkaCgqccBHDMIjwyQI6P 1Xgn7MWbU+cGmNfDCt2rM5wX9QzQI3YyaZXUs91eAkv4+KGhpuAFxNXNE4EfKxQXPBve x39mcFsVaGCmloPN+8NdoHaXGyXaPrDYw0jykkl7jpTZ6nFVPgaxLAzVoAU3TCGbx6ZT YAjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pwGKyYHU; 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 v188si7604538pfb.132.2019.06.09.10.23.13; Sun, 09 Jun 2019 10:23:29 -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=pwGKyYHU; 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 S1730949AbfFIQrn (ORCPT + 99 others); Sun, 9 Jun 2019 12:47:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:46338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730891AbfFIQrh (ORCPT ); Sun, 9 Jun 2019 12:47:37 -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 1765C206DF; Sun, 9 Jun 2019 16:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560098856; bh=dsuY3ika3pM2TpW6IhoPArLRbVaGg/raG5jngM0Jwrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwGKyYHU1CQPhpP21tq4/HdVEEK2TlUqyyQKPUta56z7DzVSnZfFSjtmm3N2ujVUR G3XbFHSorEIPU9UpOSVgDmjk2foxCmIRvnWBwpOsKWQ4zOsNEmuAhVLxa5ujJ0FGuJ D88h79LgXSPRiKnR51vAteOB6FyMCxxP6zaj0h5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Yaro Slav , =?UTF-8?q?Maciej=20=C5=BBenczykowski?= , Hangbin Liu , "David S. Miller" Subject: [PATCH 4.19 14/51] Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied" Date: Sun, 9 Jun 2019 18:41:55 +0200 Message-Id: <20190609164127.924633657@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.123076536@linuxfoundation.org> References: <20190609164127.123076536@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 From: Hangbin Liu [ Upstream commit 4970b42d5c362bf873982db7d93245c5281e58f4 ] This reverts commit e9919a24d3022f72bcadc407e73a6ef17093a849. Nathan reported the new behaviour breaks Android, as Android just add new rules and delete old ones. If we return 0 without adding dup rules, Android will remove the new added rules and causing system to soft-reboot. Fixes: e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied") Reported-by: Nathan Chancellor Reported-by: Yaro Slav Reported-by: Maciej Żenczykowski Signed-off-by: Hangbin Liu Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/fib_rules.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -756,9 +756,9 @@ int fib_nl_newrule(struct sk_buff *skb, if (err) goto errout; - if (rule_exists(ops, frh, tb, rule)) { - if (nlh->nlmsg_flags & NLM_F_EXCL) - err = -EEXIST; + if ((nlh->nlmsg_flags & NLM_F_EXCL) && + rule_exists(ops, frh, tb, rule)) { + err = -EEXIST; goto errout_free; }