• OGAWA Hirofumi's avatar
    nfc: Fix hangup of RC-S380* in port100_send_ack() · 24971281
    OGAWA Hirofumi authored
    If port100_send_ack() was called twice or more, it has race to hangup.
    
      port100_send_ack()          port100_send_ack()
        init_completion()
        [...]
        dev->cmd_cancel = true
                                    /* this removes previous from completion */
                                    init_completion()
    				[...]
                                    dev->cmd_cancel = true
                                    wait_for_completion()
        /* never be waked up */
        wait_for_completion()
    
    Like above race, this code is not assuming port100_send_ack() is
    called twice or more.
    
    To fix, this checks dev->cmd_cancel to know if prior cancel is
    in-flight or not. And never be remove prior task from completion by
    using reinit_completion(), so this guarantees to be waked up properly
    soon or later.
    Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
    24971281
port100.c 42.7 KB