Skip to content

Commit

Permalink
xen: unitialised return value in xenbus_write_transaction
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ian Campbell authored and Ingo Molnar committed Jan 26, 2009
1 parent 659d261 commit e88a0fa
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/xen/xenfs/xenbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static void watch_fired(struct xenbus_watch *watch,
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);
Expand Down Expand Up @@ -326,15 +326,14 @@ static int xenbus_write_transaction(unsigned msg_type,
}

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);

Expand Down

0 comments on commit e88a0fa

Please sign in to comment.