Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666282

[PATCH 4/4] firmware: send -EINTR on signal abort on fallback mechanism

From "Luis R. Rodriguez" <mcgrof@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 4/4] firmware: send -EINTR on signal abort on fallback mechanism
Date 2017-06-15 00:30 +0200
Message-ID <tSoXx-2yP-41@gated-at.bofh.it> (permalink)
References <tSoXx-2yP-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/base/firmware_class.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 70fc42e5e0da..da043cb16e2f 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -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);
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] firmware: fix fallback mechanism by ignoring SIGCHLD "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 00:30 +0200
  [PATCH 4/4] firmware: send -EINTR on signal abort on fallback mechanism "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 00:30 +0200
  [PATCH 1/4] test_firmware: add test case for SIGCHLD on sync fallback "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 00:30 +0200
  [PATCH 3/4] firmware: avoid invalid fallback aborts by using killable swait "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-15 00:30 +0200
  Re: [PATCH 0/4] firmware: fix fallback mechanism by ignoring SIGCHLD Martin Fuzzey <mfuzzey@parkeon.com> - 2017-06-15 09:50 +0200

csiph-web