uart_ioctl OOPS with irtty-sir

Jean Tourrilhes (jt@bougret.hpl.hp.com)
Thu, 3 Apr 2003 17:34:05 -0800


Hi Russel,

Sorry to bring more bad news...

In 2.5.66, somebody (maybe you) added a check to
tty_hung_up_p(filp) in uart_ioctl().
The code now looks like this (drivers/serial/core.c) :
------------------------------------
static int
uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
unsigned long arg)
{
[...]
if (tty_hung_up_p(filp)) {
ret = -EIO;
goto out_up;
}
[...]
switch (cmd) {
case TIOCMSET:
ret = uart_set_modem_info(state->port, cmd,
(unsigned int *)arg);
break;
------------------------------------

Unfortunately, the irtty-sir driver, which is a TTY line
discipline and a network driver, need to be able to change the RTS and
DTR line from a kernel thread.
The code looks like (drivers/net/irda/irtty-sir.c) :
----------------------------
static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
{
[...]
if (priv->tty->driver.ioctl(priv->tty, NULL, TIOCMSET, (unsigned long) &arg)) {
IRDA_DEBUG(2, "%s(), error doing ioctl!\n", __FUNCTION__);
}
----------------------------

You can guess the result : instant OPPS.

I don't really see how I would be able to get hold of a "struct
file" in kernel space, so please advise.

Have fun, and thanks in advance...

Jean
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/