All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template
@ 2021-03-11  4:01 Lv Yunlong
  2021-03-12  2:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Lv Yunlong @ 2021-03-11  4:01 UTC (permalink / raw)
  To: shshaikh, manishc, GR-Linux-NIC-Dev, davem, kuba
  Cc: netdev, linux-kernel, Lv Yunlong

In qlcnic_83xx_get_minidump_template, fw_dump->tmpl_hdr was freed by
vfree(). But unfortunately, it is used when extended is true.

Fixes: 7061b2bdd620e ("qlogic: Deletion of unnecessary checks before two function calls")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
index 7760a3394e93..7ecb3dfe30bd 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
@@ -1425,6 +1425,7 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter)
 
 	if (fw_dump->tmpl_hdr == NULL || current_version > prev_version) {
 		vfree(fw_dump->tmpl_hdr);
+		fw_dump->tmpl_hdr = NULL;
 
 		if (qlcnic_83xx_md_check_extended_dump_capability(adapter))
 			extended = !qlcnic_83xx_extend_md_capab(adapter);
@@ -1443,6 +1444,8 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter)
 			struct qlcnic_83xx_dump_template_hdr *hdr;
 
 			hdr = fw_dump->tmpl_hdr;
+			if (!hdr)
+				return;
 			hdr->drv_cap_mask = 0x1f;
 			fw_dump->cap_mask = 0x1f;
 			dev_info(&pdev->dev,
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template
  2021-03-11  4:01 [PATCH] net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template Lv Yunlong
@ 2021-03-12  2:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-12  2:30 UTC (permalink / raw)
  To: Lv Yunlong
  Cc: shshaikh, manishc, GR-Linux-NIC-Dev, davem, kuba, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 10 Mar 2021 20:01:40 -0800 you wrote:
> In qlcnic_83xx_get_minidump_template, fw_dump->tmpl_hdr was freed by
> vfree(). But unfortunately, it is used when extended is true.
> 
> Fixes: 7061b2bdd620e ("qlogic: Deletion of unnecessary checks before two function calls")
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template
    https://git.kernel.org/netdev/net/c/db74623a3850

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-12  2:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11  4:01 [PATCH] net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template Lv Yunlong
2021-03-12  2:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.