{
struct kdbus_bus *bus = container_of(kref, struct kdbus_bus, kref);
+ BUG_ON(!bus->disconnected);
BUG_ON(!list_empty(&bus->ep_list));
BUG_ON(!list_empty(&bus->monitors_list));
BUG_ON(!hash_empty(bus->conn_hash));
- kdbus_bus_disconnect(bus);
kdbus_notify_free(bus);
atomic_dec(&bus->user->buses);
kdbus_domain_user_unref(bus->user);
struct timespec ts;
u64 now;
+ conn = container_of(work, struct kdbus_conn, work.work);
ktime_get_ts(&ts);
now = timespec_to_ns(&ts);
- conn = container_of(work, struct kdbus_conn, work.work);
-
mutex_lock(&conn->lock);
if (!kdbus_conn_active(conn)) {
mutex_unlock(&conn->lock);
conn->flags);
kdbus_notify_flush(conn->bus);
+
+ /* drop additional reference whe took at HELLO time */
+ kdbus_conn_unref(conn);
+
return 0;
}
{
struct kdbus_conn *conn = container_of(kref, struct kdbus_conn, kref);
+ BUG_ON(kdbus_conn_active(conn));
BUG_ON(!list_empty(&conn->msg_list));
BUG_ON(!list_empty(&conn->names_list));
BUG_ON(!list_empty(&conn->names_queue_list));
BUG_ON(!list_empty(&conn->reply_list));
- kdbus_conn_disconnect(conn, false);
atomic_dec(&conn->user->connections);
kdbus_domain_user_unref(conn->user);
const char *seclabel = NULL;
const char *name = NULL;
struct kdbus_conn *conn;
- struct kdbus_bus *bus;
+ struct kdbus_bus *bus = ep->bus;
size_t seclabel_len = 0;
bool is_policy_holder;
bool is_activator;
bool is_monitor;
int ret;
- bus = ep->bus;
-
BUG_ON(*c);
is_monitor = hello->conn_flags & KDBUS_HELLO_MONITOR;
list_add_tail(&conn->ep_entry, &ep->conn_list);
hash_add(bus->conn_hash, &conn->hentry, conn->id);
+ /* take additional reference until we disconnect */
+ kdbus_conn_ref(conn);
+
mutex_unlock(&ep->lock);
mutex_unlock(&bus->lock);
struct kdbus_domain *domain =
container_of(kref, struct kdbus_domain, kref);
+ BUG_ON(!domain->disconnected);
BUG_ON(!list_empty(&domain->domain_list));
BUG_ON(!list_empty(&domain->bus_list));
BUG_ON(!hash_empty(domain->user_hash));
- kdbus_domain_disconnect(domain);
kdbus_domain_unref(domain->parent);
kfree(domain->name);
kfree(domain->devpath);
{
struct kdbus_ep *ep = container_of(kref, struct kdbus_ep, kref);
+ BUG_ON(!ep->disconnected);
BUG_ON(!list_empty(&ep->conn_list));
- kdbus_ep_disconnect(ep);
kdbus_policy_db_free(ep->policy_db);
kdbus_bus_unref(ep->bus);
kdbus_domain_user_unref(ep->user);