[systemd-devel] [PATCH 08/12] policy: kdbus_policy_set() make sure we restore the right entries

Daniel Mack daniel at zonque.org
Fri Jun 20 10:29:04 PDT 2014


On 06/20/2014 06:50 PM, Djalal Harouni wrote:
> If kdbus_policy_set() fails we try to restore the entries that were
> previously saved in a list, however due to a typo that logic was trying
> to access a previously freed entry which will just break things...
> So fix the typo 'l->e' instead of 'e'.
> 
> This fixes a bug triggered by test-kdbus-policy and makes the code able
> to restore previously saved entries in case of errors.

Applied, thanks!


Daniel

> 
> Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
> ---
>  policy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/policy.c b/policy.c
> index 79d6fa4..9cf7f67 100644
> --- a/policy.c
> +++ b/policy.c
> @@ -601,7 +601,7 @@ exit:
>  
>  		/* restore original entries from list */
>  		list_for_each_entry_safe(l, l_tmp, &list, entry) {
> -			kdbus_policy_add_one(db, e);
> +			kdbus_policy_add_one(db, l->e);
>  			kfree(l);
>  		}
>  	}
> 



More information about the systemd-devel mailing list