Re: serial.c patch in 2.3.19

Nick Holloway (Nick.Holloway@alfie.demon.co.uk)
Fri, 15 Oct 1999 19:49:24 +0100


sailer@ife.ee.ethz.ch (Thomas Sailer) wrote:
> tytso@mit.edu wrote:
> > I don't see how this would be breaking systems. Basically, this patch
> > causes the serial driver to not release the ioregion if the UART is
> > unknown. But if the UART is unknown, the region wouldn't have been
> > requested by the serial driver.
>
> setserial /dev/ttySx uart none
> resource not released
> setserial /dev/ttySx port 0
> resource still not released

I submitted the patch originally. Otherwise it would release the resource
that wasn't held for the port I don't have.

I think the problem is that when deciding if to release the port, it
considers the _new_ setting of the state->type. Thus, when you change
the uart to "none", the previous allocation is not released.

I think the following (untested) patch should remedy this. My brain
is having trouble thinking around this, but the check for releasing the
region uses the same values used for requesting the region.

--- serial.c~ Fri Oct 15 19:26:57 1999
+++ serial.c Fri Oct 15 19:36:56 1999
@@ -1997,7 +1997,6 @@
info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) |
(info->flags & ASYNC_INTERNAL_FLAGS));
state->custom_divisor = new_serial.custom_divisor;
- state->type = new_serial.type;
state->close_delay = new_serial.close_delay * HZ/100;
state->closing_wait = new_serial.closing_wait * HZ/100;
#if (LINUX_VERSION_CODE > 0x200100)
@@ -2018,6 +2017,7 @@
info->port = state->port = new_serial.port;
info->hub6 = state->hub6 = new_serial.hub6;
}
+ state->type = new_serial.type;
if ((state->type != PORT_UNKNOWN) && state->port)
request_region(state->port,8,"serial(set)");

-- 
 `O O'  | Nick.Holloway@alfie.demon.co.uk
// ^ \\ | http://www.alfie.demon.co.uk/

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