Skip to content

Commit

Permalink
xen-blkfront: free resources if xlvbd_alloc_gendisk fails
Browse files Browse the repository at this point in the history
Current code forgets to free resources in the failure path of
xlvbd_alloc_gendisk(), this patch fix it.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Bob Liu authored and Konrad Rzeszutek Wilk committed Aug 19, 2016
1 parent 172335a commit 4e876c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ static void blkfront_connect(struct blkfront_info *info)
if (err) {
xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s",
info->xbdev->otherend);
return;
goto fail;
}

xenbus_switch_state(info->xbdev, XenbusStateConnected);
Expand All @@ -2455,6 +2455,11 @@ static void blkfront_connect(struct blkfront_info *info)
device_add_disk(&info->xbdev->dev, info->gd);

info->is_ready = 1;
return;

fail:
blkif_free(info, 0);
return;
}

/**
Expand Down

0 comments on commit 4e876c2

Please sign in to comment.