Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1566019

Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev
Date Tue, 24 Jan 2017 18:40:01 +0100
Message-ID <t3dex-7da-3@gated-at.bofh.it> (permalink)
References <t27Xz-6NT-1@gated-at.bofh.it>
X-Original-To f.fainelli@gmail.com
X-Mailer Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO)
MIME-Version 1.0
Content-Type Text/Plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Greylist Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 24 Jan 2017 08:40:10 -0800 (PST)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 20
Organization linux.* mail to news gateway
X-Original-Cc netdev@vger.kernel.org, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, linux-kernel@vger.kernel.org
X-Original-Date Tue, 24 Jan 2017 12:39:11 -0500 (EST)
X-Original-Message-ID <20170124.123911.330293119907498159.davem@davemloft.net>
X-Original-References <20170121174055.27560-1-f.fainelli@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1566019

Show key headers only | View raw


From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat, 21 Jan 2017 09:40:54 -0800

> of_find_net_device_by_node() just returns a reference to a net_device but does
> not increment its reference count, which means that the master network device
> can just vanish under our feet.
> 
> Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

This is fine, except now this netdev is completely locked into place with
no way to dynamically unload it.

If someone tries to modunload the driver for this ethernet device,
their screen will fill up with warning messages indicating that the
reference taken here in the DSA code is not going away.

You need to implement a netdev notifier that tears down this DSA
instance during an unregister event and releases the ethernet_dev.
Similar to how we handle protocol addresses bound to a netdev, etc.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net] net: dsa: Keep a reference count on ethernet_dev Florian Fainelli <f.fainelli@gmail.com> - 2017-01-21 18:50 +0100
  Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev David Miller <davem@davemloft.net> - 2017-01-24 18:40 +0100
    Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev Florian Fainelli <f.fainelli@gmail.com> - 2017-01-24 19:00 +0100
    Re: [PATCH net] net: dsa: Keep a reference count on ethernet_dev Florian Fainelli <f.fainelli@gmail.com> - 2017-01-24 23:30 +0100

csiph-web