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

2014-06-20 Thread Djalal Harouni
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


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

2014-06-20 Thread Daniel Mack
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 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);
   }
   }
 

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