diff options
author | Phillip Lougher <phillip@squashfs.org.uk> | 2024-08-23 00:31:06 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-08-23 13:11:36 +0200 |
commit | 84e0e03b308816a48c67f6da2168fcea6d49eda8 (patch) | |
tree | c10910f65477d1b9f9620820460310c88634f8e9 /fs/squashfs/page_actor.h | |
parent | d937c813f88d727ea9d34a7768264a64c8b93025 (diff) | |
download | linux-84e0e03b308816a48c67f6da2168fcea6d49eda8.tar.gz linux-84e0e03b308816a48c67f6da2168fcea6d49eda8.tar.bz2 linux-84e0e03b308816a48c67f6da2168fcea6d49eda8.zip |
Squashfs: Ensure all readahead pages have been used
In the recent work to remove page->index, a sanity check
that ensured all the readhead pages were covered by the
Squashfs data block was removed [1].
To avoid any regression, this commit adds the sanity check
back in an equivalent way. Namely the page actor will now
return error if any pages are unused after completion.
[1] https://lore.kernel.org/all/20240818235847.170468-3-phillip@squashfs.org.uk/
--
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Link: https://lore.kernel.org/r/20240822233106.121522-1-phillip@squashfs.org.uk
V3: last_page should be actor->last_page
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/squashfs/page_actor.h')
-rw-r--r-- | fs/squashfs/page_actor.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/squashfs/page_actor.h b/fs/squashfs/page_actor.h index c6d837f0e9ca..ffe25eb77c32 100644 --- a/fs/squashfs/page_actor.h +++ b/fs/squashfs/page_actor.h @@ -33,10 +33,11 @@ extern struct squashfs_page_actor *squashfs_page_actor_init_special( loff_t start_index); static inline struct page *squashfs_page_actor_free(struct squashfs_page_actor *actor) { - struct page *last_page = actor->last_page; + struct page *last_page = actor->next_page == actor->pages ? actor->last_page : ERR_PTR(-EIO); kfree(actor->tmp_buffer); kfree(actor); + return last_page; } static inline void *squashfs_first_page(struct squashfs_page_actor *actor) |