From: Keir Fraser Subject: Re: Re: [patch] netfront: unregister net device at backend_changed() if network_connect() failed Date: Wed, 19 Nov 2008 08:56:09 +0000 Message-ID: References: <20081119021337.GA16531@joejin-pc.cn.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20081119021337.GA16531@joejin-pc.cn.oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Joe Jin Cc: Xen-Devel List-Id: xen-devel@lists.xenproject.org On 19/11/08 02:13, "Joe Jin" wrote: >> One concern I have is that leaving an interface structure allocated but >> unregistered is not a state we've previously handled in netfront, and could >> cause bad kernel behaviour if, for example, the netif gets unprobed later. >> > > I think if device initilise failed, we'd better release all resources like > former's netif_free(): http://xen.markmail.org/message/2bp3xgsqzdofwoy6 > from patch description the patch tried to *"eliminates earlier workaround > patch > for an observed crash."* > In fact the crashed caused by not unregister the device made the interface's > state is NETREG_REGISTERED, when network_connect() failed, call free_netdev() > would trigered BUG_ON, just add unregister_netdev() would solved the issue. My point is, if you unregister_netdev() on failed network_connect(), and then do it unconditionally again in netfront_remove(), you will BUG_ON() in unregister_netdevice(). -- Keir