aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irnet
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:43:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:43:29 -0400
commitdb6d8c7a4027b48d797b369a53f8470aaeed7063 (patch)
treee140c104a89abc2154e1f41a7db8ebecbb6fa0b4 /net/irda/irnet
parent3a533374283aea50eab3976d8a6d30532175f009 (diff)
parentfb65a7c091529bfffb1262515252c0d0f6241c5c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (1232 commits) iucv: Fix bad merging. net_sched: Add size table for qdiscs net_sched: Add accessor function for packet length for qdiscs net_sched: Add qdisc_enqueue wrapper highmem: Export totalhigh_pages. ipv6 mcast: Omit redundant address family checks in ip6_mc_source(). net: Use standard structures for generic socket address structures. ipv6 netns: Make several "global" sysctl variables namespace aware. netns: Use net_eq() to compare net-namespaces for optimization. ipv6: remove unused macros from net/ipv6.h ipv6: remove unused parameter from ip6_ra_control tcp: fix kernel panic with listening_get_next tcp: Remove redundant checks when setting eff_sacks tcp: options clean up tcp: Fix MD5 signatures for non-linear skbs sctp: Update sctp global memory limit allocations. sctp: remove unnecessary byteshifting, calculate directly in big-endian sctp: Allow only 1 listening socket with SO_REUSEADDR sctp: Do not leak memory on multiple listen() calls sctp: Support ipv6only AF_INET6 sockets. ...
Diffstat (limited to 'net/irda/irnet')
-rw-r--r--net/irda/irnet/irnet_ppp.c54
-rw-r--r--net/irda/irnet/irnet_ppp.h7
2 files changed, 33 insertions, 28 deletions
diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c
index e84a70dd346b..6d8ae03c14f5 100644
--- a/net/irda/irnet/irnet_ppp.c
+++ b/net/irda/irnet/irnet_ppp.c
@@ -631,8 +631,8 @@ dev_irnet_poll(struct file * file,
631 * This is the way pppd configure us and control us while the PPP 631 * This is the way pppd configure us and control us while the PPP
632 * instance is active. 632 * instance is active.
633 */ 633 */
634static int 634static long
635dev_irnet_ioctl(struct inode * inode, 635dev_irnet_ioctl(
636 struct file * file, 636 struct file * file,
637 unsigned int cmd, 637 unsigned int cmd,
638 unsigned long arg) 638 unsigned long arg)
@@ -663,6 +663,7 @@ dev_irnet_ioctl(struct inode * inode,
663 { 663 {
664 DEBUG(FS_INFO, "Entering PPP discipline.\n"); 664 DEBUG(FS_INFO, "Entering PPP discipline.\n");
665 /* PPP channel setup (ap->chan in configued in dev_irnet_open())*/ 665 /* PPP channel setup (ap->chan in configued in dev_irnet_open())*/
666 lock_kernel();
666 err = ppp_register_channel(&ap->chan); 667 err = ppp_register_channel(&ap->chan);
667 if(err == 0) 668 if(err == 0)
668 { 669 {
@@ -675,12 +676,14 @@ dev_irnet_ioctl(struct inode * inode,
675 } 676 }
676 else 677 else
677 DERROR(FS_ERROR, "Can't setup PPP channel...\n"); 678 DERROR(FS_ERROR, "Can't setup PPP channel...\n");
679 unlock_kernel();
678 } 680 }
679 else 681 else
680 { 682 {
681 /* In theory, should be N_TTY */ 683 /* In theory, should be N_TTY */
682 DEBUG(FS_INFO, "Exiting PPP discipline.\n"); 684 DEBUG(FS_INFO, "Exiting PPP discipline.\n");
683 /* Disconnect from the generic PPP layer */ 685 /* Disconnect from the generic PPP layer */
686 lock_kernel();
684 if(ap->ppp_open) 687 if(ap->ppp_open)
685 { 688 {
686 ap->ppp_open = 0; 689 ap->ppp_open = 0;
@@ -689,24 +692,20 @@ dev_irnet_ioctl(struct inode * inode,
689 else 692 else
690 DERROR(FS_ERROR, "Channel not registered !\n"); 693 DERROR(FS_ERROR, "Channel not registered !\n");
691 err = 0; 694 err = 0;
695 unlock_kernel();
692 } 696 }
693 break; 697 break;
694 698
695 /* Query PPP channel and unit number */ 699 /* Query PPP channel and unit number */
696 case PPPIOCGCHAN: 700 case PPPIOCGCHAN:
697 if(!ap->ppp_open) 701 if(ap->ppp_open && !put_user(ppp_channel_index(&ap->chan),
698 break; 702 (int __user *)argp))
699 if(put_user(ppp_channel_index(&ap->chan), (int __user *)argp)) 703 err = 0;
700 break;
701 DEBUG(FS_INFO, "Query channel.\n");
702 err = 0;
703 break; 704 break;
704 case PPPIOCGUNIT: 705 case PPPIOCGUNIT:
705 if(!ap->ppp_open) 706 lock_kernel();
706 break; 707 if(ap->ppp_open && !put_user(ppp_unit_number(&ap->chan),
707 if(put_user(ppp_unit_number(&ap->chan), (int __user *)argp)) 708 (int __user *)argp))
708 break;
709 DEBUG(FS_INFO, "Query unit number.\n");
710 err = 0; 709 err = 0;
711 break; 710 break;
712 711
@@ -726,34 +725,39 @@ dev_irnet_ioctl(struct inode * inode,
726 DEBUG(FS_INFO, "Standard PPP ioctl.\n"); 725 DEBUG(FS_INFO, "Standard PPP ioctl.\n");
727 if(!capable(CAP_NET_ADMIN)) 726 if(!capable(CAP_NET_ADMIN))
728 err = -EPERM; 727 err = -EPERM;
729 else 728 else {
729 lock_kernel();
730 err = ppp_irnet_ioctl(&ap->chan, cmd, arg); 730 err = ppp_irnet_ioctl(&ap->chan, cmd, arg);
731 unlock_kernel();
732 }
731 break; 733 break;
732 734
733 /* TTY IOCTLs : Pretend that we are a tty, to keep pppd happy */ 735 /* TTY IOCTLs : Pretend that we are a tty, to keep pppd happy */
734 /* Get termios */ 736 /* Get termios */
735 case TCGETS: 737 case TCGETS:
736 DEBUG(FS_INFO, "Get termios.\n"); 738 DEBUG(FS_INFO, "Get termios.\n");
739 lock_kernel();
737#ifndef TCGETS2 740#ifndef TCGETS2
738 if(kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios)) 741 if(!kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios))
739 break; 742 err = 0;
740#else 743#else
741 if(kernel_termios_to_user_termios_1((struct termios __user *)argp, &ap->termios)) 744 if(kernel_termios_to_user_termios_1((struct termios __user *)argp, &ap->termios))
742 break; 745 err = 0;
743#endif 746#endif
744 err = 0; 747 unlock_kernel();
745 break; 748 break;
746 /* Set termios */ 749 /* Set termios */
747 case TCSETSF: 750 case TCSETSF:
748 DEBUG(FS_INFO, "Set termios.\n"); 751 DEBUG(FS_INFO, "Set termios.\n");
752 lock_kernel();
749#ifndef TCGETS2 753#ifndef TCGETS2
750 if(user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp)) 754 if(!user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp))
751 break; 755 err = 0;
752#else 756#else
753 if(user_termios_to_kernel_termios_1(&ap->termios, (struct termios __user *)argp)) 757 if(!user_termios_to_kernel_termios_1(&ap->termios, (struct termios __user *)argp))
754 break; 758 err = 0;
755#endif 759#endif
756 err = 0; 760 unlock_kernel();
757 break; 761 break;
758 762
759 /* Set DTR/RTS */ 763 /* Set DTR/RTS */
@@ -776,7 +780,9 @@ dev_irnet_ioctl(struct inode * inode,
776 * We should also worry that we don't accept junk here and that 780 * We should also worry that we don't accept junk here and that
777 * we get rid of our own buffers */ 781 * we get rid of our own buffers */
778#ifdef FLUSH_TO_PPP 782#ifdef FLUSH_TO_PPP
783 lock_kernel();
779 ppp_output_wakeup(&ap->chan); 784 ppp_output_wakeup(&ap->chan);
785 unlock_kernel();
780#endif /* FLUSH_TO_PPP */ 786#endif /* FLUSH_TO_PPP */
781 err = 0; 787 err = 0;
782 break; 788 break;
@@ -791,7 +797,7 @@ dev_irnet_ioctl(struct inode * inode,
791 797
792 default: 798 default:
793 DERROR(FS_ERROR, "Unsupported ioctl (0x%X)\n", cmd); 799 DERROR(FS_ERROR, "Unsupported ioctl (0x%X)\n", cmd);
794 err = -ENOIOCTLCMD; 800 err = -ENOTTY;
795 } 801 }
796 802
797 DEXIT(FS_TRACE, " - err = 0x%X\n", err); 803 DEXIT(FS_TRACE, " - err = 0x%X\n", err);
diff --git a/net/irda/irnet/irnet_ppp.h b/net/irda/irnet/irnet_ppp.h
index d2beb7df8f7f..d9f8bd4ebd05 100644
--- a/net/irda/irnet/irnet_ppp.h
+++ b/net/irda/irnet/irnet_ppp.h
@@ -76,9 +76,8 @@ static ssize_t
76static unsigned int 76static unsigned int
77 dev_irnet_poll(struct file *, 77 dev_irnet_poll(struct file *,
78 poll_table *); 78 poll_table *);
79static int 79static long
80 dev_irnet_ioctl(struct inode *, 80 dev_irnet_ioctl(struct file *,
81 struct file *,
82 unsigned int, 81 unsigned int,
83 unsigned long); 82 unsigned long);
84/* ------------------------ PPP INTERFACE ------------------------ */ 83/* ------------------------ PPP INTERFACE ------------------------ */
@@ -102,7 +101,7 @@ static struct file_operations irnet_device_fops =
102 .read = dev_irnet_read, 101 .read = dev_irnet_read,
103 .write = dev_irnet_write, 102 .write = dev_irnet_write,
104 .poll = dev_irnet_poll, 103 .poll = dev_irnet_poll,
105 .ioctl = dev_irnet_ioctl, 104 .unlocked_ioctl = dev_irnet_ioctl,
106 .open = dev_irnet_open, 105 .open = dev_irnet_open,
107 .release = dev_irnet_close 106 .release = dev_irnet_close
108 /* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */ 107 /* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */