patch-2.3.99-pre4 linux/drivers/net/ppp_async.c
Next file: linux/drivers/net/ppp_generic.c
Previous file: linux/drivers/net/pcmcia/ibmtr_cs.c
Back to the patch index
Back to the overall index
- Lines: 69
- Date:
Mon Apr 10 23:05:35 2000
- Orig file:
v2.3.99-pre3/linux/drivers/net/ppp_async.c
- Orig date:
Sun Mar 19 18:35:30 2000
diff -u --recursive --new-file v2.3.99-pre3/linux/drivers/net/ppp_async.c linux/drivers/net/ppp_async.c
@@ -119,9 +119,11 @@
struct asyncppp *ap;
int err;
+ MOD_INC_USE_COUNT;
+ err = -ENOMEM;
ap = kmalloc(sizeof(*ap), GFP_KERNEL);
if (ap == 0)
- return -ENOMEM;
+ goto out;
/* initialize the asyncppp structure */
memset(ap, 0, sizeof(*ap));
@@ -140,15 +142,18 @@
ap->chan.ops = &async_ops;
ap->chan.mtu = PPP_MRU;
err = ppp_register_channel(&ap->chan);
- if (err) {
- kfree(ap);
- return err;
- }
+ if (err)
+ goto out_free;
tty->disc_data = ap;
- MOD_INC_USE_COUNT;
return 0;
+
+ out_free:
+ kfree(ap);
+ out:
+ MOD_DEC_USE_COUNT;
+ return err;
}
/*
@@ -215,6 +220,16 @@
err = -EFAULT;
switch (cmd) {
+ case PPPIOCGCHAN:
+ err = -ENXIO;
+ if (ap == 0)
+ break;
+ err = -EFAULT;
+ if (put_user(ppp_channel_index(&ap->chan), (int *) arg))
+ break;
+ err = 0;
+ break;
+
case PPPIOCGUNIT:
err = -ENXIO;
if (ap == 0)
@@ -257,10 +272,14 @@
case PPPIOCSXASYNCMAP:
case PPPIOCGMRU:
case PPPIOCSMRU:
+ err = -EPERM;
+ if (!capable(CAP_NET_ADMIN))
+ break;
err = ppp_async_ioctl(&ap->chan, cmd, arg);
break;
case PPPIOCATTACH:
+ case PPPIOCDETACH:
err = ppp_channel_ioctl(&ap->chan, cmd, arg);
break;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)