Skip to contentSkip to conversation

lpfc: Fix Buffer Overflow Error

PATCH James Smart 1 participant 1 message Aug 26, 2019 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 11 lines · KyleMahlkuch

Power and x86 have different page sizes so rather than allocate the buffer based on number of pages we should allocate space by using max_sectors. There is also code in lpfc_scsi.c to be sure we don't write past the end of this buffer.

---
drivers/scsi/lpfc/lpfc_init.c | 41
+++++++----------------------------------
drivers/scsi/lpfc/lpfc_scsi.c | 14 ++++++++++++--

2 files changed, 19 insertions(+), 36 deletions(-)

Kyle,

After looking at this code, there are several issues:
- why the 2^10 (4MB @ 4k pgsz) buffer size (horribly named as pagecnt)
- didn't comprehend pagesizes > 4k
- corresponding dif buffer doesn't need to be the same size
- no checking of exceeding buffer length when copying
- allocation even when debugfs wasn't configured
- could the entity downloading identify which phba loaded the buffer ?

Given this was added a decade ago with initial DIF support and has rarely been used, we're going to remove the debugfs bg buffer mechanism completely.

- james