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

Djalal Harouni tixxdz at opendz.org
Fri Jun 20 09:50:02 PDT 2014


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 <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);
 		}
 	}
-- 
1.9.0



More information about the systemd-devel mailing list