From: Kay Sievers Date: Thu, 31 Jul 2014 14:59:27 +0000 (+0200) Subject: domain: add BUG_ON() X-Git-Tag: upstream/0.20140911.160207utc~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc25c95354fed3caeaa8c8087a6c0ba8079dbd38;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git domain: add BUG_ON() --- diff --git a/domain.c b/domain.c index eeb73ca..6f6df15 100644 --- a/domain.c +++ b/domain.c @@ -462,15 +462,10 @@ static int kdbus_domain_user_assign_id(struct kdbus_domain *domain, * * Return: 0 on success, negative errno on failure. * - * On success: if there is a uid matching, then use the already - * accounted kdbus_domain_user, increment its reference counter and - * return it in the 'user' argument. Otherwise, allocate a new one, - * link it into the domain, then return it. - * - * On failure: the 'user' argument is not updated. - * - * Caller must have the domain lock held and must ensure that the - * domain was not disconnected. + * If there is a uid matching, then use the already accounted + * kdbus_domain_user, increment its reference counter and + * return it in the @user argument. Otherwise allocate a new one, + * link it into the domain and return it. */ int __kdbus_domain_user_account(struct kdbus_domain *domain, kuid_t uid, @@ -480,6 +475,8 @@ int __kdbus_domain_user_account(struct kdbus_domain *domain, struct kdbus_domain_user *tmp_user; struct kdbus_domain_user *u = NULL; + BUG_ON(!mutex_is_locked(&domain->lock)); + /* find uid and reference it */ if (uid_valid(uid)) { hash_for_each_possible(domain->user_hash, tmp_user, diff --git a/handle.c b/handle.c index d8e1dc6..59842c1 100644 --- a/handle.c +++ b/handle.c @@ -464,9 +464,8 @@ static long kdbus_handle_ioctl_ep(struct file *file, unsigned int cmd, * endpoint users do not share the budget with the ordinary * users created for a UID. */ - ret = kdbus_domain_user_account( - handle->ep->bus->domain, - INVALID_UID, &ep->user); + ret = kdbus_domain_user_account(handle->ep->bus->domain, + INVALID_UID, &ep->user); if (ret < 0) { kdbus_ep_unref(ep); break;