[PATCH 1/2] drm/xen-front: Free page on event channel error path

From: Oleksandr Andrushchenko
Date: Thu Mar 29 2018 - 01:54:25 EST


While creating an event channel a page was leaked in case
of error. Fix this by freeing the page.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
---
drivers/gpu/drm/xen/xen_drm_front_evtchnl.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xen/xen_drm_front_evtchnl.c b/drivers/gpu/drm/xen/xen_drm_front_evtchnl.c
index e521785fd22b..02b6f3d9fe4c 100644
--- a/drivers/gpu/drm/xen/xen_drm_front_evtchnl.c
+++ b/drivers/gpu/drm/xen/xen_drm_front_evtchnl.c
@@ -186,8 +186,10 @@ static int evtchnl_alloc(struct xen_drm_front_info *front_info, int index,
sring, XEN_PAGE_SIZE);

ret = xenbus_grant_ring(xb_dev, sring, 1, &gref);
- if (ret < 0)
+ if (ret < 0) {
+ free_page(page);
goto fail;
+ }

handler = evtchnl_interrupt_ctrl;
} else {
@@ -195,8 +197,10 @@ static int evtchnl_alloc(struct xen_drm_front_info *front_info, int index,

ret = gnttab_grant_foreign_access(xb_dev->otherend_id,
virt_to_gfn((void *)page), 0);
- if (ret < 0)
+ if (ret < 0) {
+ free_page(page);
goto fail;
+ }

gref = ret;
handler = evtchnl_interrupt_evt;
--
2.7.4


--------------0F431B0390EA6413AB0422ED
Content-Type: text/x-patch;
name="0002-drm-xen-front-Align-documentation-title-w-other-driv.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0002-drm-xen-front-Align-documentation-title-w-other-driv.pa";
filename*1="tch"