[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xenbus: add proper handling of XS_ERROR from Xenbus for transactions


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Tue, 10 Mar 2015 13:44:03 +0000
  • Delivery-date: Tue, 10 Mar 2015 13:44:10 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jennifer Herbert <Jennifer.Herbert@xxxxxxxxxx>
# Date 1425994719 -3600
# Node ID afe2ac5137b8c247dea886c732d09791fe44ac91
# Parent  72387b3c2252e38b55ff2c943388c32f0ae338e6
xenbus: add proper handling of XS_ERROR from Xenbus for transactions

If Xenstore sends back a XS_ERROR for TRANSACTION_END, the driver
wrongly removes the transaction from the transaction list.  For
TRANSACTION_START, it leaks memory.

Check the message as returned from xenbus_dev_request_and_reply(), and
clean up for TRANSACTION_START or discard the error for
TRANSACTION_END.

Signed-off-by: Jennifer Herbert <Jennifer.Herbert@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 72387b3c2252 -r afe2ac5137b8 drivers/xen/xenbus/xenbus_dev.c
--- a/drivers/xen/xenbus/xenbus_dev.c   Tue Mar 10 14:37:27 2015 +0100
+++ b/drivers/xen/xenbus/xenbus_dev.c   Tue Mar 10 14:38:39 2015 +0100
@@ -343,9 +343,13 @@ static ssize_t xenbus_dev_write(struct f
                }
 
                if (msg_type == XS_TRANSACTION_START) {
-                       trans->handle.id = simple_strtoul(reply, NULL, 0);
-                       list_add(&trans->list, &u->transactions);
-               } else if (msg_type == XS_TRANSACTION_END) {
+                       if (u->u.msg.type == XS_ERROR)
+                               kfree(trans);
+                       else {
+                               trans->handle.id = simple_strtoul(reply, NULL, 
0);
+                               list_add(&trans->list, &u->transactions);
+                       }
+               } else if (u->u.msg.type == XS_TRANSACTION_END) {
                        list_del(&trans->list);
                        kfree(trans);
                }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.