mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare()
[ Upstream commite0058f0fa8] The function dma_alloc_coherent() in qed_vf_hw_prepare() can fail, so its return value should be checked. Fixes:1408cc1fa4("qed: Introduce VFs") Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
33c74f8085
commit
16386479ef
|
|
@ -513,6 +513,9 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
|
||||||
p_iov->bulletin.size,
|
p_iov->bulletin.size,
|
||||||
&p_iov->bulletin.phys,
|
&p_iov->bulletin.phys,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
if (!p_iov->bulletin.p_virt)
|
||||||
|
goto free_pf2vf_reply;
|
||||||
|
|
||||||
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
|
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
|
||||||
"VF's bulletin Board [%p virt 0x%llx phys 0x%08x bytes]\n",
|
"VF's bulletin Board [%p virt 0x%llx phys 0x%08x bytes]\n",
|
||||||
p_iov->bulletin.p_virt,
|
p_iov->bulletin.p_virt,
|
||||||
|
|
@ -552,6 +555,10 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
free_pf2vf_reply:
|
||||||
|
dma_free_coherent(&p_hwfn->cdev->pdev->dev,
|
||||||
|
sizeof(union pfvf_tlvs),
|
||||||
|
p_iov->pf2vf_reply, p_iov->pf2vf_reply_phys);
|
||||||
free_vf2pf_request:
|
free_vf2pf_request:
|
||||||
dma_free_coherent(&p_hwfn->cdev->pdev->dev,
|
dma_free_coherent(&p_hwfn->cdev->pdev->dev,
|
||||||
sizeof(union vfpf_tlvs),
|
sizeof(union vfpf_tlvs),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user