diff mbox

xenbus: remove transaction holder from list before freeing

Message ID 58E3AD4A020000780014C9C9@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich April 4, 2017, 12:27 p.m. UTC
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 <jbeulich@suse.com>
---
 drivers/xen/xenbus/xenbus_dev_frontend.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

--- 4.11-rc5/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ 4.11-rc5-xenbus-del-trans/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -442,8 +442,10 @@  static int xenbus_write_transaction(unsi
 		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;