]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: scsi_debug: Fix buffer size of REPORT ZONES command
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 7 Dec 2021 01:06:38 +0000 (10:06 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 7 Dec 2021 03:04:35 +0000 (22:04 -0500)
commit776ea72474c709ea226dd71f8f0a156f744f39fc
treeff260adc93c44c64474920dbaaa007027c0af0ec
parentd4c11d335ab2c893119c347e8250e1e636b91a3c
scsi: scsi_debug: Fix buffer size of REPORT ZONES command

According to ZBC and SPC specifications, the unit of ALLOCATION LENGTH
field of REPORT ZONES command is byte. However, current scsi_debug
implementation handles it as number of zones to calculate buffer size to
report zones. When the ALLOCATION LENGTH has a large number, this results
in too large buffer size and causes memory allocation failure.  Fix the
failure by handling ALLOCATION LENGTH as byte unit.

Link: https://lore.kernel.org/r/20211207010638.124280-1-shinichiro.kawasaki@wdc.com
Fixes: 6a87ea528821 ("scsi: scsi_debug: Add ZBC zone commands")
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c