Skip to content

Commit ebf04f3

Browse files
HW42Boris Ostrovsky
authored andcommitted
xen: xenbus_dev_frontend: Really return response string
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>
1 parent cd6e992 commit ebf04f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/xen/xenbus/xenbus_dev_frontend.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static int xenbus_command_reply(struct xenbus_file_priv *u,
403403
{
404404
struct {
405405
struct xsd_sockmsg hdr;
406-
const char body[16];
406+
char body[16];
407407
} msg;
408408
int rc;
409409

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

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

0 commit comments

Comments
 (0)