Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: fixup /proc/tty/driver/serial after proc_fops conversion

"struct tty_driver *" lies in m->private not in v which is
SEQ_TOKEN_START which is 1 which is enough to trigger NULL dereference
next line:

BUG: unable to handle kernel NULL pointer dereference at 000000ad
IP: [<c040d689>] uart_proc_show+0xe/0x2b0

Noticed by Linus.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexey Dobriyan and committed by
Linus Torvalds
833bb304 8b53ef33

+1 -1
+1 -1
drivers/serial/serial_core.c
··· 1765 1765 1766 1766 static int uart_proc_show(struct seq_file *m, void *v) 1767 1767 { 1768 - struct tty_driver *ttydrv = v; 1768 + struct tty_driver *ttydrv = m->private; 1769 1769 struct uart_driver *drv = ttydrv->driver_state; 1770 1770 int i; 1771 1771