• Ilan Peer's avatar
    wifi: iwlwifi: mvm: Fix race in scan completion · 2e194efa
    Ilan Peer authored
    The move of the scan complete notification handling to the wiphy worker
    introduced a race between scan complete notification and scan abort:
    
    - The wiphy lock is held, e.g., for rfkill handling etc.
    - Scan complete notification is received but not handled yet.
    - Scan abort is triggered, and scan abort is sent to the FW. Once the
      scan abort command is sent successfully, the flow synchronously waits
      for the scan complete notification. However, as the scan complete
      notification was already received but not processed yet, this hangs for
      a second and continues leaving the scan status in an inconsistent
      state.
    - Once scan complete handling is started (when the wiphy lock is not held)
      since the scan status is not an inconsistent state, a warning is issued
      and the scan complete notification is not handled.
    
    To fix this issue, switch back the scan complete notification to be
    asynchronously handling, and only move the link selection logic to
    a worker (which was the original reason for the move to use wiphy lock).
    
    While at it, refactor some prints to improve debug data.
    
    Fixes: 07bf5297 ("wifi: iwlwifi: mvm: Implement new link selection algorithm")
    Signed-off-by: default avatarIlan Peer <ilan.peer@intel.com>
    Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20240506095953.1f484a86324b.I63ed445a47f144546948c74ae6df85587fdb4ce3@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    2e194efa
ops.c 61.2 KB