kdbus: properly reset metadata iovecs on multicasts
PATCH 1/1 kdbus: properly reset metadata iovecs on multicasts
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 <[email protected]>
Signed-off-by David Herrmann <[email protected]>
---
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(+)
ipc/kdbus/message.c +10 -0
@@ -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 ... */
Signature · 1 line
2.4.5