Skip to content

Commit

Permalink
KEYS: Fix use-after-free in assoc_array_gc()
Browse files Browse the repository at this point in the history
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@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
cc: shemming@brocade.com
cc: paulmck@linux.vnet.ibm.com
Cc: stable@vger.kernel.org
Signed-off-by: James Morris <james.l.morris@oracle.com>
  • Loading branch information
dhowells authored and James Morris committed Sep 3, 2014
1 parent 876c6e3 commit 2741960
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/assoc_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ int assoc_array_gc(struct assoc_array *array,
gc_complete:
edit->set[0].to = new_root;
assoc_array_apply_edit(edit);
edit->array->nr_leaves_on_tree = nr_leaves_on_tree;
array->nr_leaves_on_tree = nr_leaves_on_tree;
return 0;

enomem:
Expand Down

0 comments on commit 2741960

Please sign in to comment.