scsi: sd_zbc: Fix potential memory leak
authorDamien Le Moal <damien.lemoal@wdc.com>
Thu, 1 Mar 2018 22:19:28 +0000 (07:19 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Jun 2018 20:49:17 +0000 (22:49 +0200)
commit1110636ed2d91dd63599af646305e280d89000a8
tree3e57540a661f325bb6b3a271101b844636e1cfcf
parent2c6025ebc7fd8e0a8ca785d778dc6ae25225744b
scsi: sd_zbc: Fix potential memory leak

commit 4b433924b2755a94f99258c178684a0e05c344de upstream.

Rework sd_zbc_check_zone_size() to avoid a memory leak due to an early
return if sd_zbc_report_zones() fails.

Reported-by: David.butterfield <david.butterfield@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/sd_zbc.c