scsi: lpfc: Fix panic when FW-log buffsize is not initialized
authorJames Smart <jsmart2021@gmail.com>
Fri, 30 Nov 2018 00:09:27 +0000 (16:09 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 8 Dec 2018 03:35:31 +0000 (22:35 -0500)
commitcb34990b90f73b9a77a504c5129442c9aae0430a
treeb290202cd883f811e3242d8bd400fdfeb3be160b
parent492ca4da6f0798cf20ecaf330abc8d79e540a43a
scsi: lpfc: Fix panic when FW-log buffsize is not initialized

While trying to get adapter fw-log for a function whose buffsize was set to
0, kernel panic occurred.

When buffsize is 0, the kernel buffer for the log won't be allocated.  When
fw log usage was enabled, it failed to check the buffer size, and log usage
was started. Eventually the driver referenced the unallocated log buffer.

Added checks of the buffer size before allowing fw logging to be enabled
and added check for valid buffer if enabling fw log.

Performed a couple other minor cleanups while fixing this:
 - clarified log messages
 - re-evaluated log message severity
 - treat any error as an error, not only a couple codes

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_bsg.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c