aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/specialix.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 03:53:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:39 -0400
commitb190e178f63e8dad7755054e02dc18a24ea6f0ac (patch)
tree2069b828afbc0bf5aeb97b95cf99dad5cf598eff /drivers/char/specialix.c
parent638157bc1461f6718eeca06bedd9a09cf1f35c36 (diff)
specialix: Prepare for BKL pushdown
Lock the ioctl handlers and remove bogus softcar handling. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/specialix.c')
-rw-r--r--drivers/char/specialix.c46
1 files changed, 6 insertions, 40 deletions
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 4b5b5b78acb4..9f9a4bdc1b0e 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -1922,29 +1922,13 @@ static inline int sx_set_serial_info(struct specialix_port * port,
1922 int change_speed; 1922 int change_speed;
1923 1923
1924 func_enter(); 1924 func_enter();
1925 /* 1925
1926 if (!access_ok(VERIFY_READ, (void *) newinfo, sizeof(tmp))) {
1927 func_exit();
1928 return -EFAULT;
1929 }
1930 */
1931 if (copy_from_user(&tmp, newinfo, sizeof(tmp))) { 1926 if (copy_from_user(&tmp, newinfo, sizeof(tmp))) {
1932 func_enter(); 1927 func_enter();
1933 return -EFAULT; 1928 return -EFAULT;
1934 } 1929 }
1935 1930
1936#if 0 1931 lock_kernel();
1937 if ((tmp.irq != bp->irq) ||
1938 (tmp.port != bp->base) ||
1939 (tmp.type != PORT_CIRRUS) ||
1940 (tmp.baud_base != (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC) ||
1941 (tmp.custom_divisor != 0) ||
1942 (tmp.xmit_fifo_size != CD186x_NFIFO) ||
1943 (tmp.flags & ~SPECIALIX_LEGAL_FLAGS)) {
1944 func_exit();
1945 return -EINVAL;
1946 }
1947#endif
1948 1932
1949 change_speed = ((port->flags & ASYNC_SPD_MASK) != 1933 change_speed = ((port->flags & ASYNC_SPD_MASK) !=
1950 (tmp.flags & ASYNC_SPD_MASK)); 1934 (tmp.flags & ASYNC_SPD_MASK));
@@ -1956,6 +1940,7 @@ static inline int sx_set_serial_info(struct specialix_port * port,
1956 ((tmp.flags & ~ASYNC_USR_MASK) != 1940 ((tmp.flags & ~ASYNC_USR_MASK) !=
1957 (port->flags & ~ASYNC_USR_MASK))) { 1941 (port->flags & ~ASYNC_USR_MASK))) {
1958 func_exit(); 1942 func_exit();
1943 unlock_kernel();
1959 return -EPERM; 1944 return -EPERM;
1960 } 1945 }
1961 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1946 port->flags = ((port->flags & ~ASYNC_USR_MASK) |
@@ -1972,6 +1957,7 @@ static inline int sx_set_serial_info(struct specialix_port * port,
1972 sx_change_speed(bp, port); 1957 sx_change_speed(bp, port);
1973 } 1958 }
1974 func_exit(); 1959 func_exit();
1960 unlock_kernel();
1975 return 0; 1961 return 0;
1976} 1962}
1977 1963
@@ -1984,12 +1970,8 @@ static inline int sx_get_serial_info(struct specialix_port * port,
1984 1970
1985 func_enter(); 1971 func_enter();
1986 1972
1987 /*
1988 if (!access_ok(VERIFY_WRITE, (void *) retinfo, sizeof(tmp)))
1989 return -EFAULT;
1990 */
1991
1992 memset(&tmp, 0, sizeof(tmp)); 1973 memset(&tmp, 0, sizeof(tmp));
1974 lock_kernel();
1993 tmp.type = PORT_CIRRUS; 1975 tmp.type = PORT_CIRRUS;
1994 tmp.line = port - sx_port; 1976 tmp.line = port - sx_port;
1995 tmp.port = bp->base; 1977 tmp.port = bp->base;
@@ -2000,6 +1982,7 @@ static inline int sx_get_serial_info(struct specialix_port * port,
2000 tmp.closing_wait = port->closing_wait * HZ/100; 1982 tmp.closing_wait = port->closing_wait * HZ/100;
2001 tmp.custom_divisor = port->custom_divisor; 1983 tmp.custom_divisor = port->custom_divisor;
2002 tmp.xmit_fifo_size = CD186x_NFIFO; 1984 tmp.xmit_fifo_size = CD186x_NFIFO;
1985 unlock_kernel();
2003 if (copy_to_user(retinfo, &tmp, sizeof(tmp))) { 1986 if (copy_to_user(retinfo, &tmp, sizeof(tmp))) {
2004 func_exit(); 1987 func_exit();
2005 return -EFAULT; 1988 return -EFAULT;
@@ -2045,23 +2028,6 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp,
2045 sx_send_break(port, arg ? arg*(HZ/10) : HZ/4); 2028 sx_send_break(port, arg ? arg*(HZ/10) : HZ/4);
2046 func_exit(); 2029 func_exit();
2047 return 0; 2030 return 0;
2048 case TIOCGSOFTCAR:
2049 if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)argp)) {
2050 func_exit();
2051 return -EFAULT;
2052 }
2053 func_exit();
2054 return 0;
2055 case TIOCSSOFTCAR:
2056 if (get_user(arg, (unsigned long __user *) argp)) {
2057 func_exit();
2058 return -EFAULT;
2059 }
2060 tty->termios->c_cflag =
2061 ((tty->termios->c_cflag & ~CLOCAL) |
2062 (arg ? CLOCAL : 0));
2063 func_exit();
2064 return 0;
2065 case TIOCGSERIAL: 2031 case TIOCGSERIAL:
2066 func_exit(); 2032 func_exit();
2067 return sx_get_serial_info(port, argp); 2033 return sx_get_serial_info(port, argp);