copy_from_user_nmi() validates that the pointer is in the user range,
so there is no need for an extra check in copy_code().

Signed-off-by: Andy Lutomirski <l...@kernel.org>
---
 arch/x86/kernel/dumpstack.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 299c20f0a38b..55cf3c8325c6 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -81,12 +81,6 @@ static int copy_code(struct pt_regs *regs, u8 *buf, unsigned 
long src,
        /* The user space code from other tasks cannot be accessed. */
        if (regs != task_pt_regs(current))
                return -EPERM;
-       /*
-        * Make sure userspace isn't trying to trick us into dumping kernel
-        * memory by pointing the userspace instruction pointer at it.
-        */
-       if (__chk_range_not_ok(src, nbytes, TASK_SIZE_MAX))
-               return -EINVAL;
 
        /*
         * Even if named copy_from_user_nmi() this can be invoked from
-- 
2.29.2

Reply via email to