summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2023-02-10 09:03:38 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2023-02-12 12:12:36 +0100
commitc9fd2952754a03b2c14433c0318f4b46e9c0f2ef (patch)
tree9b8b11931015c5ac11c454be8e0d7a60029f6cd8
parentpowerpc/pseries: Fix alignment of PLPKS structures and buffers (diff)
downloadlinux-c9fd2952754a03b2c14433c0318f4b46e9c0f2ef.tar.xz
linux-c9fd2952754a03b2c14433c0318f4b46e9c0f2ef.zip
powerpc/secvar: Fix incorrect return in secvar_sysfs_load()
secvar_ops->get_next() returns -ENOENT when there are no more variables to return, which is expected behaviour. Fix this by returning 0 if get_next() returns -ENOENT. This fixes an issue introduced in commit bd5d9c743d38 ("powerpc: expose secure variables to userspace via sysfs"), but the return code of secvar_sysfs_load() was never checked so this issue never mattered. Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20230210080401.345462-4-ajd@linux.ibm.com
-rw-r--r--arch/powerpc/kernel/secvar-sysfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c
index 1ee4640a2641..7fa5f8ed9542 100644
--- a/arch/powerpc/kernel/secvar-sysfs.c
+++ b/arch/powerpc/kernel/secvar-sysfs.c
@@ -179,8 +179,10 @@ static int secvar_sysfs_load(void)
rc = secvar_ops->get_next(name, &namesize, NAME_MAX_SIZE);
if (rc) {
if (rc != -ENOENT)
- pr_err("error getting secvar from firmware %d\n",
- rc);
+ pr_err("error getting secvar from firmware %d\n", rc);
+ else
+ rc = 0;
+
break;
}