Skip to contentSkip to conversation

block: Fix potential page reference leak in __bio_iov_iter_get_pages()

PATCH linmiaohe 1 participant 1 message Sep 2, 2020 Block layer

lore
Share & tools
lore

linmiaohe

author
#0 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 7 lines · Miaohe Lin

When bio is full, __bio_iov_iter_get_pages() would return error directly while left page reference still held in pages. Release these references. Also advance the iov_iter according to what we have done successfully.

Fixes 576ed9135489 ("block: use bio_add_page in

bio_iov_iter_get_pages")

The WARN_ON means something is fundamentally wrong here. I think a few leaked pages are the least of our problems in this case.

Yes, WARN_ON means something is fundamentally wrong here. But IMO it's not really a big problem when bio is full. We should not simply rely on this WARN_ON and we can handle this gracefully.
Thanks.