* [PATCH 2/4][MAC80211]: Fix not checked kmalloc() result.
@ 2008-05-06 14:49 Pavel Emelyanov
0 siblings, 0 replies; only message in thread
From: Pavel Emelyanov @ 2008-05-06 14:49 UTC (permalink / raw)
To: Johannes Berg, John W. Linville
Cc: David Miller, linux-wireless, Linux Netdev List
The new_node kmallocation is not checked for success, so add
this check.
BTW, it also happens under the read_lock.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
net/mac80211/mesh_pathtbl.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 727aa52..1d2d051 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -164,13 +164,19 @@ int mesh_path_add(u8 *dst, struct net_device *dev)
err = -ENOMEM;
goto endadd2;
}
+ new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
+ if (!new_node) {
+ kfree(new_mpath);
+ atomic_dec(&sdata->u.sta.mpaths);
+ err = -ENOMEM;
+ goto endadd2;
+ }
read_lock(&pathtbl_resize_lock);
memcpy(new_mpath->dst, dst, ETH_ALEN);
new_mpath->dev = dev;
new_mpath->flags = 0;
skb_queue_head_init(&new_mpath->frame_queue);
- new_node = kmalloc(sizeof(struct mpath_node), GFP_KERNEL);
new_node->mpath = new_mpath;
new_mpath->timer.data = (unsigned long) new_mpath;
new_mpath->timer.function = mesh_path_timer;
--
1.5.3.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-06 14:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-06 14:49 [PATCH 2/4][MAC80211]: Fix not checked kmalloc() result Pavel Emelyanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).