mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
caif: fix a potential NULL dereference
Commit bd30ce4bc0 (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]>
This commit is contained in:
parent
d5ccd49660
commit
4fb66b8210
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue