summaryrefslogtreecommitdiff
path: root/drivers/net/hyperv
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2018-05-24 04:02:00 +0300
committerDavid S. Miller <davem@davemloft.net>2018-05-25 06:06:33 +0300
commitd97cde6ab547a8115fb4fae73f030a96519ac3c6 (patch)
tree00b4ca9906e4205a3ca11c57825168a0d023b0f2 /drivers/net/hyperv
parentde0a8267e235a8e8557a001c3b29b5c5e4cc3c63 (diff)
downloadlinux-d97cde6ab547a8115fb4fae73f030a96519ac3c6.tar.xz
hv_netvsc: fix bogus ifalias on network device
If the guest network adapter is not configured with DeviceNaming enabled on the host, then the query for friendly name will return success but with a zero length name. Which then leads to a garbage value (stack contents) for ifalias. Fix is simple, just don't set name if host doesn't return it. Fixes: 0fe554a46a0f ("hv_netvsc: propogate Hyper-V friendly name into interface alias") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r--drivers/net/hyperv/rndis_filter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 7f3dab4b4cbc..5428bb261102 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1237,7 +1237,10 @@ static void rndis_get_friendly_name(struct net_device *net,
if (rndis_filter_query_device(rndis_device, net_device,
RNDIS_OID_GEN_FRIENDLY_NAME,
wname, &size) != 0)
- return;
+ return; /* ignore if host does not support */
+
+ if (size == 0)
+ return; /* name not set */
/* Convert Windows Unicode string to UTF-8 */
len = ucs2_as_utf8(ifalias, wname, sizeof(ifalias));