402-ath9k-fix-invalid-mac-address-handling.patch 758 B

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