From: David Herrmann <dh.herrmann@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Jan Alexander Steffens <jan.steffens@gmail.com>,
gregkh@linuxfoundation.org, daniel@zonque.org, tixxdz@opendz.org,
David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH] kdbus: properly reset metadata iovecs on multicasts
Date: Tue, 14 Jul 2015 20:12:28 +0200 [thread overview]
Message-ID: <1436897548-11155-1-git-send-email-dh.herrmann@gmail.com> (raw)
If a message is sent to multiple destinations, each destination might
request a different set of metadata. Hence, we cannot rely on each one
requesting at least a single bit.
Fix the message exporter to properly reset the metadata iovec on each
emit-iteration. Otherwise, we might end up scanning random heap memory if
a following destination does not request metadata.
Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
Hi Greg
One fall-out from the rewrite of the message importer. Reported by Jan. This
fixes some issues with metadata on messages targeted at more than one
destination. Reproducible by running a debug-monitor (which thus gets any
messages, additionally to the normal receiver).
Thanks
David
ipc/kdbus/message.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/ipc/kdbus/message.c b/ipc/kdbus/message.c
index 64763ea..3520f45 100644
--- a/ipc/kdbus/message.c
+++ b/ipc/kdbus/message.c
@@ -946,6 +946,16 @@ struct kdbus_pool_slice *kdbus_staging_emit(struct kdbus_staging *staging,
++v;
msg_size = KDBUS_ALIGN8(msg_size) + meta_size;
+ } else {
+ /* metadata items */
+ v->iov_len = 0;
+ v->iov_base = (void __user *)zeros;
+ ++v;
+
+ /* padding after metadata */
+ v->iov_len = 0;
+ v->iov_base = (void __user *)zeros;
+ ++v;
}
/* ... payload iovecs are already filled in ... */
--
2.4.5
reply other threads:[~2015-07-14 18:13 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=1436897548-11155-1-git-send-email-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=daniel@zonque.org \
--cc=gregkh@linuxfoundation.org \
--cc=jan.steffens@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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®