Skip to content

Commit

Permalink
Merge remote-tracking branch 'linux-stable/linux-3.10.y' into cm-14.1
Browse files Browse the repository at this point in the history
Change-Id: I7594c4e547ff9c86811900a3225e5f3b5844dbf7
  • Loading branch information
TheStrix authored and AndroiableDroid committed Dec 27, 2017
1 parent 87986d0 commit ee824ba
Show file tree
Hide file tree
Showing 286 changed files with 2,899 additions and 1,139 deletions.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,6 +1,6 @@
VERSION = 3
PATCHLEVEL = 10
SUBLEVEL = 104
SUBLEVEL = 105
EXTRAVERSION =
NAME = TOSSUG Baby Fish

Expand Down
19 changes: 8 additions & 11 deletions arch/alpha/include/asm/uaccess.h
Expand Up @@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, const void *from, long len)
return __cu_len;
}

extern inline long
__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate)
{
if (__access_ok((unsigned long)validate, len, get_fs()))
len = __copy_tofrom_user_nocheck(to, from, len);
return len;
}

#define __copy_to_user(to,from,n) \
({ \
__chk_user_ptr(to); \
Expand All @@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void *from, long len, const void __user *vali
#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user


extern inline long
copy_to_user(void __user *to, const void *from, long n)
{
return __copy_tofrom_user((__force void *)to, from, n, to);
if (likely(__access_ok((unsigned long)to, n, get_fs())))
n = __copy_tofrom_user_nocheck((__force void *)to, from, n);
return n;
}

extern inline long
copy_from_user(void *to, const void __user *from, long n)
{
return __copy_tofrom_user(to, (__force void *)from, n, from);
if (likely(__access_ok((unsigned long)from, n, get_fs())))
n = __copy_tofrom_user_nocheck(to, (__force void *)from, n);
else
memset(to, 0, n);
return n;
}

extern void __do_clear_user(void);
Expand Down
11 changes: 9 additions & 2 deletions arch/arc/include/asm/uaccess.h
Expand Up @@ -83,7 +83,10 @@
"2: ;nop\n" \
" .section .fixup, \"ax\"\n" \
" .align 4\n" \
"3: mov %0, %3\n" \
"3: # return -EFAULT\n" \
" mov %0, %3\n" \
" # zero out dst ptr\n" \
" mov %1, 0\n" \
" j 2b\n" \
" .previous\n" \
" .section __ex_table, \"a\"\n" \
Expand All @@ -101,7 +104,11 @@
"2: ;nop\n" \
" .section .fixup, \"ax\"\n" \
" .align 4\n" \
"3: mov %0, %3\n" \
"3: # return -EFAULT\n" \
" mov %0, %3\n" \
" # zero out dst ptr\n" \
" mov %1, 0\n" \
" mov %R1, 0\n" \
" j 2b\n" \
" .previous\n" \
" .section __ex_table, \"a\"\n" \
Expand Down
11 changes: 6 additions & 5 deletions arch/arc/kernel/signal.c
Expand Up @@ -80,13 +80,14 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
int err;

err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
if (!err)
set_current_blocked(&set);

err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs),
err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch),
sizeof(sf->uc.uc_mcontext.regs.scratch));
if (err)
return err;

return err;
set_current_blocked(&set);

return 0;
}

static inline int is_do_ss_needed(unsigned int magic)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/boot/compressed/head.S
Expand Up @@ -715,7 +715,7 @@ __armv7_mmu_cache_on:
orrne r0, r0, #1 @ MMU enabled
movne r1, #0xfffffffd @ domain 0 = client
bic r6, r6, #1 << 31 @ 32-bit translation system
bic r6, r6, #3 << 0 @ use only ttbr0
bic r6, r6, #(7 << 0) | (1 << 4) @ use only ttbr0
mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
mcr p15, 0, r0, c7, c5, 4 @ ISB
Expand Down
22 changes: 13 additions & 9 deletions arch/arm/common/sa1111.c
Expand Up @@ -872,9 +872,9 @@ struct sa1111_save_data {

#ifdef CONFIG_PM

static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
static int sa1111_suspend_noirq(struct device *dev)
{
struct sa1111 *sachip = platform_get_drvdata(dev);
struct sa1111 *sachip = dev_get_drvdata(dev);
struct sa1111_save_data *save;
unsigned long flags;
unsigned int val;
Expand Down Expand Up @@ -937,9 +937,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
* restored by their respective drivers, and must be called
* via LDM after this function.
*/
static int sa1111_resume(struct platform_device *dev)
static int sa1111_resume_noirq(struct device *dev)
{
struct sa1111 *sachip = platform_get_drvdata(dev);
struct sa1111 *sachip = dev_get_drvdata(dev);
struct sa1111_save_data *save;
unsigned long flags, id;
void __iomem *base;
Expand All @@ -955,7 +955,7 @@ static int sa1111_resume(struct platform_device *dev)
id = sa1111_readl(sachip->base + SA1111_SKID);
if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
__sa1111_remove(sachip);
platform_set_drvdata(dev, NULL);
dev_set_drvdata(dev, NULL);
kfree(save);
return 0;
}
Expand Down Expand Up @@ -1006,8 +1006,8 @@ static int sa1111_resume(struct platform_device *dev)
}

#else
#define sa1111_suspend NULL
#define sa1111_resume NULL
#define sa1111_suspend_noirq NULL
#define sa1111_resume_noirq NULL
#endif

static int sa1111_probe(struct platform_device *pdev)
Expand Down Expand Up @@ -1041,6 +1041,11 @@ static int sa1111_remove(struct platform_device *pdev)
return 0;
}

