* [PATCH] net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare()
@ 2022-03-03 3:34 Jia-Ju Bai
2022-03-04 5:19 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2022-03-03 3:34 UTC (permalink / raw)
To: aelior, manishc, davem, kuba; +Cc: netdev, linux-kernel, Jia-Ju Bai
The function dma_alloc_coherent() in qed_vf_hw_prepare() can fail, so
its return value should be checked.
Fixes: 1408cc1fa48c ("qed: Introduce VFs")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/net/ethernet/qlogic/qed/qed_vf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
index 597cd9cd57b5..5786d7ab6310 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
@@ -513,6 +513,9 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
p_iov->bulletin.size,
&p_iov->bulletin.phys,
GFP_KERNEL);
+ if (!p_iov->bulletin.p_virt)
+ goto free_vf2pf_request;
+
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
"VF's bulletin Board [%p virt 0x%llx phys 0x%08x bytes]\n",
p_iov->bulletin.p_virt,
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare()
2022-03-03 3:34 [PATCH] net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare() Jia-Ju Bai
@ 2022-03-04 5:19 ` Jakub Kicinski
2022-03-05 8:37 ` Jia-Ju Bai
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-03-04 5:19 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: aelior, manishc, davem, netdev, linux-kernel
On Wed, 2 Mar 2022 19:34:50 -0800 Jia-Ju Bai wrote:
> --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
> +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
> @@ -513,6 +513,9 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
> p_iov->bulletin.size,
> &p_iov->bulletin.phys,
> GFP_KERNEL);
> + if (!p_iov->bulletin.p_virt)
> + goto free_vf2pf_request;
leaking the reply buffer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare()
2022-03-04 5:19 ` Jakub Kicinski
@ 2022-03-05 8:37 ` Jia-Ju Bai
0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2022-03-05 8:37 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: aelior, manishc, davem, netdev, linux-kernel
On 2022/3/4 13:19, Jakub Kicinski wrote:
> On Wed, 2 Mar 2022 19:34:50 -0800 Jia-Ju Bai wrote:
>> --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
>> +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
>> @@ -513,6 +513,9 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
>> p_iov->bulletin.size,
>> &p_iov->bulletin.phys,
>> GFP_KERNEL);
>> + if (!p_iov->bulletin.p_virt)
>> + goto free_vf2pf_request;
> leaking the reply buffer
Hi Jakub,
Thanks for pointing out this problem.
I will send a V2 patch.
Best wishes,
Jia-Ju Bai
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-05 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 3:34 [PATCH] net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare() Jia-Ju Bai
2022-03-04 5:19 ` Jakub Kicinski
2022-03-05 8:37 ` Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).