Skip to content

Commit

Permalink
efivarfs: Don't return -EINTR when rate-limiting reads
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tony Luck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ard Biesheuvel <[email protected]>
  • Loading branch information
aegl authored and ardbiesheuvel committed Jun 15, 2020
1 parent 2096721 commit 4353f03
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/efivarfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4353f03

Please sign in to comment.