The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com
Cc: Adam Wendt <thelsdj@gmail.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] xen: unitialised return value in xenbus_write_transaction
Date: Sat, 24 Jan 2009 08:22:47 +0000	[thread overview]
Message-ID: <03f51a1eb4a7e77d6488.1232785367@localhost.localdomain> (raw)

The return value of xenbus_write_transaction can be uninitialised in
the success case leading to the userspace xenstore utilities failing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Adam Wendt <thelsdj@gmail.com>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Ingo Molnar <mingo@elte.hu>

---
 drivers/xen/xenfs/xenbus.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff -r 7c66d3ac6805 -r 03f51a1eb4a7 drivers/xen/xenfs/xenbus.c
--- a/drivers/xen/xenfs/xenbus.c	Fri Jan 23 16:42:41 2009 +0000
+++ b/drivers/xen/xenfs/xenbus.c	Fri Jan 23 16:42:41 2009 +0000
@@ -291,7 +291,7 @@
 static int xenbus_write_transaction(unsigned msg_type,
 				    struct xenbus_file_priv *u)
 {
-	int rc, ret;
+	int rc;
 	void *reply;
 	struct xenbus_transaction_holder *trans = NULL;
 	LIST_HEAD(staging_q);
@@ -326,15 +326,14 @@
 	}
 
 	mutex_lock(&u->reply_mutex);
-	ret = queue_reply(&staging_q, &u->u.msg, sizeof(u->u.msg));
-	if (!ret)
-		ret = queue_reply(&staging_q, reply, u->u.msg.len);
-	if (!ret) {
+	rc = queue_reply(&staging_q, &u->u.msg, sizeof(u->u.msg));
+	if (!rc)
+		rc = queue_reply(&staging_q, reply, u->u.msg.len);
+	if (!rc) {
 		list_splice_tail(&staging_q, &u->read_buffers);
 		wake_up(&u->read_waitq);
 	} else {
 		queue_cleanup(&staging_q);
-		rc = ret;
 	}
 	mutex_unlock(&u->reply_mutex);
 

             reply	other threads:[~2009-01-24  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-24  8:22 Ian Campbell [this message]
2009-01-26 13:29 ` [PATCH] xen: unitialised return value in xenbus_write_transaction Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03f51a1eb4a7e77d6488.1232785367@localhost.localdomain \
    --to=ian.campbell@citrix.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=thelsdj@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox