[PATCH] Fix oops in the 8250 serial driver when accessing a removed device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
---
 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
--
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

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux