linux/drivers/char
Andrew Morton 9ffee4cbc5 tty_check_change(): avoid taking tasklist_lock while holding tty->ctrl_lock
May 11 09:42:27 [kernel] [ 1104.496819] rarian-sk-get-c[5630]: segfault at 0 ip 7f478556caf0 sp 7fff8e3fe338 error 4 in libc-2.6.1.so[7f47854f9000+136000]
May 11 10:59:48 [kernel] [ 2494.165792]
May 11 10:59:48 [kernel] [ 2494.165794] =======================================================
May 11 10:59:48 [kernel] [ 2494.165801] [ INFO: possible circular locking dependency detected ]
May 11 10:59:48 [kernel] [ 2494.165805] 2.6.26-rc1-00007-g91b3a7a #217
May 11 10:59:48 [kernel] [ 2494.165807] -------------------------------------------------------
May 11 10:59:48 [kernel] [ 2494.165809] less/7053 is trying to acquire lock:
May 11 10:59:48 [kernel] [ 2494.165812]  (tasklist_lock){..??}, at: [<ffffffff80232e95>] is_current_pgrp_orphaned+0x15/0x50
May 11 10:59:48 [kernel] [ 2494.165821]
May 11 10:59:48 [kernel] [ 2494.165822] but task is already holding lock:
May 11 10:59:48 [kernel] [ 2494.165824]  (&tty->ctrl_lock){....}, at: [<ffffffff803d5f31>] tty_check_change+0x61/0x110
May 11 10:59:48 [kernel] [ 2494.165831]
May 11 10:59:48 [kernel] [ 2494.165832] which lock already depends on the new lock.
May 11 10:59:48 [kernel] [ 2494.165833]
May 11 10:59:48 [kernel] [ 2494.165835]
May 11 10:59:48 [kernel] [ 2494.165836] the existing dependency chain (in reverse order) is:
May 11 10:59:48 [kernel] [ 2494.165838]
May 11 10:59:48 [kernel] [ 2494.165839] -> #2 (&tty->ctrl_lock){....}:
May 11 10:59:48 [kernel] [ 2494.165843]        [<ffffffff80253796>] __lock_acquire+0xf86/0x1080
May 11 10:59:48 [kernel] [ 2494.165851]        [<ffffffff80253922>] lock_acquire+0x92/0xc0
May 11 10:59:48 [kernel] [ 2494.165858]        [<ffffffff804deee0>] _spin_lock_irqsave+0x40/0x60
May 11 10:59:48 [kernel] [ 2494.165866]        [<ffffffff803d31b5>] __proc_set_tty+0x35/0xe0
May 11 10:59:48 [kernel] [ 2494.165873]        [<ffffffff803d76d4>] tty_ioctl+0xbf4/0xfe0
May 11 10:59:48 [kernel] [ 2494.165880]        [<ffffffff802a05e1>] vfs_ioctl+0x31/0x90
May 11 10:59:48 [kernel] [ 2494.165888]        [<ffffffff802a06b3>] do_vfs_ioctl+0x73/0x2d0
May 11 10:59:48 [kernel] [ 2494.165895]        [<ffffffff802a095a>] sys_ioctl+0x4a/0x80
May 11 10:59:48 [kernel] [ 2494.165902]        [<ffffffff8020b5ab>] system_call_after_swapgs+0x7b/0x80
May 11 10:59:48 [kernel] [ 2494.165910]        [<ffffffffffffffff>] 0xffffffffffffffff
May 11 10:59:48 [kernel] [ 2494.165924]
May 11 10:59:48 [kernel] [ 2494.165925] -> #1 (&sighand->siglock){++..}:
May 11 10:59:48 [kernel] [ 2494.165929]        [<ffffffff80253796>] __lock_acquire+0xf86/0x1080
May 11 10:59:48 [kernel] [ 2494.165936]        [<ffffffff80253922>] lock_acquire+0x92/0xc0
May 11 10:59:48 [kernel] [ 2494.165943]        [<ffffffff804dec1f>] _spin_lock+0x2f/0x40
May 11 10:59:48 [kernel] [ 2494.165951]        [<ffffffff8022d5a3>] copy_process+0x973/0x1210
May 11 10:59:48 [kernel] [ 2494.165959]        [<ffffffff8022df12>] do_fork+0x82/0x2f0
May 11 10:59:48 [kernel] [ 2494.165967]        [<ffffffff8020bfe1>] kernel_thread+0x81/0xde
May 11 10:59:48 [kernel] [ 2494.165974]        [<ffffffff8020c048>] child_rip+0xa/0x12
May 11 10:59:48 [kernel] [ 2494.165981]        [<ffffffffffffffff>] 0xffffffffffffffff
May 11 10:59:48 [kernel] [ 2494.166038]
May 11 10:59:48 [kernel] [ 2494.166039] -> #0 (tasklist_lock){..??}:
May 11 10:59:48 [kernel] [ 2494.166043]        [<ffffffff802535ab>] __lock_acquire+0xd9b/0x1080
May 11 10:59:48 [kernel] [ 2494.166050]        [<ffffffff80253922>] lock_acquire+0x92/0xc0
May 11 10:59:48 [kernel] [ 2494.166057]        [<ffffffff804dede2>] _read_lock+0x32/0x50
May 11 10:59:48 [kernel] [ 2494.166063]        [<ffffffff80232e95>] is_current_pgrp_orphaned+0x15/0x50
May 11 10:59:48 [kernel] [ 2494.166071]        [<ffffffff803d5f80>] tty_check_change+0xb0/0x110
May 11 10:59:48 [kernel] [ 2494.166078]        [<ffffffff803dac5f>] set_termios+0x1f/0x4c0
May 11 10:59:48 [kernel] [ 2494.166085]        [<ffffffff803db379>] tty_mode_ioctl+0x279/0x3e0
May 11 10:59:48 [kernel] [ 2494.166092]        [<ffffffff803db51d>] n_tty_ioctl+0x3d/0x260
May 11 10:59:48 [kernel] [ 2494.166100]        [<ffffffff803d6c34>] tty_ioctl+0x154/0xfe0
May 11 10:59:48 [kernel] [ 2494.166107]        [<ffffffff802a05e1>] vfs_ioctl+0x31/0x90
May 11 10:59:48 [kernel] [ 2494.166114]        [<ffffffff802a06b3>] do_vfs_ioctl+0x73/0x2d0
May 11 10:59:48 [kernel] [ 2494.166121]        [<ffffffff802a095a>] sys_ioctl+0x4a/0x80
May 11 10:59:48 [kernel] [ 2494.166128]        [<ffffffff8020b5ab>] system_call_after_swapgs+0x7b/0x80
May 11 10:59:48 [kernel] [ 2494.166135]        [<ffffffffffffffff>] 0xffffffffffffffff
May 11 10:59:48 [kernel] [ 2494.166142]
May 11 10:59:48 [kernel] [ 2494.166143] other info that might help us debug this:
May 11 10:59:48 [kernel] [ 2494.166144]
May 11 10:59:48 [kernel] [ 2494.166146] 1 lock held by less/7053:
May 11 10:59:48 [kernel] [ 2494.166148]  #0:  (&tty->ctrl_lock){....}, at: [<ffffffff803d5f31>] tty_check_change+0x61/0x110
May 11 10:59:48 [kernel] [ 2494.166155]
May 11 10:59:48 [kernel] [ 2494.166156] stack backtrace:
May 11 10:59:48 [kernel] [ 2494.166159] Pid: 7053, comm: less Not tainted 2.6.26-rc1-00007-g91b3a7a #217
May 11 10:59:48 [kernel] [ 2494.166161]
May 11 10:59:48 [kernel] [ 2494.166162] Call Trace:
May 11 10:59:48 [kernel] [ 2494.166168]  [<ffffffff80251223>] print_circular_bug_tail+0x83/0x90
May 11 10:59:48 [kernel] [ 2494.166172]  [<ffffffff80250889>] ? print_circular_bug_entry+0x49/0x60
May 11 10:59:48 [kernel] [ 2494.166178]  [<ffffffff802535ab>] __lock_acquire+0xd9b/0x1080
May 11 10:59:48 [kernel] [ 2494.166184]  [<ffffffff80232e95>] ? is_current_pgrp_orphaned+0x15/0x50
May 11 10:59:48 [kernel] [ 2494.166189]  [<ffffffff80253922>] lock_acquire+0x92/0xc0
May 11 10:59:48 [kernel] [ 2494.166206]  [<ffffffff803d5f80>] tty_check_change+0xb0/0x110
May 11 10:59:48 [kernel] [ 2494.166211]  [<ffffffff803dac5f>] set_termios+0x1f/0x4c0
May 11 10:59:48 [kernel] [ 2494.166216]  [<ffffffff803d3423>] ? tty_ldisc_try+0x23/0x60
May 11 10:59:48 [kernel] [ 2494.166220]  [<ffffffff803d3444>] ? tty_ldisc_try+0x44/0x60
May 11 10:59:48 [kernel] [ 2494.166224]  [<ffffffff804df2c5>] ? _spin_unlock_irqrestore+0x65/0x80
May 11 10:59:48 [kernel] [ 2494.166230]  [<ffffffff803db379>] tty_mode_ioctl+0x279/0x3e0
May 11 10:59:48 [kernel] [ 2494.166234]  [<ffffffff803d3444>] ? tty_ldisc_try+0x44/0x60
May 11 10:59:48 [kernel] [ 2494.166239]  [<ffffffff803db51d>] n_tty_ioctl+0x3d/0x260
May 11 10:59:48 [kernel] [ 2494.166244]  [<ffffffff803d6c34>] tty_ioctl+0x154/0xfe0
May 11 10:59:48 [kernel] [ 2494.166249]  [<ffffffff80252baa>] ? __lock_acquire+0x39a/0x1080
May 11 10:59:48 [kernel] [ 2494.166256]  [<ffffffff80252baa>] ? __lock_acquire+0x39a/0x1080
May 11 10:59:48 [kernel] [ 2494.166263]  [<ffffffff80252baa>] ? __lock_acquire+0x39a/0x1080
May 11 10:59:48 [kernel] [ 2494.166269]  [<ffffffff802a05e1>] vfs_ioctl+0x31/0x90
May 11 10:59:48 [kernel] [ 2494.166274]  [<ffffffff802a06b3>] do_vfs_ioctl+0x73/0x2d0
May 11 10:59:48 [kernel] [ 2494.166280]  [<ffffffff802a095a>] sys_ioctl+0x4a/0x80
May 11 10:59:48 [kernel] [ 2494.166286]  [<ffffffff8020b5ab>] system_call_after_swapgs+0x7b/0x80
May 11 10:59:48 [kernel] [ 2494.166292]

Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-05-14 19:11:15 -07:00
..
agp drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
drm drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
hw_random
ip2 ip2: switch remaining direct call of ops->flush_buffer 2008-04-30 08:29:47 -07:00
ipmi ipmi: support I/O resources in OF driver 2008-05-14 19:11:14 -07:00
mwave
pcmcia drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
rio drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
tpm tpm: change Kconfig dependencies from PNPACPI to PNP 2008-04-29 08:06:26 -07:00
xilinx_hwicap [POWERPC] Xilinx: Fix compile warnings 2008-05-01 23:09:42 -05:00
.gitignore
amiserial.c amiserial: Switch put char to return success/fail 2008-04-30 08:29:45 -07:00
apm-emulation.c
applicom.c char serial: switch drivers to ioremap_nocache 2008-04-30 08:29:48 -07:00
applicom.h
bfin-otp.c
briq_panel.c
cd1865.h
ChangeLog
consolemap.c Basic braille screen reader support 2008-04-30 08:29:52 -07:00
cp437.uni
cs5535_gpio.c
cyclades.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
defkeymap.c_shipped
defkeymap.map
digi1.h
digiFep1.h
digiPCI.h
ds1286.c drivers/char/ds1286.c: use time_before, time_before_eq, etc 2008-04-30 08:29:45 -07:00
ds1302.c
ds1620.c
dsp56k.c
dtlk.c
efirtc.c
epca.c epca: coding style 2008-04-30 08:29:47 -07:00
epca.h
epcaconfig.h
esp.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
generic_nvram.c
generic_serial.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
genrtc.c
hangcheck-timer.c
hpet.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
hvc_beat.c
hvc_console.c
hvc_console.h
hvc_iseries.c
hvc_rtas.c
hvc_vio.c
hvc_xen.c
hvcs.c
hvsi.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
i8k.c i8k: make fan multiplier tunable with a module parameter 2008-05-01 08:04:00 -07:00
ip27-rtc.c
isicom.c isicom: fix buffer allocation 2008-04-30 08:29:47 -07:00
istallion.c char serial: switch drivers to ioremap_nocache 2008-04-30 08:29:48 -07:00
Kconfig char: select fw_loader by moxa 2008-05-14 19:11:15 -07:00
keyboard.c Basic braille screen reader support 2008-04-30 08:29:52 -07:00
lcd.c
lcd.h
lp.c
Makefile
mbcs.c
mbcs.h
mem.c
misc.c
mmtimer.c remove div_long_long_rem 2008-05-01 08:03:58 -07:00
moxa.c char serial: switch drivers to ioremap_nocache 2008-04-30 08:29:48 -07:00
moxa.h Char: moxa, cleanup rx/tx 2008-04-30 08:29:43 -07:00
mspec.c [IA64] allocate multiple contiguous pages via uncached allocator 2008-04-29 13:49:01 -07:00
mxser.c mxser: convert large macros to functions 2008-04-30 08:29:49 -07:00
mxser.h mxser: convert large macros to functions 2008-04-30 08:29:49 -07:00
n_hdlc.c tty: The big operations rework 2008-04-30 08:29:47 -07:00
n_r3964.c tty: The big operations rework 2008-04-30 08:29:47 -07:00
n_tty.c tty: add throttle/unthrottle helpers 2008-04-30 08:29:47 -07:00
nozomi.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
ppdev.c
ps3flash.c
pty.c pty: prepare for tty->ops changes 2008-04-30 08:29:46 -07:00
random.c random: add async notification support to /dev/random 2008-04-29 08:06:25 -07:00
raw.c
riscom8_reg.h
riscom8.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
riscom8.h
rocket_int.h char: use get_unaligned_* helpers 2008-04-29 08:06:27 -07:00
rocket.c riscom/rocket: switch to int put_char method 2008-04-30 08:29:46 -07:00
rocket.h
rtc.c
scc.h
scx200_gpio.c
selection.c
ser_a2232.c
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c m68k: serial167 missing return value in cy_put_char() 2008-05-05 12:37:02 -07:00
snsc_event.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
snsc.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
snsc.h
sonypi.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
specialix_io8.h
specialix.c drivers/char: replace remaining __FUNCTION__ occurrences 2008-04-30 08:29:54 -07:00
stallion.c tty/serial: lay the foundations for the next set of reworks 2008-04-30 08:29:45 -07:00
sx.c sx.c: fix printk warnings on sparc32 2008-05-08 10:46:56 -07:00
sx.h
sxboards.h
sxwindow.h
synclink_gt.c drivers/char/synclink_gt.c: don't return an uninitialised local 2008-05-13 08:02:26 -07:00
synclink.c drivers-char-synclinkc-inbreak-mgsl_put_char-fix 2008-05-01 08:04:02 -07:00
synclinkmp.c char serial: switch drivers to ioremap_nocache 2008-04-30 08:29:48 -07:00
sysrq.c
tb0219.c
tlclk.c
toshiba.c toshiba: use ioremap_cached 2008-04-30 23:15:34 +02:00
tty_audit.c [PATCH] split linux/file.h 2008-05-01 13:08:16 -04:00
tty_io.c tty_check_change(): avoid taking tasklist_lock while holding tty->ctrl_lock 2008-05-14 19:11:15 -07:00
tty_ioctl.c tty: add throttle/unthrottle helpers 2008-04-30 08:29:47 -07:00
vc_screen.c
viocons.c consoles: switch to int put_char method 2008-04-30 08:29:46 -07:00
viotape.c
virtio_console.c
vme_scc.c
vr41xx_giu.c
vt_ioctl.c vt_ioctl: Prepare for BKL push down 2008-04-30 08:29:40 -07:00
vt.c vt: fix canonical input in UTF-8 mode 2008-05-08 10:46:56 -07:00