|
@@ -1083,7 +1083,10 @@ static struct tty_struct *tty_driver_lookup_tty(struct tty_driver *driver,
|
|
struct tty_struct *tty;
|
|
struct tty_struct *tty;
|
|
|
|
|
|
if (driver->ops->lookup)
|
|
if (driver->ops->lookup)
|
|
- tty = driver->ops->lookup(driver, file, idx);
|
|
|
|
|
|
+ if (!file)
|
|
|
|
+ tty = ERR_PTR(-EIO);
|
|
|
|
+ else
|
|
|
|
+ tty = driver->ops->lookup(driver, file, idx);
|
|
else
|
|
else
|
|
tty = driver->ttys[idx];
|
|
tty = driver->ttys[idx];
|
|
|
|
|
|
@@ -1715,7 +1718,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp,
|
|
struct tty_driver *console_driver = console_device(index);
|
|
struct tty_driver *console_driver = console_device(index);
|
|
if (console_driver) {
|
|
if (console_driver) {
|
|
driver = tty_driver_kref_get(console_driver);
|
|
driver = tty_driver_kref_get(console_driver);
|
|
- if (driver) {
|
|
|
|
|
|
+ if (driver && filp) {
|
|
/* Don't let /dev/console block */
|
|
/* Don't let /dev/console block */
|
|
filp->f_flags |= O_NONBLOCK;
|
|
filp->f_flags |= O_NONBLOCK;
|
|
break;
|
|
break;
|
|
@@ -1748,7 +1751,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp,
|
|
* - concurrent tty driver removal w/ lookup
|
|
* - concurrent tty driver removal w/ lookup
|
|
* - concurrent tty removal from driver table
|
|
* - concurrent tty removal from driver table
|
|
*/
|
|
*/
|
|
-static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
|
|
|
|
|
|
+struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
|
|
struct file *filp)
|
|
struct file *filp)
|
|
{
|
|
{
|
|
struct tty_struct *tty;
|
|
struct tty_struct *tty;
|
|
@@ -1793,6 +1796,7 @@ out:
|
|
tty_driver_kref_put(driver);
|
|
tty_driver_kref_put(driver);
|
|
return tty;
|
|
return tty;
|
|
}
|
|
}
|
|
|
|
+EXPORT_SYMBOL_GPL(tty_open_by_driver);
|
|
|
|
|
|
/**
|
|
/**
|
|
* tty_open - open a tty device
|
|
* tty_open - open a tty device
|