]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: lpfc: Fix bad memory access during VPD DUMP mailbox command
authorJames Smart <jsmart2021@gmail.com>
Wed, 21 Apr 2021 23:45:11 +0000 (16:45 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 27 Apr 2021 02:58:38 +0000 (22:58 -0400)
commit47df5fcc37650286c0f5c6e25964423b00dd1389
treea5cc7732965c7efd6f028c389f418cfbbe077221
parent96395af0f5de68f9a3dc9606cad78cedbddcd53c
scsi: lpfc: Fix bad memory access during VPD DUMP mailbox command

The dump command for reading a region passes a requested read length
specified in words (4-byte units). The response overwrites the same field
with the actual number of bytes read.

The mailbox handler for DUMP which reads VPD data (region 23) is treating
the response field as if it were still a word_cnt, thus multiplying it by 4
to set the read's "length". Given the read value was calculated based on
the size of the read buffer, the longer response length runs off the end of
the buffer.

Fix by reworking the code to use the response field as a byte count.

Link: https://lore.kernel.org/r/20210421234511.102206-1-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c