Skip to content

Commit d3bfdf4

Browse files
committed
Merge: CVE-2024-43821 scsi: lpfc: Fix a possible null pointer dereference
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5662 scsi: lpfc: Fix a possible null pointer dereference JIRA: https://issues.redhat.com/browse/RHEL-64869 CVE: CVE-2024-43821 In function lpfc_xcvr_data_show, the memory allocation with kmalloc might fail, thereby making rdp_context a null pointer. In the following context and functions that use this pointer, there are dereferencing operations, leading to null pointer dereference. To fix this issue, a null pointer check should be added. If it is null, use scnprintf to notify the user and return len. Signed-off-by: Ewan D. Milne <emilne@redhat.com> Approved-by: Chris von Recklinghausen <crecklin@redhat.com> Approved-by: Chris Leech <cleech@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents 8bf1e37 + d9d1c26 commit d3bfdf4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,11 @@ lpfc_xcvr_data_show(struct device *dev, struct device_attribute *attr,
19101910

19111911
/* Get transceiver information */
19121912
rdp_context = kmalloc(sizeof(*rdp_context), GFP_KERNEL);
1913+
if (!rdp_context) {
1914+
len = scnprintf(buf, PAGE_SIZE - len,
1915+
"SPF info NA: alloc failure\n");
1916+
return len;
1917+
}
19131918

19141919
rc = lpfc_get_sfp_info_wait(phba, rdp_context);
19151920
if (rc) {

0 commit comments

Comments
 (0)