Skip to contentSkip to conversation

squashfs: free page if bio_add_page fails

PATCH New Leon M. George 1 participant 1 message May 13, 2022 SquashFS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 squashfs: free page if bio_add_page fails

In squashfs_bio_read, the page recently allocated for use with bio_add_page isn't freed when the call fails.

This patch adds a call to __free_page.

---
 fs/squashfs/block.c | 1 +
 1 file changed, 1 insertion(+)
fs/squashfs/block.c +1 -0
index 622c844f6d11..5ca1c9caef7d 100644
@@ -110,6 +110,7 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length,
 		}
 		if (!bio_add_page(bio, page, len, offset)) {
 			error = -EIO;
+			__free_page(page);
 			goto out_free_bio;
 		}
 		offset = 0;
Signature · 1 line
2.35.1