[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220407001926.11252-4-lech.perczak@gmail.com>
Date: Thu, 7 Apr 2022 02:19:26 +0200
From: Lech Perczak <lech.perczak@...il.com>
To: netdev@...r.kernel.org, linux-usb@...r.kernel.org
Cc: Lech Perczak <lech.perczak@...il.com>,
Kristian Evensen <kristian.evensen@...il.com>,
Bjørn Mork <bjorn@...k.no>,
Oliver Neukum <oliver@...kum.org>
Subject: [PATCH 3/3] rndis_host: limit scope of bogus MAC address detection to ZTE devices
Reporting of bogus MAC addresses and ignoring configuration of new
destination address wasn't observed outside of a range of ZTE devices,
among which this seems to be the common bug. Align rndis_host driver
with implementation found in cdc_ether, which also limits this workaround
to ZTE devices.
Cc: Kristian Evensen <kristian.evensen@...il.com>
Suggested-by: Bjørn Mork <bjorn@...k.no>
Cc: Oliver Neukum <oliver@...kum.org>
Signed-off-by: Lech Perczak <lech.perczak@...il.com>
---
drivers/net/usb/rndis_host.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index a7eb032115e8..55ff0461d39b 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -418,10 +418,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
goto halt_fail_and_release;
}
- if (bp[0] & 0x02)
- eth_hw_addr_random(net);
- else
- eth_hw_addr_set(net, bp);
+ eth_hw_addr_set(net, bp);
/* set a nonzero filter to enable data transfers */
memset(u.set, 0, sizeof *u.set);
@@ -463,6 +460,16 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS);
}
+static int zte_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
+{
+ int status = rndis_bind(dev, intf);
+
+ if (!status && (dev->net->dev_addr[0] & 0x02))
+ eth_hw_addr_random(dev->net);
+
+ return status;
+}
+
void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
{
struct rndis_halt *halt;
@@ -607,7 +614,7 @@ static const struct driver_info rndis_poll_status_info = {
static const struct driver_info zte_rndis_info = {
.description = "ZTE RNDIS device",
.flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
- .bind = rndis_bind,
+ .bind = zte_rndis_bind,
.unbind = rndis_unbind,
.status = rndis_status,
.rx_fixup = zte_rndis_rx_fixup,
--
2.30.2
Powered by blists - more mailing lists