]> git.baikalelectronics.ru Git - kernel.git/commit
iwlwifi: pcie: gen2: fix race in cmd fifo write ptr
authorShaul Triebitz <shaul.triebitz@intel.com>
Sun, 28 Jan 2018 16:27:52 +0000 (18:27 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 20 Apr 2018 07:57:16 +0000 (10:57 +0300)
commit3506832b098850a8aafee19512e79c33debab380
tree3eb19bf58e08a050dee1bd0f1a18d734cc896daa
parent8f66e064c9db418c6c3037aa2c217dc7b18f3276
iwlwifi: pcie: gen2: fix race in cmd fifo write ptr

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: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c