[PATCH 3.13 102/103] KEYS: Fix use-after-free in assoc_array_gc()

Kamal Mostafa kamal at canonical.com
Tue Sep 30 21:31:47 UTC 2014 -stable review patch.  If anyone has any objections, please let me know.


From: David Howells <dhowells at redhat.com>

commit 27419604f51a97d497853f14142c1059d46eb597 upstream.

An edit script should be considered inaccessible by a function once it has
called assoc_array_apply_edit() or assoc_array_cancel_edit().

However, assoc_array_gc() is accessing the edit script just after the
gc_complete: label.

Reported-by: Andreea-Cristina Bernat <bernat.ada at gmail.com>
Signed-off-by: David Howells <dhowells at redhat.com>
Reviewed-by: Andreea-Cristina Bernat <bernat.ada at gmail.com>
cc: shemming at brocade.com
cc: paulmck at linux.vnet.ibm.com
Signed-off-by: James Morris <james.l.morris at oracle.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 lib/assoc_array.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index 76ae279..f9524b8 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -1737,7 +1737,7 @@ ascend_old_tree:
 	edit->set[0].to = new_root;
-	edit->array->nr_leaves_on_tree = nr_leaves_on_tree;
+	array->nr_leaves_on_tree = nr_leaves_on_tree;
 	return 0;

More information about the kernel-team mailing list