Skip to contentSkip to conversation

btrfs: Call kunmap if zlib_inflateInit2 fails

PATCH In review Nick Terrell 2 participants 2 messages Nov 2, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Call kunmap if zlib_inflateInit2 fails

If zlib_inflateInit2 fails, the input page is never unmapped. Add a call to kunmap when it fails.

---
 fs/btrfs/zlib.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/zlib.c +1 -0
index 88d274e..30e19c9 100644
@@ -250,6 +250,7 @@ static int zlib_decompress_biovec(struct list_head *ws, struct page **pages_in,
 
 	if (Z_OK != zlib_inflateInit2(&workspace->strm, wbits)) {
 		printk(KERN_WARNING "BTRFS: inflateInit failed\n");
+		kunmap(pages_in[page_in_index]);
 		return -EIO;
 	}
 	while (workspace->strm.total_in < srclen) {
Signature · 1 line
2.7.4