• Julian Wiedmann's avatar
    s390/qdio: fix roll-back after timeout on ESTABLISH ccw · 2c197870
    Julian Wiedmann authored
    When qdio_establish() times out while waiting for the ESTABLISH ccw to
    complete, it calls qdio_shutdown() to roll back all of its previous
    actions. But at this point the qdio_irq's state is still
    QDIO_IRQ_STATE_INACTIVE, so qdio_shutdown() will exit immediately
    without doing any actual work.
    
    Which means that eg. the qdio_irq's thinint-indicator stays registered,
    and cdev->handler isn't restored to its old value. And since
    commit 954d6235 ("s390/qdio: make thinint registration symmetric")
    the qdio_irq also stays on the tiq_list, so on the next qdio_establish()
    we might get a helpful BUG from the list-debugging code:
    
    ...
    [ 4633.512591] list_add double add: new=00000000005a4110, prev=00000001b357db78, next=00000000005a4110.
    [ 4633.512621] ------------[ cut here ]------------
    [ 4633.512623] kernel BUG at lib/list_debug.c:29!
    ...
    [ 4633.512796]  [<00000001b2c6ee9a>] __list_add_valid+0x82/0xa0
    [ 4633.512798] ([<00000001b2c6ee96>] __list_add_valid+0x7e/0xa0)
    [ 4633.512800]  [<00000001b2fcecce>] qdio_establish_thinint+0x116/0x190
    [ 4633.512805]  [<00000001b2fcbe58>] qdio_establish+0x128/0x498
    ...
    
    Fix this by extracting a goto-chain from the existing error exits in
    qdio_establish(), and check the return value of the wait_event_...()
    to detect the timeout condition.
    
    Fixes: 779e6e1c ("[S390] qdio: new qdio driver.")
    Root-caused-by: default avatarBenjamin Block <bblock@linux.ibm.com>
    Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
    Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
    Cc: <stable@vger.kernel.org> # 2.6.27
    Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    2c197870
qdio_main.c 37.6 KB