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 <pra...@yahoo.com>
Signed-off-by: David Herrmann <dh.herrm...@gmail.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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to