All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Call kunmap if zlib_inflateInit2 fails
@ 2016-11-02  3:25 Nick Terrell
  2016-11-02 14:23 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Terrell @ 2016-11-02  3:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nick Terrell

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

Signed-off-by: Nick Terrell <nickrterrell@gmail.com>
---
 fs/btrfs/zlib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 88d274e..30e19c9 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -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) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: Call kunmap if zlib_inflateInit2 fails
  2016-11-02  3:25 [PATCH] btrfs: Call kunmap if zlib_inflateInit2 fails Nick Terrell
@ 2016-11-02 14:23 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-11-02 14:23 UTC (permalink / raw)
  To: Nick Terrell; +Cc: linux-btrfs

On Tue, Nov 01, 2016 at 08:25:27PM -0700, Nick Terrell wrote:
> If zlib_inflateInit2 fails, the input page is never unmapped.
> Add a call to kunmap when it fails.
> 
> Signed-off-by: Nick Terrell <nickrterrell@gmail.com>

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-02 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-02  3:25 [PATCH] btrfs: Call kunmap if zlib_inflateInit2 fails Nick Terrell
2016-11-02 14:23 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.