Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3491984pxb; Mon, 4 Apr 2022 18:42:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0UShJlVPYMmO2GH/cfY5zUZq2ilGKioEgR9ciI8qbtx+s+NAZFVZlRl8TyShDPuziB0e1 X-Received: by 2002:a17:902:f70f:b0:153:ebfe:21b3 with SMTP id h15-20020a170902f70f00b00153ebfe21b3mr966851plo.119.1649122961210; Mon, 04 Apr 2022 18:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649122961; cv=none; d=google.com; s=arc-20160816; b=LdFujI+gCgzvp1pGh6NzexzrZGhJjX8mBdmc9DiRfyvNAUvKl+kLSgzav3yGHbXE4H 0BL7zk1+9JMzQQl2a9cStlHAJCmlgEUWYowuDIvHppyco0huUZZOrEiQ3ak28SoCu4cD 6hPoObtsQ3/F+W95qKjzrJrYL7dTb+cB7YUUyeeaWm834RyIdBmJEKWsgpHT405HQfOR vqvKuZOVyTNSQGLAgMozBCP5sF+awlszSaV8q4SpcB+CMXnpeKAeaj03CzhbkMlkisuE /aq12MHi0lIWPk9OYRdxiI0hHfrHsI1dQIZypdjRkhteb/wmw4yXIPKdFLsw41Cxq63o vLkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tmaE3bk3w7jHXRbre4aq94KKPhz4+yMA0dlZbfzC3so=; b=at7qQQSZqo278+ZgE55Jqf8ukYRcHU+0LZjL2xOYkIqwQlSk42y/Rn+u0h7yxbca/f 0mB/oqmocWRvyfvp3EAKGd3X9fSD7daPi0djYhSc+XBi9R//VgjoY6Jatc09FpgHH1/6 4kmSDzdhcuDmqBDvG4d3bxGJ01a7YMdlV2T8i61j2RluTndppfTafSQpGEetH8ke1oGF i6mjyLXOqQQ1peln0rMnRIPpzBCEApHUw5g5jSvEAQkp6Lwlp7N2rGNivAJscb4g8mOp 2nSVT+gQgZ9jS7pp5xGSqSefR2dsu3P8rWtQZhAyEkLmnFjPxRwM8rgwHyCzu8e0LweF l3hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=m4hXgbCn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h9-20020a170902f70900b00153b2d16549si10195755plo.337.2022.04.04.18.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:42:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=m4hXgbCn; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 718EB2986D1; Mon, 4 Apr 2022 17:40:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347731AbiDDMuA (ORCPT + 99 others); Mon, 4 Apr 2022 08:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347355AbiDDMt7 (ORCPT ); Mon, 4 Apr 2022 08:49:59 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB4763C73A; Mon, 4 Apr 2022 05:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=tmaE3bk3w7jHXRbre4aq94KKPhz4+yMA0dlZbfzC3so=; b=m4hXgbCngnMiIc9qDyq1NKCNeR 1/pITLzBAP6ZWb6sQteBI21QuKTYKrQWXPbfkWJZ07ozns2AxCQf7coy+W1y01RllfjDjgOG2NbWK DlKyGr92bsQiT8ip6B3zNJSG0cOAFPGy0rO4P5acGKsHEUBN0lJ4LJCQfbjYHQGwQ/MU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nbM7i-00E5hI-2o; Mon, 04 Apr 2022 14:47:58 +0200 Date: Mon, 4 Apr 2022 14:47:58 +0200 From: Andrew Lunn To: Niels Dossche Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , Paolo Abeni Subject: Re: [PATCH net-next v2] ipv6: fix locking issues with loops over idev->addr_list Message-ID: References: <20220403231523.45843-1-dossche.niels@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220403231523.45843-1-dossche.niels@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 04, 2022 at 01:15:24AM +0200, Niels Dossche wrote: > idev->addr_list needs to be protected by idev->lock. However, it is not > always possible to do so while iterating and performing actions on > inet6_ifaddr instances. For example, multiple functions (like > addrconf_{join,leave}_anycast) eventually call down to other functions > that acquire the idev->lock. The current code temporarily unlocked the > idev->lock during the loops, which can cause race conditions. Moving the > locks up is also not an appropriate solution as the ordering of lock > acquisition will be inconsistent with for example mc_lock. Hi Niels What sort of issues could the race result in? I've been chasing a netdev reference leak, when using the GNS3 simulator. Shutting down the system can result in one interface having a netdev reference count of 5, and it never gets destroyed. Using the tracker code Eric recently added, i found one of the leaks is idev, its reference count does not go to 0, and hence the reference it holds on the netdev is never released. I will test this patch out, see if it helps, but i'm just wondering if you think the issue i'm seeing is theoretically possible because of this race? If it is, we might want this applied to stable, not just net-next. Thanks Andrew