Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * User address space access functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *  For licencing details see kernel-base/COPYING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/tlbflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * We rely on the nested NMI work to allow atomic faults from the NMI path; the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * nested NMI paths are careful to preserve CR2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	unsigned long ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	if (__range_not_ok(from, n, TASK_SIZE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 		return n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	if (!nmi_uaccess_okay())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		return n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	 * Even though this function is typically called from NMI/IRQ context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	 * disable pagefaults so that its behaviour is consistent even when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	 * called form other contexts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	pagefault_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	ret = __copy_from_user_inatomic(to, from, n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	pagefault_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) EXPORT_SYMBOL_GPL(copy_from_user_nmi);