Skip to contentSkip to conversation

xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.

PATCH Applied David Vrabel 2 participants 3 messages Feb 5, 2015 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.

From: Jennifer Herbert <[email protected]>

If Xenstore sends back a XS_ERROR for TRANSACTION_END, the driver BUGs because it cannot find the matching transaction in the 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.

---
 drivers/xen/xenbus/xenbus_dev_frontend.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +7 -4
index 85534ea..9433e46 100644
@@ -326,10 +326,13 @@ static int xenbus_write_transaction(unsigned msg_type,
 	}
 
 	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_for_each_entry(trans, &u->transactions, list)
 			if (trans->handle.id == u->u.msg.tx_id)
 				break;
Signature · 1 line
1.7.10.4
author Applied
#1 lore raw
Quoted 9 lines · David Vrabel

From: Jennifer Herbert <[email protected]>

If Xenstore sends back a XS_ERROR for TRANSACTION_END, the driver BUGs because it cannot find the matching transaction in the 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.

Applied to devel/for-linus-3.20, thanks.

David

#2 lore raw
Quoted 7 lines · David Vrabel
Quoted 6 lines · David Vrabel

From: Jennifer Herbert <[email protected]>

If Xenstore sends back a XS_ERROR for TRANSACTION_END, the driver BUGs because it cannot find the matching transaction in the list. For TRANSACTION_START, it leaks memory.

Quoted 5 lines
Quoted 3 lines

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

Applied to devel/for-linus-3.20, thanks.

You are thanking yourself :-) ?

Maybe it is time for some vacation?

Quoted 7 lines

David

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel