qcacld-3.0: Protect tx descritpor states during allocation

Tx descriptors' state info, such as vdev pointer, vdev ID and
ref_cnt, are protected by a spin lock during freeing, but not
protected by the same lock during allocation. Correct the
discrepancies to avoid a NULL pointer dereference issue

Change-Id: Ie0fb634a893a8d33888f7f1f6685a4fb7219e308
CRs-Fixed: 2091379
此提交包含在:
wadesong
2017-08-11 14:15:05 +08:00
提交者 snandini
父節點 c314884bcd
當前提交 8332b59669

查看文件

@@ -144,19 +144,18 @@ struct ol_tx_desc_t *ol_tx_desc_alloc(struct ol_txrx_pdev_t *pdev,
qdf_spin_lock_bh(&pdev->tx_mutex);
if (pdev->tx_desc.freelist) {
tx_desc = ol_tx_get_desc_global_pool(pdev);
if (!tx_desc) {
qdf_spin_unlock_bh(&pdev->tx_mutex);
return NULL;
}
ol_tx_desc_dup_detect_set(pdev, tx_desc);
ol_tx_desc_sanity_checks(pdev, tx_desc);
ol_tx_desc_compute_delay(tx_desc);
ol_tx_desc_vdev_update(tx_desc, vdev);
ol_tx_desc_count_inc(vdev);
qdf_atomic_inc(&tx_desc->ref_cnt);
}
qdf_spin_unlock_bh(&pdev->tx_mutex);
if (!tx_desc)
return NULL;
ol_tx_desc_vdev_update(tx_desc, vdev);
ol_tx_desc_count_inc(vdev);
qdf_atomic_inc(&tx_desc->ref_cnt);
return tx_desc;
}