]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
commitde22f3a5783c43b385ec1d589d58c490b0a0c806
treec6de8409493c337fd319b773a26e0d6f1c5cb09e
parent87b7aaebc2d5f9ceb51f972512f558760dcc74b9
ata: Fix ZBC_OUT command block check

BugLink: http://bugs.launchpad.net/bugs/1810554
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/ata/libata-scsi.c