Skip to content

Commit e3a57b3

Browse files
author
Jens Axboe
committed
Merge branch 'for-jens/xen-blkback.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen into for-linus
2 parents e2bd967 + 9b83c77 commit e3a57b3

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

drivers/block/xen-blkback/blkback.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void)
809809
failed_init:
810810
kfree(blkbk->pending_reqs);
811811
kfree(blkbk->pending_grant_handles);
812-
for (i = 0; i < mmap_pages; i++) {
813-
if (blkbk->pending_pages[i])
814-
__free_page(blkbk->pending_pages[i]);
812+
if (blkbk->pending_pages) {
813+
for (i = 0; i < mmap_pages; i++) {
814+
if (blkbk->pending_pages[i])
815+
__free_page(blkbk->pending_pages[i]);
816+
}
817+
kfree(blkbk->pending_pages);
815818
}
816-
kfree(blkbk->pending_pages);
817819
kfree(blkbk);
818820
blkbk = NULL;
819821
return rc;

drivers/block/xen-blkback/xenbus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,13 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
357357
}
358358

359359
vbd->bdev = bdev;
360-
vbd->size = vbd_sz(vbd);
361-
362360
if (vbd->bdev->bd_disk == NULL) {
363361
DPRINTK("xen_vbd_create: device %08x doesn't exist.\n",
364362
vbd->pdevice);
365363
xen_vbd_free(vbd);
366364
return -ENOENT;
367365
}
366+
vbd->size = vbd_sz(vbd);
368367

369368
if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
370369
vbd->type |= VDISK_CDROM;

0 commit comments

Comments
 (0)