libata: add SG safety checks in SFF pio transfers
authorJens Axboe <axboe@kernel.dk>
Wed, 7 Aug 2019 18:23:57 +0000 (12:23 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2019 06:26:41 +0000 (08:26 +0200)
commit01b9d50557ea829b5fa5a1fb31b2667be8ff39e9
treec0439b8710e31b2d89788edba9930f3b81ed31c5
parentb853d7cbd238400d4e6f8767e839c14ed7a06a45
libata: add SG safety checks in SFF pio transfers

[ Upstream commit 752ead44491e8c91e14d7079625c5916b30921c5 ]

Abort processing of a command if we run out of mapped data in the
SG list. This should never happen, but a previous bug caused it to
be possible. Play it safe and attempt to abort nicely if we don't
have more SG segments left.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ata/libata-sff.c