Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: qla4xxx: Prevent a potential error pointer dereference

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 <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/aJwnVKS9tHsw1tEu@stanley.mountain
Reviewed-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Dan Carpenter and committed by
Martin K. Petersen
9dcf111d 823f9557

+2
+2
drivers/scsi/qla4xxx/ql4_os.c
··· 6606 6606 6607 6607 ep = qla4xxx_ep_connect(ha->host, (struct sockaddr *)dst_addr, 0); 6608 6608 vfree(dst_addr); 6609 + if (IS_ERR(ep)) 6610 + return NULL; 6609 6611 return ep; 6610 6612 } 6611 6613