OSDN Git Service

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>
Fri, 6 Sep 2019 08:19:35 +0000 (10:19 +0200)
commit071434c30d6882ab447a417b2cc4692c26525df9
treee8ed0db9d4ae4ed2768f5c1de2ab383b4017b531
parent34e7dd9e9f3ff8edadfd19eba7833de62287de93
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