public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix oops in the 8250 serial driver when accessing a removed device
@ 2008-07-22 15:37 Laurent Pinchart
  2008-07-22 15:54 ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2008-07-22 15:37 UTC (permalink / raw)
  To: linux-serial; +Cc: Alan Cox

The 8250 serial driver allocates dummy devices for ISA serial ports and lets
userspace applications open them even when they are not present. That hack is
required by setserial to set the ISA serial ports I/O address.

When a plug-and-play 8250 device is detected, the driver reuses one of the
dummy ports. If that device is later removed, the port goes pack to the dummy
ports pool. The capabilities field is not reset, which causes a oops when
trying to access the port.

This patch resets the capabilities field when a 8250 device is unregistered.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 drivers/serial/8250.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index ef158c1..40eb91f 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2886,6 +2886,7 @@ void serial8250_unregister_port(int line)
 		uart->port.flags &= ~UPF_BOOT_AUTOCONF;
 		uart->port.type = PORT_UNKNOWN;
 		uart->port.dev = &serial8250_isa_devs->dev;
+		uart->capabilities = 0;
 		uart_add_one_port(&serial8250_reg, &uart->port);
 	} else {
 		uart->port.dev = NULL;
-- 
1.5.0

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

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

end of thread, other threads:[~2008-07-25 12:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-22 15:37 [PATCH] Fix oops in the 8250 serial driver when accessing a removed device Laurent Pinchart
2008-07-22 15:54 ` Alan Cox
2008-07-22 16:31   ` Laurent Pinchart
2008-07-25  9:51     ` Russell King
2008-07-25 11:40       ` Laurent Pinchart
2008-07-25 11:57         ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox