Files
Nathan Chancellor 725f0b5505 Merge 4.4.236 into android-msm-wahoo-4.4
Changes in 4.4.236: (63 commits)
        HID: core: Correctly handle ReportSize being zero
        HID: core: Sanitize event code and type when mapping input
        perf record/stat: Explicitly call out event modifiers in the documentation
        mm, page_alloc: remove unnecessary variable from free_pcppages_bulk
        hwmon: (applesmc) check status earlier.
        ceph: don't allow setlease on cephfs
        s390: don't trace preemption in percpu macros
        xen/xenbus: Fix granting of vmalloc'd memory
        dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
        batman-adv: Avoid uninitialized chaddr when handling DHCP
        batman-adv: bla: use netif_rx_ni when not in interrupt context
        dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
        netfilter: nf_tables: incorrect enum nft_list_attributes definition
        netfilter: nf_tables: fix destination register zeroing
        dmaengine: pl330: Fix burst length if burst size is smaller than bus width
        bnxt_en: Check for zero dir entries in NVRAM.
        fix regression in "epoll: Keep a reference on files added to the check list"
        tg3: Fix soft lockup when tg3_reset_task() fails.
        iommu/vt-d: Serialize IOMMU GCMD register modifications
        thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
        include/linux/log2.h: add missing () around n in roundup_pow_of_two()
        btrfs: drop path before adding new uuid tree entry
        btrfs: Remove redundant extent_buffer_get in get_old_root
        btrfs: Remove extraneous extent_buffer_get from tree_mod_log_rewind
        btrfs: set the lockdep class for log tree extent buffers
        uaccess: Add non-pagefault user-space read functions
        uaccess: Add non-pagefault user-space write function
        btrfs: fix potential deadlock in the search ioctl
        net: qmi_wwan: MDM9x30 specific power management
        net: qmi_wwan: support "raw IP" mode
        net: qmi_wwan: should hold RTNL while changing netdev type
        net: qmi_wwan: ignore bogus CDC Union descriptors
        Add Dell Wireless 5809e Gobi 4G HSPA+ Mobile Broadband Card (rev3) to qmi_wwan
        qmi_wwan: Added support for Gemalto's Cinterion PHxx WWAN interface
        qmi_wwan: add support for Quectel EC21 and EC25
        NET: usb: qmi_wwan: add support for Telit LE922A PID 0x1040
        drivers: net: usb: qmi_wwan: add QMI_QUIRK_SET_DTR for Telit PID 0x1201
        usb: qmi_wwan: add D-Link DWM-222 A2 device ID
        net: usb: qmi_wwan: add Telit ME910 support
        net: usb: qmi_wwan: add Telit 0x1050 composition
        ALSA: ca0106: fix error code handling
        ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
        dm cache metadata: Avoid returning cmd->bm wild pointer on error
        dm thin metadata: Avoid returning cmd->bm wild pointer on error
        net: refactor bind_bucket fastreuse into helper
        net: initialize fastreuse on inet_inherit_port
        checkpatch: fix the usage of capture group ( ... )
        mm/hugetlb: fix a race between hugetlb sysctl handlers
        cfg80211: regulatory: reject invalid hints
        net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
        ALSA: firewire-digi00x: add support for console models of Digi00x series
        ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
        ALSA; firewire-tascam: exclude Tascam FE-8 from detection
        fs/affs: use octal for permissions
        affs: fix basic permission bits to actually work
        ravb: Fixed to be able to unload modules
        net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
        bnxt_en: Failure to update PHY is not fatal condition.
        bnxt: don't enable NAPI until rings are ready
        net: usb: dm9601: Add USB ID of Keenetic Plus DSL
        sctp: not disable bh in the whole sctp_get_port_local()
        net: disable netpoll on fresh napis
        Linux 4.4.236

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2020-09-12 09:47:22 -07:00

155 lines
4.7 KiB
C

