linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter
@ 2011-05-19 19:03 Michael Reed
  2011-05-19 23:49 ` Greg KH
  2011-05-25 17:07 ` [PATCH] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter mreed
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Reed @ 2011-05-19 19:03 UTC (permalink / raw)
  To: linux-serial; +Cc: Michael Reed, Greg Kroah-Hartman, Breno Leitao, Scott Kilau

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@linux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Breno Leitao <leitao@linux.vnet.ibm.com>
Cc: Scott Kilau <scottk@digi.com>
Signed-off-by:   Michael Reed <mreed@linux.vnet.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-26 14:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-19 19:03 [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter Michael Reed
2011-05-19 23:49 ` Greg KH
2011-05-25 14:48   ` [PATCH] 8250: Fix capabilities when changing the port type leitao
2011-05-26 14:18     ` leitao
2011-05-25 17:07 ` [PATCH] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter mreed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).