Patch "efivarfs: fix statfs() on efivarfs" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    efivarfs: fix statfs() on efivarfs

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     efivarfs-fix-statfs-on-efivarfs.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5b822d83e40e1b537c7d5f9aca1e6d45d235c0c6
Author: Heinrich Schuchardt <heinrich.schuchardt@xxxxxxxxxxxxx>
Date:   Sun Sep 10 06:54:45 2023 +0200

    efivarfs: fix statfs() on efivarfs
    
    [ Upstream commit 79b83606abc778aa3cbee535b362ce905d0b9448 ]
    
    Some firmware (notably U-Boot) provides GetVariable() and
    GetNextVariableName() but not QueryVariableInfo().
    
    With commit d86ff3333cb1 ("efivarfs: expose used and total size") the
    statfs syscall was broken for such firmware.
    
    If QueryVariableInfo() does not exist or returns EFI_UNSUPPORTED, just
    report the file system size as 0 as statfs_simple() previously did.
    
    Fixes: d86ff3333cb1 ("efivarfs: expose used and total size")
    Link: https://lore.kernel.org/all/20230910045445.41632-1-heinrich.schuchardt@xxxxxxxxxxxxx/
    Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@xxxxxxxxxxxxx>
    [ardb: log warning on QueryVariableInfo() failure]
    Reviewed-by: Ilias Apalodimas <ilias.apalodimas@xxxxxxxxxx>
    Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index e028fafa04f38..996271473609a 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -32,10 +32,16 @@ static int efivarfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	u64 storage_space, remaining_space, max_variable_size;
 	efi_status_t status;
 
-	status = efivar_query_variable_info(attr, &storage_space, &remaining_space,
-					    &max_variable_size);
-	if (status != EFI_SUCCESS)
-		return efi_status_to_err(status);
+	/* Some UEFI firmware does not implement QueryVariableInfo() */
+	storage_space = remaining_space = 0;
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)) {
+		status = efivar_query_variable_info(attr, &storage_space,
+						    &remaining_space,
+						    &max_variable_size);
+		if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED)
+			pr_warn_ratelimited("query_variable_info() failed: 0x%lx\n",
+					    status);
+	}
 
 	/*
 	 * This is not a normal filesystem, so no point in pretending it has a block



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux