From 2cde449861429ec3f2cbae1ac1a2493155d01728 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 28 Oct 2025 11:28:42 +0800 Subject: [PATCH] scsi: qla4xxx: Prevent a potential error pointer dereference stable inclusion from stable-v5.4.297 commit d0225f41ee70611ca88ccb22c8542ecdfa7faea8 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/ICWO34 CVE: CVE-2025-39676 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d0225f41ee70611ca88ccb22c8542ecdfa7faea8 -------------------------------- [ Upstream commit 9dcf111dd3e7ed5fce82bb108e3a3fc001c07225 ] The qla4xxx_get_ep_fwdb() function is supposed to return NULL on error, but qla4xxx_ep_connect() returns error pointers. Propagating the error pointers will lead to an Oops in the caller, so change the error pointers to NULL. Fixes: 13483730a13b ("[SCSI] qla4xxx: fix flash/ddb support") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/aJwnVKS9tHsw1tEu@stanley.mountain Reviewed-by: Chris Leech Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Zhang Qilong --- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 8d42f20ba7e5..2d11451a800e 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -6596,6 +6596,8 @@ static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha, ep = qla4xxx_ep_connect(ha->host, (struct sockaddr *)dst_addr, 0); vfree(dst_addr); + if (IS_ERR(ep)) + return NULL; return ep; } -- Gitee