• Shaul Triebitz's avatar
    iwlwifi: pcie: gen2: fix race in cmd fifo write ptr · 3506832b
    Shaul Triebitz authored
    Avoid a race where two (or more) commands get the
    same index:
    
    1. T1 calls enqueue_hcmd and the local TFD index is assigned to
       txq->write_ptr;
    2. Context switch 'before incrementing txq->write_ptr';
    3. T2 calls enqueue_hcmd and the local TFD index is assigned to
       txq->write_ptr;
    4. Now the index is set to the same value for both commands of T1 and
       T2.
    
    To prevent this from happening, set the local TFD index inside the
    critical section (the index is set by global txq write pointer).
    Signed-off-by: default avatarShaul Triebitz <shaul.triebitz@intel.com>
    Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
    3506832b
tx-gen2.c 34 KB