From: Ian Campbell Date: Thu, 1 Feb 2007 10:20:34 +0000 (+0000) Subject: [LINUX] netfront: Don't call netif_carrier_off until the device is X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15358^2~27^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5d4e92412ea79ff6a085b756721ddc735a99aa1d;p=xen.git [LINUX] netfront: Don't call netif_carrier_off until the device is fuly allocated. netif_carrier_off() causes events to be queued on the device so if we subsequently abort the allocation (e.g. due to lack of grant entries) then we crash trying to access the now invalid device. Signed-off-by: Ian Campbell --- diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index f54cc84b89..bd86948fed 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -1935,8 +1935,6 @@ static struct net_device * __devinit create_netdev(struct xenbus_device *dev) np = netdev_priv(netdev); np->xbdev = dev; - netif_carrier_off(netdev); - spin_lock_init(&np->tx_lock); spin_lock_init(&np->rx_lock); @@ -1991,6 +1989,9 @@ static struct net_device * __devinit create_netdev(struct xenbus_device *dev) SET_NETDEV_DEV(netdev, &dev->dev); np->netdev = netdev; + + netif_carrier_off(netdev); + return netdev; exit_free_tx: