mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
Btrfs: avoid possible NULL deref in io_ctl_drop_pages()
If we run into some failure path in io_ctl_prepare_pages(), io_ctl->pages[] array may have some NULL pointers. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
This commit is contained in:
parent
db804f23a7
commit
a1ee5a4581
1 changed files with 5 additions and 3 deletions
|
@ -319,9 +319,11 @@ static void io_ctl_drop_pages(struct io_ctl *io_ctl)
|
|||
io_ctl_unmap_page(io_ctl);
|
||||
|
||||
for (i = 0; i < io_ctl->num_pages; i++) {
|
||||
ClearPageChecked(io_ctl->pages[i]);
|
||||
unlock_page(io_ctl->pages[i]);
|
||||
page_cache_release(io_ctl->pages[i]);
|
||||
if (io_ctl->pages[i]) {
|
||||
ClearPageChecked(io_ctl->pages[i]);
|
||||
unlock_page(io_ctl->pages[i]);
|
||||
page_cache_release(io_ctl->pages[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue