[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] xen/fb: fix potential memory leak
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxxxx> # Date 1297241969 0 # Node ID 350c17abbc171cff0227b4ee9131f32851ea4f37 # Parent f6bae96cb09472afa9b3b1bd0e6ed2996b33713b xen/fb: fix potential memory leak From: Joe Jin <joe.jin@xxxxxxxxxx> This patch fixes a potential memory leak when xenfb connect to the backend fails. Thanks for Ian's review and comments. [v2: reworded the commit message a bit] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx> Tested-by: Gurudas Pai <gurudas.pai@xxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Made apply to linux-2.6.18-xen.hg. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- drivers/xen/fbfront/xenfb.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff -r f6bae96cb094 -r 350c17abbc17 drivers/xen/fbfront/xenfb.c --- a/drivers/xen/fbfront/xenfb.c Wed Feb 09 08:38:55 2011 +0000 +++ b/drivers/xen/fbfront/xenfb.c Wed Feb 09 08:59:29 2011 +0000 @@ -735,23 +735,22 @@ static int xenfb_connect_backend(struct static int xenfb_connect_backend(struct xenbus_device *dev, struct xenfb_info *info) { - int ret; + int ret, irq; struct xenbus_transaction xbt; - ret = bind_listening_port_to_irqhandler( + irq = bind_listening_port_to_irqhandler( dev->otherend_id, xenfb_event_handler, 0, "xenfb", info); - if (ret < 0) { - xenbus_dev_fatal(dev, ret, + if (irq < 0) { + xenbus_dev_fatal(dev, irq, "bind_listening_port_to_irqhandler"); - return ret; - } - info->irq = ret; + return irq; + } again: ret = xenbus_transaction_start(&xbt); if (ret) { xenbus_dev_fatal(dev, ret, "starting transaction"); - return ret; + goto unbind_irq; } ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu", virt_to_mfn(info->page)); @@ -773,15 +772,18 @@ static int xenfb_connect_backend(struct if (ret == -EAGAIN) goto again; xenbus_dev_fatal(dev, ret, "completing transaction"); - return ret; - } - + goto unbind_irq; + } + + info->irq = irq; xenbus_switch_state(dev, XenbusStateInitialised); return 0; error_xenbus: xenbus_transaction_end(xbt, 1); xenbus_dev_fatal(dev, ret, "writing xenstore"); + unbind_irq: + unbind_from_irqhandler(irq, info); return ret; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |