xen-blkback: fix leak on grant map error path
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 15 Sep 2014 09:55:27 +0000 (11:55 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 1 Oct 2014 20:32:31 +0000 (16:32 -0400)
Fix leaking a page when a grant mapping has failed.

CC: stable@vger.kernel.org
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported-and-Tested-by: Tao Chen <boby.chen@huawei.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkback/blkback.c

index 64c60edcdfbc5546cd84538986b5d26625f9f248..63fc7f06a0146821296e2d4c625f680d6c9ac008 100644 (file)
@@ -763,6 +763,7 @@ again:
                        BUG_ON(new_map_idx >= segs_to_map);
                        if (unlikely(map[new_map_idx].status != 0)) {
                                pr_debug(DRV_PFX "invalid buffer -- could not remap it\n");
+                               put_free_pages(blkif, &pages[seg_idx]->page, 1);
                                pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE;
                                ret |= 1;
                                goto next;