Unverified Commit 564d6bbe authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11745 powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()

parents 670bc4d3 f38343c0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/completion.h>
#include <linux/cpumask.h>
#include <linux/memblock.h>
#include <linux/nospec.h>
#include <linux/slab.h>
#include <linux/reboot.h>
#include <linux/syscalls.h>
@@ -1168,6 +1169,9 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
	    || nargs + nret > ARRAY_SIZE(args.args))
		return -EINVAL;

	nargs = array_index_nospec(nargs, ARRAY_SIZE(args.args));
	nret = array_index_nospec(nret, ARRAY_SIZE(args.args) - nargs);

	/* Copy in args. */
	if (copy_from_user(args.args, uargs->args,
			   nargs * sizeof(rtas_arg_t)) != 0)