[1/2] xen-netfront: Fix mismatched rtnl_unlock

Message ID 1531407011-403-2-git-send-email-stefan.bader@canonical.com
State New
Headers show
Series
  • [1/2] xen-netfront: Fix mismatched rtnl_unlock
Related show

Commit Message

Stefan Bader July 12, 2018, 2:50 p.m.
From: Ross Lagerwall <ross.lagerwall@citrix.com>

Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

BugLink: https://bugs.launchpad.net/bugs/1781413

(cherry picked from commit cb257783c2927b73614b20f915a91ff78aa6f3e8)
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 drivers/net/xen-netfront.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Colin King July 12, 2018, 3:07 p.m. | #1
On 12/07/18 15:50, Stefan Bader wrote:
> From: Ross Lagerwall <ross.lagerwall@citrix.com>
> 
> Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
> Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> Reviewed-by: Juergen Gross <jgross@suse.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> BugLink: https://bugs.launchpad.net/bugs/1781413
> 
> (cherry picked from commit cb257783c2927b73614b20f915a91ff78aa6f3e8)
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  drivers/net/xen-netfront.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index a0de245..f4479b9 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1821,7 +1821,7 @@ static int talk_to_netback(struct xenbus_device *dev,
>  	err = xen_net_read_mac(dev, info->netdev->dev_addr);
>  	if (err) {
>  		xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
> -		goto out;
> +		goto out_unlocked;
>  	}
>  
>  	rtnl_lock();
> @@ -1936,6 +1936,7 @@ abort_transaction_no_dev_fatal:
>  	xennet_destroy_queues(info);
>   out:
>  	rtnl_unlock();
> +out_unlocked:
>  	device_unregister(&dev->dev);
>  	return err;
>  }
> 

Clean cherry pick, looks OK to me.

Acked-by: Colin Ian King <colin.king@canonical.com>

Patch

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index a0de245..f4479b9 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1821,7 +1821,7 @@  static int talk_to_netback(struct xenbus_device *dev,
 	err = xen_net_read_mac(dev, info->netdev->dev_addr);
 	if (err) {
 		xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
-		goto out;
+		goto out_unlocked;
 	}
 
 	rtnl_lock();
@@ -1936,6 +1936,7 @@  abort_transaction_no_dev_fatal:
 	xennet_destroy_queues(info);
  out:
 	rtnl_unlock();
+out_unlocked:
 	device_unregister(&dev->dev);
 	return err;
 }