Fix kernel oops when starting wpa_supplicant.
This closes bug #2267.
Signed-off-by: Mike Westerhof <[email protected]>
---
drivers/ar6000/ar6000/wireless_ext.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/ar6000/ar6000/wireless_ext.c
b/drivers/ar6000/ar6000/wireless_ext.c
index d9a5920..af78ae0 100644
--- a/drivers/ar6000/ar6000/wireless_ext.c
+++ b/drivers/ar6000/ar6000/wireless_ext.c
@@ -976,6 +976,16 @@ static int ar6000_ioctl_giwpower(struct net_device *dev,
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)netdev_priv(dev);
+ /*
+ * FIXME:
+ * https://docs.openmoko.org/trac/ticket/2267
+ * When starting wpa_supplicant the kernel oopses.
+ * The following condition avoids the oops.
+ * Remove this comment to bless this solution.
+ */
+ if (ar->arWlanState == WLAN_DISABLED || ar->arWmiReady == FALSE)
+ return -EIO;
+
return wmi_get_power_mode_cmd(ar->arWmi);
}