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.

Signed-off-by: Nathan Fontenot <[EMAIL PROTECTED]>
---

Index: linux-2.6.git/arch/powerpc/kernel/rtas.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/kernel/rtas.c       2008-07-22 
09:34:03.000000000 -0500
+++ linux-2.6.git/arch/powerpc/kernel/rtas.c    2008-07-28 11:25:18.000000000 
-0500
@@ -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)

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to