netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel
@ 2020-10-12 19:02 Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 06/24] mt76: mt7615: reduce maximum VHT MPDU length to 7991 Sasha Levin
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Hauke Mehrtens, David S . Miller, Sasha Levin, netdev

From: Hauke Mehrtens <hauke@hauke-m.de>

[ Upstream commit f9317ae5523f99999fb54c513ebabbb2bc887ddf ]

The TX DMA channel data is accessed by the xrx200_start_xmit() and the
xrx200_tx_housekeeping() function from different threads. Make sure the
accesses are synchronized by acquiring the netif_tx_lock() in the
xrx200_tx_housekeeping() function too. This lock is acquired by the
kernel before calling xrx200_start_xmit().

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/lantiq_xrx200.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 635ff3a5dcfb3..51ed8a54d3801 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -245,6 +245,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
 	int pkts = 0;
 	int bytes = 0;
 
+	netif_tx_lock(net_dev);
 	while (pkts < budget) {
 		struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->tx_free];
 
@@ -268,6 +269,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
 	net_dev->stats.tx_bytes += bytes;
 	netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
 
+	netif_tx_unlock(net_dev);
 	if (netif_queue_stopped(net_dev))
 		netif_wake_queue(net_dev);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 06/24] mt76: mt7615: reduce maximum VHT MPDU length to 7991
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 07/24] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions Sasha Levin
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Felix Fietkau, Kalle Valo, Sasha Levin, linux-wireless, netdev,
	linux-arm-kernel, linux-mediatek

From: Felix Fietkau <nbd@nbd.name>

[ Upstream commit efb1676306f664625c0c546dd10d18d33c75e3fc ]

After fixing mac80211 to allow larger A-MSDUs in some cases, there have been
reports of performance regressions and packet loss with some clients.
It appears that the issue occurs when the hardware is transmitting A-MSDUs
bigger than 8k. Limit the local VHT MPDU size capability to 7991, matching
the value used for MT7915 as well.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200923052442.24141-1-nbd@nbd.name
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7615/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index e2d80518e5af9..992a36602ad4c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -453,7 +453,7 @@ void mt7615_init_device(struct mt7615_dev *dev)
 	dev->mphy.sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
 	dev->mphy.sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
 	dev->mphy.sband_5g.sband.vht_cap.cap |=
-			IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
+			IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
 			IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
 	mt7615_cap_dbdc_disable(dev);
 	dev->phy.dfs_state = -1;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 07/24] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 06/24] mt76: mt7615: reduce maximum VHT MPDU length to 7991 Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 09/24] net/fsl: quieten expected MDIO access failures Sasha Levin
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Xie He, Martin Schiller, David S . Miller, Sasha Levin, netdev

From: Xie He <xie.he.0141@gmail.com>

[ Upstream commit ed46cd1d4cc4b2cf05f31fe25fc68d1a9d3589ba ]

1.
Move the lapb_register/lapb_unregister calls into the ndo_open/ndo_stop
functions.
This makes the LAPB protocol start/stop when the network interface
starts/stops. When the network interface is down, the LAPB protocol
shouldn't be running and the LAPB module shoudn't be generating control
frames.

2.
Move netif_start_queue/netif_stop_queue into the ndo_open/ndo_stop
functions.
This makes the TX queue start/stop when the network interface
starts/stops.
(netif_stop_queue was originally in the ndo_stop function. But to make
the code look better, I created a new function to use as ndo_stop, and
made it call the original ndo_stop function. I moved netif_stop_queue
from the original ndo_stop function to the new ndo_stop function.)

Cc: Martin Schiller <ms@dev.tdt.de>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wan/x25_asy.c | 43 +++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 84640a0c13f35..6b427d5dec7e4 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -456,7 +456,6 @@ static int x25_asy_open(struct net_device *dev)
 {
 	struct x25_asy *sl = netdev_priv(dev);
 	unsigned long len;
-	int err;
 
 	if (sl->tty == NULL)
 		return -ENODEV;
@@ -482,14 +481,7 @@ static int x25_asy_open(struct net_device *dev)
 	sl->xleft    = 0;
 	sl->flags   &= (1 << SLF_INUSE);      /* Clear ESCAPE & ERROR flags */
 
-	netif_start_queue(dev);
-
-	/*
-	 *	Now attach LAPB
-	 */
-	err = lapb_register(dev, &x25_asy_callbacks);
-	if (err == LAPB_OK)
-		return 0;
+	return 0;
 
 	/* Cleanup */
 	kfree(sl->xbuff);
@@ -511,7 +503,6 @@ static int x25_asy_close(struct net_device *dev)
 	if (sl->tty)
 		clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
 
-	netif_stop_queue(dev);
 	sl->rcount = 0;
 	sl->xleft  = 0;
 	spin_unlock(&sl->lock);
@@ -596,7 +587,6 @@ static int x25_asy_open_tty(struct tty_struct *tty)
 static void x25_asy_close_tty(struct tty_struct *tty)
 {
 	struct x25_asy *sl = tty->disc_data;
-	int err;
 
 	/* First make sure we're connected. */
 	if (!sl || sl->magic != X25_ASY_MAGIC)
@@ -607,11 +597,6 @@ static void x25_asy_close_tty(struct tty_struct *tty)
 		dev_close(sl->dev);
 	rtnl_unlock();
 
-	err = lapb_unregister(sl->dev);
-	if (err != LAPB_OK)
-		pr_err("%s: lapb_unregister error: %d\n",
-		       __func__, err);
-
 	tty->disc_data = NULL;
 	sl->tty = NULL;
 	x25_asy_free(sl);
@@ -714,15 +699,39 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file,
 
 static int x25_asy_open_dev(struct net_device *dev)
 {
+	int err;
 	struct x25_asy *sl = netdev_priv(dev);
 	if (sl->tty == NULL)
 		return -ENODEV;
+
+	err = lapb_register(dev, &x25_asy_callbacks);
+	if (err != LAPB_OK)
+		return -ENOMEM;
+
+	netif_start_queue(dev);
+
+	return 0;
+}
+
+static int x25_asy_close_dev(struct net_device *dev)
+{
+	int err;
+
+	netif_stop_queue(dev);
+
+	err = lapb_unregister(dev);
+	if (err != LAPB_OK)
+		pr_err("%s: lapb_unregister error: %d\n",
+		       __func__, err);
+
+	x25_asy_close(dev);
+
 	return 0;
 }
 
 static const struct net_device_ops x25_asy_netdev_ops = {
 	.ndo_open	= x25_asy_open_dev,
-	.ndo_stop	= x25_asy_close,
+	.ndo_stop	= x25_asy_close_dev,
 	.ndo_start_xmit	= x25_asy_xmit,
 	.ndo_tx_timeout	= x25_asy_timeout,
 	.ndo_change_mtu	= x25_asy_change_mtu,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 09/24] net/fsl: quieten expected MDIO access failures
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 06/24] mt76: mt7615: reduce maximum VHT MPDU length to 7991 Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 07/24] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 10/24] net: usb: ax88179_178a: add Toshiba usb 3.0 adapter Sasha Levin
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jamie Iles, Jeremy Linton, Andrew Lunn, David S . Miller,
	Sasha Levin, netdev

From: Jamie Iles <jamie@nuviainc.com>

[ Upstream commit 1ec8e74855588cecb2620b28b877c08f45765374 ]

MDIO reads can happen during PHY probing, and printing an error with
dev_err can result in a large number of error messages during device
probe.  On a platform with a serial console this can result in
excessively long boot times in a way that looks like an infinite loop
when multiple busses are present.  Since 0f183fd151c (net/fsl: enable
extended scanning in xgmac_mdio) we perform more scanning so there are
potentially more failures.

Reduce the logging level to dev_dbg which is consistent with the
Freescale enetc driver.

