summaryrefslogtreecommitdiffstats
path: root/drivers/xen/xenbus/xenbus_dev_frontend.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2016-08-03 12:55:49 +0200
committerRalf Baechle <ralf@linux-mips.org>2016-08-03 12:55:49 +0200
commit4a89cf810130fde41e3fc729e770cb1a5a87d245 (patch)
tree84da40f8d26e51c21e61fc4fc5b7242c0050ae7d /drivers/xen/xenbus/xenbus_dev_frontend.c
parentMIPS: mm: Fix definition of R6 cache instruction (diff)
parentMIPS: Fix MSA asm warnings in control reg accessors (diff)
downloadlinux-4a89cf810130fde41e3fc729e770cb1a5a87d245.tar.xz
linux-4a89cf810130fde41e3fc729e770cb1a5a87d245.zip
Merge branch '4.7-fixes' into mips-for-linux-next
Diffstat (limited to 'drivers/xen/xenbus/xenbus_dev_frontend.c')
-rw-r--r--drivers/xen/xenbus/xenbus_dev_frontend.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index cacf30d14747..7487971f9f78 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -316,11 +316,18 @@ static int xenbus_write_transaction(unsigned msg_type,
rc = -ENOMEM;
goto out;
}
+ } else {
+ list_for_each_entry(trans, &u->transactions, list)
+ if (trans->handle.id == u->u.msg.tx_id)
+ break;
+ if (&trans->list == &u->transactions)
+ return -ESRCH;
}
reply = xenbus_dev_request_and_reply(&u->u.msg);
if (IS_ERR(reply)) {
- kfree(trans);
+ if (msg_type == XS_TRANSACTION_START)
+ kfree(trans);
rc = PTR_ERR(reply);
goto out;
}
@@ -333,12 +340,7 @@ static int xenbus_write_transaction(unsigned msg_type,
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;
- BUG_ON(&trans->list == &u->transactions);
list_del(&trans->list);
-
kfree(trans);
}