[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1437733929-30378-1-git-send-email-dh.herrmann@gmail.com>
Date: Fri, 24 Jul 2015 12:32:09 +0200
From: David Herrmann <dh.herrmann@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Greg KH <gregkh@...uxfoundation.org>,
Daniel Mack <daniel@...que.org>,
Djalal Harouni <tixxdz@...ndz.org>,
Alban Browaeys <prahal@...oo.com>,
David Herrmann <dh.herrmann@...il.com>
Subject: [PATCH] kdbus: fix wrong message size on 32bit
When broadcasting messages, each receiver might get a different message
due to different metadata requirements. Therefore, the value of msg->size
might be different for each receiver. To account for that, we use a
temporary variable to store the real size and use it as source for the
iovec-copy transaction instead of &msg->size.
But we incorrectly used "size_t" for this variable. Hence, on 32bit, we
end up missing 4 bytes of the message header as "size_t" might only be
32bit wide.
Fix this and properly use "u64" for the message size that is copied to
user-space.
Reported-by: Alban Browaeys <prahal@...oo.com>
Signed-off-by: David Herrmann <dh.herrmann@...il.com>
---
ipc/kdbus/message.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c
index 27a5021..432dba4 100644
--- a/ipc/kdbus/message.c
+++ b/ipc/kdbus/message.c
@@ -886,9 +886,9 @@ struct kdbus_pool_slice *kdbus_staging_emit(struct kdbus_staging *staging,
{
struct kdbus_item *item, *meta_items = NULL;
struct kdbus_pool_slice *slice = NULL;
- size_t off, size, msg_size, meta_size;
+ size_t off, size, meta_size;
struct iovec *v;
- u64 attach;
+ u64 attach, msg_size;
int ret;
/*
--
2.4.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists