Fix for Xen MTU issue (rhbz 1584216)

This commit is contained in:
Laura Abbott 2018-06-21 14:15:09 -07:00
parent a94d1056ee
commit c9cb169d5e
3 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,46 @@
From patchwork Thu Jun 21 13:00:20 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [1/2] xen-netfront: Fix mismatched rtnl_unlock
X-Patchwork-Submitter: Ross Lagerwall <ross.lagerwall@citrix.com>
X-Patchwork-Id: 932721
Message-Id: <20180621130021.27029-2-ross.lagerwall@citrix.com>
To: <netdev@vger.kernel.org>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>, "David S. Miller" <davem@davemloft.net>,
<xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>
Date: Thu, 21 Jun 2018 14:00:20 +0100
From: Ross Lagerwall <ross.lagerwall@citrix.com>
List-Id: <netdev.vger.kernel.org>
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>
---
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;
}

View File

@ -0,0 +1,58 @@
From patchwork Thu Jun 21 13:00:21 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [2/2] xen-netfront: Update features after registering netdev
X-Patchwork-Submitter: Ross Lagerwall <ross.lagerwall@citrix.com>
X-Patchwork-Id: 932720
Message-Id: <20180621130021.27029-3-ross.lagerwall@citrix.com>
To: <netdev@vger.kernel.org>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>, "David S. Miller" <davem@davemloft.net>,
<xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
Liam Shepherd <liam@dancer.es>
Date: Thu, 21 Jun 2018 14:00:21 +0100
From: Ross Lagerwall <ross.lagerwall@citrix.com>
List-Id: <netdev.vger.kernel.org>
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 <liam@dancer.es>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
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

View File

@ -647,6 +647,10 @@ Patch508: ath10k-Update-the-phymode-along-with-bandwidth-change.patch
# In 4.18
Patch509: rtc-nvmem-don-t-return-an-error-when-not-enabled.patch
# rhbz 1584216
Patch510: 1-2-xen-netfront-Fix-mismatched-rtnl_unlock.patch
Patch511: 2-2-xen-netfront-Update-features-after-registering-netdev.patch
# END OF PATCH DEFINITIONS
%endif
@ -1896,6 +1900,9 @@ fi
#
#
%changelog
* Thu Jun 21 2018 Laura Abbott <labbott@fedoraproject.org>
- Fix for Xen MTU issue (rhbz 1584216)
* Thu Jun 21 2018 Peter Robinson <pbrobinson@fedoraproject.org>
- Add fix for 96boards DB410c