OSDN Git Service

ata: Fix ZBC_OUT command block check
authorDamien Le Moal <damien.lemoal@wdc.com>
Tue, 26 Jun 2018 11:56:54 +0000 (20:56 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jul 2018 09:37:51 +0000 (11:37 +0200)
commit51bacd848cc1bcd8fb82d413cf27f407973536f5
tree9499da1ce5b072f8c77eeac9a70e9c31f8f789aa
parent2823345cd41f30d39483aebb9e3eb5341a2d4f06
ata: Fix ZBC_OUT command block check

commit b320a0a9f23c98f21631eb27bcbbca91c79b1c6e upstream.

The block (LBA) specified must not exceed the last addressable LBA,
which is dev->nr_sectors - 1. So fix the correct check is
"if (block >= dev->n_sectors)" and not "if (block > dev->n_sectords)".

Additionally, the asc/ascq to return for an LBA that is not a zone start
LBA should be ILLEGAL REQUEST, regardless if the bad LBA is out of
range.

Reported-by: David Butterfield <david.butterfield@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/libata-scsi.c