|
@@ -93,10 +93,14 @@ static struct caif_device_entry *caif_device_alloc(struct net_device *dev)
|
|
caifdevs = caif_device_list(dev_net(dev));
|
|
caifdevs = caif_device_list(dev_net(dev));
|
|
BUG_ON(!caifdevs);
|
|
BUG_ON(!caifdevs);
|
|
|
|
|
|
- caifd = kzalloc(sizeof(*caifd), GFP_ATOMIC);
|
|
|
|
|
|
+ caifd = kzalloc(sizeof(*caifd), GFP_KERNEL);
|
|
if (!caifd)
|
|
if (!caifd)
|
|
return NULL;
|
|
return NULL;
|
|
caifd->pcpu_refcnt = alloc_percpu(int);
|
|
caifd->pcpu_refcnt = alloc_percpu(int);
|
|
|
|
+ if (!caifd->pcpu_refcnt) {
|
|
|
|
+ kfree(caifd);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
caifd->netdev = dev;
|
|
caifd->netdev = dev;
|
|
dev_hold(dev);
|
|
dev_hold(dev);
|
|
return caifd;
|
|
return caifd;
|