qed: Release CQ resource under lock on failure
authorRam Amrani <Ram.Amrani@cavium.com>
Mon, 20 Feb 2017 20:43:30 +0000 (22:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Feb 2017 22:11:54 +0000 (17:11 -0500)
The CQ resource pool is protected by a spin lock. When a CQ creation
fails it now deallocates under that lock as well.

Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_roce.c

index c3c8c5018e9397a43c8f3404b2c9568315ac7c25..50fdcd3fa9b4f772be28da78b233175955623e58 100644 (file)
@@ -948,7 +948,9 @@ static int qed_rdma_create_cq(void *rdma_cxt,
 
 err:
        /* release allocated icid */
+       spin_lock_bh(&p_info->lock);
        qed_bmap_release_id(p_hwfn, &p_info->cq_map, returned_id);
+       spin_unlock_bh(&p_info->lock);
        DP_NOTICE(p_hwfn, "Create CQ failed, rc = %d\n", rc);
 
        return rc;