Unverified Commit 7511eee9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

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

parents 0076e85e 49d6aaad
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/kernel.h>
#include <linux/lockdep.h>
#include <linux/memblock.h>
#include <linux/nospec.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/reboot.h>
@@ -1839,6 +1840,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)