[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1313581695-30520-1-git-send-email-jslaby@suse.cz>
Date: Wed, 17 Aug 2011 13:48:15 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: gregkh@...e.de
Cc: linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
jirislaby@...il.com, Jiri Slaby <jslaby@...e.cz>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Russel King <linux@....linux.org.uk>
Subject: [PATCH] TTY: serial, document ignoring of uart->ops->startup error
When a user has SYS_ADMIN capabilities and uart->ops->startup returns
an error in uart_startup, we silently drop the error. We then return 0
and behave as if it didn't fail. (Not quite, since we set TTY_IO_ERROR
bit and leave ASYNC_INITIALIZED bit cleared.)
This all is to allow setserial to work with improperly configured or
unconfigured ports. User can thus set port properties and reconfigure
properly.
This patch only documents this behavior.
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Greg KH <gregkh@...e.de>
Cc: Russel King <linux@....linux.org.uk>
---
On 08/17/2011 12:13 PM, Alan Cox wrote:
> On Wed, 17 Aug 2011 11:25:27 +0200
> Jiri Slaby <jirislaby@...il.com> wrote:
>
>> Hi,
>>
>> while I was in the process of uart cleanup, I found this:
>> static int uart_startup(...) {
>> ...
>> retval = port->ops->startup(port);
>> ...
>> if (retval && capable(CAP_SYS_ADMIN))
>> retval = 0;
>>
>> return retval;
>> }
>>
>> Why CAP_SYS_ADMIN should not see the failing port startup? Does anybody
>> from you remember if it is for some kind of possibility to later
>> re-autoconfigure the port or something like that?
>
> In a word - setserial
Yes, thanks. So I assume especially for the configuration of port/irq/type. So
this is why this is special to tty/serial and USB serials don't need to support
this.
drivers/tty/serial/serial_core.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index db7912c..a3efbea 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -200,6 +200,11 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in
clear_bit(TTY_IO_ERROR, &tty->flags);
}
+ /*
+ * This is to allow setserial on this port. People may want to set
+ * port/irq/type and then reconfigure the port properly if it failed
+ * now.
+ */
if (retval && capable(CAP_SYS_ADMIN))
retval = 0;
--
1.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists