Skip to content

Commit

Permalink
xen: xenbus_dev_frontend: Really return response string
Browse files Browse the repository at this point in the history
xenbus_command_reply() did not actually copy the response string and
leaked stack content instead.

Fixes: 9a6161f ("xen: return xenstore command failures via response instead of rc")
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
  • Loading branch information
Simon Gaiser authored and Boris Ostrovsky committed Apr 17, 2018
1 parent cd6e992 commit ebf04f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/xen/xenbus/xenbus_dev_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static int xenbus_command_reply(struct xenbus_file_priv *u,
{
struct {
struct xsd_sockmsg hdr;
const char body[16];
char body[16];
} msg;
int rc;

Expand All @@ -412,6 +412,7 @@ static int xenbus_command_reply(struct xenbus_file_priv *u,
msg.hdr.len = strlen(reply) + 1;
if (msg.hdr.len > sizeof(msg.body))
return -E2BIG;
memcpy(&msg.body, reply, msg.hdr.len);

mutex_lock(&u->reply_mutex);
rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len);
Expand Down

0 comments on commit ebf04f3

Please sign in to comment.