diff options
| author | Jan Beulich <JBeulich@suse.com> | 2016-07-07 03:23:57 -0400 |
|---|---|---|
| committer | David Vrabel <david.vrabel@citrix.com> | 2016-07-07 07:19:52 -0400 |
| commit | 0beef634b86a1350c31da5fcc2992f0d7c8a622b (patch) | |
| tree | 89be6a7c5e2d6af18fbc9935f3afaae9c42f0970 | |
| parent | d2bd05d88d245c13b64c3bf9c8927a1c56453d8c (diff) | |
xenbus: don't BUG() on user mode induced condition
Inability to locate a user mode specified transaction ID should not
lead to a kernel crash. For other than XS_TRANSACTION_START also
don't issue anything to xenbus if the specified ID doesn't match that
of any active transaction.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
| -rw-r--r-- | drivers/xen/xenbus/xenbus_dev_frontend.c | 14 |
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, | |||
| 316 | rc = -ENOMEM; | 316 | rc = -ENOMEM; |
| 317 | goto out; | 317 | goto out; |
| 318 | } | 318 | } |
| 319 | } else { | ||
| 320 | list_for_each_entry(trans, &u->transactions, list) | ||
| 321 | if (trans->handle.id == u->u.msg.tx_id) | ||
| 322 | break; | ||
| 323 | if (&trans->list == &u->transactions) | ||
| 324 | return -ESRCH; | ||
| 319 | } | 325 | } |
| 320 | 326 | ||
| 321 | reply = xenbus_dev_request_and_reply(&u->u.msg); | 327 | reply = xenbus_dev_request_and_reply(&u->u.msg); |
| 322 | if (IS_ERR(reply)) { | 328 | if (IS_ERR(reply)) { |
| 323 | kfree(trans); | 329 | if (msg_type == XS_TRANSACTION_START) |
| 330 | kfree(trans); | ||
| 324 | rc = PTR_ERR(reply); | 331 | rc = PTR_ERR(reply); |
| 325 | goto out; | 332 | goto out; |
| 326 | } | 333 | } |
| @@ -333,12 +340,7 @@ static int xenbus_write_transaction(unsigned msg_type, | |||
| 333 | list_add(&trans->list, &u->transactions); | 340 | list_add(&trans->list, &u->transactions); |
| 334 | } | 341 | } |
| 335 | } else if (u->u.msg.type == XS_TRANSACTION_END) { | 342 | } else if (u->u.msg.type == XS_TRANSACTION_END) { |
| 336 | list_for_each_entry(trans, &u->transactions, list) | ||
| 337 | if (trans->handle.id == u->u.msg.tx_id) | ||
| 338 | break; | ||
| 339 | BUG_ON(&trans->list == &u->transactions); | ||
| 340 | list_del(&trans->list); | 343 | list_del(&trans->list); |
| 341 | |||
| 342 | kfree(trans); | 344 | kfree(trans); |
| 343 | } | 345 | } |
| 344 | 346 | ||
