projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
418c437
)
ieee802154: Fix possible NULL pointer dereference in wpan_phy_alloc
author
Denis Kirjanov
<
[email protected]
>
Sun, 23 May 2010 05:45:45 +0000
(
05:45
+0000)
committer
David S. Miller
<
[email protected]
>
Mon, 24 May 2010 06:11:07 +0000
(23:11 -0700)
Check for NULL pointer after kzalloc
Signed-off-by: Denis Kirjanov <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
net/ieee802154/wpan-class.c
patch
|
blob
|
history
diff --git
a/net/ieee802154/wpan-class.c
b/net/ieee802154/wpan-class.c
index 3d803a1b9fb69a046205a57be9dcbe2bfb141e72..1627ef2e85229d524727af6c111e3f4aa6507d36 100644
(file)
--- a/
net/ieee802154/wpan-class.c
+++ b/
net/ieee802154/wpan-class.c
@@
-147,13
+147,15
@@
struct wpan_phy *wpan_phy_alloc(size_t priv_size)
struct wpan_phy *phy = kzalloc(sizeof(*phy) + priv_size,
GFP_KERNEL);
+ if (!phy)
+ goto out;
mutex_lock(&wpan_phy_mutex);
phy->idx = wpan_phy_idx++;
if (unlikely(!wpan_phy_idx_valid(phy->idx))) {
wpan_phy_idx--;
mutex_unlock(&wpan_phy_mutex);
kfree(phy);
-
return NULL
;
+
goto out
;
}
mutex_unlock(&wpan_phy_mutex);
@@
-168,6
+170,9
@@
struct wpan_phy *wpan_phy_alloc(size_t priv_size)
phy->current_page = 0; /* for compatibility */
return phy;
+
+out:
+ return NULL;
}
EXPORT_SYMBOL(wpan_phy_alloc);