[PATCH] rtl8187: ensure priv->hwaddr is always valid
authorMichael Wu <flamingice@sourmilk.net>
Mon, 16 Jul 2007 00:09:55 +0000 (17:09 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Aug 2007 19:06:03 +0000 (15:06 -0400)
conf->mac_addr is not guaranteed to be set. This ensures priv->hwaddr is
always set to a valid mac address. Thanks to Johannes Berg
<johannes@sipsolutions.net> for finding this problem.

Signed-off-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtl8187_dev.c

index cea85894b7f2d1882a2951313073d5c39c638f9a..e61c6d5ba1a93d26261369dfacffde1c8c5231da 100644 (file)
@@ -466,7 +466,7 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
                return -EOPNOTSUPP;
        }
 
-       priv->hwaddr = conf->mac_addr;
+       priv->hwaddr = conf->mac_addr ? conf->mac_addr : dev->wiphy->perm_addr;
 
        return 0;
 }