403-ath9k-fix-invalid-mac-address-handling.patch 815 B

12345678910111213141516171819202122232425262728293031
  1. --- a/drivers/net/wireless/ath/ath9k/hw.c
  2. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  3. @@ -15,6 +15,7 @@
  4. */
  5. #include <linux/io.h>
  6. +#include <linux/etherdevice.h>
  7. #include <asm/unaligned.h>
  8. #include "hw.h"
  9. @@ -485,8 +486,18 @@ static int ath9k_hw_init_macaddr(struct
  10. common->macaddr[2 * i] = eeval >> 8;
  11. common->macaddr[2 * i + 1] = eeval & 0xff;
  12. }
  13. - if (sum == 0 || sum == 0xffff * 3)
  14. - return -EADDRNOTAVAIL;
  15. + if (!is_valid_ether_addr(common->macaddr)) {
  16. + DECLARE_MAC_BUF(macbuf);
  17. +
  18. + ath_print(common, ATH_DBG_EEPROM,
  19. + "eeprom contains invalid mac address: %s\n",
  20. + print_mac(macbuf, common->macaddr));
  21. +
  22. + random_ether_addr(common->macaddr);
  23. + ath_print(common, ATH_DBG_EEPROM,
  24. + "random mac address will be used: %s\n",
  25. + print_mac(macbuf, common->macaddr));
  26. + }
  27. return 0;
  28. }