提交 2cda0e11 编写于 作者: T Tong Zhang 提交者: Zheng Zengkai

scsi: myrs: Fix crash in error case

stable inclusion
from stable-v5.10.101
commit 0e42c4a3d732517edc3766dd45a14e60d29dd929
bugzilla: https://gitee.com/openeuler/kernel/issues/I5669Z

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

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

[ Upstream commit 4db09593 ]

In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fails
with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and
crash the kernel.

[    1.105606] myrs 0000:00:03.0: Unknown Initialization Error 5A
[    1.105872] myrs 0000:00:03.0: Failed to initialize Controller
[    1.106082] BUG: kernel NULL pointer dereference, address: 0000000000000000
[    1.110774] Call Trace:
[    1.110950]  myrs_cleanup+0xe4/0x150 [myrs]
[    1.111135]  myrs_probe.cold+0x91/0x56a [myrs]
[    1.111302]  ? DAC960_GEM_intr_handler+0x1f0/0x1f0 [myrs]
[    1.111500]  local_pci_probe+0x48/0x90

Link: https://lore.kernel.org/r/20220123225717.1069538-1-ztong0001@gmail.comReviewed-by: NHannes Reinecke <hare@suse.de>
Signed-off-by: NTong Zhang <ztong0001@gmail.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ca26aa46
...@@ -2272,7 +2272,8 @@ static void myrs_cleanup(struct myrs_hba *cs) ...@@ -2272,7 +2272,8 @@ static void myrs_cleanup(struct myrs_hba *cs)
myrs_unmap(cs); myrs_unmap(cs);
if (cs->mmio_base) { if (cs->mmio_base) {
cs->disable_intr(cs); if (cs->disable_intr)
cs->disable_intr(cs);
iounmap(cs->mmio_base); iounmap(cs->mmio_base);
cs->mmio_base = NULL; cs->mmio_base = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册