2018-06-21 13:02:09

by Ross Lagerwall

[permalink] [raw]
Subject: [PATCH 0/2] xen-netfront: Fix issues with commit f599c64fdf7d

Fix a couple of issues with commit f599c64fdf7d ("xen-netfront: Fix race
between device setup and open").

Ross Lagerwall (2):
xen-netfront: Fix mismatched rtnl_unlock
xen-netfront: Update features after registering netdev

drivers/net/xen-netfront.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

--
2.9.5



2018-06-21 13:01:44

by Ross Lagerwall

[permalink] [raw]
Subject: [PATCH 2/2] xen-netfront: Update features after registering netdev

Update the features after calling register_netdev() otherwise the
device features are not set up correctly and it not possible to change
the MTU of the device. After this change, the features reported by
ethtool match the device's features before the commit which introduced
the issue and it is possible to change the device's MTU.

Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
Reported-by: Liam Shepherd <[email protected]>
Signed-off-by: Ross Lagerwall <[email protected]>
---
drivers/net/xen-netfront.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index ee4cb6c..a57daec 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1951,10 +1951,6 @@ static int xennet_connect(struct net_device *dev)
/* talk_to_netback() sets the correct number of queues */
num_queues = dev->real_num_tx_queues;

- rtnl_lock();
- netdev_update_features(dev);
- rtnl_unlock();
-
if (dev->reg_state == NETREG_UNINITIALIZED) {
err = register_netdev(dev);
if (err) {
@@ -1964,6 +1960,10 @@ static int xennet_connect(struct net_device *dev)
}
}

+ rtnl_lock();
+ netdev_update_features(dev);
+ rtnl_unlock();
+
/*
* All public and private state should now be sane. Get
* ready to start sending and receiving packets and give the driver
--
2.9.5


2018-06-21 13:02:19

by Ross Lagerwall

[permalink] [raw]
Subject: [PATCH 1/2] xen-netfront: Fix mismatched rtnl_unlock

Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
Reported-by: Ben Hutchings <[email protected]>
Signed-off-by: Ross Lagerwall <[email protected]>
---
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 922ce0a..ee4cb6c 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1810,7 +1810,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();
@@ -1925,6 +1925,7 @@ static int talk_to_netback(struct xenbus_device *dev,
xennet_destroy_queues(info);
out:
rtnl_unlock();
+out_unlocked:
device_unregister(&dev->dev);
return err;
}
--
2.9.5


2018-06-21 13:07:46

by Juergen Gross

[permalink] [raw]
Subject: Re: [PATCH 1/2] xen-netfront: Fix mismatched rtnl_unlock

On 21/06/18 15:00, Ross Lagerwall wrote:
> Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
> Reported-by: Ben Hutchings <[email protected]>
> Signed-off-by: Ross Lagerwall <[email protected]>

Reviewed-by: Juergen Gross <[email protected]>


Juergen

2018-06-21 13:14:54

by Juergen Gross

[permalink] [raw]
Subject: Re: [PATCH 2/2] xen-netfront: Update features after registering netdev

On 21/06/18 15:00, Ross Lagerwall wrote:
> Update the features after calling register_netdev() otherwise the
> device features are not set up correctly and it not possible to change
> the MTU of the device. After this change, the features reported by
> ethtool match the device's features before the commit which introduced
> the issue and it is possible to change the device's MTU.
>
> Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
> Reported-by: Liam Shepherd <[email protected]>
> Signed-off-by: Ross Lagerwall <[email protected]>

Reviewed-by: Juergen Gross <[email protected]>


Juergen

2018-06-21 22:57:33

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 0/2] xen-netfront: Fix issues with commit f599c64fdf7d

From: Ross Lagerwall <[email protected]>
Date: Thu, 21 Jun 2018 14:00:19 +0100

> Fix a couple of issues with commit f599c64fdf7d ("xen-netfront: Fix race
> between device setup and open").

Series applied and queued up for -stable.