]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:17 +0000 (09:49 +0100)
commit62488126d5f222f53bcf0b8432bb2836c3a97979
treec3292015bff4cabd6cb02000fbaa56e55383e6a6
parentfe1b3fa1485a37b4958d3ce2abd5e8fd56658dc7
scsi: scsi_debug: Fix buffer size of REPORT ZONES command

BugLink: https://bugs.launchpad.net/bugs/1954931
commit 7db0e0c8190a086ef92ce5bb960836cde49540aa upstream.

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: f0d1cf9378bd ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/scsi/scsi_debug.c