Skip to contentSkip to conversation

hv_netvsc: fix bogus ifalias on network device

PATCH Applied Stephen Hemminger 2 participants 2 messages May 24, 2018 – May 25, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/hyperv/rndis_filter.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/hyperv/rndis_filter.c +4 -1
index 7f3dab4b4cbc..5428bb261102 100644
@@ -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));
Signature · 1 line
2.17.0
maintainer Applied
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Wed, 23 May 2018 18:02:00 -0700

Quoted 9 lines

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")

Applied.