From: Jan Beulich Date: Tue, 4 Apr 2017 12:27:22 +0000 (-0600) Subject: xenbus: remove transaction holder from list before freeing X-Git-Tag: v4.1.12-111.0.20170918_2215~231 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=dc944e5b7e7fa19bf4b1a65f21cbb7607f531ae6;p=users%2Fjedix%2Flinux-maple.git xenbus: remove transaction holder from list before freeing After allocation the item is being placed on the list right away. Consequently it needs to be taken off the list before freeing in the case xenbus_dev_request_and_reply() failed, as in that case the callback (xenbus_dev_queue_reply()) is not being called (and if it was called, it should do both). Fixes: 5584ea250ae44f929feb4c7bd3877d1c5edbf813 Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross Signed-off-by: Boris Ostrovsky OraBug: 26662731 (cherry picked from commit ac4cde398a96c1d28b1c28a0f69b6efd892a1c8a) Signed-off-by: Boris Ostrovsky Reviewed-by: Joao Martins --- diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 6cd35bd8a2d43..87ac5cab7a45f 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -445,8 +445,10 @@ static int xenbus_write_transaction(unsigned msg_type, return xenbus_command_reply(u, XS_ERROR, "ENOENT"); rc = xenbus_dev_request_and_reply(&u->u.msg, u); - if (rc) + if (rc && trans) { + list_del(&trans->list); kfree(trans); + } out: return rc;