md: check for failure when adding pages in alloc_behind_master_bio
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 31 May 2023 11:50:36 +0000 (04:50 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 1 Jun 2023 15:13:13 +0000 (09:13 -0600)
commitb42473cdbab7661535516ae76e0a871d98b5cb97
tree40a82f9dff9e71f4a5b653a7ec629cfdb6f04bc5
parent5225229b8fdfb3e65520c43547ecf9a737161c3f
md: check for failure when adding pages in alloc_behind_master_bio

alloc_behind_master_bio() can possibly add multiple pages to a bio, but it
is not checking for the return value of bio_add_page() if adding really
succeeded.

Check if the page adding succeeded and if not bail out.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Song Liu <song@kernel.org>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/827aa12d44ebf3f50b41b47f5cedc0f80179f2c1.1685532726.git.johannes.thumshirn@wdc.com
[axboe: fold in s/free_page/put_page fix]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid1.c