mirror of
https://github.com/torvalds/linux
synced 2024-09-21 19:47:35 +00:00
xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.
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 <Jennifer.Herbert@citrix.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
This commit is contained in:
parent
dab069c61a
commit
a2e75bc2ee
|
@ -326,10 +326,13 @@ static int xenbus_write_transaction(unsigned msg_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg_type == XS_TRANSACTION_START) {
|
if (msg_type == XS_TRANSACTION_START) {
|
||||||
trans->handle.id = simple_strtoul(reply, NULL, 0);
|
if (u->u.msg.type == XS_ERROR)
|
||||||
|
kfree(trans);
|
||||||
list_add(&trans->list, &u->transactions);
|
else {
|
||||||
} else if (msg_type == XS_TRANSACTION_END) {
|
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)
|
list_for_each_entry(trans, &u->transactions, list)
|
||||||
if (trans->handle.id == u->u.msg.tx_id)
|
if (trans->handle.id == u->u.msg.tx_id)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue