summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2013-04-18 12:57:11 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-05-19 10:54:43 -0700
commit1203d9c66e6b892bd8043eea51c5cd510d097266 (patch)
tree32354f0b70a77ff5f1fb41e6a3014e642fb19db6 /drivers
parentd8abf422282e2452c83392717481ad850b0d982c (diff)
downloadlinux-3.10-1203d9c66e6b892bd8043eea51c5cd510d097266.tar.gz
linux-3.10-1203d9c66e6b892bd8043eea51c5cd510d097266.tar.bz2
linux-3.10-1203d9c66e6b892bd8043eea51c5cd510d097266.zip
net: qmi_wwan: prevent duplicate mac address on link (firmware bug workaround)
[ Upstream commit cc6ba5fdaabea7a7b28de3ba1e0fe54d92232fe5 ] We normally trust and use the CDC functional descriptors provided by a number of devices. But some of these will erroneously list the address reserved for the device end of the link. Attempting to use this on both the device and host side will naturally not work. Work around this bug by ignoring the functional descriptor and assign a random address instead in this case. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/usb/qmi_wwan.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index fe3be504d84..3b6e932890b 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -175,6 +175,9 @@ err:
return status;
}
+/* default ethernet address used by the modem */
+static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3};
+
/* Make up an ethernet header if the packet doesn't have one.
*
* A firmware bug common among several devices cause them to send raw
@@ -342,6 +345,12 @@ static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
/* save subdriver struct for suspend/resume wrappers */
dev->data[0] = (unsigned long)subdriver;
+ /* Never use the same address on both ends of the link, even
+ * if the buggy firmware told us to.
+ */
+ if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr))
+ eth_hw_addr_random(dev->net);
+
/* make MAC addr easily distinguishable from an IP header */
if (possibly_iphdr(dev->net->dev_addr)) {
dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */