* [GIT PATCH] TTY fixes for .36-rc2
@ 2010-08-24 4:05 Greg KH
2010-08-24 4:24 ` [PATCH 1/6] serial: print early console device address in hex Greg Kroah-Hartman
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Greg KH @ 2010-08-24 4:05 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
Here are some tty and serial driver bugfixes for the .36-rc2 kernel.
Some fixes due to the BKL removal fallout, and other minor things.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/
These patches have been in the linux-next tree and -mm for a while now.
Patches will be sent to the linux-kernel mailing list, if anyone wants
to see them.
thanks,
greg k-h
------------
drivers/char/ip2/ip2main.c | 4 +++-
drivers/char/rocket.c | 1 +
drivers/char/synclink_gt.c | 4 +++-
drivers/serial/68328serial.c | 29 +++++++++++------------------
drivers/serial/8250_early.c | 4 ++--
5 files changed, 20 insertions(+), 22 deletions(-)
---------------
Dan Carpenter (4):
ip2: remove unneeded NULL check
ip2: return -EFAULT on copy_to_user errors
rocket: add a mutex_unlock()
synclink: add mutex_unlock() on error path
Kulikov Vasiliy (1):
68328serial: check return value of copy_*_user() instead of access_ok()
Tony Luck (1):
serial: print early console device address in hex
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] serial: print early console device address in hex
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
@ 2010-08-24 4:24 ` Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 2/6] ip2: remove unneeded NULL check Greg Kroah-Hartman
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2010-08-24 4:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Luck, Tony, Andrew Morton, Greg Kroah-Hartman
From: Luck, Tony <tony.luck@intel.com>
Device addresses are usually printed in hex.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/serial/8250_early.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index b745792..eaafb98 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -203,13 +203,13 @@ static int __init parse_options(struct early_serial8250_device *device,
if (mmio || mmio32)
printk(KERN_INFO
- "Early serial console at MMIO%s 0x%llu (options '%s')\n",
+ "Early serial console at MMIO%s 0x%llx (options '%s')\n",
mmio32 ? "32" : "",
(unsigned long long)port->mapbase,
device->options);
else
printk(KERN_INFO
- "Early serial console at I/O port 0x%lu (options '%s')\n",
+ "Early serial console at I/O port 0x%lx (options '%s')\n",
port->iobase,
device->options);
--
1.7.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/6] ip2: remove unneeded NULL check
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
2010-08-24 4:24 ` [PATCH 1/6] serial: print early console device address in hex Greg Kroah-Hartman
@ 2010-08-24 4:24 ` Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 3/6] ip2: return -EFAULT on copy_to_user errors Greg Kroah-Hartman
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2010-08-24 4:24 UTC (permalink / raw)
To: linux-kernel
Cc: Dan Carpenter, Michael H. Warfield, Andrew Morton, Greg Kroah-Hartman
From: Dan Carpenter <error27@gmail.com>
We don't pass NULL tty pointers to the close function, and anyway we
already dereferenced it at this point. This check can be removed.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: "Michael H. Warfield" <mhw@wittsend.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/ip2/ip2main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 07f3ea3..8fa041e 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -1650,7 +1650,7 @@ ip2_close( PTTY tty, struct file *pFile )
/* disable DSS reporting */
i2QueueCommands(PTYPE_INLINE, pCh, 100, 4,
CMD_DCD_NREP, CMD_CTS_NREP, CMD_DSR_NREP, CMD_RI_NREP);
- if ( !tty || (tty->termios->c_cflag & HUPCL) ) {
+ if (tty->termios->c_cflag & HUPCL) {
i2QueueCommands(PTYPE_INLINE, pCh, 100, 2, CMD_RTSDN, CMD_DTRDN);
pCh->dataSetOut &= ~(I2_DTR | I2_RTS);
i2QueueCommands( PTYPE_INLINE, pCh, 100, 1, CMD_PAUSE(25));
--
1.7.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/6] ip2: return -EFAULT on copy_to_user errors
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
2010-08-24 4:24 ` [PATCH 1/6] serial: print early console device address in hex Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 2/6] ip2: remove unneeded NULL check Greg Kroah-Hartman
@ 2010-08-24 4:24 ` Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 4/6] rocket: add a mutex_unlock() Greg Kroah-Hartman
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2010-08-24 4:24 UTC (permalink / raw)
To: linux-kernel
Cc: Dan Carpenter, Michael H. Warfield, Andrew Morton, Greg Kroah-Hartman
From: Dan Carpenter <error27@gmail.com>
copy_to_user() returns the number of bytes remaining but we want to return
a negative error code on errors.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: "Michael H. Warfield" <mhw@wittsend.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/ip2/ip2main.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 8fa041e..d4b71e8 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -2930,6 +2930,8 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg )
if ( pCh )
{
rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
+ if (rc)
+ rc = -EFAULT;
} else {
rc = -ENODEV;
}
--
1.7.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/6] rocket: add a mutex_unlock()
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
` (2 preceding siblings ...)
2010-08-24 4:24 ` [PATCH 3/6] ip2: return -EFAULT on copy_to_user errors Greg Kroah-Hartman
@ 2010-08-24 4:24 ` Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 5/6] synclink: add mutex_unlock() on error path Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 6/6] 68328serial: check return value of copy_*_user() instead of access_ok() Greg Kroah-Hartman
5 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2010-08-24 4:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Dan Carpenter, Greg Kroah-Hartman
From: Dan Carpenter <error27@gmail.com>
This path needs a mutex_unlock(). This is stuff from the bkl to mutex
transition.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/rocket.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 79c3bc6..7c79d24 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -1244,6 +1244,7 @@ static int set_config(struct tty_struct *tty, struct r_port *info,
}
info->flags = ((info->flags & ~ROCKET_USR_MASK) | (new_serial.flags & ROCKET_USR_MASK));
configure_r_port(tty, info, NULL);
+ mutex_unlock(&info->port.mutex);
return 0;
}
--
1.7.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/6] synclink: add mutex_unlock() on error path
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
` (3 preceding siblings ...)
2010-08-24 4:24 ` [PATCH 4/6] rocket: add a mutex_unlock() Greg Kroah-Hartman
@ 2010-08-24 4:24 ` Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 6/6] 68328serial: check return value of copy_*_user() instead of access_ok() Greg Kroah-Hartman
5 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2010-08-24 4:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Dan Carpenter, Greg Kroah-Hartman
From: Dan Carpenter <error27@gmail.com>
There is a path which still holds its mutex here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/synclink_gt.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index fef80cf..e63b830 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -691,8 +691,10 @@ static int open(struct tty_struct *tty, struct file *filp)
if (info->port.count == 1) {
/* 1st open on this device, init hardware */
retval = startup(info);
- if (retval < 0)
+ if (retval < 0) {
+ mutex_unlock(&info->port.mutex);
goto cleanup;
+ }
}
mutex_unlock(&info->port.mutex);
retval = block_til_ready(tty, filp, info);
--
1.7.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/6] 68328serial: check return value of copy_*_user() instead of access_ok()
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
` (4 preceding siblings ...)
2010-08-24 4:24 ` [PATCH 5/6] synclink: add mutex_unlock() on error path Greg Kroah-Hartman
@ 2010-08-24 4:24 ` Greg Kroah-Hartman
5 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2010-08-24 4:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Kulikov Vasiliy, Greg Kroah-Hartman
From: Kulikov Vasiliy <segooon@gmail.com>
As copy_*_user() calls access_ok() it should not be called explicitly.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/serial/68328serial.c | 29 +++++++++++------------------
1 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 7356a56..be0ebce 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -869,7 +869,9 @@ static int get_serial_info(struct m68k_serial * info,
tmp.close_delay = info->close_delay;
tmp.closing_wait = info->closing_wait;
tmp.custom_divisor = info->custom_divisor;
- copy_to_user(retinfo,&tmp,sizeof(*retinfo));
+ if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
+ return -EFAULT;
+
return 0;
}
@@ -882,7 +884,8 @@ static int set_serial_info(struct m68k_serial * info,
if (!new_info)
return -EFAULT;
- copy_from_user(&new_serial,new_info,sizeof(new_serial));
+ if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
+ return -EFAULT;
old_info = *info;
if (!capable(CAP_SYS_ADMIN)) {
@@ -943,8 +946,7 @@ static int get_lsr_info(struct m68k_serial * info, unsigned int *value)
status = 0;
#endif
local_irq_restore(flags);
- put_user(status,value);
- return 0;
+ return put_user(status, value);
}
/*
@@ -999,27 +1001,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
send_break(info, arg ? arg*(100) : 250);
return 0;
case TIOCGSERIAL:
- if (access_ok(VERIFY_WRITE, (void *) arg,
- sizeof(struct serial_struct)))
- return get_serial_info(info,
- (struct serial_struct *) arg);
- return -EFAULT;
+ return get_serial_info(info,
+ (struct serial_struct *) arg);
case TIOCSSERIAL:
return set_serial_info(info,
(struct serial_struct *) arg);
case TIOCSERGETLSR: /* Get line status register */
- if (access_ok(VERIFY_WRITE, (void *) arg,
- sizeof(unsigned int)))
- return get_lsr_info(info, (unsigned int *) arg);
- return -EFAULT;
+ return get_lsr_info(info, (unsigned int *) arg);
case TIOCSERGSTRUCT:
- if (!access_ok(VERIFY_WRITE, (void *) arg,
- sizeof(struct m68k_serial)))
+ if (copy_to_user((struct m68k_serial *) arg,
+ info, sizeof(struct m68k_serial)))
return -EFAULT;
- copy_to_user((struct m68k_serial *) arg,
- info, sizeof(struct m68k_serial));
return 0;
-
default:
return -ENOIOCTLCMD;
}
--
1.7.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-08-24 4:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 4:05 [GIT PATCH] TTY fixes for .36-rc2 Greg KH
2010-08-24 4:24 ` [PATCH 1/6] serial: print early console device address in hex Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 2/6] ip2: remove unneeded NULL check Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 3/6] ip2: return -EFAULT on copy_to_user errors Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 4/6] rocket: add a mutex_unlock() Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 5/6] synclink: add mutex_unlock() on error path Greg Kroah-Hartman
2010-08-24 4:24 ` [PATCH 6/6] 68328serial: check return value of copy_*_user() instead of access_ok() Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.