• Hans Verkuil's avatar
    media: cec: check 'transmit_in_progress', not 'transmitting' · ac479b51
    Hans Verkuil authored
    Currently wait_event_interruptible_timeout is called in cec_thread_func()
    when adap->transmitting is set. But if the adapter is unconfigured
    while transmitting, then adap->transmitting is set to NULL. But the
    hardware is still actually transmitting the message, and that's
    indicated by adap->transmit_in_progress and we should wait until that
    is finished or times out before transmitting new messages.
    
    As the original commit says: adap->transmitting is the userspace view,
    adap->transmit_in_progress reflects the hardware state.
    
    However, if adap->transmitting is NULL and adap->transmit_in_progress
    is true, then wait_event_interruptible is called (no timeout), which
    can get stuck indefinitely if the CEC driver is flaky and never marks
    the transmit-in-progress as 'done'.
    
    So test against transmit_in_progress when deciding whether to use
    the timeout variant or not, instead of testing against adap->transmitting.
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Fixes: 32804fcb ("media: cec: keep track of outstanding transmits")
    Cc: <stable@vger.kernel.org>      # for v4.19 and up
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    ac479b51
cec-adap.c 63 KB