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,8 +2376,11 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) ...@@ -2376,8 +2376,11 @@ 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:
memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, if (!dev->addr_len)
min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) 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,
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;
return 0; return 0;
......
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