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:
d5ccd49
)
caif: fix a potential NULL dereference
author
Eric Dumazet
<
[email protected]
>
Fri, 2 Sep 2011 02:19:23 +0000
(
02:19
+0000)
committer
David S. Miller
<
[email protected]
>
Fri, 16 Sep 2011 21:40:34 +0000
(17:40 -0400)
Commit
bd30ce4bc0b7
(caif: Use RCU instead of spin-lock in caif_dev.c)
added a potential NULL dereference in case alloc_percpu() fails.
caif_device_alloc() can also use GFP_KERNEL instead of GFP_ATOMIC.
Signed-off-by: Eric Dumazet <
[email protected]
>
CC: Sjur Brændeland <
[email protected]
>
Acked-by: Sjur Brændeland <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
net/caif/caif_dev.c
patch
|
blob
|
history
diff --git
a/net/caif/caif_dev.c
b/net/caif/caif_dev.c
index 7c2fa0a0814848c399c64aa9f44fc4fa119fa28b..7f9ac0742d19cc71fa367ea83bd8a9a117adbd1d 100644
(file)
--- a/
net/caif/caif_dev.c
+++ b/
net/caif/caif_dev.c
@@
-93,10
+93,14
@@
static struct caif_device_entry *caif_device_alloc(struct net_device *dev)
caifdevs = caif_device_list(dev_net(dev));
BUG_ON(!caifdevs);
- caifd = kzalloc(sizeof(*caifd), GFP_
ATOMIC
);
+ caifd = kzalloc(sizeof(*caifd), GFP_
KERNEL
);
if (!caifd)
return NULL;
caifd->pcpu_refcnt = alloc_percpu(int);
+ if (!caifd->pcpu_refcnt) {
+ kfree(caifd);
+ return NULL;
+ }
caifd->netdev = dev;
dev_hold(dev);
return caifd;