Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b906a33 authored by Vipin Mehta's avatar Vipin Mehta Committed by Greg Kroah-Hartman
Browse files

staging: ath6kl: Fixing a race condition during initialization



The commit fixes a race condition in the initialization portion of the
driver. The problem was observed while testing with the kernel in the
staging-next tree. The wait on the ready event is signalled prematurely
before setting the arVersion.wlan_ver and arVersion.abi_ver. The code
waiting on this semaphore checks for the validity of these values and
hence may proceed with an un-updated values of these fields. The wakeup
signal is now sent after these values are set.

Signed-off-by: default avatarVipin Mehta <vmehta@atheros.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 103281df
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -4170,8 +4170,6 @@ ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver,
    AR_SOFTC_T *ar = (AR_SOFTC_T *)devt;
    AR_SOFTC_T *ar = (AR_SOFTC_T *)devt;
    struct net_device *dev = ar->arNetDev;
    struct net_device *dev = ar->arNetDev;


    ar->arWmiReady = TRUE;
    wake_up(&arEvent);
    A_MEMCPY(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN);
    A_MEMCPY(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN);
    AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("mac address = %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
    AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("mac address = %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
        dev->dev_addr[0], dev->dev_addr[1],
        dev->dev_addr[0], dev->dev_addr[1],
@@ -4182,6 +4180,10 @@ ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver,
    ar->arVersion.wlan_ver = sw_ver;
    ar->arVersion.wlan_ver = sw_ver;
    ar->arVersion.abi_ver = abi_ver;
    ar->arVersion.abi_ver = abi_ver;


    /* Indicate to the waiting thread that the ready event was received */
    ar->arWmiReady = TRUE;
    wake_up(&arEvent);

#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN
    wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN);
    wmi_pmparams_cmd(ar->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN);
#endif
#endif