diff options
Diffstat (limited to 'drivers/net/ppp_generic.c')
| -rw-r--r-- | drivers/net/ppp_generic.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 83625fdff3dd..6b1d7a8edf15 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -363,7 +363,7 @@ static int ppp_open(struct inode *inode, struct file *file) | |||
| 363 | return 0; | 363 | return 0; |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | static int ppp_release(struct inode *inode, struct file *file) | 366 | static int ppp_release(struct inode *unused, struct file *file) |
| 367 | { | 367 | { |
| 368 | struct ppp_file *pf = file->private_data; | 368 | struct ppp_file *pf = file->private_data; |
| 369 | struct ppp *ppp; | 369 | struct ppp *ppp; |
| @@ -547,8 +547,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 547 | } | 547 | } |
| 548 | #endif /* CONFIG_PPP_FILTER */ | 548 | #endif /* CONFIG_PPP_FILTER */ |
| 549 | 549 | ||
| 550 | static int ppp_ioctl(struct inode *inode, struct file *file, | 550 | static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
| 551 | unsigned int cmd, unsigned long arg) | ||
| 552 | { | 551 | { |
| 553 | struct ppp_file *pf = file->private_data; | 552 | struct ppp_file *pf = file->private_data; |
| 554 | struct ppp *ppp; | 553 | struct ppp *ppp; |
| @@ -576,24 +575,29 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
| 576 | * this fd and reopening /dev/ppp. | 575 | * this fd and reopening /dev/ppp. |
| 577 | */ | 576 | */ |
| 578 | err = -EINVAL; | 577 | err = -EINVAL; |
| 578 | lock_kernel(); | ||
| 579 | if (pf->kind == INTERFACE) { | 579 | if (pf->kind == INTERFACE) { |
| 580 | ppp = PF_TO_PPP(pf); | 580 | ppp = PF_TO_PPP(pf); |
| 581 | if (file == ppp->owner) | 581 | if (file == ppp->owner) |
| 582 | ppp_shutdown_interface(ppp); | 582 | ppp_shutdown_interface(ppp); |
| 583 | } | 583 | } |
| 584 | if (atomic_read(&file->f_count) <= 2) { | 584 | if (atomic_read(&file->f_count) <= 2) { |
| 585 | ppp_release(inode, file); | 585 | ppp_release(NULL, file); |
| 586 | err = 0; | 586 | err = 0; |
| 587 | } else | 587 | } else |
| 588 | printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%d\n", | 588 | printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%d\n", |
| 589 | atomic_read(&file->f_count)); | 589 | atomic_read(&file->f_count)); |
| 590 | unlock_kernel(); | ||
| 590 | return err; | 591 | return err; |
| 591 | } | 592 | } |
| 592 | 593 | ||
| 593 | if (pf->kind == CHANNEL) { | 594 | if (pf->kind == CHANNEL) { |
| 594 | struct channel *pch = PF_TO_CHANNEL(pf); | 595 | struct channel *pch; |
| 595 | struct ppp_channel *chan; | 596 | struct ppp_channel *chan; |
| 596 | 597 | ||
| 598 | lock_kernel(); | ||
| 599 | pch = PF_TO_CHANNEL(pf); | ||
| 600 | |||
| 597 | switch (cmd) { | 601 | switch (cmd) { |
| 598 | case PPPIOCCONNECT: | 602 | case PPPIOCCONNECT: |
| 599 | if (get_user(unit, p)) | 603 | if (get_user(unit, p)) |
| @@ -613,6 +617,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
| 613 | err = chan->ops->ioctl(chan, cmd, arg); | 617 | err = chan->ops->ioctl(chan, cmd, arg); |
| 614 | up_read(&pch->chan_sem); | 618 | up_read(&pch->chan_sem); |
| 615 | } | 619 | } |
| 620 | unlock_kernel(); | ||
| 616 | return err; | 621 | return err; |
| 617 | } | 622 | } |
| 618 | 623 | ||
| @@ -622,6 +627,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
| 622 | return -EINVAL; | 627 | return -EINVAL; |
| 623 | } | 628 | } |
| 624 | 629 | ||
| 630 | lock_kernel(); | ||
| 625 | ppp = PF_TO_PPP(pf); | 631 | ppp = PF_TO_PPP(pf); |
| 626 | switch (cmd) { | 632 | switch (cmd) { |
| 627 | case PPPIOCSMRU: | 633 | case PPPIOCSMRU: |
| @@ -769,7 +775,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
| 769 | default: | 775 | default: |
| 770 | err = -ENOTTY; | 776 | err = -ENOTTY; |
| 771 | } | 777 | } |
| 772 | 778 | unlock_kernel(); | |
| 773 | return err; | 779 | return err; |
| 774 | } | 780 | } |
| 775 | 781 | ||
| @@ -781,6 +787,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
| 781 | struct channel *chan; | 787 | struct channel *chan; |
| 782 | int __user *p = (int __user *)arg; | 788 | int __user *p = (int __user *)arg; |
| 783 | 789 | ||
| 790 | lock_kernel(); | ||
| 784 | switch (cmd) { | 791 | switch (cmd) { |
| 785 | case PPPIOCNEWUNIT: | 792 | case PPPIOCNEWUNIT: |
| 786 | /* Create a new ppp unit */ | 793 | /* Create a new ppp unit */ |
| @@ -829,6 +836,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
| 829 | default: | 836 | default: |
| 830 | err = -ENOTTY; | 837 | err = -ENOTTY; |
| 831 | } | 838 | } |
| 839 | unlock_kernel(); | ||
| 832 | return err; | 840 | return err; |
| 833 | } | 841 | } |
| 834 | 842 | ||
| @@ -837,7 +845,7 @@ static const struct file_operations ppp_device_fops = { | |||
| 837 | .read = ppp_read, | 845 | .read = ppp_read, |
| 838 | .write = ppp_write, | 846 | .write = ppp_write, |
| 839 | .poll = ppp_poll, | 847 | .poll = ppp_poll, |
| 840 | .ioctl = ppp_ioctl, | 848 | .unlocked_ioctl = ppp_ioctl, |
| 841 | .open = ppp_open, | 849 | .open = ppp_open, |
| 842 | .release = ppp_release | 850 | .release = ppp_release |
| 843 | }; | 851 | }; |
