Race against parent deletion in key_user_lookup()
Subsystems (2)
I looked at some of the oops reports against keyrings, I think the problem is that the search isn't restarted after dropping the key_user_lock, *p will still be NULL when we get back to try_again and look through the tree.
It looks like the intention was that the search start over from scratch.
Signed-off-by Alexander Nyberg <[email protected]>
===== security/keys/key.c 1.5 vs edited =====
security/keys/key.c +2 -1
@@ -57,9 +57,10 @@ struct key_user *key_user_lookup(uid_t u {struct key_user *candidate =NULL , *user;struct rb_node *parent =NULL ; -struct rb_node **p = &key_user_tree.rb_node; +struct rb_node **p; try_again: + p = &key_user_tree.rb_node;spin_lock (&key_user_lock);/* search the tree for a user record with a matching UID */
David Howells
maintainerI looked at some of the oops reports against keyrings, I think the problem is that the search isn't restarted after dropping the key_user_lock, *p will still be NULL when we get back to try_again and look through the tree.
It looks like the intention was that the search start over from scratch.
Signed-off-by Alexander Nyberg <[email protected]>
Signed-off-by David Howells <[email protected]>
===== security/keys/key.c 1.5 vs edited =====
security/keys/key.c +2 -1
@@ -57,9 +57,10 @@ struct key_user *key_user_lookup(uid_t u {struct key_user *candidate =NULL , *user;struct rb_node *parent =NULL ; -struct rb_node **p = &key_user_tree.rb_node; +struct rb_node **p; try_again: + p = &key_user_tree.rb_node;spin_lock (&key_user_lock);/* search the tree for a user record with a matching UID */