Skip to contentSkip to conversation

Zero fill the return values of rtas arg buffer

PATCH New Nathan Fontenot 1 participant 1 message Jul 30, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Zero fill the return values of rtas arg buffer

The kernel copy of the rtas args struct contains the return value(s) for the specified rtas call. These are copied back to user space with the assumption that every value is properly updated prior. This patch zero's out the return value fields of the rtas args struct before processing the rtas call.

I am seeing an issue in testing partition mobility, where the return value fields of the rtas args struct contain stale data. This causes it to appear as thought the rtas call fails, when it actually succeeds.

---

arch/powerpc/kernel/rtas.c +0 -0
Index: linux-2.6.git/arch/powerpc/kernel/rtas.c
===================================================================
@@ -792,6 +792,9 @@
	if (args.token == RTAS_UNKNOWN_SERVICE)
		return -EINVAL;

+ args.rets = &args.args[nargs];
+ memset(args.rets, 0, args.nret * sizeof(rtas_arg_t));
+

	/* Need to handle ibm,suspend_me call specially */
	if (args.token == ibm_suspend_me_token) {
		rc = rtas_ibm_suspend_me(&args);
@@ -808,8 +811,6 @@
	enter_rtas(__pa(&rtas.args));
	args = rtas.args;

- args.rets = &args.args[nargs];
-

	/* A -1 return code indicates that the last command couldn't
	   be completed due to a hardware error. */
	if (args.rets[0] == -1)