• Devin Heitmueller's avatar
    [media] au0828: fix possible race condition in usage of dev->ctrlmsg · 77fc2863
    Devin Heitmueller authored
    The register read function is referencing the dev->ctrlmsg structure outside
    of the dev->mutex lock, which can cause corruption of the value if multiple
    callers are invoking au0828_readreg() simultaneously.
    
    Use a stack variable to hold the result, and copy the buffer returned by
    usb_control_msg() to that variable.
    
    In reality, the whole recv_control_msg() function can probably be collapsed
    into au0288_readreg() since it is the only caller.
    
    Also get rid of cmd_msg_dump() since the only case in which the function is
    ever called only is ever passed a single byte for the response (and it is
    already logged).
    Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
    77fc2863
au0828-core.c 6.94 KB