Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Jennifer Herbert <[email protected]>
Signed-off-by: David Vrabel <[email protected]>
  • Loading branch information
xennifer authored and David Vrabel committed Feb 5, 2015
1 parent dab069c commit a2e75bc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/xen/xenbus/xenbus_dev_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a2e75bc

Please sign in to comment.