qcacmn: Acquire spinlock before taking ref for scan_db entry

Locks must be taken before accessing scan_db nodes to ensure
reference counts are not changed while changing entries within
the node or while freeing the node.

Ensure that a spinlock is used before increasing the reference
count to make sure that there is no other execution context
accessing the scan_db.

CRs-Fixed: 2791279
Change-Id: I4402ff15de7c8d4fc31009f7307ba262b4df6702
This commit is contained in:
Aditya Sathish
2020-10-12 15:31:49 +05:30
committed by snandini
parent b5692dc64c
commit 309120eac2

View File

@@ -535,8 +535,10 @@ static QDF_STATUS scm_flush_oldest_entry(struct scan_dbs *scan_db)
scm_scan_entry_put_ref(scan_db,
oldest_node,
true);
qdf_spin_lock_bh(&scan_db->scan_db_lock);
oldest_node = cur_node;
scm_scan_entry_get_ref(oldest_node);
qdf_spin_lock_bh(&scan_db->scan_db_lock);
}
cur_node = scm_get_next_node(scan_db,