• Johan Hovold's avatar
    USB: console: fix uninitialised ldisc semaphore · d269d443
    Johan Hovold authored
    The USB console currently allocates a temporary fake tty which is used
    to pass terminal settings to the underlying serial driver.
    
    The tty struct is not fully initialised, something which can lead to a
    lockdep warning (or worse) if a serial driver tries to acquire a
    line-discipline reference:
    
    	usbserial: USB Serial support registered for pl2303
    	pl2303 1-2.1:1.0: pl2303 converter detected
    	usb 1-2.1: pl2303 converter now attached to ttyUSB0
    	INFO: trying to register non-static key.
    	the code is fine but needs lockdep annotation.
    	turning off the locking correctness validator.
    	CPU: 0 PID: 68 Comm: udevd Tainted: G        W      3.18.0-rc5 #10
    	[<c0016f04>] (unwind_backtrace) from [<c0013978>] (show_stack+0x20/0x24)
    	[<c0013978>] (show_stack) from [<c0449794>] (dump_stack+0x24/0x28)
    	[<c0449794>] (dump_stack) from [<c006f730>] (__lock_acquire+0x1e50/0x2004)
    	[<c006f730>] (__lock_acquire) from [<c0070128>] (lock_acquire+0xe4/0x18c)
    	[<c0070128>] (lock_acquire) from [<c027c6f8>] (ldsem_down_read_trylock+0x78/0x90)
    	[<c027c6f8>] (ldsem_down_read_trylock) from [<c027a1cc>] (tty_ldisc_ref+0x24/0x58)
    	[<c027a1cc>] (tty_ldisc_ref) from [<c0340760>] (usb_serial_handle_dcd_change+0x48/0xe8)
    	[<c0340760>] (usb_serial_handle_dcd_change) from [<bf000484>] (pl2303_read_int_callback+0x210/0x220 [pl2303])
    	[<bf000484>] (pl2303_read_int_callback [pl2303]) from [<c031624c>] (__usb_hcd_giveback_urb+0x80/0x140)
    	[<c031624c>] (__usb_hcd_giveback_urb) from [<c0316fc0>] (usb_giveback_urb_bh+0x98/0xd4)
    	[<c0316fc0>] (usb_giveback_urb_bh) from [<c0042e44>] (tasklet_hi_action+0x9c/0x108)
    	[<c0042e44>] (tasklet_hi_action) from [<c0042380>] (__do_softirq+0x148/0x42c)
    	[<c0042380>] (__do_softirq) from [<c00429cc>] (irq_exit+0xd8/0x114)
    	[<c00429cc>] (irq_exit) from [<c007ae58>] (__handle_domain_irq+0x84/0xdc)
    	[<c007ae58>] (__handle_domain_irq) from [<c000879c>] (omap_intc_handle_irq+0xd8/0xe0)
    	[<c000879c>] (omap_intc_handle_irq) from [<c0014544>] (__irq_svc+0x44/0x7c)
    	Exception stack(0xdf4e7f08 to 0xdf4e7f50)
    	7f00:                   debc0b80 df4e7f5c 00000000 00000000 debc0b80 be8da96c
    	7f20: 00000000 00000128 c000fc84 df4e6000 00000000 df4e7f94 00000004 df4e7f50
    	7f40: c038ebc0 c038d74c 600f0013 ffffffff
    	[<c0014544>] (__irq_svc) from [<c038d74c>] (___sys_sendmsg.part.29+0x0/0x2e0)
    	[<c038d74c>] (___sys_sendmsg.part.29) from [<c038ec08>] (SyS_sendmsg+0x18/0x1c)
    	[<c038ec08>] (SyS_sendmsg) from [<c000fa00>] (ret_fast_syscall+0x0/0x48)
    	console [ttyUSB0] enabled
    
    Fixes: 36697529 ("tty: Replace ldisc locking with ldisc_sem")
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    d269d443
console.c 7.08 KB