Skip to content

Commit 42c871d

Browse files
MichelleJin12gregkh
authored andcommitted
mac80211: check return value of rhashtable_init
[ Upstream commit 111461d ] 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 <shjy180909@gmail.com> Link: https://lore.kernel.org/r/20210927033457.1020967-4-shjy180909@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent bda06af commit 42c871d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

net/mac80211/mesh_pathtbl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ static struct mesh_table *mesh_table_alloc(void)
6060
atomic_set(&newtbl->entries, 0);
6161
spin_lock_init(&newtbl->gates_lock);
6262
spin_lock_init(&newtbl->walk_lock);
63-
rhashtable_init(&newtbl->rhead, &mesh_rht_params);
63+
if (rhashtable_init(&newtbl->rhead, &mesh_rht_params)) {
64+
kfree(newtbl);
65+
return NULL;
66+
}
6467

6568
return newtbl;
6669
}

0 commit comments

Comments
 (0)