@@ -509,6 +509,10 @@ Note: we do not have explicit unassign,
MOD_DEC_USE_COUNT;
return -EFAULT;
}
+ brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
+ if (!brvcc)
+ return -ENOMEM;
+ memset(brvcc, 0, sizeof(struct br2684_vcc));
write_lock_irq(&devs_lock);
brdev = br2684_find_dev(&be.ifspec);
if (brdev == NULL) {
@@ -532,11 +536,6 @@ Note: we do not have explicit unassign,
err = -EINVAL;
goto error;
}
- brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
- if (!brvcc) {
- err = -ENOMEM;
- goto error;
- }
memset(brvcc, 0, sizeof(struct br2684_vcc));
DPRINTK("br2684_regvcc vcc=%p, encaps=%d, brvcc=%p\n", atmvcc, be.encaps,
brvcc);
@@ -567,6 +566,7 @@ Note: we do not have explicit unassign,
return 0;
error:
write_unlock_irq(&devs_lock);
+ kfree(brvcc);
MOD_DEC_USE_COUNT;
return err;
}