diff options
author | Alan Cox <alan@redhat.com> | 2008-05-26 02:40:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-26 02:40:58 -0400 |
commit | f3ff8a4d80e8ec867caf60b120c65db21f820e6d (patch) | |
tree | 54ced4957d443d2c4c35131e81272ee45a623bcd /drivers/net | |
parent | 43154d08d6bb5c69aa0d0e3448fb348b4cd84e91 (diff) |
ppp: push BKL down into the driver
I've pushed it down as far as I dare at this point. Someone familiar with
the internal PPP semantics can probably push it further. Another step to
eliminating the old BKL ioctl usage.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-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 1f4ca2b54a73..c926bf0b190e 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -361,7 +361,7 @@ static int ppp_open(struct inode *inode, struct file *file) | |||
361 | return 0; | 361 | return 0; |
362 | } | 362 | } |
363 | 363 | ||
364 | static int ppp_release(struct inode *inode, struct file *file) | 364 | static int ppp_release(struct inode *unused, struct file *file) |
365 | { | 365 | { |
366 | struct ppp_file *pf = file->private_data; | 366 | struct ppp_file *pf = file->private_data; |
367 | struct ppp *ppp; | 367 | struct ppp *ppp; |
@@ -545,8 +545,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
545 | } | 545 | } |
546 | #endif /* CONFIG_PPP_FILTER */ | 546 | #endif /* CONFIG_PPP_FILTER */ |
547 | 547 | ||
548 | static int ppp_ioctl(struct inode *inode, struct file *file, | 548 | static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
549 | unsigned int cmd, unsigned long arg) | ||
550 | { | 549 | { |
551 | struct ppp_file *pf = file->private_data; | 550 | struct ppp_file *pf = file->private_data; |
552 | struct ppp *ppp; | 551 | struct ppp *ppp; |
@@ -574,24 +573,29 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
574 | * this fd and reopening /dev/ppp. | 573 | * this fd and reopening /dev/ppp. |
575 | */ | 574 | */ |
576 | err = -EINVAL; | 575 | err = -EINVAL; |
576 | lock_kernel(); | ||
577 | if (pf->kind == INTERFACE) { | 577 | if (pf->kind == INTERFACE) { |
578 | ppp = PF_TO_PPP(pf); | 578 | ppp = PF_TO_PPP(pf); |
579 | if (file == ppp->owner) | 579 | if (file == ppp->owner) |
580 | ppp_shutdown_interface(ppp); | 580 | ppp_shutdown_interface(ppp); |
581 | } | 581 | } |
582 | if (atomic_read(&file->f_count) <= 2) { | 582 | if (atomic_read(&file->f_count) <= 2) { |
583 | ppp_release(inode, file); | 583 | ppp_release(NULL, file); |
584 | err = 0; | 584 | err = 0; |
585 | } else | 585 | } else |
586 | printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%d\n", | 586 | printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%d\n", |
587 | atomic_read(&file->f_count)); | 587 | atomic_read(&file->f_count)); |
588 | unlock_kernel(); | ||
588 | return err; | 589 | return err; |
589 | } | 590 | } |
590 | 591 | ||
591 | if (pf->kind == CHANNEL) { | 592 | if (pf->kind == CHANNEL) { |
592 | struct channel *pch = PF_TO_CHANNEL(pf); | 593 | struct channel *pch; |
593 | struct ppp_channel *chan; | 594 | struct ppp_channel *chan; |
594 | 595 | ||
596 | lock_kernel(); | ||
597 | pch = PF_TO_CHANNEL(pf); | ||
598 | |||
595 | switch (cmd) { | 599 | switch (cmd) { |
596 | case PPPIOCCONNECT: | 600 | case PPPIOCCONNECT: |
597 | if (get_user(unit, p)) | 601 | if (get_user(unit, p)) |
@@ -611,6 +615,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
611 | err = chan->ops->ioctl(chan, cmd, arg); | 615 | err = chan->ops->ioctl(chan, cmd, arg); |
612 | up_read(&pch->chan_sem); | 616 | up_read(&pch->chan_sem); |
613 | } | 617 | } |
618 | unlock_kernel(); | ||
614 | return err; | 619 | return err; |
615 | } | 620 | } |
616 | 621 | ||
@@ -620,6 +625,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
620 | return -EINVAL; | 625 | return -EINVAL; |
621 | } | 626 | } |
622 | 627 | ||
628 | lock_kernel(); | ||
623 | ppp = PF_TO_PPP(pf); | 629 | ppp = PF_TO_PPP(pf); |
624 | switch (cmd) { | 630 | switch (cmd) { |
625 | case PPPIOCSMRU: | 631 | case PPPIOCSMRU: |
@@ -767,7 +773,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file, | |||
767 | default: | 773 | default: |
768 | err = -ENOTTY; | 774 | err = -ENOTTY; |
769 | } | 775 | } |
770 | 776 | unlock_kernel(); | |
771 | return err; | 777 | return err; |
772 | } | 778 | } |
773 | 779 | ||
@@ -779,6 +785,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
779 | struct channel *chan; | 785 | struct channel *chan; |
780 | int __user *p = (int __user *)arg; | 786 | int __user *p = (int __user *)arg; |
781 | 787 | ||
788 | lock_kernel(); | ||
782 | switch (cmd) { | 789 | switch (cmd) { |
783 | case PPPIOCNEWUNIT: | 790 | case PPPIOCNEWUNIT: |
784 | /* Create a new ppp unit */ | 791 | /* Create a new ppp unit */ |
@@ -827,6 +834,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file, | |||
827 | default: | 834 | default: |
828 | err = -ENOTTY; | 835 | err = -ENOTTY; |
829 | } | 836 | } |
837 | unlock_kernel(); | ||
830 | return err; | 838 | return err; |
831 | } | 839 | } |
832 | 840 | ||
@@ -835,7 +843,7 @@ static const struct file_operations ppp_device_fops = { | |||
835 | .read = ppp_read, | 843 | .read = ppp_read, |
836 | .write = ppp_write, | 844 | .write = ppp_write, |
837 | .poll = ppp_poll, | 845 | .poll = ppp_poll, |
838 | .ioctl = ppp_ioctl, | 846 | .unlocked_ioctl = ppp_ioctl, |
839 | .open = ppp_open, | 847 | .open = ppp_open, |
840 | .release = ppp_release | 848 | .release = ppp_release |
841 | }; | 849 | }; |