kdbus: Check for bloom parameter in "make bus" command

When handling a KDBUS_CMD_BUS_MAKE command the kernel must make sure
that the message contains a bloom parameter item to avoid a null-
pointer dereference.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
connection: remove useless kdbus_str_hash() call

The hash is calculated internally in kdbus_name_lookup(), so just
remove this useless kdbus_str_hash() call. It is not used.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
endpoint: protect the idr tree on release

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
handle: change return value from -EFAULT to -EPERM

Return -EPERM if current does not have the appropriate privileges to
create custom endpoints.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: unref ep and bus and free match_db on error path

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: add function kdbus_conn_find_peer()

Use this function to find a connection peer with a given id.

The returned connection is on the same bus of the source connection
and it is ref'ed.

This allows to reduce code duplication and will make it easy to
read code and differentiate between messages that have a source
connection and other kernel generated messages.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
kdbus: use kdbus_conn_find_peer() where appropriate

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
policy: whitespace cleanup
connection: check whether a reply exists before freeing it

For KDBUS_RECV_DROP, Walk the list of pending replies and see if the
one attached to this queue item is stil there.  It might have been
removed by an incoming reply, and we currently don't track reply
entries in that direction in order to prevent potentially dangling
pointers.

At least atm, KDBUS_RECV_DROP is considered a rarely used operation, so
we can live with that.