mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
mm: remove the access_ok() call from gup_fast_fallback()
Historiaclly the code relied on access_ok() to validate the address range. Commit26f4c32807added an explicit wrap check before access_ok(). Commitc28b1fc703then changed the wrap test to use check_add_overflow(). Commit6014bc2756relaxed the checks in x86-64's access_ok() and added an explicit check for TASK_SIZE here to make up for it. That left a pointless access_ok() call with its associated 'lfence' that can never actually fail. So just delete the test. Link: https://lkml.kernel.org/r/20250209174711.60889-1-david.laight.linux@gmail.com Signed-off-by: David Laight <david.laight.linux@gmail.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirks^H^Hski <luto@kernel.org> Cc: Borislav Betkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jan Kara <jack@suse.cz> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Xu <peterx@redhat.com> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
67254c7d70
commit
c2661f5fe8
4
mm/gup.c
4
mm/gup.c
|
|
@ -2760,7 +2760,7 @@ EXPORT_SYMBOL(get_user_pages_unlocked);
|
|||
*
|
||||
* *) ptes can be read atomically by the architecture.
|
||||
*
|
||||
* *) access_ok is sufficient to validate userspace address ranges.
|
||||
* *) valid user addesses are below TASK_MAX_SIZE
|
||||
*
|
||||
* The last two assumptions can be relaxed by the addition of helper functions.
|
||||
*
|
||||
|
|
@ -3414,8 +3414,6 @@ static int gup_fast_fallback(unsigned long start, unsigned long nr_pages,
|
|||
return -EOVERFLOW;
|
||||
if (end > TASK_SIZE_MAX)
|
||||
return -EFAULT;
|
||||
if (unlikely(!access_ok((void __user *)start, len)))
|
||||
return -EFAULT;
|
||||
|
||||
nr_pinned = gup_fast(start, end, gup_flags, pages);
|
||||
if (nr_pinned == nr_pages || gup_flags & FOLL_FAST_ONLY)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user