qcacmn: Ensure rx_desc->unmapped is set to 1 before releasing lock

Originally Change-Id: I9fa71bdb6d4e4aa93fc795cc5dd472a181325991
was brought in to fix a race condition between Rx buffers
map/unmapped in dp_ipa_handle_rx_buf_smmu_mapping() and at the
same time map/unmapped from dp rx replenish context.
The fix ensured that rx_desc is unmapped and rx_desc->unmapped=1
flag will be set atomically within a lock.

But Change-Id: Iadb40071fb733cc4de3291784df5075d5a099a8e
introduced a flaw by releasing the lock before setting the flag to 1.

This is currently causing race condition and causing double
unmap calls when IPA smmu pool unmap and dp_rx_replenish unmap
is running in parallel. This change will fix this issue, by setting
the flag before the lock is released.

Change-Id: I3533bb5f6cc0437395149cd3c718826ef0b482a3
CRs-Fixed: 3594252
This commit is contained in:
Namita Nair
2023-08-21 11:41:35 -07:00
committed by Rahul Choudhary
vanhempi 8de279eab8
commit 429dc9c9e6
4 muutettua tiedostoa jossa 1 lisäystä ja 6 poistoa

Näytä tiedosto

@@ -2769,6 +2769,7 @@ void dp_rx_nbuf_unmap(struct dp_soc *soc,
qdf_nbuf_unmap_nbytes_single(soc->osdev, rx_desc->nbuf,
QDF_DMA_FROM_DEVICE,
rx_desc_pool->buf_size);
rx_desc->unmapped = 1;
dp_ipa_reo_ctx_buf_mapping_unlock(soc, reo_ring_num);
}