Cc: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Jamie Iles <jamie@nuviainc.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/freescale/xgmac_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index c82c85ef5fb34..61cb4ba0005bd 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -229,7 +229,7 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 	/* Return all Fs if nothing was there */
 	if ((xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
 	    !priv->has_a011043) {
-		dev_err(&bus->dev,
+		dev_dbg(&bus->dev,
 			"Error while reading PHY%d reg at %d.%hhu\n",
 			phy_id, dev_addr, regnum);
 		return 0xffff;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 10/24] net: usb: ax88179_178a: add Toshiba usb 3.0 adapter
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (2 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 09/24] net/fsl: quieten expected MDIO access failures Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 11/24] net: atlantic: fix build when object tree is separate Sasha Levin
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Wilken Gottwalt, David S . Miller, Sasha Levin, linux-usb, netdev

From: Wilken Gottwalt <wilken.gottwalt@mailbox.org>

[ Upstream commit e42d72fea91f8f2e82b65808739ca04b7a8cd7a8 ]

Adds the driver_info and usb ids of the AX88179 based Toshiba USB 3.0
ethernet adapter.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@mailbox.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/usb/ax88179_178a.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index a38e868e44d46..125f7bf57590b 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1828,6 +1828,19 @@ static const struct driver_info belkin_info = {
 	.tx_fixup = ax88179_tx_fixup,
 };
 
+static const struct driver_info toshiba_info = {
+	.description = "Toshiba USB Ethernet Adapter",
+	.bind	= ax88179_bind,
+	.unbind = ax88179_unbind,
+	.status = ax88179_status,
+	.link_reset = ax88179_link_reset,
+	.reset	= ax88179_reset,
+	.stop = ax88179_stop,
+	.flags	= FLAG_ETHER | FLAG_FRAMING_AX,
+	.rx_fixup = ax88179_rx_fixup,
+	.tx_fixup = ax88179_tx_fixup,
+};
+
 static const struct usb_device_id products[] = {
 {
 	/* ASIX AX88179 10/100/1000 */
@@ -1861,6 +1874,10 @@ static const struct usb_device_id products[] = {
 	/* Belkin B2B128 USB 3.0 Hub + Gigabit Ethernet Adapter */
 	USB_DEVICE(0x050d, 0x0128),
 	.driver_info = (unsigned long)&belkin_info,
+}, {
+	/* Toshiba USB 3.0 GBit Ethernet Adapter */
+	USB_DEVICE(0x0930, 0x0a13),
+	.driver_info = (unsigned long)&toshiba_info,
 },
 	{ },
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 11/24] net: atlantic: fix build when object tree is separate
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (3 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 10/24] net: usb: ax88179_178a: add Toshiba usb 3.0 adapter Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 12/24] net: usb: ax88179_178a: add MCT usb 3.0 adapter Sasha Levin
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Igor Russkikh, David S . Miller, Sasha Levin, netdev

From: Igor Russkikh <irusskikh@marvell.com>

[ Upstream commit 059432495e209279bae12db3d2b0bc8c8fe987bb ]

Driver subfolder files refer parent folder includes in an
absolute manner.

Makefile contains a -I for this, but apparently that does not
work if object tree is separated.

Adding srctree to fix that.

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/aquantia/atlantic/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/Makefile b/drivers/net/ethernet/aquantia/atlantic/Makefile
index 130a105d03f3b..8ebcc68e807fc 100644
--- a/drivers/net/ethernet/aquantia/atlantic/Makefile
+++ b/drivers/net/ethernet/aquantia/atlantic/Makefile
@@ -8,7 +8,7 @@
 
 obj-$(CONFIG_AQTION) += atlantic.o
 
-ccflags-y += -I$(src)
+ccflags-y += -I$(srctree)/$(src)
 
 atlantic-objs := aq_main.o \
 	aq_nic.o \
@@ -33,4 +33,4 @@ atlantic-objs := aq_main.o \
 
 atlantic-$(CONFIG_MACSEC) += aq_macsec.o
 
-atlantic-$(CONFIG_PTP_1588_CLOCK) += aq_ptp.o
\ No newline at end of file
+atlantic-$(CONFIG_PTP_1588_CLOCK) += aq_ptp.o
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 12/24] net: usb: ax88179_178a: add MCT usb 3.0 adapter
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (4 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 11/24] net: atlantic: fix build when object tree is separate Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 13/24] net: dsa: felix: fix incorrect action offsets for VCAP IS2 Sasha Levin
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Wilken Gottwalt, David S . Miller, Sasha Levin, linux-usb, netdev

From: Wilken Gottwalt <wilken.gottwalt@mailbox.org>

[ Upstream commit c92a79829c7c169139874aa1d4bf6da32d10c38a ]

Adds the driver_info and usb ids of the AX88179 based MCT U3-A9003 USB
3.0 ethernet adapter.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@mailbox.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/usb/ax88179_178a.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 125f7bf57590b..a2f8a93c89269 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1841,6 +1841,19 @@ static const struct driver_info toshiba_info = {
 	.tx_fixup = ax88179_tx_fixup,
 };
 
