Commit ba599be9 authored by Matt Domsch's avatar Matt Domsch Committed by David S. Miller

[NET]: Zero out SIOCGIFHWADDR buffer if dev->addr_len is zero.

This preserves 2.4.x behavior.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bfa84030
...@@ -2376,6 +2376,9 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) ...@@ -2376,6 +2376,9 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
return dev_set_mtu(dev, ifr->ifr_mtu); return dev_set_mtu(dev, ifr->ifr_mtu);
case SIOCGIFHWADDR: case SIOCGIFHWADDR:
if (!dev->addr_len)
memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data);
else
memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr,
min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
ifr->ifr_hwaddr.sa_family = dev->type; ifr->ifr_hwaddr.sa_family = dev->type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment