summaryrefslogtreecommitdiffstats
path: root/drivers/net/ppp_async.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-04-19 04:00:00 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-04-19 04:00:00 +0000
commit46e045034336a2cc90c1798cd7cc07af744ddfd6 (patch)
tree3b9b51fc482e729f663d25333e77fbed9aaa939a /drivers/net/ppp_async.c
parent31dc59d503a02e84c4de98826452acaeb56dc15a (diff)
Merge with Linux 2.3.99-pre4.
Diffstat (limited to 'drivers/net/ppp_async.c')
-rw-r--r--drivers/net/ppp_async.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index e87de253d..c3eb74c37 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -119,9 +119,11 @@ ppp_asynctty_open(struct tty_struct *tty)
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 @@ ppp_asynctty_open(struct tty_struct *tty)
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 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
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 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
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;