Skip to content

Commit

Permalink
mac80211: check return value of rhashtable_init
Browse files Browse the repository at this point in the history
When rhashtable_init() fails, it returns -EINVAL.
However, since error return value of rhashtable_init is not checked,
it can cause use of uninitialized pointers.
So, fix unhandled errors of rhashtable_init.

Signed-off-by: MichelleJin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
MichelleJin12 authored and jmberg-intel committed Sep 27, 2021
1 parent 9451306 commit 111461d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/mac80211/mesh_pathtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ static struct mesh_table *mesh_table_alloc(void)
atomic_set(&newtbl->entries, 0);
spin_lock_init(&newtbl->gates_lock);
spin_lock_init(&newtbl->walk_lock);
rhashtable_init(&newtbl->rhead, &mesh_rht_params);
if (rhashtable_init(&newtbl->rhead, &mesh_rht_params)) {
kfree(newtbl);
return NULL;
}

return newtbl;
}
Expand Down

0 comments on commit 111461d

Please sign in to comment.