提交 fb399f5a 编写于 作者: S Sreekanth Reddy 提交者: Jialin Zhang

scsi: mpt3sas: Fix use-after-free warning

stable inclusion
from stable-v5.10.143
commit ea10a652ad2ae2cf3eced6f632a5c98f26727057
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0U6

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

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

commit 991df3dd upstream.

Fix the following use-after-free warning which is observed during
controller reset:

refcount_t: underflow; use-after-free.
WARNING: CPU: 23 PID: 5399 at lib/refcount.c:28 refcount_warn_saturate+0xa6/0xf0

Link: https://lore.kernel.org/r/20220906134908.1039-2-sreekanth.reddy@broadcom.comSigned-off-by: NSreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 96b1919d
...@@ -3501,6 +3501,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc) ...@@ -3501,6 +3501,7 @@ static struct fw_event_work *dequeue_next_fw_event(struct MPT3SAS_ADAPTER *ioc)
fw_event = list_first_entry(&ioc->fw_event_list, fw_event = list_first_entry(&ioc->fw_event_list,
struct fw_event_work, list); struct fw_event_work, list);
list_del_init(&fw_event->list); list_del_init(&fw_event->list);
fw_event_work_put(fw_event);
} }
spin_unlock_irqrestore(&ioc->fw_event_lock, flags); spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
...@@ -3559,7 +3560,6 @@ _scsih_fw_event_cleanup_queue(struct MPT3SAS_ADAPTER *ioc) ...@@ -3559,7 +3560,6 @@ _scsih_fw_event_cleanup_queue(struct MPT3SAS_ADAPTER *ioc)
if (cancel_work_sync(&fw_event->work)) if (cancel_work_sync(&fw_event->work))
fw_event_work_put(fw_event); fw_event_work_put(fw_event);
fw_event_work_put(fw_event);
} }
ioc->fw_events_cleanup = 0; ioc->fw_events_cleanup = 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册