+static const struct driver_info mct_info = {
+	.description = "MCT USB 3.0 Gigabit Ethernet Adapter",
+	.bind	= ax88179_bind,
+	.unbind	= ax88179_unbind,
+	.status	= ax88179_status,
+	.link_reset = ax88179_link_reset,
+	.reset	= ax88179_reset,
+	.stop	= ax88179_stop,
+	.flags	= FLAG_ETHER | FLAG_FRAMING_AX,
+	.rx_fixup = ax88179_rx_fixup,
+	.tx_fixup = ax88179_tx_fixup,
+};
+
 static const struct usb_device_id products[] = {
 {
 	/* ASIX AX88179 10/100/1000 */
@@ -1878,6 +1891,10 @@ static const struct usb_device_id products[] = {
 	/* Toshiba USB 3.0 GBit Ethernet Adapter */
 	USB_DEVICE(0x0930, 0x0a13),
 	.driver_info = (unsigned long)&toshiba_info,
+}, {
+	/* Magic Control Technology U3-A9003 USB 3.0 Gigabit Ethernet Adapter */
+	USB_DEVICE(0x0711, 0x0179),
+	.driver_info = (unsigned long)&mct_info,
 },
 	{ },
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 13/24] net: dsa: felix: fix incorrect action offsets for VCAP IS2
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (5 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 12/24] net: usb: ax88179_178a: add MCT usb 3.0 adapter Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 14/24] via-rhine: Fix for the hardware having a reset failure after resume Sasha Levin
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vladimir Oltean, David S . Miller, Sasha Levin, netdev

From: Vladimir Oltean <vladimir.oltean@nxp.com>

[ Upstream commit 460e985ea07ec23d46af257e84e57b5409576577 ]

The port mask width was larger than the actual number of ports, and
therefore, all fields following this one were also shifted by the number
of excess bits. But the driver doesn't use the REW_OP, SMAC_REPLACE_ENA
or ACL_ID bits from the action vector, so the bug was inconsequential.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 7c167a394b762..885a59c97ff23 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -647,12 +647,12 @@ struct vcap_field vsc9959_vcap_is2_actions[] = {
 	[VCAP_IS2_ACT_POLICE_ENA]		= {  9,  1},
 	[VCAP_IS2_ACT_POLICE_IDX]		= { 10,  9},
 	[VCAP_IS2_ACT_POLICE_VCAP_ONLY]		= { 19,  1},
-	[VCAP_IS2_ACT_PORT_MASK]		= { 20, 11},
-	[VCAP_IS2_ACT_REW_OP]			= { 31,  9},
-	[VCAP_IS2_ACT_SMAC_REPLACE_ENA]		= { 40,  1},
-	[VCAP_IS2_ACT_RSV]			= { 41,  2},
-	[VCAP_IS2_ACT_ACL_ID]			= { 43,  6},
-	[VCAP_IS2_ACT_HIT_CNT]			= { 49, 32},
+	[VCAP_IS2_ACT_PORT_MASK]		= { 20,  6},
+	[VCAP_IS2_ACT_REW_OP]			= { 26,  9},
+	[VCAP_IS2_ACT_SMAC_REPLACE_ENA]		= { 35,  1},
+	[VCAP_IS2_ACT_RSV]			= { 36,  2},
+	[VCAP_IS2_ACT_ACL_ID]			= { 38,  6},
+	[VCAP_IS2_ACT_HIT_CNT]			= { 44, 32},
 };
 
 static const struct vcap_props vsc9959_vcap_props[] = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 14/24] via-rhine: Fix for the hardware having a reset failure after resume
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (6 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 13/24] net: dsa: felix: fix incorrect action offsets for VCAP IS2 Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 15/24] via-rhine: VTunknown1 device is really VT8251 South Bridge Sasha Levin
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Kevin Brace, David S . Miller, Sasha Levin, netdev

From: Kevin Brace <kevinbrace@bracecomputerlab.com>

[ Upstream commit d120c9a81e32c43cba8017dec873b6a414898716 ]

In rhine_resume() and rhine_suspend(), the code calls netif_running()
to see if the network interface is down or not.  If it is down (i.e.,
netif_running() returning false), they will skip any housekeeping work
within the function relating to the hardware.  This becomes a problem
when the hardware resumes from a standby since it is counting on
rhine_resume() to map its MMIO and power up rest of the hardware.
Not getting its MMIO remapped and rest of the hardware powered
up lead to a soft reset failure and hardware disappearance.  The
solution is to map its MMIO and power up rest of the hardware inside
rhine_open() before soft reset is to be performed.  This solution was
verified on ASUS P5V800-VM mainboard's integrated Rhine-II Ethernet
MAC inside VIA Technologies VT8251 South Bridge.

Signed-off-by: Kevin Brace <kevinbrace@bracecomputerlab.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/via/via-rhine.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 803247d51fe97..a20492da34079 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -1706,6 +1706,8 @@ static int rhine_open(struct net_device *dev)
 		goto out_free_ring;
 
 	alloc_tbufs(dev);
+	enable_mmio(rp->pioaddr, rp->quirks);
+	rhine_power_init(dev);
 	rhine_chip_reset(dev);
 	rhine_task_enable(rp);
 	init_registers(dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 15/24] via-rhine: VTunknown1 device is really VT8251 South Bridge
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (7 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 14/24] via-rhine: Fix for the hardware having a reset failure after resume Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 16/24] vhost vdpa: fix vhost_vdpa_open error handling Sasha Levin
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Kevin Brace, David S . Miller, Sasha Levin, netdev

From: Kevin Brace <kevinbrace@bracecomputerlab.com>

[ Upstream commit aa15190cf2cf25ec7e6c6d7373ae3ca563d48601 ]

The VIA Technologies VT8251 South Bridge's integrated Rhine-II
Ethernet MAC comes has a PCI revision value of 0x7c.  This was
verified on ASUS P5V800-VM mainboard.

Signed-off-by: Kevin Brace <kevinbrace@bracecomputerlab.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/via/via-rhine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index a20492da34079..d3a2be2e75d09 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -243,7 +243,7 @@ enum rhine_revs {
 	VT8233		= 0x60,	/* Integrated MAC */
 	VT8235		= 0x74,	/* Integrated MAC */
 	VT8237		= 0x78,	/* Integrated MAC */
-	VTunknown1	= 0x7C,
+	VT8251		= 0x7C,	/* Integrated MAC */
 	VT6105		= 0x80,
 	VT6105_B0	= 0x83,
 	VT6105L		= 0x8A,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 16/24] vhost vdpa: fix vhost_vdpa_open error handling
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (8 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 15/24] via-rhine: VTunknown1 device is really VT8251 South Bridge Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 17/24] net: usb: pegasus: Proper error handing when setting pegasus' MAC address Sasha Levin
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Mike Christie, Michael S . Tsirkin, Jason Wang, Sasha Levin, kvm,
	virtualization, netdev

From: Mike Christie <michael.christie@oracle.com>

[ Upstream commit 37787e9f81e2e586b526ff5c29c94e4f41513e80 ]

We must free the vqs array in the open failure path, because
vhost_vdpa_release will not be called.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/1600712588-9514-2-git-send-email-michael.christie@oracle.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/vhost/vdpa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index a54b60d6623f0..13cdf38f8578a 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -760,6 +760,7 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
 
 err_init_iotlb:
 	vhost_dev_cleanup(&v->vdev);
+	kfree(vqs);
 err:
 	atomic_dec(&v->opened);
 	return r;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 17/24] net: usb: pegasus: Proper error handing when setting pegasus' MAC address
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (9 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 16/24] vhost vdpa: fix vhost_vdpa_open error handling Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails Sasha Levin
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 24/24] net: usb: qmi_wwan: add Cellient MPL200 card Sasha Levin
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Petko Manolov, David S . Miller, Sasha Levin, linux-usb, netdev

From: Petko Manolov <petko.manolov@konsulko.com>

[ Upstream commit f30e25a9d1b25ac8d40071c4dc2679ad0fcdc55a ]

v2:

If reading the MAC address from eeprom fail don't throw an error, use randomly
generated MAC instead.  Either way the adapter will soldier on and the return
type of set_ethernet_addr() can be reverted to void.

v1:

Fix a bug in set_ethernet_addr() which does not take into account possible
errors (or partial reads) returned by its helpers.  This can potentially lead to
writing random data into device's MAC address registers.

Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/usb/pegasus.c | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 0ef7e1f443e33..2e7b67fc7e64d 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -360,28 +360,47 @@ fail:
 }
 #endif				/* PEGASUS_WRITE_EEPROM */
 
