* [PATCH net-next] hv_netvsc: fix bogus ifalias on network device
@ 2018-05-24 1:02 Stephen Hemminger
2018-05-25 3:10 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2018-05-24 1:02 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
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>
---
drivers/net/hyperv/rndis_filter.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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));
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] hv_netvsc: fix bogus ifalias on network device
2018-05-24 1:02 [PATCH net-next] hv_netvsc: fix bogus ifalias on network device Stephen Hemminger
@ 2018-05-25 3:10 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-05-25 3:10 UTC (permalink / raw)
To: stephen; +Cc: netdev, sthemmin
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 23 May 2018 18:02:00 -0700
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-25 3:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 1:02 [PATCH net-next] hv_netvsc: fix bogus ifalias on network device Stephen Hemminger
2018-05-25 3:10 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.