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

[Xen-changelog] Fail early without calling dev_request_and_reply if memory cannot be allocated.



# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 96c7303b03ab570bff9df5944ca9ea35b63fdaf6
# Parent  0ba3b9d60da65bcb9a14122c8b17c255354db764
Fail early without calling dev_request_and_reply if memory cannot be allocated.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r 0ba3b9d60da6 -r 96c7303b03ab 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Mon Jan  9 
11:25:05 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Mon Jan  9 
11:31:49 2006
@@ -134,14 +134,17 @@
        case XS_MKDIR:
        case XS_RM:
        case XS_SET_PERMS:
-               reply = xenbus_dev_request_and_reply(&u->u.msg);
-               if (IS_ERR(reply))
-                       return PTR_ERR(reply);
-
                if (u->u.msg.type == XS_TRANSACTION_START) {
                        trans = kmalloc(sizeof(*trans), GFP_KERNEL);
                        if (!trans)
                                return -ENOMEM;
+               }
+
+               reply = xenbus_dev_request_and_reply(&u->u.msg);
+               if (IS_ERR(reply))
+                       return PTR_ERR(reply);
+
+               if (u->u.msg.type == XS_TRANSACTION_START) {
                        trans->handle = (struct xenbus_transaction *)
                                simple_strtoul(reply, NULL, 0);
                        list_add(&trans->list, &u->transactions);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.