-static inline void get_node_id(pegasus_t *pegasus, __u8 *id)
+static inline int get_node_id(pegasus_t *pegasus, u8 *id)
 {
-	int i;
-	__u16 w16;
+	int i, ret;
+	u16 w16;
 
 	for (i = 0; i < 3; i++) {
-		read_eprom_word(pegasus, i, &w16);
+		ret = read_eprom_word(pegasus, i, &w16);
+		if (ret < 0)
+			return ret;
 		((__le16 *) id)[i] = cpu_to_le16(w16);
 	}
+
+	return 0;
 }
 
 static void set_ethernet_addr(pegasus_t *pegasus)
 {
-	__u8 node_id[6];
+	int ret;
+	u8 node_id[6];
 
 	if (pegasus->features & PEGASUS_II) {
-		get_registers(pegasus, 0x10, sizeof(node_id), node_id);
+		ret = get_registers(pegasus, 0x10, sizeof(node_id), node_id);
+		if (ret < 0)
+			goto err;
 	} else {
-		get_node_id(pegasus, node_id);
-		set_registers(pegasus, EthID, sizeof(node_id), node_id);
+		ret = get_node_id(pegasus, node_id);
+		if (ret < 0)
+			goto err;
+		ret = set_registers(pegasus, EthID, sizeof(node_id), node_id);
+		if (ret < 0)
+			goto err;
 	}
+
 	memcpy(pegasus->net->dev_addr, node_id, sizeof(node_id));
+
+	return;
+err:
+	eth_hw_addr_random(pegasus->net);
+	dev_info(&pegasus->intf->dev, "software assigned MAC address.\n");
+
+	return;
 }
 
 static inline int reset_mac(pegasus_t *pegasus)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (10 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 17/24] net: usb: pegasus: Proper error handing when setting pegasus' MAC address Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  2020-10-12 19:11   ` Joe Perches
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 24/24] net: usb: qmi_wwan: add Cellient MPL200 card Sasha Levin
  12 siblings, 1 reply; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Anant Thazhemadam, syzbot+abbc768b560c84d92fd3, Petko Manolov,
	David S . Miller, Sasha Levin, linux-usb, netdev

From: Anant Thazhemadam <anant.thazhemadam@gmail.com>

[ Upstream commit f45a4248ea4cc13ed50618ff066849f9587226b2 ]

When get_registers() fails in set_ethernet_addr(),the uninitialized
value of node_id gets copied over as the address.
So, check the return value of get_registers().

If get_registers() executed successfully (i.e., it returns
sizeof(node_id)), copy over the MAC address using ether_addr_copy()
(instead of using memcpy()).

Else, if get_registers() failed instead, a randomly generated MAC
address is set as the MAC address instead.

Reported-by: syzbot+abbc768b560c84d92fd3@syzkaller.appspotmail.com
Tested-by: syzbot+abbc768b560c84d92fd3@syzkaller.appspotmail.com
Acked-by: Petko Manolov <petkan@nucleusys.com>
Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/usb/rtl8150.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index e7c630d375899..63a4da0b2d6dd 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -274,12 +274,20 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
 		return 1;
 }
 
-static inline void set_ethernet_addr(rtl8150_t * dev)
+static void set_ethernet_addr(rtl8150_t *dev)
 {
-	u8 node_id[6];
+	u8 node_id[ETH_ALEN];
+	int ret;
+
+	ret = get_registers(dev, IDR, sizeof(node_id), node_id);
 
-	get_registers(dev, IDR, sizeof(node_id), node_id);
-	memcpy(dev->netdev->dev_addr, node_id, sizeof(node_id));
+	if (ret == sizeof(node_id)) {
+		ether_addr_copy(dev->netdev->dev_addr, node_id);
+	} else {
+		eth_hw_addr_random(dev->netdev);
+		netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n",
+			      dev->netdev->dev_addr);
+	}
 }
 
 static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH AUTOSEL 5.8 24/24] net: usb: qmi_wwan: add Cellient MPL200 card
  2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
                   ` (11 preceding siblings ...)
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails Sasha Levin
@ 2020-10-12 19:02 ` Sasha Levin
  12 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-12 19:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Wilken Gottwalt, Bjørn Mork, Jakub Kicinski, Sasha Levin,
	linux-usb, netdev

From: Wilken Gottwalt <wilken.gottwalt@mailbox.org>

[ Upstream commit 28802e7c0c9954218d1830f7507edc9d49b03a00 ]

