Skip to content

Commit

Permalink
KEYS: potential uninitialized variable
Browse files Browse the repository at this point in the history
If __key_link_begin() failed then "edit" would be uninitialized.  I've
added a check to fix that.

Change-Id: I0e28bdba07f645437db2b08daf67ca27f16c6f5c
Fixes: f70e2e0 ('KEYS: Do preallocation for __key_link()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  • Loading branch information
Dan Carpenter authored and andi34 committed Jul 8, 2017
1 parent 8d57d9a commit e6be44d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/keys/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ int key_reject_and_link(struct key *key,

mutex_unlock(&key_construction_mutex);

if (keyring)
if (keyring && link_ret == 0)
__key_link_end(keyring, key->type, prealloc);

/* wake up anyone waiting for a key to be constructed */
Expand Down

0 comments on commit e6be44d

Please sign in to comment.