summaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_pathtbl.c
diff options
context:
space:
mode:
authorMichelleJin <shjy180909@gmail.com>2021-09-27 05:34:57 +0200
committerDavid S. Miller <davem@davemloft.net>2021-09-28 13:59:24 +0200
commitf43bed7193a36b1b4f73212ee0069f9113816856 (patch)
tree644296520f535792541f5417ee903ff24788a732 /net/mac80211/mesh_pathtbl.c
parentnet: ipv6: check return value of rhashtable_init (diff)
downloadlinux-f43bed7193a36b1b4f73212ee0069f9113816856.tar.xz
linux-f43bed7193a36b1b4f73212ee0069f9113816856.zip
net: mac80211: check return value of rhashtable_init
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/mac80211/mesh_pathtbl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index efbefcbac3ac..7cab1cf09bf1 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -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;
}