aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-16 11:10:50 -0400
committerJonathan Corbet <corbet@lwn.net>2008-06-20 16:05:50 -0400
commit39d95b9d857ad9ed335dd1a2d6c6de1f1ee69ce1 (patch)
treea16394617563ac99600da266a679ca29e14fc644
parentc43ef17450dce8cbf50f97497a1949ff8f484e88 (diff)
tty: cdev lock_kernel() pushdown
Parts of the serial code actually BUG() if we don't do this.
-rw-r--r--drivers/char/tty_io.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e94bee032314..fd182f2e4a6c 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2665,7 +2665,7 @@ static void release_dev(struct file *filp)
2665 * ->siglock protects ->signal/->sighand 2665 * ->siglock protects ->signal/->sighand
2666 */ 2666 */
2667 2667
2668static int tty_open(struct inode *inode, struct file *filp) 2668static int __tty_open(struct inode *inode, struct file *filp)
2669{ 2669{
2670 struct tty_struct *tty; 2670 struct tty_struct *tty;
2671 int noctty, retval; 2671 int noctty, retval;
@@ -2779,6 +2779,19 @@ got_driver:
2779 return 0; 2779 return 0;
2780} 2780}
2781 2781
2782/* BKL pushdown: scary code avoidance wrapper */
2783static int tty_open(struct inode *inode, struct file *filp)
2784{
2785 int ret;
2786
2787 lock_kernel();
2788 ret = __tty_open(inode, filp);
2789 unlock_kernel();
2790 return ret;
2791}
2792
2793
2794
2782#ifdef CONFIG_UNIX98_PTYS 2795#ifdef CONFIG_UNIX98_PTYS
2783/** 2796/**
2784 * ptmx_open - open a unix 98 pty master 2797 * ptmx_open - open a unix 98 pty master
@@ -2792,7 +2805,7 @@ got_driver:
2792 * allocated_ptys_lock handles the list of free pty numbers 2805 * allocated_ptys_lock handles the list of free pty numbers
2793 */ 2806 */
2794 2807
2795static int ptmx_open(struct inode *inode, struct file *filp) 2808static int __ptmx_open(struct inode *inode, struct file *filp)
2796{ 2809{
2797 struct tty_struct *tty; 2810 struct tty_struct *tty;
2798 int retval; 2811 int retval;
@@ -2831,6 +2844,16 @@ out:
2831 devpts_kill_index(index); 2844 devpts_kill_index(index);
2832 return retval; 2845 return retval;
2833} 2846}
2847
2848static int ptmx_open(struct inode *inode, struct file *filp)
2849{
2850 int ret;
2851
2852 lock_kernel();
2853 ret = __ptmx_open(inode, filp);
2854 unlock_kernel();
2855 return ret;
2856}
2834#endif 2857#endif
2835 2858
2836/** 2859/**