plpks_signed_update_var() dereferences the supplied PLPKS variable pointer
without validating it. A NULL argument could therefore result in a NULL
pointer dereference.

Reject a NULL pointer argument with -EINVAL.

Fixes: 899d9b8fee66 ("powerpc/pseries: Implement signed update for PLPKS 
objects")
Cc: [email protected] # 6.3
Signed-off-by: Srish Srinivasan <[email protected]>
Tested-by: R Nageswara Sastry <[email protected]>
---
 arch/powerpc/platforms/pseries/plpks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/plpks.c 
b/arch/powerpc/platforms/pseries/plpks.c
index ccf5765a907b..e3ae2cd78247 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -637,6 +637,9 @@ int plpks_signed_update_var(struct plpks_var *var, u64 
flags)
        u64 continuetoken = 0;
        u64 timeout = 0;
 
+       if (!var)
+               return -EINVAL;
+
        if (!var->data || var->datalen <= 0 || var->namelen > 
PLPKS_MAX_NAME_SIZE)
                return -EINVAL;
 
-- 
2.52.0


Reply via email to