[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210925061037.4555-4-shjy180909@gmail.com>
Date: Sat, 25 Sep 2021 06:10:37 +0000
From: MichelleJin <shjy180909@...il.com>
To: davem@...emloft.net, kuba@...nel.org, yoshfuji@...ux-ipv6.org,
dsahern@...nel.org, johannes@...solutions.net
Cc: saeedm@...dia.com, leon@...nel.org, roid@...dia.com,
paulb@...dia.com, ozsh@...dia.com, vladbu@...dia.com,
lariel@...dia.com, cmi@...dia.com, netdev@...r.kernel.org
Subject: [PATCH net-next v3 3/3] 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@...il.com>
---
v1->v2:
- change commit message
- fix possible memory leaks
v2->v3:
- nothing changed
net/mac80211/mesh_pathtbl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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;
}
--
2.25.1
Powered by blists - more mailing lists