When working on the 8250_pci driver on PPC, the rmmod command was resulting in a crash when removing the module. The serial8250_do_pm() is called after the memory are deallocated, meaning that serial8250_set_sleep->serial_outp() will try to write to a position that is invalid, crashing the system. The purpose of this patch is to correct that issue. This patch was created against 2.6.38.6 Patch-created-by: Breno Leitao <leitao@xxxxxxxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx> Cc: Breno Leitao <leitao@xxxxxxxxxxxxxxxxxx> Cc: Scott Kilau <scottk@xxxxxxxx> Signed-off-by: Michael Reed <mreed@xxxxxxxxxxxxxxxxxx> --- drivers/tty/serial/8250.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index b3b881b..7617cde 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c @@ -145,6 +145,8 @@ struct uart_8250_port { unsigned char mcr_mask; /* mask of user bits */ unsigned char mcr_force; /* mask of forced bits */ unsigned char cur_iotype; /* Running I/O type */ +#define SERIAL8250_DYING 1 + unsigned char status; /* * Some bits in registers are cleared on a read, so they must @@ -2494,7 +2496,8 @@ void serial8250_do_pm(struct uart_port *port, unsigned int state, struct uart_8250_port *p = container_of(port, struct uart_8250_port, port); - serial8250_set_sleep(p, state != 0); + if (!(p->status & SERIAL8250_DYING)) + serial8250_set_sleep(p, state != 0); } EXPORT_SYMBOL(serial8250_do_pm); @@ -2588,6 +2591,7 @@ static void serial8250_release_std_resource(struct uart_8250_port *up) release_region(up->port.iobase, size); break; } + up->status |= SERIAL8250_DYING; } static int serial8250_request_rsa_resource(struct uart_8250_port *up) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html