All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv1] xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.
@ 2015-02-05 15:02 David Vrabel
  2015-02-05 15:07 ` David Vrabel
  0 siblings, 1 reply; 3+ messages in thread
From: David Vrabel @ 2015-02-05 15:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Boris Ostrovsky, Jennifer Herbert, David Vrabel

From: Jennifer Herbert <Jennifer.Herbert@citrix.com>

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>
---
 drivers/xen/xenbus/xenbus_dev_frontend.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 85534ea..9433e46 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -326,10 +326,13 @@ static int xenbus_write_transaction(unsigned msg_type,
 	}
 
 	if (msg_type == XS_TRANSACTION_START) {
-		trans->handle.id = simple_strtoul(reply, NULL, 0);
-
-		list_add(&trans->list, &u->transactions);
-	} else if (msg_type == XS_TRANSACTION_END) {
+		if (u->u.msg.type == XS_ERROR)
+			kfree(trans);
+		else {
+			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)
 			if (trans->handle.id == u->u.msg.tx_id)
 				break;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv1] xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.
  2015-02-05 15:02 [PATCHv1] xenbus: Add proper handling of XS_ERROR from Xenbus for transactions David Vrabel
@ 2015-02-05 15:07 ` David Vrabel
  2015-02-05 19:40   ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 3+ messages in thread
From: David Vrabel @ 2015-02-05 15:07 UTC (permalink / raw)
  To: David Vrabel, xen-devel; +Cc: Boris Ostrovsky, Jennifer Herbert

On 05/02/15 15:02, David Vrabel wrote:
> From: Jennifer Herbert <Jennifer.Herbert@citrix.com>
> 
> 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.

Applied to devel/for-linus-3.20, thanks.

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv1] xenbus: Add proper handling of XS_ERROR from Xenbus for transactions.
  2015-02-05 15:07 ` David Vrabel
@ 2015-02-05 19:40   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-02-05 19:40 UTC (permalink / raw)
  To: David Vrabel; +Cc: xen-devel, Boris Ostrovsky, Jennifer Herbert

On Thu, Feb 05, 2015 at 03:07:59PM +0000, David Vrabel wrote:
> On 05/02/15 15:02, David Vrabel wrote:
> > From: Jennifer Herbert <Jennifer.Herbert@citrix.com>
> > 
> > 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.
> 
> Applied to devel/for-linus-3.20, thanks.

You are thanking yourself :-) ?

Maybe it is time for some vacation?
> 
> David
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-05 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 15:02 [PATCHv1] xenbus: Add proper handling of XS_ERROR from Xenbus for transactions David Vrabel
2015-02-05 15:07 ` David Vrabel
2015-02-05 19:40   ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.