* [PATCH] kdbus: properly reset metadata iovecs on multicasts
@ 2015-07-14 18:12 David Herrmann
0 siblings, 0 replies; only message in thread
From: David Herrmann @ 2015-07-14 18:12 UTC (permalink / raw)
To: linux-kernel
Cc: Jan Alexander Steffens, gregkh, daniel, tixxdz, David Herrmann
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-14 18:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 18:12 [PATCH] kdbus: properly reset metadata iovecs on multicasts David Herrmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).