#ifndef __LINUX_UACCESS_H__
#define __LINUX_UACCESS_H__
#include <linux/sched.h>
#define uaccess_kernel() segment_eq(get_fs(), KERNEL_DS)
#include <asm/uaccess.h>
#ifndef untagged_addr
#define untagged_addr(addr) addr
#endif
static __always_inline void pagefault_disabled_inc(void)
{
current->pagefault_disabled++;
}
static __always_inline void pagefault_disabled_dec(void)
{
current->pagefault_disabled--;
WARN_ON(current->pagefault_disabled < 0);
}
/*
* These routines enable/disable the pagefault handler. If disabled, it will
* not take any locks and go straight to the fixup table.
*
* User access methods will not sleep when called from a pagefault_disabled()
* environment.
*/
static inline void pagefault_disable(void)
{
pagefault_disabled_inc();
/*
* make sure to have issued the store before a pagefault
* can hit.
*/
barrier();
}
static inline void pagefault_enable(void)
{
/*
* make sure to issue those last loads/stores before enabling
* the pagefault handler again.
*/
barrier();
pagefault_disabled_dec();
}
/*
* Is the pagefault handler disabled? If so, user access methods will not sleep.
*/
#define pagefault_disabled() (current->pagefault_disabled != 0)
/*
* The pagefault handler is in general disabled by pagefault_disable() or
* when in irq context (via in_atomic()).
*
* This function should only be used by the fault handlers. Other users should
* stick to pagefault_disabled().
* Please NEVER use preempt_disable() to disable the fault handler. With
* !CONFIG_PREEMPT_COUNT, this is like a NOP. So the handler won't be disabled.
* in_atomic() will report different values based on !CONFIG_PREEMPT_COUNT.
*/
#define faulthandler_disabled() (pagefault_disabled() || in_atomic())
#ifndef ARCH_HAS_NOCACHE_UACCESS
static inline unsigned long __copy_from_user_inatomic_nocache(void *to,
const void __user *from, unsigned long n)
{
return __copy_from_user_inatomic(to, from, n);
}
static inline unsigned long __copy_from_user_nocache(void *to,
const void __user *from, unsigned long n)
{
return __copy_from_user(to, from, n);
}
#endif /* ARCH_HAS_NOCACHE_UACCESS */
/*
* probe_kernel_read(): safely attempt to read from a location
* @dst: pointer to the buffer that shall take the data
* @src: address to read from
* @size: size of the data chunk
*
* Safely read from address @src to the buffer at @dst. If a kernel fault
* happens, handle that and return -EFAULT.
*/
extern long probe_kernel_read(void *dst, const void *src, size_t size);
extern long __probe_kernel_read(void *dst, const void *src, size_t size);
/*
* probe_user_read(): safely attempt to read from a location in user space
* @dst: pointer to the buffer that shall take the data
* @src: address to read from
* @size: size of the data chunk
*
* Safely read from address @src to the buffer at @dst. If a kernel fault
* happens, handle that and return -EFAULT.
*/
extern long probe_user_read(void *dst, const void __user *src, size_t size);
/*
* probe_kernel_write(): safely attempt to write to a location
* @dst: address to write to
* @src: pointer to the data that shall be written
* @size: size of the data chunk
*
* Safely write to address @dst from the buffer at @src. If a kernel fault
* happens, handle that and return -EFAULT.
*/
extern long notrace probe_kernel_write(void *dst, const void *src, size_t size);
extern long notrace __probe_kernel_write(void *dst, const void *src, size_t size);
/*
* probe_user_write(): safely attempt to write to a location in user space
* @dst: address to write to
* @src: pointer to the data that shall be written
* @size: size of the data chunk
*
* Safely write to address @dst from the buffer at @src. If a kernel fault
* happens, handle that and return -EFAULT.
*/
extern long notrace probe_user_write(void __user *dst, const void *src, size_t size);
extern long notrace __probe_user_write(void __user *dst, const void *src, size_t size);
extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr,
long count);
extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count);
/**
* probe_kernel_address(): safely attempt to read from a location
* @addr: address to read from
* @retval: read into this variable
*
* Returns 0 on success, or -EFAULT.
*/
#define probe_kernel_address(addr, retval) \
probe_kernel_read(&retval, addr, sizeof(retval))
#ifndef user_access_begin
#define user_access_begin() do { } while (0)
#define user_access_end() do { } while (0)
#define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0)
#define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0)
#endif
#endif /* __LINUX_UACCESS_H__ */