static struct dev_pm_ops sa1111_pm_ops = {
.suspend_noirq = sa1111_suspend_noirq,
.resume_noirq = sa1111_resume_noirq,
};

/*
* Not sure if this should be on the system bus or not yet.
* We really want some way to register a system device at
Expand All @@ -1053,11 +1058,10 @@ static int sa1111_remove(struct platform_device *pdev)
static struct platform_driver sa1111_device_driver = {
.probe = sa1111_probe,
.remove = sa1111_remove,
.suspend = sa1111_suspend,
.resume = sa1111_resume,
.driver = {
.name = "sa1111",
.owner = THIS_MODULE,
.pm = &sa1111_pm_ops,
},
};

Expand Down
14 changes: 11 additions & 3 deletions arch/arm/kernel/devtree.c
Expand Up @@ -58,6 +58,8 @@ void __init arm_dt_init_cpu_maps(void)
return;

for_each_child_of_node(cpus, cpu) {
const __be32 *cell;
int prop_bytes;
u32 hwid;

if (of_node_cmp(cpu->type, "cpu"))
Expand All @@ -69,17 +71,23 @@ void __init arm_dt_init_cpu_maps(void)
* properties is considered invalid to build the
* cpu_logical_map.
*/
if (of_property_read_u32(cpu, "reg", &hwid)) {
cell = of_get_property(cpu, "reg", &prop_bytes);
if (!cell || prop_bytes < sizeof(*cell)) {
pr_debug(" * %s missing reg property\n",
cpu->full_name);
return;
}

/*
* 8 MSBs must be set to 0 in the DT since the reg property
* Bits n:24 must be set to 0 in the DT since the reg property
* defines the MPIDR[23:0].
*/
if (hwid & ~MPIDR_HWID_BITMASK)
do {
hwid = be32_to_cpu(*cell++);
prop_bytes -= sizeof(*cell);
} while (!hwid && prop_bytes > 0);

if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK))
return;

/*
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-sa1100/generic.c
Expand Up @@ -31,6 +31,7 @@

#include <mach/hardware.h>
#include <mach/irqs.h>
#include <mach/reset.h>

#include "generic.h"

Expand Down Expand Up @@ -134,6 +135,7 @@ static void sa1100_power_off(void)

void sa11x0_restart(enum reboot_mode mode, const char *cmd)
{
clear_reset_status(RESET_STATUS_ALL);
if (mode == REBOOT_SOFT) {
/* Jump into ROM at address 0 */
soft_restart(0);
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/include/asm/elf.h
Expand Up @@ -137,6 +137,7 @@ extern unsigned long randomize_et_dyn(unsigned long base);

#define SET_PERSONALITY(ex) clear_thread_flag(TIF_32BIT);

/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
#define ARCH_DLINFO \
do { \
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
Expand Down
10 changes: 10 additions & 0 deletions arch/arm64/include/asm/spinlock.h
Expand Up @@ -233,4 +233,14 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)
#define arch_read_relax(lock) cpu_relax()
#define arch_write_relax(lock) cpu_relax()

/*
* Accesses appearing in program order before a spin_lock() operation
* can be reordered with accesses inside the critical section, by virtue
* of arch_spin_lock being constructed using acquire semantics.
*
* In cases where this is problematic (e.g. try_to_wake_up), an
* smp_mb__before_spinlock() can restore the required ordering.
*/
#define smp_mb__before_spinlock() smp_mb()

#endif /* __ASM_SPINLOCK_H */
2 changes: 2 additions & 0 deletions arch/arm64/include/uapi/asm/auxvec.h
Expand Up @@ -19,4 +19,6 @@
/* vDSO location */
#define AT_SYSINFO_EHDR 33

#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */

#endif
6 changes: 4 additions & 2 deletions arch/arm64/kernel/debug-monitors.c
Expand Up @@ -428,8 +428,10 @@ int kernel_active_single_step(void)
/* ptrace API */
void user_enable_single_step(struct task_struct *task)
{
set_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP);
set_regs_spsr_ss(task_pt_regs(task));
struct thread_info *ti = task_thread_info(task);

