firmware: send -EINTR on signal abort on fallback mechanism
authorLuis R. Rodriguez <mcgrof@kernel.org>
Thu, 20 Jul 2017 20:13:39 +0000 (13:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Aug 2017 20:58:41 +0000 (13:58 -0700)
Right now we send -EAGAIN to a syfs write which got interrupted.
Userspace can't tell what happened though, send -EINTR if we
were killed due to a signal so userspace can tell things apart.

This is only applicable to the fallback mechanism.

Reported-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c

index b9f907eedbf770ee32359468d2b8d07e57bde667..ac7e32fac8fcdb915bf92d09a7b28cca27e1f8e6 100644 (file)
@@ -1089,9 +1089,12 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
                mutex_unlock(&fw_lock);
        }
 
-       if (fw_state_is_aborted(&buf->fw_st))
-               retval = -EAGAIN;
-       else if (buf->is_paged_buf && !buf->data)
+       if (fw_state_is_aborted(&buf->fw_st)) {
+               if (retval == -ERESTARTSYS)
+                       retval = -EINTR;
+               else
+                       retval = -EAGAIN;
+       } else if (buf->is_paged_buf && !buf->data)
                retval = -ENOMEM;
 
        device_del(f_dev);