All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@intel.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>,
	Lennart Poettering <mzxreary@0pointer.de>,
	Matthew Garrett <matthew.garrett@nebula.com>,
	Jeremy Kerr <jk@ozlabs.org>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] efivarfs: Don't return -EINTR when rate-limiting reads
Date: Thu, 28 May 2020 12:49:05 -0700	[thread overview]
Message-ID: <20200528194905.690-3-tony.luck@intel.com> (raw)
In-Reply-To: <20200528194905.690-1-tony.luck@intel.com>

Applications that read EFI variables may see a return
value of -EINTR if they exceed the rate limit and a
signal delivery is attempted while the process is sleeping.

This is quite surprising to the application, which probably
doesn't have code to handle it.

Change the interruptible sleep to a non-interruptible one.

Reported-by: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 fs/efivarfs/file.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c
index 4b8bc4560d70..feaa5e182b7b 100644
--- a/fs/efivarfs/file.c
+++ b/fs/efivarfs/file.c
@@ -73,10 +73,8 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,
 	ssize_t size = 0;
 	int err;
 
-	while (!__ratelimit(&file->f_cred->user->ratelimit)) {
-		if (!msleep_interruptible(50))
-			return -EINTR;
-	}
+	while (!__ratelimit(&file->f_cred->user->ratelimit))
+		msleep(50);
 
 	err = efivar_entry_size(var, &datasize);
 
-- 
2.21.1


  parent reply	other threads:[~2020-05-28 19:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 19:49 [PATCH 0/2] Couple of efivarfs fixes Tony Luck
2020-05-28 19:49 ` [PATCH 1/2] efivarfs: Update inode modification time for successful writes Tony Luck
2020-06-19 16:46   ` [tip: efi/urgent] " tip-bot2 for Tony Luck
2020-05-28 19:49 ` Tony Luck [this message]
2020-06-19 16:46   ` [tip: efi/urgent] efivarfs: Don't return -EINTR when rate-limiting reads tip-bot2 for Tony Luck
2020-06-15  9:50 ` [PATCH 0/2] Couple of efivarfs fixes Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200528194905.690-3-tony.luck@intel.com \
    --to=tony.luck@intel.com \
    --cc=ardb@kernel.org \
    --cc=jk@ozlabs.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=mzxreary@0pointer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.