• Ming Lei's avatar
    firmware loader: fix races during loading firmware · 28eefa75
    Ming Lei authored
    This patch fixes two races in loading firmware:
    
    1, FW_STATUS_DONE should be set before waking up the task waitting
    on _request_firmware_load, otherwise FW_STATUS_ABORT may be
    thought as DONE mistakenly.
    
    2, Inside _request_firmware_load(), there is a small window between
    wait_for_completion() and mutex_lock(&fw_lock), and 'echo 1 > loading'
    still may happen during the period, so this patch checks FW_STATUS_DONE
    to prevent pages' buffer completed from being freed in firmware_loading_store.
    Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    28eefa75
firmware_class.c 18.1 KB