efivarfs: Don't return -EINTR when rate-limiting reads
authorTony Luck <tony.luck@intel.com>
Thu, 28 May 2020 19:49:05 +0000 (12:49 -0700)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 15 Jun 2020 12:38:56 +0000 (14:38 +0200)
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>
Link: https://lore.kernel.org/r/20200528194905.690-3-tony.luck@intel.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
fs/efivarfs/file.c

index 4b8bc4560d70900802eb280931bef4eb9edee7f8..feaa5e182b7b4c71c33aa712646dc87e9a67c49f 100644 (file)
@@ -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);