Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp548135imp; Thu, 21 Feb 2019 06:38:32 -0800 (PST) X-Google-Smtp-Source: AHgI3Iax582Cba4BQaRh0f/8NCk3oueKqxs58knssuSI5p1f7SXyVnNlLxdb6MeOi8QXfqHMdJHA X-Received: by 2002:a17:902:e60e:: with SMTP id cm14mr5117060plb.192.1550759912281; Thu, 21 Feb 2019 06:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550759912; cv=none; d=google.com; s=arc-20160816; b=m7+69mbNnpM4wKMAnTcRmNvWN3BafD6j5oUgKthfUbsEmcjZ0h23Kw6a2TRhq3s7Bx m2hrfDeiR1SSNwuI9CMjtGAKcO9BEuqPBurUO1xE4oItfEeheHM9SyL20O5f0cEhzR6t F89hovnmrn/yIfPO25mNCXW2+id0iEzLOAA2lMVOPB7jB9zzSJ+FBdWZoxdxluHwCMRP VvYLRXwfma6fM+r+Qw+173yDHII0TlFo+9QH/y5O+zKKRcQdZm/oHhSWBRgIlfaMaG6t Dji6lt+w2ebrRpwf3Rv2rPZ1pjzrZ5C80b/60Tejriknf4F0CPUiDCTtpvZhRD0CG5md hXDw== 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=u9zjFoyqRMcYcZZyxP5Z5feAlzDrxaON+ztVJb9lI78=; b=wCtG9xqXKKxf5kU04dyXU81Ik8ysFMSx1/HMuMtKVXhc3xSYCfBzVf6/jgslpnGDnc BObtHCbeuljyp8Y/aHNh4KVR6M43a9vRWXhaTCaP1dRM84aeTKacIrFKBdHClF8flV1d YITOTVXhM9o0wDCdgT3seeCp5m5R2se7GTIWe7eTYHwIj4phBCV7ThmQW9VLwZ1WGg56 BIRlGRPcg7scbfm78pWHjeWgqM7zqGo8chfOVj1pjqg2pbsu16OGjDGt4i0RrtnsYjOy aQXPPuw03a++ReRkbLlqMRX33OD9X8T2fcS1l58ipXFO4zj2yVBn9g6ZoOKY4kiWxWVv usVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ntre7ErZ; 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 h189si5256323pge.152.2019.02.21.06.38.17; Thu, 21 Feb 2019 06:38:32 -0800 (PST) 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=Ntre7ErZ; 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 S1728374AbfBUOhX (ORCPT + 99 others); Thu, 21 Feb 2019 09:37:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:58534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728356AbfBUOhW (ORCPT ); Thu, 21 Feb 2019 09:37:22 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 E48302084D; Thu, 21 Feb 2019 14:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550759841; bh=kkJzxKYZrE+q3S7+uQ/qRhpDlT9j+pq1GRG3koGBJbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ntre7ErZv3UvfObehpPuaLYWfx1+v7cnNPOM24R55wSvl1qcDCet0luxP8EPKmCfO Bqix+jGieLO1j9Kklrv3Wp/ThfMbXh8kDMTRIak/75SVfRXRX22oBu6dDMa6jzG8BH 4Zyp9q+ZBUdJU2b5tEZWWRPbccptPEDkecJC0G/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhiqiang Liu , Wenhao Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 01/20] net: fix IPv6 prefix route residue Date: Thu, 21 Feb 2019 15:35:31 +0100 Message-Id: <20190221141946.820305647@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221141946.772985220@linuxfoundation.org> References: <20190221141946.772985220@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e75913c93f7cd5f338ab373c34c93a655bd309cb ] Follow those steps: # ip addr add 2001:123::1/32 dev eth0 # ip addr add 2001:123:456::2/64 dev eth0 # ip addr del 2001:123::1/32 dev eth0 # ip addr del 2001:123:456::2/64 dev eth0 and then prefix route of 2001:123::1/32 will still exist. This is because ipv6_prefix_equal in check_cleanup_prefix_route func does not check whether two IPv6 addresses have the same prefix length. If the prefix of one address starts with another shorter address prefix, even though their prefix lengths are different, the return value of ipv6_prefix_equal is true. Here I add a check of whether two addresses have the same prefix to decide whether their prefixes are equal. Fixes: 5b84efecb7d9 ("ipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE") Signed-off-by: Zhiqiang Liu Reported-by: Wenhao Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4dde1e0e7d379..086cdf9f05013 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1043,7 +1043,8 @@ check_cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long *expires) list_for_each_entry(ifa, &idev->addr_list, if_list) { if (ifa == ifp) continue; - if (!ipv6_prefix_equal(&ifa->addr, &ifp->addr, + if (ifa->prefix_len != ifp->prefix_len || + !ipv6_prefix_equal(&ifa->addr, &ifp->addr, ifp->prefix_len)) continue; if (ifa->flags & (IFA_F_PERMANENT | IFA_F_NOPREFIXROUTE)) -- 2.19.1