* [PATCH] kdbus: fix wrong message size on 32bit
@ 2015-07-24 10:32 David Herrmann
0 siblings, 0 replies; only message in thread
From: David Herrmann @ 2015-07-24 10:32 UTC (permalink / raw)
To: linux-kernel
Cc: Greg KH, Daniel Mack, Djalal Harouni, Alban Browaeys, David Herrmann
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@yahoo.com>
Signed-off-by: David Herrmann <dh.herrmann@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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-24 10:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 10:32 [PATCH] kdbus: fix wrong message size on 32bit David Herrmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®