aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/xen-fbfront.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:48:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:48:46 -0500
commit9f99a2f0e44663517b99b69a3e4a499d0ba877df (patch)
tree92bbe9f9c9c6687a49e13e4e1bfe2a29bc736476 /drivers/video/xen-fbfront.c
parent8c8ae4e8cd5a67467192f3361eeec463694f8ed8 (diff)
parent110e7c7e4f8a61a34e0ab88fc9bdf4d5c6d220b2 (diff)
Merge branch 'stable/bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
* 'stable/bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen/event: validate irq before get evtchn by irq xen/fb: fix potential memory leak xen/fb: fix xenfb suspend/resume race. xen: disable ACPI NUMA for PV guests xen/irq: Cleanup the find_unbound_irq
Diffstat (limited to 'drivers/video/xen-fbfront.c')
-rw-r--r--drivers/video/xen-fbfront.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index 4abb0b9ed653..3e6934d4bea8 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -562,26 +562,24 @@ static void xenfb_init_shared_page(struct xenfb_info *info,
562static int xenfb_connect_backend(struct xenbus_device *dev, 562static int xenfb_connect_backend(struct xenbus_device *dev,
563 struct xenfb_info *info) 563 struct xenfb_info *info)
564{ 564{
565 int ret, evtchn; 565 int ret, evtchn, irq;
566 struct xenbus_transaction xbt; 566 struct xenbus_transaction xbt;
567 567
568 ret = xenbus_alloc_evtchn(dev, &evtchn); 568 ret = xenbus_alloc_evtchn(dev, &evtchn);
569 if (ret) 569 if (ret)
570 return ret; 570 return ret;
571 ret = bind_evtchn_to_irqhandler(evtchn, xenfb_event_handler, 571 irq = bind_evtchn_to_irqhandler(evtchn, xenfb_event_handler,
572 0, dev->devicetype, info); 572 0, dev->devicetype, info);
573 if (ret < 0) { 573 if (irq < 0) {
574 xenbus_free_evtchn(dev, evtchn); 574 xenbus_free_evtchn(dev, evtchn);
575 xenbus_dev_fatal(dev, ret, "bind_evtchn_to_irqhandler"); 575 xenbus_dev_fatal(dev, ret, "bind_evtchn_to_irqhandler");
576 return ret; 576 return irq;
577 } 577 }
578 info->irq = ret;
579
580 again: 578 again:
581 ret = xenbus_transaction_start(&xbt); 579 ret = xenbus_transaction_start(&xbt);
582 if (ret) { 580 if (ret) {
583 xenbus_dev_fatal(dev, ret, "starting transaction"); 581 xenbus_dev_fatal(dev, ret, "starting transaction");
584 return ret; 582 goto unbind_irq;
585 } 583 }
586 ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu", 584 ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
587 virt_to_mfn(info->page)); 585 virt_to_mfn(info->page));
@@ -603,20 +601,25 @@ static int xenfb_connect_backend(struct xenbus_device *dev,
603 if (ret == -EAGAIN) 601 if (ret == -EAGAIN)
604 goto again; 602 goto again;
605 xenbus_dev_fatal(dev, ret, "completing transaction"); 603 xenbus_dev_fatal(dev, ret, "completing transaction");
606 return ret; 604 goto unbind_irq;
607 } 605 }
608 606
609 xenbus_switch_state(dev, XenbusStateInitialised); 607 xenbus_switch_state(dev, XenbusStateInitialised);
608 info->irq = irq;
610 return 0; 609 return 0;
611 610
612 error_xenbus: 611 error_xenbus:
613 xenbus_transaction_end(xbt, 1); 612 xenbus_transaction_end(xbt, 1);
614 xenbus_dev_fatal(dev, ret, "writing xenstore"); 613 xenbus_dev_fatal(dev, ret, "writing xenstore");
614 unbind_irq:
615 unbind_from_irqhandler(irq, info);
615 return ret; 616 return ret;
616} 617}
617 618
618static void xenfb_disconnect_backend(struct xenfb_info *info) 619static void xenfb_disconnect_backend(struct xenfb_info *info)
619{ 620{
621 /* Prevent xenfb refresh */
622 info->update_wanted = 0;
620 if (info->irq >= 0) 623 if (info->irq >= 0)
621 unbind_from_irqhandler(info->irq, info); 624 unbind_from_irqhandler(info->irq, info);
622 info->irq = -1; 625 info->irq = -1;