staging: tidspbridge: check return code of get_user
authorVasiliy Kulikov <segooon@gmail.com>
Sun, 5 Sep 2010 18:32:45 +0000 (22:32 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 5 Sep 2010 23:59:50 +0000 (16:59 -0700)
Function get_user may fail. Check for it.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/tidspbridge/pmgr/dspapi.c

index b23591b0f414b7431de7ccfb4d8de2e486b95389..faf8304f55e22330dbf59643680bf56b5d9c1e87 100644 (file)
@@ -872,7 +872,11 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
                /* number of elements in the envp array including NULL */
                count = 0;
                do {
-                       get_user(temp, args->args_proc_load.user_envp + count);
+                       if (get_user(temp,
+                                    args->args_proc_load.user_envp + count)) {
+                               status = -EFAULT;
+                               goto func_cont;
+                       }
                        count++;
                } while (temp);
                envp = kmalloc(count * sizeof(u8 *), GFP_KERNEL);