Repository navigation
Commit e359a4e
tty: Remove tty_hung_up_p() tests from tty drivers' open()
Since at least before 2.6.30, it has not been possible to observe
a hung up file pointer in a tty driver's open() method unless/until
the driver open() releases the tty_lock() (eg., before blocking).
This is because tty_open() adds the file pointer while holding
the tty_lock() _and_ doesn't release the lock until after calling
the tty driver's open() method. [ Before tty_lock(), this was
lock_kernel(). ]
Since __tty_hangup() first waits on the tty_lock() before
enumerating and hanging up the open file pointers, either
__tty_hangup() will wait for the tty_lock() or tty_open() will
not yet have added the file pointer. For example,
CPU 0 | CPU 1
|
tty_open | __tty_hangup
.. | ..
tty_lock | ..
tty_reopen | tty_lock / blocks
.. |
tty_add_file(tty, filp) |
.. |
tty->ops->open(tty, filp) |
tty_port_open |
tty_port_block_til_ready |
.. |
while (1) |
.. |
tty_unlock | / unblocks
schedule | for each filp on tty->tty_files
| f_ops = tty_hung_up_fops;
| ..
| tty_unlock
tty_lock |
.. |
tty_unlock |
Note that since tty_port_block_til_ready() and similar drop
the tty_lock while blocking, when woken, the file pointer
must then be tested for having been hung up.
Also, fix bit-rotted drivers that used extra_count to track the
port->count bump.
CC: Mikael Starvik <starvik@axis.com>
CC: Samuel Ortiz <samuel@sortiz.org>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 5fda7a0 commit e359a4e
10 files changed
Lines changed: 21 additions & 61 deletions
File tree
- drivers
- char/pcmcia
- staging/dgrp
- tty
- serial
- net/irda/ircomm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2510 | 2510 | | |
2511 | 2511 | | |
2512 | 2512 | | |
2513 | | - | |
| 2513 | + | |
2514 | 2514 | | |
2515 | 2515 | | |
2516 | 2516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | 634 | | |
645 | 635 | | |
646 | 636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1579 | 1579 | | |
1580 | 1580 | | |
1581 | 1581 | | |
1582 | | - | |
| 1582 | + | |
1583 | 1583 | | |
1584 | 1584 | | |
1585 | 1585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3831 | 3831 | | |
3832 | 3832 | | |
3833 | 3833 | | |
3834 | | - | |
| 3834 | + | |
3835 | 3835 | | |
3836 | 3836 | | |
3837 | 3837 | | |
3838 | 3838 | | |
3839 | 3839 | | |
3840 | | - | |
3841 | | - | |
| 3840 | + | |
3842 | 3841 | | |
3843 | 3842 | | |
3844 | 3843 | | |
| |||
3879 | 3878 | | |
3880 | 3879 | | |
3881 | 3880 | | |
3882 | | - | |
3883 | | - | |
3884 | | - | |
3885 | | - | |
| 3881 | + | |
3886 | 3882 | | |
3887 | 3883 | | |
3888 | 3884 | | |
| |||
3921 | 3917 | | |
3922 | 3918 | | |
3923 | 3919 | | |
3924 | | - | |
| 3920 | + | |
3925 | 3921 | | |
3926 | 3922 | | |
3927 | 3923 | | |
| |||
3976 | 3972 | | |
3977 | 3973 | | |
3978 | 3974 | | |
3979 | | - | |
3980 | | - | |
| 3975 | + | |
3981 | 3976 | | |
3982 | 3977 | | |
3983 | 3978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1583 | 1583 | | |
1584 | 1584 | | |
1585 | 1585 | | |
1586 | | - | |
1587 | | - | |
1588 | | - | |
1589 | | - | |
1590 | | - | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
1594 | 1586 | | |
1595 | 1587 | | |
1596 | 1588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3267 | 3267 | | |
3268 | 3268 | | |
3269 | 3269 | | |
3270 | | - | |
3271 | 3270 | | |
3272 | 3271 | | |
3273 | 3272 | | |
| |||
3300 | 3299 | | |
3301 | 3300 | | |
3302 | 3301 | | |
3303 | | - | |
3304 | | - | |
3305 | | - | |
3306 | | - | |
| 3302 | + | |
3307 | 3303 | | |
3308 | 3304 | | |
3309 | 3305 | | |
| |||
3342 | 3338 | | |
3343 | 3339 | | |
3344 | 3340 | | |
3345 | | - | |
| 3341 | + | |
3346 | 3342 | | |
3347 | 3343 | | |
3348 | 3344 | | |
| |||
3403 | 3399 | | |
3404 | 3400 | | |
3405 | 3401 | | |
3406 | | - | |
| 3402 | + | |
3407 | 3403 | | |
3408 | 3404 | | |
3409 | 3405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| |||
3273 | 3273 | | |
3274 | 3274 | | |
3275 | 3275 | | |
3276 | | - | |
3277 | 3276 | | |
3278 | 3277 | | |
3279 | 3278 | | |
| |||
3300 | 3299 | | |
3301 | 3300 | | |
3302 | 3301 | | |
3303 | | - | |
3304 | | - | |
3305 | | - | |
3306 | | - | |
| 3302 | + | |
3307 | 3303 | | |
3308 | 3304 | | |
3309 | 3305 | | |
| |||
3338 | 3334 | | |
3339 | 3335 | | |
3340 | 3336 | | |
3341 | | - | |
| 3337 | + | |
3342 | 3338 | | |
3343 | 3339 | | |
3344 | 3340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
756 | | - | |
| 756 | + | |
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
| |||
3288 | 3288 | | |
3289 | 3289 | | |
3290 | 3290 | | |
3291 | | - | |
3292 | 3291 | | |
3293 | 3292 | | |
3294 | 3293 | | |
| |||
3322 | 3321 | | |
3323 | 3322 | | |
3324 | 3323 | | |
3325 | | - | |
3326 | | - | |
3327 | | - | |
3328 | | - | |
| 3324 | + | |
3329 | 3325 | | |
3330 | 3326 | | |
3331 | 3327 | | |
| |||
3362 | 3358 | | |
3363 | 3359 | | |
3364 | 3360 | | |
3365 | | - | |
3366 | | - | |
| 3361 | + | |
3367 | 3362 | | |
3368 | 3363 | | |
3369 | 3364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
403 | | - | |
| 402 | + | |
404 | 403 | | |
405 | 404 | | |
406 | 405 | | |
| |||
593 | 592 | | |
594 | 593 | | |
595 | 594 | | |
596 | | - | |
597 | | - | |
| 595 | + | |
598 | 596 | | |
599 | 597 | | |
600 | 598 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
324 | | - | |
| 323 | + | |
325 | 324 | | |
326 | 325 | | |
327 | 326 | | |
| |||
458 | 457 | | |
459 | 458 | | |
460 | 459 | | |
461 | | - | |
462 | | - | |
| 460 | + | |
463 | 461 | | |
464 | 462 | | |
465 | 463 | | |
| |||
0 commit comments