lpfc: Fix Buffer Overflow Error
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 inlpfc_scsi.cto be sure we don't write past the end of this buffer.Signed-off-by KyleMahlkuch <[email protected]>---
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