Add usb ids of the Cellient MPL200 card.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@mailbox.org>
Acked-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/usb/qmi_wwan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 07c42c0719f5b..5ca1356b8656f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1375,6 +1375,7 @@ static const struct usb_device_id products[] = {
 	{QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)},	/* Fibocom NL678 series */
 	{QMI_FIXED_INTF(0x0489, 0xe0b4, 0)},	/* Foxconn T77W968 LTE */
 	{QMI_FIXED_INTF(0x0489, 0xe0b5, 0)},	/* Foxconn T77W968 LTE with eSIM support*/
+	{QMI_FIXED_INTF(0x2692, 0x9025, 4)},    /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */
 
 	/* 4. Gobi 1000 devices */
 	{QMI_GOBI1K_DEVICE(0x05c6, 0x9212)},	/* Acer Gobi Modem Device */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
  2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails Sasha Levin
@ 2020-10-12 19:11   ` Joe Perches
  2020-10-12 21:01     ` Petko Manolov
  0 siblings, 1 reply; 17+ messages in thread
From: Joe Perches @ 2020-10-12 19:11 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: Anant Thazhemadam, syzbot+abbc768b560c84d92fd3, Petko Manolov,
	David S . Miller, linux-usb, netdev

On Mon, 2020-10-12 at 15:02 -0400, Sasha Levin wrote:
> From: Anant Thazhemadam <anant.thazhemadam@gmail.com>
> 
> [ Upstream commit f45a4248ea4cc13ed50618ff066849f9587226b2 ]
> 
> When get_registers() fails in set_ethernet_addr(),the uninitialized
> value of node_id gets copied over as the address.
> So, check the return value of get_registers().
> 
> If get_registers() executed successfully (i.e., it returns
> sizeof(node_id)), copy over the MAC address using ether_addr_copy()
> (instead of using memcpy()).
> 
> Else, if get_registers() failed instead, a randomly generated MAC
> address is set as the MAC address instead.

This autosel is premature.

This patch always sets a random MAC.
See the follow on patch: https://lkml.org/lkml/2020/10/11/131
To my knowledge, this follow-ob has yet to be applied:

> diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
[]
> @@ -274,12 +274,20 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
>  		return 1;
>  }
>  
> -static inline void set_ethernet_addr(rtl8150_t * dev)
> +static void set_ethernet_addr(rtl8150_t *dev)
>  {
> -	u8 node_id[6];
> +	u8 node_id[ETH_ALEN];
> +	int ret;
> +
> +	ret = get_registers(dev, IDR, sizeof(node_id), node_id);
>  
> -	get_registers(dev, IDR, sizeof(node_id), node_id);
> -	memcpy(dev->netdev->dev_addr, node_id, sizeof(node_id));
> +	if (ret == sizeof(node_id)) {

So this needs to use
	if (!ret) {

or 
	if (ret < 0)

and reversed code blocks

> +		ether_addr_copy(dev->netdev->dev_addr, node_id);
> +	} else {
> +		eth_hw_addr_random(dev->netdev);
> +		netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n",
> +			      dev->netdev->dev_addr);
> +	}
>  }
>  
>  static int rtl8150_set_mac_address(struct net_device *netdev, void *p)


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
  2020-10-12 19:11   ` Joe Perches
@ 2020-10-12 21:01     ` Petko Manolov
  2020-10-14 14:04       ` Sasha Levin
  0 siblings, 1 reply; 17+ messages in thread
From: Petko Manolov @ 2020-10-12 21:01 UTC (permalink / raw)
  To: Joe Perches
  Cc: Sasha Levin, linux-kernel, stable, Anant Thazhemadam,
	syzbot+abbc768b560c84d92fd3, David S . Miller, linux-usb, netdev

On 20-10-12 12:11:18, Joe Perches wrote:
> On Mon, 2020-10-12 at 15:02 -0400, Sasha Levin wrote:
> > From: Anant Thazhemadam <anant.thazhemadam@gmail.com>
> > 
> > [ Upstream commit f45a4248ea4cc13ed50618ff066849f9587226b2 ]
> > 
> > When get_registers() fails in set_ethernet_addr(),the uninitialized
> > value of node_id gets copied over as the address.
> > So, check the return value of get_registers().
> > 
> > If get_registers() executed successfully (i.e., it returns
> > sizeof(node_id)), copy over the MAC address using ether_addr_copy()
> > (instead of using memcpy()).
> > 
> > Else, if get_registers() failed instead, a randomly generated MAC
> > address is set as the MAC address instead.
> 
> This autosel is premature.
> 
> This patch always sets a random MAC.
> See the follow on patch: https://lkml.org/lkml/2020/10/11/131
> To my knowledge, this follow-ob has yet to be applied:

ACK, the follow-on patch has got the correct semantics.


		Petko


> > diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
> []
> > @@ -274,12 +274,20 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
> >  		return 1;
> >  }
> >  
> > -static inline void set_ethernet_addr(rtl8150_t * dev)
> > +static void set_ethernet_addr(rtl8150_t *dev)
> >  {
> > -	u8 node_id[6];
> > +	u8 node_id[ETH_ALEN];
> > +	int ret;
> > +
> > +	ret = get_registers(dev, IDR, sizeof(node_id), node_id);
> >  
> > -	get_registers(dev, IDR, sizeof(node_id), node_id);
> > -	memcpy(dev->netdev->dev_addr, node_id, sizeof(node_id));
> > +	if (ret == sizeof(node_id)) {
> 
> So this needs to use
> 	if (!ret) {
> 
> or 
> 	if (ret < 0)
> 
> and reversed code blocks
> 
> > +		ether_addr_copy(dev->netdev->dev_addr, node_id);
> > +	} else {
> > +		eth_hw_addr_random(dev->netdev);
> > +		netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n",
> > +			      dev->netdev->dev_addr);
> > +	}
> >  }
> >  
> >  static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
  2020-10-12 21:01     ` Petko Manolov
