“087091652bf8b351432a3f3fb50996ee3582d5e4”上不存在“tools/perf/ui/browser.h”
提交 3d44fb57 编写于 作者: C Chandrakanth Patil 提交者: Zheng Zengkai

scsi: megaraid_sas: Fix resource leak in case of probe failure

stable inclusion
from stable-5.10.52
commit 0680db6f41920b2c91c7df3cc9cd5968701a6f74
bugzilla: 175542 https://gitee.com/openeuler/kernel/issues/I4DTKU

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0680db6f41920b2c91c7df3cc9cd5968701a6f74

--------------------------------

[ Upstream commit b5438f48 ]

The driver doesn't clean up all the allocated resources properly when
scsi_add_host(), megasas_start_aen() function fails during the PCI device
probe.

Clean up all those resources.

Link: https://lore.kernel.org/r/20210528131307.25683-3-chandrakanth.patil@broadcom.comSigned-off-by: NChandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: NSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 560cafdd
...@@ -7478,11 +7478,16 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -7478,11 +7478,16 @@ static int megasas_probe_one(struct pci_dev *pdev,
return 0; return 0;
fail_start_aen: fail_start_aen:
instance->unload = 1;
scsi_remove_host(instance->host);
fail_io_attach: fail_io_attach:
megasas_mgmt_info.count--; megasas_mgmt_info.count--;
megasas_mgmt_info.max_index--; megasas_mgmt_info.max_index--;
megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL; megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
if (instance->requestorId && !instance->skip_heartbeat_timer_del)
del_timer_sync(&instance->sriov_heartbeat_timer);
instance->instancet->disable_intr(instance); instance->instancet->disable_intr(instance);
megasas_destroy_irqs(instance); megasas_destroy_irqs(instance);
...@@ -7490,8 +7495,16 @@ static int megasas_probe_one(struct pci_dev *pdev, ...@@ -7490,8 +7495,16 @@ static int megasas_probe_one(struct pci_dev *pdev,
megasas_release_fusion(instance); megasas_release_fusion(instance);
else else
megasas_release_mfi(instance); megasas_release_mfi(instance);
if (instance->msix_vectors) if (instance->msix_vectors)
pci_free_irq_vectors(instance->pdev); pci_free_irq_vectors(instance->pdev);
instance->msix_vectors = 0;
if (instance->fw_crash_state != UNAVAILABLE)
megasas_free_host_crash_buffer(instance);
if (instance->adapter_type != MFI_SERIES)
megasas_fusion_stop_watchdog(instance);
fail_init_mfi: fail_init_mfi:
scsi_host_put(host); scsi_host_put(host);
fail_alloc_instance: fail_alloc_instance:
......
...@@ -5196,6 +5196,7 @@ megasas_alloc_fusion_context(struct megasas_instance *instance) ...@@ -5196,6 +5196,7 @@ megasas_alloc_fusion_context(struct megasas_instance *instance)
if (!fusion->log_to_span) { if (!fusion->log_to_span) {
dev_err(&instance->pdev->dev, "Failed from %s %d\n", dev_err(&instance->pdev->dev, "Failed from %s %d\n",
__func__, __LINE__); __func__, __LINE__);
kfree(instance->ctrl_context);
return -ENOMEM; return -ENOMEM;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册