From: Michael Reed <mreed@linux.vnet.ibm.com>
To: linux-serial@vger.kernel.org
Cc: Michael Reed <mreed@linux.vnet.ibm.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
Breno Leitao <leitao@linux.vnet.ibm.com>,
Scott Kilau <scottk@digi.com>
Subject: [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter
Date: Thu, 19 May 2011 14:03:43 -0500 [thread overview]
Message-ID: <1305831823-25400-2-git-send-email-mreed@linux.vnet.ibm.com> (raw)
In-Reply-To: <mreed@linux.vnet.ibm.com>
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
next reply other threads:[~2011-05-19 19:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 19:03 Michael Reed [this message]
2011-05-19 23:49 ` [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305831823-25400-2-git-send-email-mreed@linux.vnet.ibm.com \
--to=mreed@linux.vnet.ibm.com \
--cc=gregkh@suse.de \
--cc=leitao@linux.vnet.ibm.com \
--cc=linux-serial@vger.kernel.org \
--cc=scottk@digi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).