android_kernel_xiaomi_sm7250/drivers/serial
Taku Izumi fdc30b3d44 Fix possible NULL pointer access in 8250 serial driver
I encountered the following kernel panic.  The cause of this problem was
NULL pointer access in check_modem_status() in 8250.c.  I confirmed this
problem is fixed by the attached patch, but I don't know this is the
correct fix.

sadc[4378]: NaT consumption 2216203124768 [1]
Modules linked in: binfmt_misc dm_mirror dm_mod thermal processor fan
container button sg e100 eepro100 mii ehci_hcd ohci_hcd

    Pid: 4378, CPU 0, comm: sadc
    psr : 00001210085a2010 ifs : 8000000000000289 ip : [<a000000100482071>]
    Not tainted
    ip is at check_modem_status+0xf1/0x360

    Call Trace:
    [<a000000100013940>] show_stack+0x40/0xa0
    [<a0000001000145a0>] show_regs+0x840/0x880
    [<a0000001000368e0>] die+0x1c0/0x2c0
    [<a000000100036a30>] die_if_kernel+0x50/0x80
    [<a000000100037c40>] ia64_fault+0x11e0/0x1300
    [<a00000010000bdc0>] ia64_leave_kernel+0x0/0x280
    [<a000000100482070>] check_modem_status+0xf0/0x360
    [<a000000100482300>] serial8250_get_mctrl+0x20/0xa0
    [<a000000100478170>] uart_read_proc+0x250/0x860
    [<a0000001001c16d0>] proc_file_read+0x1d0/0x4c0
    [<a0000001001394b0>] vfs_read+0x1b0/0x300
    [<a000000100139cd0>] sys_read+0x70/0xe0
    [<a00000010000bc20>] ia64_ret_from_syscall+0x0/0x20
    [<a000000000010620>] __kernel_syscall_via_break+0x0/0x20

Fix the possible NULL pointer access in check_modem_status() in 8250.c.  The
check_modem_status() would access 'info' member of uart_port structure, but it
is not initialized before uart_open() is called.  The check_modem_status() can
be called through /proc/tty/driver/serial before uart_open() is called.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Taku Izumi <izumi2005@soft.fujitsu.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-04-24 08:23:07 -07:00
..
cpm_uart [POWERPC] Fix compile failure in cpm_uart_cpm2 2007-02-16 14:00:19 +11:00
jsm [PATCH] serial: replace kmalloc+memset with kzalloc 2007-02-14 08:09:52 -08:00
8250_accent.c [SERIAL] Use an enum for serial8250 platform device IDs 2005-09-08 16:04:41 +01:00
8250_acorn.c [PATCH] serial: replace kmalloc+memset with kzalloc 2007-02-14 08:09:52 -08:00
8250_au1x00.c [SERIAL] AMD Alchemy UART: claim memory range 2006-04-30 11:15:58 +01:00
8250_boca.c [SERIAL] Use an enum for serial8250 platform device IDs 2005-09-08 16:04:41 +01:00
8250_early.c [SERIAL] kernel console should send CRLF not LFCR 2006-03-20 20:00:09 +00:00
8250_exar_st16c554.c [PATCH] Exar quad port serial 2006-12-07 08:39:35 -08:00
8250_fourport.c [SERIAL] Use an enum for serial8250 platform device IDs 2005-09-08 16:04:41 +01:00
8250_gsc.c [PARISC] Clean up asm-parisc/serial.h 2006-10-04 06:47:03 -06:00
8250_hp300.c [PATCH] hp300: fix driver_register() return handling, remove dio_module_init() 2006-03-25 08:22:53 -08:00
8250_hub6.c [SERIAL] Use an enum for serial8250 platform device IDs 2005-09-08 16:04:41 +01:00
8250_mca.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
8250_pci.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
8250_pnp.c [PATCH] add Fujitsu Siemens Tablet PC devices to 8250_pnp.c 2007-03-23 11:01:22 -07:00
8250.c Fix possible NULL pointer access in 8250 serial driver 2007-04-24 08:23:07 -07:00
8250.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
21285.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
68328serial.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
68328serial.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
68360serial.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
amba-pl010.c [ARM] Fix AMBA serial drivers for non-first serial ports 2007-01-24 11:59:57 +00:00
amba-pl011.c [ARM] Fix AMBA serial drivers for non-first serial ports 2007-01-24 11:59:57 +00:00
atmel_serial.c Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2007-02-19 13:18:39 -08:00
atmel_serial.h [ARM] 4086/1: AT91: Whitespace cleanup 2007-01-24 11:59:55 +00:00
clps711x.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
crisv10.c [PATCH] Char: tty_wakeup cleanup 2007-02-11 10:51:26 -08:00
crisv10.h [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
dz.c [PATCH] dz: remove struct pt_regs references 2007-03-05 07:57:51 -08:00
dz.h [PATCH] dz: Fixes to make it work 2006-12-07 08:39:41 -08:00
icom.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
icom.h [PATCH] serial/icom: Remove custom msescs_to_jiffies() macro 2005-06-25 16:25:01 -07:00
imx.c [ARM] i.MX serial: fix IRQ allocation 2007-02-11 16:46:23 +00:00
ioc3_serial.c [PATCH] serial: replace kmalloc+memset with kzalloc 2007-02-14 08:09:52 -08:00
ioc4_serial.c [PATCH] serial: replace kmalloc+memset with kzalloc 2007-02-14 08:09:52 -08:00
ip22zilog.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
ip22zilog.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2007-02-19 13:18:39 -08:00
m32r_sio_reg.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
m32r_sio.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
m32r_sio.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
Makefile [PATCH] PNX8550 UART driver 2007-02-14 08:09:52 -08:00
mcfserial.c [PATCH] m68knommu: fix work queues in mcfserial.c driver 2007-03-06 18:08:38 -08:00
mcfserial.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
mpc52xx_uart.c [POWERPC] Dispose irq mapping when done in mpc52xx_serial.c 2007-02-17 18:20:18 +11:00
mpsc.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
mux.c Merge branch 'parisc' from /home/kyle/repos/parisc-2.6.git 2007-02-17 00:18:23 -05:00
netx-serial.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
of_serial.c [POWERPC] Open Firmware serial port driver 2007-02-14 11:50:04 +11:00
pmac_zilog.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
pmac_zilog.h [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
pnx8xxx_uart.c [PATCH] PNX8550 UART driver 2007-02-14 08:09:52 -08:00
pxa.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
s3c2410.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
sa1100.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
serial_core.c [PATCH] serial: replace kmalloc+memset with kzalloc 2007-02-14 08:09:52 -08:00
serial_cs.c serial: Add PCMCIA IDs for Quatech DSP-100 dual RS232 adapter. 2007-02-16 15:19:16 -08:00
serial_lh7a40x.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
serial_txx9.c [SERIAL] serial_txx9 driver update 2007-02-22 00:50:45 +00:00
sh-sci.c serial: Fix sh-sci break interrupt/sysrq handling. 2007-03-14 13:22:37 +09:00
sh-sci.h sh: SH-MobileR SH7722 CPU support. 2006-12-12 08:42:09 +09:00
sn_console.c [PATCH] 2.6 Altix: console fix for CONFIG_DEBUG_SHIRQ usage 2007-03-08 07:39:15 -08:00
suncore.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
suncore.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sunhv.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
sunsab.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
sunsab.h [SUNSAB]: Defer register updates until transmitter is idle. 2005-05-11 11:34:32 -07:00
sunsu.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
sunzilog.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
sunzilog.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
uartlite.c [PATCH] drivers/serial NULL noise removal 2007-02-09 09:14:06 -08:00
v850e_uart.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00
vr41xx_siu.c [PATCH] tty: switch to ktermios 2006-12-08 08:28:57 -08:00