[systemd-devel] [PATCH 07/12] policy: use the db->entries_hash to access the policy db entries

Daniel Mack daniel at zonque.org
Fri Jun 20 10:28:15 PDT 2014


On 06/20/2014 06:50 PM, Djalal Harouni wrote:
> Use the db->entries_hash to access the policy db entries instead of the
> db->send_access_hash which is just a cache for send entries.
> 
> Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
> ---
>  policy.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/policy.c b/policy.c
> index bf49f68..79d6fa4 100644
> --- a/policy.c
> +++ b/policy.c
> @@ -373,7 +373,7 @@ static void __kdbus_policy_remove_owner(struct kdbus_policy_db *db,
>  	struct hlist_node *tmp;
>  	int i;
>  
> -	hash_for_each_safe(db->send_access_hash, i, tmp, e, hentry)
> +	hash_for_each_safe(db->entries_hash, i, tmp, e, hentry)

Hmm, we need to do both, right? If an owner goes away, we need to kill
both the entries it created *and* the cached entries it is related to.

Now that I look at the code, I see that we miss an owner assignment for
the cache entries. I can fix that up later.

> @@ -482,7 +483,7 @@ int kdbus_policy_set(struct kdbus_policy_db *db,
>  	 * At the same time, the lookup mechanism won't find any collisions
>  	 * when looking for already exising names.
>  	 */
> -	hash_for_each_safe(db->send_access_hash, i, tmp, e, hentry)
> +	hash_for_each_safe(db->entries_hash, i, tmp, e, hentry)
>  		if (e->owner == owner) {
>  			struct kdbus_policy_list_entry *l;

This change looks right though.



Daniel




More information about the systemd-devel mailing list