bus: fix bus creator info call

This is a foll-out from the recent metadata export API rework.

Signed-off-by: Daniel Mack <daniel@zonque.org>
queue: fix memleak when freeing entry

when releasing a queue entry, no unref of meta was done, which imply a not
release of the meta data.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
message: fix memleak releated with memfd_sizes

when releasing the message resources, memfd_sizes were left behind.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
queue: fix error unwinder in kdbus_queue_entry_install()

Signed-off-by: Daniel Mack <daniel@zonque.org>
resources: make sure vec sources are not accessed illegally

VEC source addresses are no longer valid after the SEND ioctl
returns. Add a boolean flag to track that, and BUG_ON() in case
someone calls kdbus_kmsg_make_vec_slice() from invalid contexts.

Signed-off-by: Daniel Mack <daniel@zonque.org>
message: fix kerneldoc

Signed-off-by: Daniel Mack <daniel@zonque.org>
queue: fix mem leak in unwinder of kdbus_queue_entry_alloc()

Signed-off-by: Daniel Mack <daniel@zonque.org>
message: fix allocation error check

Signed-off-by: Daniel Mack <daniel@zonque.org>
message: consolidate two error checks

Signed-off-by: Daniel Mack <daniel@zonque.org>
queue.h: remove left-over

Signed-off-by: Daniel Mack <daniel@zonque.org>
message: fix res->fd allocation braino

Fix the allocation size of res->fd, and clean up the code a bit so
res->fds_count is always set to the number of successfully ref'ed
files.

Signed-off-by: Daniel Mack <daniel@zonque.org>
queue: use kdbus_pool_slice_copy_user()

When accessing memory to copy it from user space memory to the vec
slice, user kdbus_pool_slice_copy_user().

Signed-off-by: Daniel Mack <daniel@zonque.org>
metadata: clear padding memory

Don't leak memory to userspace but explicitly zero out unwritten item
memory. Based on a patch from Ryan Lortie.

Signed-off-by: Daniel Mack <daniel@zonque.org>
item: move kdbus_meta_write_item() from metadata to item.c

Signed-off-by: Daniel Mack <daniel@zonque.org>
queue: use kdbus_meta_write_item()

Use kdbus_meta_write_item from kdbus_msg_make_items(), which now
clears unused memory, so we can allocate the items with kmalloc()
instead if kzalloc().

Signed-off-by: Daniel Mack <daniel@zonque.org>
item: rename kdbus_meta_write_item() → kdbus_item_set()

Signed-off-by: Daniel Mack <daniel@zonque.org>
connection: introduce KDBUS_HELLO_UNPRIVILEGED

Allow privileged processes to create unprivileged bus connections. This is
really useful for proxies that just want to impersonate someone else, but
not be treated as privileged on the bus.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection: simplify special-conn validation

We can use simple addition to validate that only one type of
special-connection flag is set.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
match: allow passing NULL on destructor

Be consistent and allow constructors to be passed a NULL object. This
should always be handled as no-op.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection: harden kdbus_conn_unref

Make sure kdbus_conn_unref() can be called on un-initialized objects. This
will later simplify kdbus_conn_new() error-handling significantly.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>