]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: lpfc: Fix pointer defereference before it is null checked issue
authorColin Ian King <colin.king@canonical.com>
Wed, 18 Nov 2020 13:13:45 +0000 (13:13 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 Nov 2020 03:13:42 +0000 (22:13 -0500)
commit5fcb4762ac7cc479f2f9ce7910ecf8e14b68580f
tree420ca5cafc8958da69445c37b06f458d759c495f
parentb07227460dccde095a13865b4b721812d0f60b13
scsi: lpfc: Fix pointer defereference before it is null checked issue

There is a null check on pointer lpfc_cmd after the pointer has been
dereferenced when pointers rdata and ndlp are initialized at the start of
the function. Fix this by only assigning rdata and ndlp after the pointer
lpfc_cmd has been null checked.

Link: https://lore.kernel.org/r/20201118131345.460631-1-colin.king@canonical.com
Fixes: b930f389083e ("scsi: lpfc: Convert SCSI I/O completions to SLI-3 and SLI-4 handlers")
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Dereference before null check")
drivers/scsi/lpfc/lpfc_scsi.c