@ 2020-10-14 14:04       ` Sasha Levin
  0 siblings, 0 replies; 17+ messages in thread
From: Sasha Levin @ 2020-10-14 14:04 UTC (permalink / raw)
  To: Petko Manolov
  Cc: Joe Perches, linux-kernel, stable, Anant Thazhemadam,
	syzbot+abbc768b560c84d92fd3, David S . Miller, linux-usb, netdev

On Tue, Oct 13, 2020 at 12:01:06AM +0300, Petko Manolov wrote:
>On 20-10-12 12:11:18, Joe Perches wrote:
>> On Mon, 2020-10-12 at 15:02 -0400, Sasha Levin wrote:
>> > From: Anant Thazhemadam <anant.thazhemadam@gmail.com>
>> >
>> > [ Upstream commit f45a4248ea4cc13ed50618ff066849f9587226b2 ]
>> >
>> > When get_registers() fails in set_ethernet_addr(),the uninitialized
>> > value of node_id gets copied over as the address.
>> > So, check the return value of get_registers().
>> >
>> > If get_registers() executed successfully (i.e., it returns
>> > sizeof(node_id)), copy over the MAC address using ether_addr_copy()
>> > (instead of using memcpy()).
>> >
>> > Else, if get_registers() failed instead, a randomly generated MAC
>> > address is set as the MAC address instead.
>>
>> This autosel is premature.
>>
>> This patch always sets a random MAC.
>> See the follow on patch: https://lkml.org/lkml/2020/10/11/131
>> To my knowledge, this follow-ob has yet to be applied:
>
>ACK, the follow-on patch has got the correct semantics.

I'll hold off on this patch until the follow-on is merged, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-10-14 14:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 19:02 [PATCH AUTOSEL 5.8 01/24] net: lantiq: Add locking for TX DMA channel Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 06/24] mt76: mt7615: reduce maximum VHT MPDU length to 7991 Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 07/24] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 09/24] net/fsl: quieten expected MDIO access failures Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 10/24] net: usb: ax88179_178a: add Toshiba usb 3.0 adapter Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 11/24] net: atlantic: fix build when object tree is separate Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 12/24] net: usb: ax88179_178a: add MCT usb 3.0 adapter Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 13/24] net: dsa: felix: fix incorrect action offsets for VCAP IS2 Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 14/24] via-rhine: Fix for the hardware having a reset failure after resume Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 15/24] via-rhine: VTunknown1 device is really VT8251 South Bridge Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 16/24] vhost vdpa: fix vhost_vdpa_open error handling Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 17/24] net: usb: pegasus: Proper error handing when setting pegasus' MAC address Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 18/24] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails Sasha Levin
2020-10-12 19:11   ` Joe Perches
2020-10-12 21:01     ` Petko Manolov
2020-10-14 14:04       ` Sasha Levin
2020-10-12 19:02 ` [PATCH AUTOSEL 5.8 24/24] net: usb: qmi_wwan: add Cellient MPL200 card Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).