From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] Add netdev all_adj_list refcnt propagation to fix panic Date: Tue, 04 Oct 2016 02:06:28 -0400 (EDT) Message-ID: <20161004.020628.353742496666781216.davem@davemloft.net> References: <1475523782-6358-1-git-send-email-acollins@cradlepoint.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: dsa@cumulusnetworks.com, netdev@vger.kernel.org, vfalico@gmail.com, nikolay@cumulusnetworks.com To: acollins@cradlepoint.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:54832 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752123AbcJDGGh (ORCPT ); Tue, 4 Oct 2016 02:06:37 -0400 In-Reply-To: <1475523782-6358-1-git-send-email-acollins@cradlepoint.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Andrew Collins Date: Mon, 3 Oct 2016 13:43:02 -0600 > This is a respin of a patch to fix a relatively easily reproducible kernel > panic related to the all_adj_list handling for netdevs in recent kernels. > > The following sequence of commands will reproduce the issue: > > ip link add link eth0 name eth0.100 type vlan id 100 > ip link add link eth0 name eth0.200 type vlan id 200 > ip link add name testbr type bridge > ip link set eth0.100 master testbr > ip link set eth0.200 master testbr > ip link add link testbr mac0 type macvlan > ip link delete dev testbr > > This creates an upper/lower tree of (excuse the poor ASCII art): > > /---eth0.100-eth0 > mac0-testbr- > \---eth0.200-eth0 > > When testbr is deleted, the all_adj_lists are walked, and eth0 is deleted twice from > the mac0 list. Unfortunately, during setup in __netdev_upper_dev_link, only one > reference to eth0 is added, so this results in a panic. > > This change adds reference count propagation so things are handled properly. > > Matthias Schiffer reported a similar crash in batman-adv: > > https://github.com/freifunk-gluon/gluon/issues/680 > https://www.open-mesh.org/issues/247 > > which this patch also seems to resolve. > > Signed-off-by: Andrew Collins Applied and queued up for -stable, thanks.