if (!test_and_set_ti_thread_flag(ti, TIF_SINGLESTEP))
set_regs_spsr_ss(task_pt_regs(task));
}

void user_disable_single_step(struct task_struct *task)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/entry.S
Expand Up @@ -507,7 +507,7 @@ el0_inv:
mov x0, sp
mov x1, #BAD_SYNC
mrs x2, esr_el1
b bad_mode
b bad_el0_sync
ENDPROC(el0_sync)

.align 6
Expand Down
25 changes: 21 additions & 4 deletions arch/arm64/kernel/traps.c
Expand Up @@ -374,16 +374,33 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
}

/*
* bad_mode handles the impossible case in the exception vector.
* bad_mode handles the impossible case in the exception vector. This is always
* fatal.
*/
asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
{
siginfo_t info;
void __user *pc = (void __user *)instruction_pointer(regs);
console_verbose();

pr_crit("Bad mode in %s handler detected, code 0x%08x\n",
handler[reason], esr);

die("Oops - bad mode", regs, 0);
local_irq_disable();
panic("bad mode");
}

/*
* bad_el0_sync handles unexpected, but potentially recoverable synchronous
* exceptions taken from EL0. Unlike bad_mode, this returns.
*/
asmlinkage void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr)
{
siginfo_t info;
void __user *pc = (void __user *)instruction_pointer(regs);
console_verbose();

pr_crit("Bad EL0 synchronous exception detected on CPU%d, code 0x%08x\n",
smp_processor_id(), esr);
__show_regs(regs);

info.si_signo = SIGILL;
Expand All @@ -397,7 +414,7 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
arm64_erp_local_dbe_handler();
}

arm64_notify_die("Oops - bad mode", regs, &info, 0);
force_sig_info(info.si_signo, &info, current);
}

void __pte_error(const char *file, int line, unsigned long val)
Expand Down
11 changes: 10 additions & 1 deletion arch/avr32/include/asm/uaccess.h
Expand Up @@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from,

extern __kernel_size_t copy_to_user(void __user *to, const void *from,
__kernel_size_t n);
extern __kernel_size_t copy_from_user(void *to, const void __user *from,
extern __kernel_size_t ___copy_from_user(void *to, const void __user *from,
__kernel_size_t n);

static inline __kernel_size_t __copy_to_user(void __user *to, const void *from,
Expand All @@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to,
{
return __copy_user(to, (const void __force *)from, n);
}
static inline __kernel_size_t copy_from_user(void *to,
const void __user *from,
__kernel_size_t n)
{
size_t res = ___copy_from_user(to, from, n);
if (unlikely(res))
memset(to + (n - res), 0, res);
return res;
}

#define __copy_to_user_inatomic __copy_to_user
#define __copy_from_user_inatomic __copy_from_user
Expand Down
2 changes: 1 addition & 1 deletion arch/avr32/kernel/avr32_ksyms.c
Expand Up @@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page);
/*
* Userspace access stuff.
*/
EXPORT_SYMBOL(copy_from_user);
EXPORT_SYMBOL(___copy_from_user);
EXPORT_SYMBOL(copy_to_user);
EXPORT_SYMBOL(__copy_user);
EXPORT_SYMBOL(strncpy_from_user);
Expand Down
8 changes: 4 additions & 4 deletions arch/avr32/lib/copy_user.S
Expand Up @@ -23,13 +23,13 @@
*/
.text
.align 1
.global copy_from_user
.type copy_from_user, @function
copy_from_user:
.global ___copy_from_user
.type ___copy_from_user, @function
___copy_from_user:
branch_if_kernel r8, __copy_user
ret_if_privileged r8, r11, r10, r10
rjmp __copy_user
.size copy_from_user, . - copy_from_user
.size ___copy_from_user, . - ___copy_from_user

.global copy_to_user
.type copy_to_user, @function
Expand Down
2 changes: 1 addition & 1 deletion arch/avr32/mach-at32ap/pio.c
Expand Up @@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)
struct resource *regs;
struct pio_device *pio;

if (pdev->id > MAX_NR_PIO_DEVICES) {
if (pdev->id >= MAX_NR_PIO_DEVICES) {
dev_err(&pdev->dev, "only %d PIO devices supported\n",
MAX_NR_PIO_DEVICES);
return;
Expand Down
9 changes: 5 additions & 4 deletions arch/blackfin/include/asm/uaccess.h
Expand Up @@ -177,11 +177,12 @@ static inline int bad_user_access_length(void)
static inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long n)
{
if (access_ok(VERIFY_READ, from, n))
if (likely(access_ok(VERIFY_READ, from, n))) {
memcpy(to, (const void __force *)from, n);
else
return n;
return 0;
return 0;
}
memset(to, 0, n);
return n;
}

static inline unsigned long __must_check
Expand Down

0 comments on commit ee824ba

Please sign in to comment.