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


Groups > linux.kernel > #1648071 > unrolled thread

[PATCH] firmware: request_firmware() should propagate -ERESTARTSYS

Started byMartin Fuzzey <mfuzzey@parkeon.com>
First post2017-05-23 15:50 +0200
Last post2017-05-23 15:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] firmware: request_firmware() should propagate -ERESTARTSYS Martin Fuzzey <mfuzzey@parkeon.com> - 2017-05-23 15:50 +0200

#1648071 — [PATCH] firmware: request_firmware() should propagate -ERESTARTSYS

FromMartin Fuzzey <mfuzzey@parkeon.com>
Date2017-05-23 15:50 +0200
Subject[PATCH] firmware: request_firmware() should propagate -ERESTARTSYS
Message-ID<tKicz-3OV-45@gated-at.bofh.it>
When -ERESTARTSYS is returned by wait_* due to a signal this should
be returned from request_firmware() so that the syscall may be
restarted if necessary.

Without this it is not possible to distinguish the case of
request_firmware() failing due to a timeout with that due to a signal.

In my particular case request_firmware() was being called from
a sysfs .store() callback and the writing process was the
Android init process which received a SIGCHLD causing
request_firmware() to fail.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
---
 drivers/base/firmware_class.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index b616bf7..13ed62f 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -1023,9 +1023,10 @@ 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 = -EAGAIN;
+	} else if (buf->is_paged_buf && !buf->data)
 		retval = -ENOMEM;
 
 	device_del(f_dev);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web