From: David Herrmann <dh.herrmann@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>,
Daniel Mack <daniel@zonque.org>,
Djalal Harouni <tixxdz@opendz.org>,
Alban Browaeys <prahal@yahoo.com>,
David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH] kdbus: fix wrong message size on 32bit
Date: Fri, 24 Jul 2015 12:32:09 +0200 [thread overview]
Message-ID: <1437733929-30378-1-git-send-email-dh.herrmann@gmail.com> (raw)
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
reply other threads:[~2015-07-24 10:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437733929-30378-1-git-send-email-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=daniel@zonque.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prahal@yahoo.com \
--cc=tixxdz@opendz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®