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


Groups > linux.kernel > #1648071

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

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Martin Fuzzey <mfuzzey@parkeon.com>
Newsgroups linux.kernel
Subject [PATCH] firmware: request_firmware() should propagate -ERESTARTSYS
Date Tue, 23 May 2017 15:50:01 +0200
Message-ID <tKicz-3OV-45@gated-at.bofh.it> (permalink)
X-Greylist delayed 2002 seconds by postgrey-1.27 at vger.kernel.org; Tue, 23 May 2017 09:49:36 EDT
User-Agent StGit/0.16
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 35
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org
X-Original-Date Tue, 23 May 2017 15:16:07 +0200
X-Original-Message-ID <20170523131607.28138.12306.stgit@localhost>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1648071

Show key headers only | View raw


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);

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


Thread

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

csiph-web