mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
powerpc/secvar: Warn and error if multiple secvar ops are set
The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey <ruscur@russell.cc> Co-developed-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20230210080401.345462-6-ajd@linux.ibm.com
This commit is contained in:
parent
53cea34b0a
commit
26149b0202
@ -21,11 +21,11 @@ struct secvar_operations {
|
||||
|
||||
#ifdef CONFIG_PPC_SECURE_BOOT
|
||||
|
||||
extern void set_secvar_ops(const struct secvar_operations *ops);
|
||||
int set_secvar_ops(const struct secvar_operations *ops);
|
||||
|
||||
#else
|
||||
|
||||
static inline void set_secvar_ops(const struct secvar_operations *ops) { }
|
||||
static inline int set_secvar_ops(const struct secvar_operations *ops) { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,10 +8,16 @@
|
||||
|
||||
#include <linux/cache.h>
|
||||
#include <asm/secvar.h>
|
||||
#include <asm/bug.h>
|
||||
|
||||
const struct secvar_operations *secvar_ops __ro_after_init;
|
||||
const struct secvar_operations *secvar_ops __ro_after_init = NULL;
|
||||
|
||||
void set_secvar_ops(const struct secvar_operations *ops)
|
||||
int set_secvar_ops(const struct secvar_operations *ops)
|
||||
{
|
||||
if (WARN_ON_ONCE(secvar_ops))
|
||||
return -EBUSY;
|
||||
|
||||
secvar_ops = ops;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -113,9 +113,7 @@ static int opal_secvar_probe(struct platform_device *pdev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
set_secvar_ops(&opal_secvar_ops);
|
||||
|
||||
return 0;
|
||||
return set_secvar_ops(&opal_secvar_ops);
|
||||
}
|
||||
|
||||
static const struct of_device_id opal_secvar_match[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user