提交 5d0dafcb 编写于 作者: C Chengguang Xu 提交者: Zheng Zengkai

scsi: ipr: Fix missing/incorrect resource cleanup in error case

stable inclusion
from stable-v5.10.124
commit 410b69262173c6c1947b3b032338311ef412f1f9
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6E7

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

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

[ Upstream commit d64c4919 ]

Fix missing resource cleanup (when '(--i) == 0') for error case in
ipr_alloc_mem() and skip incorrect resource cleanup (when '(--i) == 0') for
error case in ipr_request_other_msi_irqs() because variable i started from
1.

Link: https://lore.kernel.org/r/20220529153456.4183738-4-cgxu519@mykernel.netReviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: NChengguang Xu <cgxu519@mykernel.net>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 9f5ff285
...@@ -9792,7 +9792,7 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) ...@@ -9792,7 +9792,7 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
GFP_KERNEL); GFP_KERNEL);
if (!ioa_cfg->hrrq[i].host_rrq) { if (!ioa_cfg->hrrq[i].host_rrq) {
while (--i > 0) while (--i >= 0)
dma_free_coherent(&pdev->dev, dma_free_coherent(&pdev->dev,
sizeof(u32) * ioa_cfg->hrrq[i].size, sizeof(u32) * ioa_cfg->hrrq[i].size,
ioa_cfg->hrrq[i].host_rrq, ioa_cfg->hrrq[i].host_rrq,
...@@ -10065,7 +10065,7 @@ static int ipr_request_other_msi_irqs(struct ipr_ioa_cfg *ioa_cfg, ...@@ -10065,7 +10065,7 @@ static int ipr_request_other_msi_irqs(struct ipr_ioa_cfg *ioa_cfg,
ioa_cfg->vectors_info[i].desc, ioa_cfg->vectors_info[i].desc,
&ioa_cfg->hrrq[i]); &ioa_cfg->hrrq[i]);
if (rc) { if (rc) {
while (--i >= 0) while (--i > 0)
free_irq(pci_irq_vector(pdev, i), free_irq(pci_irq_vector(pdev, i),
&ioa_cfg->hrrq[i]); &ioa_cfg->hrrq[i]);
return rc; return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册