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.

Signed-off-by: Djalal Harouni <tix...@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);
                }
        }
-- 
1.9.0

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to