Merge android-4.4.158 (f9e4134) into msm-4.4

* refs/heads/tmp-f9e4134
  Linux 4.4.158
  MIPS: VDSO: Match data page cache colouring when D$ aliases
  drivers: net: cpsw: fix segfault in case of bad phy-handle
  mei: bus: type promotion bug in mei_nfc_if_version()
  USB: serial: ti_usb_3410_5052: fix array underflow in completion handler
  pinctrl: qcom: spmi-gpio: Fix pmic_gpio_config_get() to be compliant
  drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
  selftest: timers: Tweak raw_skew to SKIP when ADJ_OFFSET/other clock adjustments are in progress
  ALSA: pcm: Fix snd_interval_refine first/last with open min/max
  rtc: bq4802: add error handling for devm_ioremap
  drm/amdkfd: Fix error codes in kfd_get_process
  gpiolib: Mark gpio_suffixes array with __maybe_unused
  coresight: tpiu: Fix disabling timeouts
  coresight: Handle errors in finding input/output ports
  parport: sunbpp: fix error return code
  drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping
  ARM: hisi: check of_iomap and fix missing of_node_put
  ARM: hisi: fix error handling and missing of_node_put
  ARM: hisi: handle of_iomap and fix missing of_node_put
  MIPS: loongson64: cs5536: Fix PCI_OHCI_INT_REG reads
  mtdchar: fix overflows in adjustment of `count`
  audit: fix use-after-free in audit_add_watch
  binfmt_elf: Respect error return from `regset->active'
  CIFS: fix wrapping bugs in num_entries()
  cifs: prevent integer overflow in nxt_dir_entry()
  usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt()
  USB: yurex: Fix buffer over-read in yurex_write()
  usb: misc: uss720: Fix two sleep-in-atomic-context bugs
  USB: serial: io_ti: fix array underflow in completion handler
  USB: net2280: Fix erroneous synchronization change
  USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller
  usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame()
  usb: Avoid use-after-free by flushing endpoints early in usb_set_interface()
  USB: Add quirk to support DJI CineSSD
  usb: Don't die twice if PCI xhci host is not responding in resume
  misc: hmc6352: fix potential Spectre v1
  Tools: hv: Fix a bug in the key delete code
  IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler
  xen/netfront: fix waiting for xenbus state change
  pstore: Fix incorrect persistent ram buffer mapping
  RDMA/cma: Protect cma dev list with lock
  xen-netfront: fix warn message as irq device name has '/'
  crypto: sharah - Unregister correct algorithms for SAHARA 3
  platform/x86: toshiba_acpi: Fix defined but not used build warnings
  s390/qeth: reset layer2 attribute on layer switch
  s390/qeth: fix race in used-buffer accounting
  arm64: dts: qcom: db410c: Fix Bluetooth LED trigger
  xen-netfront: fix queue name setting
  mac80211: restrict delayed tailroom needed decrement
  MIPS: jz4740: Bump zload address
  powerpc/powernv: opal_put_chars partial write fix
  perf powerpc: Fix callchain ip filtering
  ARM: exynos: Clear global variable on init error path
  fbdev: Distinguish between interlaced and progressive modes
  perf powerpc: Fix callchain ip filtering when return address is in a register
  fbdev/via: fix defined but not used warning
  video: goldfishfb: fix memory leak on driver remove
  fbdev: omapfb: off by one in omapfb_register_client()
  mtd/maps: fix solutionengine.c printk format warnings
  media: videobuf2-core: check for q->error in vb2_core_qbuf()
  MIPS: ath79: fix system restart
  dmaengine: pl330: fix irq race with terminate_all
  kbuild: add .DELETE_ON_ERROR special target
  clk: imx6ul: fix missing of_node_put()
  gfs2: Special-case rindex for gfs2_grow
  xfrm: fix 'passing zero to ERR_PTR()' warning
  ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
  ALSA: msnd: Fix the default sample sizes
  iommu/arm-smmu-v3: sync the OVACKFLG to PRIQ consumer register
  BACKPORT: arm/syscalls: Optimize address limit check
  UPSTREAM: syscalls: Use CHECK_DATA_CORRUPTION for addr_limit_user_check
  BACKPORT: arm64/syscalls: Check address limit on user-mode return
  BACKPORT: x86/syscalls: Check address limit on user-mode return
  BACKPORT: lkdtm: add bad USER_DS test
  UPSTREAM: bug: switch data corruption check to __must_check
  BACKPORT: lkdtm: Add tests for struct list corruption
  UPSTREAM: bug: Provide toggle for BUG on data corruption
  UPSTREAM: list: Split list_del() debug checking into separate function
  UPSTREAM: rculist: Consolidate DEBUG_LIST for list_add_rcu()
  BACKPORT: list: Split list_add() debug checking into separate function
  FROMLIST: ANDROID: binder: Add BINDER_GET_NODE_INFO_FOR_REF ioctl.

Conflicts:
	include/linux/bug.h
	lib/Kconfig.debug
	lib/list_debug.c

Change-Id: I9d87b6b133cac5b642e5e0c928e0bcd0eda6fbdb
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
Srinivasarao P 2018-09-28 12:18:04 +05:30
commit d9a879450e
84 changed files with 680 additions and 248 deletions

View file

@ -1,6 +1,6 @@
VERSION = 4 VERSION = 4
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 157 SUBLEVEL = 158
EXTRAVERSION = EXTRAVERSION =
NAME = Blurry Fish Butt NAME = Blurry Fish Butt

View file

@ -105,7 +105,7 @@
led@6 { led@6 {
label = "apq8016-sbc:blue:bt"; label = "apq8016-sbc:blue:bt";
gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>; gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "bt"; linux,default-trigger = "bluetooth-power";
default-state = "off"; default-state = "off";
}; };
}; };

View file

@ -12,6 +12,7 @@
#include <asm/unistd.h> #include <asm/unistd.h>
#include <asm/ftrace.h> #include <asm/ftrace.h>
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/memory.h>
#ifdef CONFIG_NEED_RET_TO_USER #ifdef CONFIG_NEED_RET_TO_USER
#include <mach/entry-macro.S> #include <mach/entry-macro.S>
@ -35,6 +36,9 @@ ret_fast_syscall:
UNWIND(.fnstart ) UNWIND(.fnstart )
UNWIND(.cantunwind ) UNWIND(.cantunwind )
disable_irq_notrace @ disable interrupts disable_irq_notrace @ disable interrupts
ldr r2, [tsk, #TI_ADDR_LIMIT]
cmp r2, #TASK_SIZE
blne addr_limit_check_failed
ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
bne fast_work_pending bne fast_work_pending
@ -61,6 +65,9 @@ ret_fast_syscall:
UNWIND(.cantunwind ) UNWIND(.cantunwind )
str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
disable_irq_notrace @ disable interrupts disable_irq_notrace @ disable interrupts
ldr r2, [tsk, #TI_ADDR_LIMIT]
cmp r2, #TASK_SIZE
blne addr_limit_check_failed
ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
beq no_work_pending beq no_work_pending
@ -93,6 +100,9 @@ ENTRY(ret_to_user)
ret_slow_syscall: ret_slow_syscall:
disable_irq_notrace @ disable interrupts disable_irq_notrace @ disable interrupts
ENTRY(ret_to_user_from_irq) ENTRY(ret_to_user_from_irq)
ldr r2, [tsk, #TI_ADDR_LIMIT]
cmp r2, #TASK_SIZE
blne addr_limit_check_failed
ldr r1, [tsk, #TI_FLAGS] ldr r1, [tsk, #TI_FLAGS]
tst r1, #_TIF_WORK_MASK tst r1, #_TIF_WORK_MASK
bne slow_work_pending bne slow_work_pending

View file

@ -14,6 +14,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/tracehook.h> #include <linux/tracehook.h>
#include <linux/uprobes.h> #include <linux/uprobes.h>
#include <linux/syscalls.h>
#include <asm/elf.h> #include <asm/elf.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
@ -631,3 +632,9 @@ struct page *get_signal_page(void)
return page; return page;
} }
/* Defer to generic check */
asmlinkage void addr_limit_check_failed(void)
{
addr_limit_user_check();
}

View file

@ -260,6 +260,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node,
NULL); NULL);
if (!domain) { if (!domain) {
iounmap(pmu_base_addr); iounmap(pmu_base_addr);
pmu_base_addr = NULL;
return -ENOMEM; return -ENOMEM;
} }

View file

@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void)
struct device_node *node; struct device_node *node;
node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
if (node) { if (!node) {
ctrl_base = of_iomap(node, 0); id = ERROR_CTRL;
id = HI3620_CTRL; return -ENOENT;
return 0;
} }
id = ERROR_CTRL;
return -ENOENT; ctrl_base = of_iomap(node, 0);
of_node_put(node);
if (!ctrl_base) {
id = ERROR_CTRL;
return -ENOMEM;
}
id = HI3620_CTRL;
return 0;
} }
void hi3xxx_set_cpu(int cpu, bool enable) void hi3xxx_set_cpu(int cpu, bool enable)
@ -173,11 +180,15 @@ static bool hix5hd2_hotplug_init(void)
struct device_node *np; struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl"); np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
if (np) { if (!np)
ctrl_base = of_iomap(np, 0); return false;
return true;
} ctrl_base = of_iomap(np, 0);
return false; of_node_put(np);
if (!ctrl_base)
return false;
return true;
} }
void hix5hd2_set_cpu(int cpu, bool enable) void hix5hd2_set_cpu(int cpu, bool enable)
@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable)
if (!ctrl_base) { if (!ctrl_base) {
np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl"); np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
if (np) BUG_ON(!np);
ctrl_base = of_iomap(np, 0); ctrl_base = of_iomap(np, 0);
else of_node_put(np);
BUG(); BUG_ON(!ctrl_base);
} }
if (enable) { if (enable) {

View file

@ -120,6 +120,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_NEED_RESCHED 1 #define TIF_NEED_RESCHED 1
#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
#define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */ #define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */
#define TIF_FSCHECK 4 /* Check FS is USER_DS on return */
#define TIF_NOHZ 7 #define TIF_NOHZ 7
#define TIF_SYSCALL_TRACE 8 #define TIF_SYSCALL_TRACE 8
#define TIF_SYSCALL_AUDIT 9 #define TIF_SYSCALL_AUDIT 9
@ -141,10 +142,12 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_SECCOMP (1 << TIF_SECCOMP)
#define _TIF_FSCHECK (1 << TIF_FSCHECK)
#define _TIF_32BIT (1 << TIF_32BIT) #define _TIF_32BIT (1 << TIF_32BIT)
#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
_TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE) _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
_TIF_FSCHECK)
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \

View file

@ -73,6 +73,9 @@ static inline void set_fs(mm_segment_t fs)
{ {
current_thread_info()->addr_limit = fs; current_thread_info()->addr_limit = fs;
/* On user-mode return, check fs is correct */
set_thread_flag(TIF_FSCHECK);
/* /*
* Enable/disable UAO so that copy_to_user() etc can access * Enable/disable UAO so that copy_to_user() etc can access
* kernel memory with the unprivileged instructions. * kernel memory with the unprivileged instructions.

View file

@ -25,6 +25,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/tracehook.h> #include <linux/tracehook.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/syscalls.h>
#include <asm/debug-monitors.h> #include <asm/debug-monitors.h>
#include <asm/elf.h> #include <asm/elf.h>
@ -402,6 +403,9 @@ static void do_signal(struct pt_regs *regs)
asmlinkage void do_notify_resume(struct pt_regs *regs, asmlinkage void do_notify_resume(struct pt_regs *regs,
unsigned int thread_flags) unsigned int thread_flags)
{ {
/* Check valid user FS if needed */
addr_limit_user_check();
if (thread_flags & _TIF_SIGPENDING) if (thread_flags & _TIF_SIGPENDING)
do_signal(regs); do_signal(regs);

View file

@ -44,6 +44,7 @@ static char ath79_sys_type[ATH79_SYS_TYPE_LEN];
static void ath79_restart(char *command) static void ath79_restart(char *command)
{ {
local_irq_disable();
ath79_device_reset_set(AR71XX_RESET_FULL_CHIP); ath79_device_reset_set(AR71XX_RESET_FULL_CHIP);
for (;;) for (;;)
if (cpu_wait) if (cpu_wait)

View file

@ -133,6 +133,7 @@ static inline u32 ath79_pll_rr(unsigned reg)
static inline void ath79_reset_wr(unsigned reg, u32 val) static inline void ath79_reset_wr(unsigned reg, u32 val)
{ {
__raw_writel(val, ath79_reset_base + reg); __raw_writel(val, ath79_reset_base + reg);
(void) __raw_readl(ath79_reset_base + reg); /* flush */
} }
static inline u32 ath79_reset_rr(unsigned reg) static inline u32 ath79_reset_rr(unsigned reg)

View file

@ -1,4 +1,4 @@
platform-$(CONFIG_MACH_INGENIC) += jz4740/ platform-$(CONFIG_MACH_INGENIC) += jz4740/
cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740 cflags-$(CONFIG_MACH_INGENIC) += -I$(srctree)/arch/mips/include/asm/mach-jz4740
load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000 load-$(CONFIG_MACH_INGENIC) += 0xffffffff80010000
zload-$(CONFIG_MACH_INGENIC) += 0xffffffff80600000 zload-$(CONFIG_MACH_INGENIC) += 0xffffffff81000000

View file

@ -14,12 +14,14 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/irqchip/mips-gic.h> #include <linux/irqchip/mips-gic.h>
#include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/timekeeper_internal.h> #include <linux/timekeeper_internal.h>
#include <asm/abi.h> #include <asm/abi.h>
#include <asm/page.h>
#include <asm/vdso.h> #include <asm/vdso.h>
/* Kernel-provided data used by the VDSO. */ /* Kernel-provided data used by the VDSO. */
@ -128,12 +130,30 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
vvar_size = gic_size + PAGE_SIZE; vvar_size = gic_size + PAGE_SIZE;
size = vvar_size + image->size; size = vvar_size + image->size;
/*
* Find a region that's large enough for us to perform the
* colour-matching alignment below.
*/
if (cpu_has_dc_aliases)
size += shm_align_mask + 1;
base = get_unmapped_area(NULL, 0, size, 0, 0); base = get_unmapped_area(NULL, 0, size, 0, 0);
if (IS_ERR_VALUE(base)) { if (IS_ERR_VALUE(base)) {
ret = base; ret = base;
goto out; goto out;
} }
/*
* If we suffer from dcache aliasing, ensure that the VDSO data page
* mapping is coloured the same as the kernel's mapping of that memory.
* This ensures that when the kernel updates the VDSO data userland
* will observe it without requiring cache invalidations.
*/
if (cpu_has_dc_aliases) {
base = __ALIGN_MASK(base, shm_align_mask);
base += ((unsigned long)&vdso_data - gic_size) & shm_align_mask;
}
data_addr = base + gic_size; data_addr = base + gic_size;
vdso_addr = data_addr + PAGE_SIZE; vdso_addr = data_addr + PAGE_SIZE;

View file

@ -138,7 +138,7 @@ u32 pci_ohci_read_reg(int reg)
break; break;
case PCI_OHCI_INT_REG: case PCI_OHCI_INT_REG:
_rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo); _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo);
if ((lo & 0x00000f00) == CS5536_USB_INTR) if (((lo >> PIC_YSEL_LOW_USB_SHIFT) & 0xf) == CS5536_USB_INTR)
conf_data = 1; conf_data = 1;
break; break;
default: default:

View file

@ -371,7 +371,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
/* Closed or other error drop */ /* Closed or other error drop */
if (rc != OPAL_SUCCESS && rc != OPAL_BUSY && if (rc != OPAL_SUCCESS && rc != OPAL_BUSY &&
rc != OPAL_BUSY_EVENT) { rc != OPAL_BUSY_EVENT) {
written = total_len; written += total_len;
break; break;
} }
if (rc == OPAL_SUCCESS) { if (rc == OPAL_SUCCESS) {

View file

@ -22,6 +22,7 @@
#include <linux/user-return-notifier.h> #include <linux/user-return-notifier.h>
#include <linux/nospec.h> #include <linux/nospec.h>
#include <linux/uprobes.h> #include <linux/uprobes.h>
#include <linux/syscalls.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/traps.h> #include <asm/traps.h>
@ -273,6 +274,8 @@ __visible inline void prepare_exit_to_usermode(struct pt_regs *regs)
struct thread_info *ti = pt_regs_to_thread_info(regs); struct thread_info *ti = pt_regs_to_thread_info(regs);
u32 cached_flags; u32 cached_flags;
addr_limit_user_check();
if (IS_ENABLED(CONFIG_PROVE_LOCKING) && WARN_ON(!irqs_disabled())) if (IS_ENABLED(CONFIG_PROVE_LOCKING) && WARN_ON(!irqs_disabled()))
local_irq_disable(); local_irq_disable();

View file

@ -111,6 +111,7 @@ struct thread_info {
#define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */ #define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */
#define TIF_ADDR32 29 /* 32-bit address space on 64 bits */ #define TIF_ADDR32 29 /* 32-bit address space on 64 bits */
#define TIF_X32 30 /* 32-bit native x86-64 binary */ #define TIF_X32 30 /* 32-bit native x86-64 binary */
#define TIF_FSCHECK 31 /* Check FS is USER_DS on return */
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
@ -135,6 +136,7 @@ struct thread_info {
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_ADDR32 (1 << TIF_ADDR32) #define _TIF_ADDR32 (1 << TIF_ADDR32)
#define _TIF_X32 (1 << TIF_X32) #define _TIF_X32 (1 << TIF_X32)
#define _TIF_FSCHECK (1 << TIF_FSCHECK)
/* work to do in syscall_trace_enter() */ /* work to do in syscall_trace_enter() */
#define _TIF_WORK_SYSCALL_ENTRY \ #define _TIF_WORK_SYSCALL_ENTRY \
@ -145,7 +147,7 @@ struct thread_info {
/* work to do on any return to user space */ /* work to do on any return to user space */
#define _TIF_ALLWORK_MASK \ #define _TIF_ALLWORK_MASK \
((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT | \ ((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT | \
_TIF_NOHZ) _TIF_NOHZ | _TIF_FSCHECK)
/* flags to check in __switch_to() */ /* flags to check in __switch_to() */
#define _TIF_WORK_CTXSW \ #define _TIF_WORK_CTXSW \

View file

@ -30,7 +30,12 @@
#define get_ds() (KERNEL_DS) #define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit) #define get_fs() (current_thread_info()->addr_limit)
#define set_fs(x) (current_thread_info()->addr_limit = (x)) static inline void set_fs(mm_segment_t fs)
{
current_thread_info()->addr_limit = fs;
/* On user-mode return, check fs is correct */
set_thread_flag(TIF_FSCHECK);
}
#define segment_eq(a, b) ((a).seg == (b).seg) #define segment_eq(a, b) ((a).seg == (b).seg)

View file

@ -4714,6 +4714,42 @@ out:
return ret; return ret;
} }
static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc,
struct binder_node_info_for_ref *info)
{
struct binder_node *node;
struct binder_context *context = proc->context;
__u32 handle = info->handle;
if (info->strong_count || info->weak_count || info->reserved1 ||
info->reserved2 || info->reserved3) {
binder_user_error("%d BINDER_GET_NODE_INFO_FOR_REF: only handle may be non-zero.",
proc->pid);
return -EINVAL;
}
/* This ioctl may only be used by the context manager */
mutex_lock(&context->context_mgr_node_lock);
if (!context->binder_context_mgr_node ||
context->binder_context_mgr_node->proc != proc) {
mutex_unlock(&context->context_mgr_node_lock);
return -EPERM;
}
mutex_unlock(&context->context_mgr_node_lock);
node = binder_get_node_from_ref(proc, handle, true, NULL);
if (!node)
return -EINVAL;
info->strong_count = node->local_strong_refs +
node->internal_strong_refs;
info->weak_count = node->local_weak_refs;
binder_put_node(node);
return 0;
}
static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, static int binder_ioctl_get_node_debug_info(struct binder_proc *proc,
struct binder_node_debug_info *info) { struct binder_node_debug_info *info) {
struct rb_node *n; struct rb_node *n;
@ -4807,6 +4843,25 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
break; break;
} }
case BINDER_GET_NODE_INFO_FOR_REF: {
struct binder_node_info_for_ref info;
if (copy_from_user(&info, ubuf, sizeof(info))) {
ret = -EFAULT;
goto err;
}
ret = binder_ioctl_get_node_info_for_ref(proc, &info);
if (ret < 0)
goto err;
if (copy_to_user(ubuf, &info, sizeof(info))) {
ret = -EFAULT;
goto err;
}
break;
}
case BINDER_GET_NODE_DEBUG_INFO: { case BINDER_GET_NODE_DEBUG_INFO: {
struct binder_node_debug_info info; struct binder_node_debug_info info;

View file

@ -120,6 +120,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-anatop"); np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-anatop");
base = of_iomap(np, 0); base = of_iomap(np, 0);
of_node_put(np);
WARN_ON(!base); WARN_ON(!base);
clks[IMX6UL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); clks[IMX6UL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));

View file

@ -1363,7 +1363,7 @@ err_sha_v4_algs:
err_sha_v3_algs: err_sha_v3_algs:
for (j = 0; j < k; j++) for (j = 0; j < k; j++)
crypto_unregister_ahash(&sha_v4_algs[j]); crypto_unregister_ahash(&sha_v3_algs[j]);
err_aes_algs: err_aes_algs:
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
@ -1379,7 +1379,7 @@ static void sahara_unregister_algs(struct sahara_dev *dev)
for (i = 0; i < ARRAY_SIZE(aes_algs); i++) for (i = 0; i < ARRAY_SIZE(aes_algs); i++)
crypto_unregister_alg(&aes_algs[i]); crypto_unregister_alg(&aes_algs[i]);
for (i = 0; i < ARRAY_SIZE(sha_v4_algs); i++) for (i = 0; i < ARRAY_SIZE(sha_v3_algs); i++)
crypto_unregister_ahash(&sha_v3_algs[i]); crypto_unregister_ahash(&sha_v3_algs[i]);
if (dev->version > SAHARA_VERSION_3) if (dev->version > SAHARA_VERSION_3)

View file

@ -2132,13 +2132,14 @@ static int pl330_terminate_all(struct dma_chan *chan)
pm_runtime_get_sync(pl330->ddma.dev); pm_runtime_get_sync(pl330->ddma.dev);
spin_lock_irqsave(&pch->lock, flags); spin_lock_irqsave(&pch->lock, flags);
spin_lock(&pl330->lock); spin_lock(&pl330->lock);
_stop(pch->thread); _stop(pch->thread);
spin_unlock(&pl330->lock);
pch->thread->req[0].desc = NULL; pch->thread->req[0].desc = NULL;
pch->thread->req[1].desc = NULL; pch->thread->req[1].desc = NULL;
pch->thread->req_running = -1; pch->thread->req_running = -1;
spin_unlock(&pl330->lock);
power_down = pch->active; power_down = pch->active;
pch->active = false; pch->active = false;

View file

@ -30,7 +30,7 @@ struct acpi_gpio_info {
}; };
/* gpio suffixes used for ACPI and device tree lookup */ /* gpio suffixes used for ACPI and device tree lookup */
static const char * const gpio_suffixes[] = { "gpios", "gpio" }; static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" };
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
void acpi_gpiochip_add(struct gpio_chip *chip); void acpi_gpiochip_add(struct gpio_chip *chip);

View file

@ -125,6 +125,8 @@ struct kfd_process *kfd_get_process(const struct task_struct *thread)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
process = find_process(thread); process = find_process(thread);
if (!process)
return ERR_PTR(-EINVAL);
return process; return process;
} }

View file

@ -23,6 +23,10 @@
#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
#include "priv.h" #include "priv.h"
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
#include <asm/dma-iommu.h>
#endif
static int static int
nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev)
{ {
@ -85,6 +89,15 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev)
unsigned long pgsize_bitmap; unsigned long pgsize_bitmap;
int ret; int ret;
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
if (dev->archdata.mapping) {
struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
arm_iommu_detach_device(dev);
arm_iommu_release_mapping(mapping);
}
#endif
if (!tdev->func->iommu_bit) if (!tdev->func->iommu_bit)
return; return;

View file

@ -823,7 +823,7 @@ static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
int ret, i; int ret, i;
ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id)); ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
if (ret < ARRAY_SIZE(id) || id[0] == 0x00) { if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
dev_err(ctx->dev, "read id failed\n"); dev_err(ctx->dev, "read id failed\n");
ctx->error = -EIO; ctx->error = -EIO;
return; return;

View file

@ -46,8 +46,9 @@
/** register definition **/ /** register definition **/
/* FFSR - 0x300 */ /* FFSR - 0x300 */
#define FFSR_FT_STOPPED BIT(1) #define FFSR_FT_STOPPED_BIT 1
/* FFCR - 0x304 */ /* FFCR - 0x304 */
#define FFCR_FON_MAN_BIT 6
#define FFCR_FON_MAN BIT(6) #define FFCR_FON_MAN BIT(6)
#define FFCR_STOP_FI BIT(12) #define FFCR_STOP_FI BIT(12)
@ -93,9 +94,9 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
/* Generate manual flush */ /* Generate manual flush */
writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR); writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
/* Wait for flush to complete */ /* Wait for flush to complete */
coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0); coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN_BIT, 0);
/* Wait for formatter to stop */ /* Wait for formatter to stop */
coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1); coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED_BIT, 1);
CS_LOCK(drvdata->base); CS_LOCK(drvdata->base);
} }

View file

@ -87,7 +87,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev)
dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n", dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n",
dev_name(&parent->dev), dev_name(&csdev->dev)); dev_name(&parent->dev), dev_name(&csdev->dev));
return 0; return -ENODEV;
} }
static int coresight_find_link_outport(struct coresight_device *csdev) static int coresight_find_link_outport(struct coresight_device *csdev)
@ -108,7 +108,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev)
dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n", dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n",
dev_name(&csdev->dev), dev_name(&child->dev)); dev_name(&csdev->dev), dev_name(&child->dev));
return 0; return -ENODEV;
} }
static int coresight_enable_sink(struct coresight_device *csdev) static int coresight_enable_sink(struct coresight_device *csdev)
@ -156,6 +156,9 @@ static int coresight_enable_link(struct coresight_device *csdev)
else else
refport = 0; refport = 0;
if (refport < 0)
return refport;
if (atomic_inc_return(&csdev->refcnt[refport]) == 1) { if (atomic_inc_return(&csdev->refcnt[refport]) == 1) {
if (link_ops(csdev)->enable) { if (link_ops(csdev)->enable) {
ret = link_ops(csdev)->enable(csdev, inport, outport); ret = link_ops(csdev)->enable(csdev, inport, outport);

View file

@ -544,6 +544,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
dgid = (union ib_gid *) &addr->sib_addr; dgid = (union ib_gid *) &addr->sib_addr;
pkey = ntohs(addr->sib_pkey); pkey = ntohs(addr->sib_pkey);
mutex_lock(&lock);
list_for_each_entry(cur_dev, &dev_list, list) { list_for_each_entry(cur_dev, &dev_list, list) {
for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
if (!rdma_cap_af_ib(cur_dev->device, p)) if (!rdma_cap_af_ib(cur_dev->device, p))
@ -567,18 +568,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
cma_dev = cur_dev; cma_dev = cur_dev;
sgid = gid; sgid = gid;
id_priv->id.port_num = p; id_priv->id.port_num = p;
goto found;
} }
} }
} }
} }
mutex_unlock(&lock);
if (!cma_dev) return -ENODEV;
return -ENODEV;
found: found:
cma_attach_to_dev(id_priv, cma_dev); cma_attach_to_dev(id_priv, cma_dev);
addr = (struct sockaddr_ib *) cma_src_addr(id_priv); mutex_unlock(&lock);
memcpy(&addr->sib_addr, &sgid, sizeof sgid); addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
return 0; return 0;
} }

View file

@ -992,12 +992,14 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
skb_queue_head_init(&skqueue); skb_queue_head_init(&skqueue);
netif_tx_lock_bh(p->dev);
spin_lock_irq(&priv->lock); spin_lock_irq(&priv->lock);
set_bit(IPOIB_FLAG_OPER_UP, &p->flags); set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
if (p->neigh) if (p->neigh)
while ((skb = __skb_dequeue(&p->neigh->queue))) while ((skb = __skb_dequeue(&p->neigh->queue)))
__skb_queue_tail(&skqueue, skb); __skb_queue_tail(&skqueue, skb);
spin_unlock_irq(&priv->lock); spin_unlock_irq(&priv->lock);
netif_tx_unlock_bh(p->dev);
while ((skb = __skb_dequeue(&skqueue))) { while ((skb = __skb_dequeue(&skqueue))) {
skb->dev = p->dev; skb->dev = p->dev;

View file

@ -1219,6 +1219,7 @@ static irqreturn_t arm_smmu_priq_thread(int irq, void *dev)
/* Sync our overflow flag, as we believe we're up to speed */ /* Sync our overflow flag, as we believe we're up to speed */
q->cons = Q_OVF(q, q->prod) | Q_WRP(q, q->cons) | Q_IDX(q, q->cons); q->cons = Q_OVF(q, q->prod) | Q_WRP(q, q->cons) | Q_IDX(q, q->cons);
writel(q->cons, q->cons_reg);
return IRQ_HANDLED; return IRQ_HANDLED;
} }

View file

@ -1366,6 +1366,11 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb)
struct vb2_buffer *vb; struct vb2_buffer *vb;
int ret; int ret;
if (q->error) {
dprintk(1, "fatal error occurred on queue\n");
return -EIO;
}
vb = q->bufs[index]; vb = q->bufs[index];
switch (vb->state) { switch (vb->state) {

View file

@ -27,6 +27,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/nospec.h>
static DEFINE_MUTEX(compass_mutex); static DEFINE_MUTEX(compass_mutex);
@ -50,6 +51,7 @@ static int compass_store(struct device *dev, const char *buf, size_t count,
return ret; return ret;
if (val >= strlen(map)) if (val >= strlen(map))
return -EINVAL; return -EINVAL;
val = array_index_nospec(val, strlen(map));
mutex_lock(&compass_mutex); mutex_lock(&compass_mutex);
ret = compass_command(c, map[val]); ret = compass_command(c, map[val]);
mutex_unlock(&compass_mutex); mutex_unlock(&compass_mutex);

View file

@ -47,11 +47,18 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/mman.h> #include <linux/mman.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#ifdef CONFIG_IDE #ifdef CONFIG_IDE
#include <linux/ide.h> #include <linux/ide.h>
#endif #endif
struct lkdtm_list {
struct list_head node;
};
/* /*
* Make sure our attempts to over run the kernel stack doesn't trigger * Make sure our attempts to over run the kernel stack doesn't trigger
* a compiler warning when CONFIG_FRAME_WARN is set. Then make sure we * a compiler warning when CONFIG_FRAME_WARN is set. Then make sure we
@ -88,6 +95,9 @@ enum ctype {
CT_EXCEPTION, CT_EXCEPTION,
CT_LOOP, CT_LOOP,
CT_OVERFLOW, CT_OVERFLOW,
CT_CORRUPT_LIST_ADD,
CT_CORRUPT_LIST_DEL,
CT_CORRUPT_USER_DS,
CT_CORRUPT_STACK, CT_CORRUPT_STACK,
CT_UNALIGNED_LOAD_STORE_WRITE, CT_UNALIGNED_LOAD_STORE_WRITE,
CT_OVERWRITE_ALLOCATION, CT_OVERWRITE_ALLOCATION,
@ -126,6 +136,9 @@ static char* cp_type[] = {
"EXCEPTION", "EXCEPTION",
"LOOP", "LOOP",
"OVERFLOW", "OVERFLOW",
"CORRUPT_LIST_ADD",
"CORRUPT_LIST_DEL",
"CORRUPT_USER_DS",
"CORRUPT_STACK", "CORRUPT_STACK",
"UNALIGNED_LOAD_STORE_WRITE", "UNALIGNED_LOAD_STORE_WRITE",
"OVERWRITE_ALLOCATION", "OVERWRITE_ALLOCATION",
@ -548,6 +561,75 @@ static void lkdtm_do_action(enum ctype which)
do_overwritten(); do_overwritten();
break; break;
} }
case CT_CORRUPT_LIST_ADD: {
/*
* Initially, an empty list via LIST_HEAD:
* test_head.next = &test_head
* test_head.prev = &test_head
*/
LIST_HEAD(test_head);
struct lkdtm_list good, bad;
void *target[2] = { };
void *redirection = &target;
pr_info("attempting good list addition\n");
/*
* Adding to the list performs these actions:
* test_head.next->prev = &good.node
* good.node.next = test_head.next
* good.node.prev = test_head
* test_head.next = good.node
*/
list_add(&good.node, &test_head);
pr_info("attempting corrupted list addition\n");
/*
* In simulating this "write what where" primitive, the "what" is
* the address of &bad.node, and the "where" is the address held
* by "redirection".
*/
test_head.next = redirection;
list_add(&bad.node, &test_head);
if (target[0] == NULL && target[1] == NULL)
pr_err("Overwrite did not happen, but no BUG?!\n");
else
pr_err("list_add() corruption not detected!\n");
break;
}
case CT_CORRUPT_LIST_DEL: {
LIST_HEAD(test_head);
struct lkdtm_list item;
void *target[2] = { };
void *redirection = &target;
list_add(&item.node, &test_head);
pr_info("attempting good list removal\n");
list_del(&item.node);
pr_info("attempting corrupted list removal\n");
list_add(&item.node, &test_head);
/* As with the list_add() test above, this corrupts "next". */
item.node.next = redirection;
list_del(&item.node);
if (target[0] == NULL && target[1] == NULL)
pr_err("Overwrite did not happen, but no BUG?!\n");
else
pr_err("list_del() corruption not detected!\n");
break;
}
case CT_CORRUPT_USER_DS: {
pr_info("setting bad task size limit\n");
set_fs(KERNEL_DS);
/* Make sure we do not keep running with a KERNEL_DS! */
force_sig(SIGKILL, current);
break;
}
case CT_NONE: case CT_NONE:
default: default:
break; break;

View file

@ -151,7 +151,7 @@ static int mei_nfc_if_version(struct mei_cl *cl,
ret = 0; ret = 0;
bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length); bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
if (bytes_recv < if_version_length) { if (bytes_recv < 0 || bytes_recv < if_version_length) {
dev_err(bus->dev, "Could not read IF version\n"); dev_err(bus->dev, "Could not read IF version\n");
ret = -EIO; ret = -EIO;
goto err; goto err;

View file

@ -59,9 +59,9 @@ static int __init init_soleng_maps(void)
return -ENXIO; return -ENXIO;
} }
} }
printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n", printk(KERN_NOTICE "Solution Engine: Flash at 0x%pap, EPROM at 0x%pap\n",
soleng_flash_map.phys & 0x1fffffff, &soleng_flash_map.phys,
soleng_eprom_map.phys & 0x1fffffff); &soleng_eprom_map.phys);
flash_mtd->owner = THIS_MODULE; flash_mtd->owner = THIS_MODULE;
eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map); eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);

View file

@ -160,8 +160,12 @@ static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count,
pr_debug("MTD_read\n"); pr_debug("MTD_read\n");
if (*ppos + count > mtd->size) if (*ppos + count > mtd->size) {
count = mtd->size - *ppos; if (*ppos < mtd->size)
count = mtd->size - *ppos;
else
count = 0;
}
if (!count) if (!count)
return 0; return 0;
@ -246,7 +250,7 @@ static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t c
pr_debug("MTD_write\n"); pr_debug("MTD_write\n");
if (*ppos == mtd->size) if (*ppos >= mtd->size)
return -ENOSPC; return -ENOSPC;
if (*ppos + count > mtd->size) if (*ppos + count > mtd->size)

View file

@ -1164,25 +1164,34 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1 << slave_port, 0, 0, ALE_MCAST_FWD_2); 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
if (slave->data->phy_node) if (slave->data->phy_node) {
slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node, slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node,
&cpsw_adjust_link, 0, slave->data->phy_if); &cpsw_adjust_link, 0, slave->data->phy_if);
else if (!slave->phy) {
dev_err(priv->dev, "phy \"%s\" not found on slave %d\n",
slave->data->phy_node->full_name,
slave->slave_num);
return;
}
} else {
slave->phy = phy_connect(priv->ndev, slave->data->phy_id, slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
&cpsw_adjust_link, slave->data->phy_if); &cpsw_adjust_link, slave->data->phy_if);
if (IS_ERR(slave->phy)) { if (IS_ERR(slave->phy)) {
dev_err(priv->dev, "phy %s not found on slave %d\n", dev_err(priv->dev,
slave->data->phy_id, slave->slave_num); "phy \"%s\" not found on slave %d, err %ld\n",
slave->phy = NULL; slave->data->phy_id, slave->slave_num,
} else { PTR_ERR(slave->phy));
dev_info(priv->dev, "phy found : id is : 0x%x\n", slave->phy = NULL;
slave->phy->phy_id); return;
phy_start(slave->phy); }
/* Configure GMII_SEL register */
cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface,
slave->slave_num);
} }
dev_info(priv->dev, "phy found : id is : 0x%x\n", slave->phy->phy_id);
phy_start(slave->phy);
/* Configure GMII_SEL register */
cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, slave->slave_num);
} }
static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)

View file

@ -86,8 +86,7 @@ struct netfront_cb {
/* IRQ name is queue name with "-tx" or "-rx" appended */ /* IRQ name is queue name with "-tx" or "-rx" appended */
#define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
static DECLARE_WAIT_QUEUE_HEAD(module_load_q); static DECLARE_WAIT_QUEUE_HEAD(module_wq);
static DECLARE_WAIT_QUEUE_HEAD(module_unload_q);
struct netfront_stats { struct netfront_stats {
u64 packets; u64 packets;
@ -1336,11 +1335,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
netif_carrier_off(netdev); netif_carrier_off(netdev);
xenbus_switch_state(dev, XenbusStateInitialising); xenbus_switch_state(dev, XenbusStateInitialising);
wait_event(module_load_q, wait_event(module_wq,
xenbus_read_driver_state(dev->otherend) != xenbus_read_driver_state(dev->otherend) !=
XenbusStateClosed && XenbusStateClosed &&
xenbus_read_driver_state(dev->otherend) != xenbus_read_driver_state(dev->otherend) !=
XenbusStateUnknown); XenbusStateUnknown);
return netdev; return netdev;
exit: exit:
@ -1608,6 +1607,7 @@ static int xennet_init_queue(struct netfront_queue *queue)
{ {
unsigned short i; unsigned short i;
int err = 0; int err = 0;
char *devid;
spin_lock_init(&queue->tx_lock); spin_lock_init(&queue->tx_lock);
spin_lock_init(&queue->rx_lock); spin_lock_init(&queue->rx_lock);
@ -1615,8 +1615,9 @@ static int xennet_init_queue(struct netfront_queue *queue)
setup_timer(&queue->rx_refill_timer, rx_refill_timeout, setup_timer(&queue->rx_refill_timer, rx_refill_timeout,
(unsigned long)queue); (unsigned long)queue);
snprintf(queue->name, sizeof(queue->name), "%s-q%u", devid = strrchr(queue->info->xbdev->nodename, '/') + 1;
queue->info->netdev->name, queue->id); snprintf(queue->name, sizeof(queue->name), "vif%s-q%u",
devid, queue->id);
/* Initialise tx_skbs as a free chain containing every entry. */ /* Initialise tx_skbs as a free chain containing every entry. */
queue->tx_skb_freelist = 0; queue->tx_skb_freelist = 0;
@ -2023,15 +2024,14 @@ static void netback_changed(struct xenbus_device *dev,
dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state)); dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state));
wake_up_all(&module_wq);
switch (backend_state) { switch (backend_state) {
case XenbusStateInitialising: case XenbusStateInitialising:
case XenbusStateInitialised: case XenbusStateInitialised:
case XenbusStateReconfiguring: case XenbusStateReconfiguring:
case XenbusStateReconfigured: case XenbusStateReconfigured:
break;
case XenbusStateUnknown: case XenbusStateUnknown:
wake_up_all(&module_unload_q);
break; break;
case XenbusStateInitWait: case XenbusStateInitWait:
@ -2047,12 +2047,10 @@ static void netback_changed(struct xenbus_device *dev,
break; break;
case XenbusStateClosed: case XenbusStateClosed:
wake_up_all(&module_unload_q);
if (dev->state == XenbusStateClosed) if (dev->state == XenbusStateClosed)
break; break;
/* Missed the backend's CLOSING state -- fallthrough */ /* Missed the backend's CLOSING state -- fallthrough */
case XenbusStateClosing: case XenbusStateClosing:
wake_up_all(&module_unload_q);
xenbus_frontend_closed(dev); xenbus_frontend_closed(dev);
break; break;
} }
@ -2160,14 +2158,14 @@ static int xennet_remove(struct xenbus_device *dev)
if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) { if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) {
xenbus_switch_state(dev, XenbusStateClosing); xenbus_switch_state(dev, XenbusStateClosing);
wait_event(module_unload_q, wait_event(module_wq,
xenbus_read_driver_state(dev->otherend) == xenbus_read_driver_state(dev->otherend) ==
XenbusStateClosing || XenbusStateClosing ||
xenbus_read_driver_state(dev->otherend) == xenbus_read_driver_state(dev->otherend) ==
XenbusStateUnknown); XenbusStateUnknown);
xenbus_switch_state(dev, XenbusStateClosed); xenbus_switch_state(dev, XenbusStateClosed);
wait_event(module_unload_q, wait_event(module_wq,
xenbus_read_driver_state(dev->otherend) == xenbus_read_driver_state(dev->otherend) ==
XenbusStateClosed || XenbusStateClosed ||
xenbus_read_driver_state(dev->otherend) == xenbus_read_driver_state(dev->otherend) ==

View file

@ -286,12 +286,16 @@ static int bpp_probe(struct platform_device *op)
ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations), ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations),
GFP_KERNEL); GFP_KERNEL);
if (!ops) if (!ops) {
err = -ENOMEM;
goto out_unmap; goto out_unmap;
}
dprintk(("register_port\n")); dprintk(("register_port\n"));
if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) {
err = -ENOMEM;
goto out_free_ops; goto out_free_ops;
}
p->size = size; p->size = size;
p->dev = &op->dev; p->dev = &op->dev;

View file

@ -411,31 +411,47 @@ static int pmic_gpio_config_get(struct pinctrl_dev *pctldev,
switch (param) { switch (param) {
case PIN_CONFIG_DRIVE_PUSH_PULL: case PIN_CONFIG_DRIVE_PUSH_PULL:
arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_CMOS; if (pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_DRIVE_OPEN_DRAIN: case PIN_CONFIG_DRIVE_OPEN_DRAIN:
arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS; if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_NMOS)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_DRIVE_OPEN_SOURCE: case PIN_CONFIG_DRIVE_OPEN_SOURCE:
arg = pad->buffer_type == PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS; if (pad->buffer_type != PMIC_GPIO_OUT_BUF_OPEN_DRAIN_PMOS)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_DOWN:
arg = pad->pullup == PMIC_GPIO_PULL_DOWN; if (pad->pullup != PMIC_GPIO_PULL_DOWN)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_DISABLE: case PIN_CONFIG_BIAS_DISABLE:
arg = pad->pullup = PMIC_GPIO_PULL_DISABLE; if (pad->pullup != PMIC_GPIO_PULL_DISABLE)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
arg = pad->pullup == PMIC_GPIO_PULL_UP_30; if (pad->pullup != PMIC_GPIO_PULL_UP_30)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
arg = !pad->is_enabled; if (pad->is_enabled)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_POWER_SOURCE: case PIN_CONFIG_POWER_SOURCE:
arg = pad->power_source; arg = pad->power_source;
break; break;
case PIN_CONFIG_INPUT_ENABLE: case PIN_CONFIG_INPUT_ENABLE:
arg = pad->input_enabled; if (!pad->input_enabled)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_OUTPUT: case PIN_CONFIG_OUTPUT:
arg = pad->out_value; arg = pad->out_value;

View file

@ -34,6 +34,7 @@
#define TOSHIBA_ACPI_VERSION "0.23" #define TOSHIBA_ACPI_VERSION "0.23"
#define PROC_INTERFACE_VERSION 1 #define PROC_INTERFACE_VERSION 1
#include <linux/compiler.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
@ -1472,7 +1473,7 @@ static const struct file_operations keys_proc_fops = {
.write = keys_proc_write, .write = keys_proc_write,
}; };
static int version_proc_show(struct seq_file *m, void *v) static int __maybe_unused version_proc_show(struct seq_file *m, void *v)
{ {
seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION); seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION);
seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION); seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION);

View file

@ -164,6 +164,10 @@ static int bq4802_probe(struct platform_device *pdev)
} else if (p->r->flags & IORESOURCE_MEM) { } else if (p->r->flags & IORESOURCE_MEM) {
p->regs = devm_ioremap(&pdev->dev, p->r->start, p->regs = devm_ioremap(&pdev->dev, p->r->start,
resource_size(p->r)); resource_size(p->r));
if (!p->regs){
err = -ENOMEM;
goto out;
}
p->read = bq4802_read_mem; p->read = bq4802_read_mem;
p->write = bq4802_write_mem; p->write = bq4802_write_mem;
} else { } else {

View file

@ -3505,13 +3505,14 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
qdio_flags = QDIO_FLAG_SYNC_OUTPUT; qdio_flags = QDIO_FLAG_SYNC_OUTPUT;
if (atomic_read(&queue->set_pci_flags_count)) if (atomic_read(&queue->set_pci_flags_count))
qdio_flags |= QDIO_FLAG_PCI_OUT; qdio_flags |= QDIO_FLAG_PCI_OUT;
atomic_add(count, &queue->used_buffers);
rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags, rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags,
queue->queue_no, index, count); queue->queue_no, index, count);
if (queue->card->options.performance_stats) if (queue->card->options.performance_stats)
queue->card->perf_stats.outbound_do_qdio_time += queue->card->perf_stats.outbound_do_qdio_time +=
qeth_get_micros() - qeth_get_micros() -
queue->card->perf_stats.outbound_do_qdio_start_time; queue->card->perf_stats.outbound_do_qdio_start_time;
atomic_add(count, &queue->used_buffers);
if (rc) { if (rc) {
queue->card->stats.tx_errors += count; queue->card->stats.tx_errors += count;
/* ignore temporary SIGA errors without busy condition */ /* ignore temporary SIGA errors without busy condition */

View file

@ -419,6 +419,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
if (card->discipline) { if (card->discipline) {
card->discipline->remove(card->gdev); card->discipline->remove(card->gdev);
qeth_core_free_discipline(card); qeth_core_free_discipline(card);
card->options.layer2 = -1;
} }
rc = qeth_core_load_discipline(card, newdis); rc = qeth_core_load_discipline(card, newdis);

View file

@ -453,7 +453,7 @@ static int clear_wdm_read_flag(struct wdm_device *desc)
set_bit(WDM_RESPONDING, &desc->flags); set_bit(WDM_RESPONDING, &desc->flags);
spin_unlock_irq(&desc->iuspin); spin_unlock_irq(&desc->iuspin);
rv = usb_submit_urb(desc->response, GFP_KERNEL); rv = usb_submit_urb(desc->response, GFP_ATOMIC);
spin_lock_irq(&desc->iuspin); spin_lock_irq(&desc->iuspin);
if (rv) { if (rv) {
dev_err(&desc->intf->dev, dev_err(&desc->intf->dev,

View file

@ -529,8 +529,6 @@ static int resume_common(struct device *dev, int event)
event == PM_EVENT_RESTORE); event == PM_EVENT_RESTORE);
if (retval) { if (retval) {
dev_err(dev, "PCI post-resume error %d!\n", retval); dev_err(dev, "PCI post-resume error %d!\n", retval);
if (hcd->shared_hcd)
usb_hc_died(hcd->shared_hcd);
usb_hc_died(hcd); usb_hc_died(hcd);
} }
} }

View file

@ -1283,6 +1283,11 @@ void usb_enable_interface(struct usb_device *dev,
* is submitted that needs that bandwidth. Some other operating systems * is submitted that needs that bandwidth. Some other operating systems
* allocate bandwidth early, when a configuration is chosen. * allocate bandwidth early, when a configuration is chosen.
* *
* xHCI reserves bandwidth and configures the alternate setting in
* usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting
* may be disabled. Drivers cannot rely on any particular alternate
* setting being in effect after a failure.
*
* This call is synchronous, and may not be used in an interrupt context. * This call is synchronous, and may not be used in an interrupt context.
* Also, drivers must not change altsettings while urbs are scheduled for * Also, drivers must not change altsettings while urbs are scheduled for
* endpoints in that interface; all such urbs must first be completed * endpoints in that interface; all such urbs must first be completed
@ -1318,6 +1323,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
alternate); alternate);
return -EINVAL; return -EINVAL;
} }
/*
* usb3 hosts configure the interface in usb_hcd_alloc_bandwidth,
* including freeing dropped endpoint ring buffers.
* Make sure the interface endpoints are flushed before that
*/
usb_disable_interface(dev, iface, false);
/* Make sure we have enough bandwidth for this alternate interface. /* Make sure we have enough bandwidth for this alternate interface.
* Remove the current alt setting and add the new alt setting. * Remove the current alt setting and add the new alt setting.

View file

@ -37,6 +37,10 @@ static const struct usb_device_id usb_quirk_list[] = {
/* CBM - Flash disk */ /* CBM - Flash disk */
{ USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
/* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */
{ USB_DEVICE(0x0218, 0x0201), .driver_info =
USB_QUIRK_CONFIG_INTF_STRINGS },
/* WORLDE easy key (easykey.25) MIDI controller */ /* WORLDE easy key (easykey.25) MIDI controller */
{ USB_DEVICE(0x0218, 0x0401), .driver_info = { USB_DEVICE(0x0218, 0x0401), .driver_info =
USB_QUIRK_CONFIG_INTF_STRINGS }, USB_QUIRK_CONFIG_INTF_STRINGS },
@ -259,6 +263,9 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x2040, 0x7200), .driver_info = { USB_DEVICE(0x2040, 0x7200), .driver_info =
USB_QUIRK_CONFIG_INTF_STRINGS }, USB_QUIRK_CONFIG_INTF_STRINGS },
/* DJI CineSSD */
{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
/* INTEL VALUE SSD */ /* INTEL VALUE SSD */
{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },

View file

@ -1542,11 +1542,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on)
writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
} else { } else {
writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
stop_activity(dev, dev->driver); stop_activity(dev, NULL);
} }
spin_unlock_irqrestore(&dev->lock, flags); spin_unlock_irqrestore(&dev->lock, flags);
if (!is_on && dev->driver)
dev->driver->disconnect(&dev->gadget);
return 0; return 0;
} }
@ -2425,8 +2428,11 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver)
nuke(&dev->ep[i]); nuke(&dev->ep[i]);
/* report disconnect; the driver is already quiesced */ /* report disconnect; the driver is already quiesced */
if (driver) if (driver) {
spin_unlock(&dev->lock);
driver->disconnect(&dev->gadget); driver->disconnect(&dev->gadget);
spin_lock(&dev->lock);
}
usb_reinit(dev); usb_reinit(dev);
} }
@ -3272,6 +3278,8 @@ next_endpoints:
BIT(PCI_RETRY_ABORT_INTERRUPT)) BIT(PCI_RETRY_ABORT_INTERRUPT))
static void handle_stat1_irqs(struct net2280 *dev, u32 stat) static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
__releases(dev->lock)
__acquires(dev->lock)
{ {
struct net2280_ep *ep; struct net2280_ep *ep;
u32 tmp, num, mask, scratch; u32 tmp, num, mask, scratch;
@ -3312,12 +3320,14 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
if (disconnect || reset) { if (disconnect || reset) {
stop_activity(dev, dev->driver); stop_activity(dev, dev->driver);
ep0_start(dev); ep0_start(dev);
spin_unlock(&dev->lock);
if (reset) if (reset)
usb_gadget_udc_reset usb_gadget_udc_reset
(&dev->gadget, dev->driver); (&dev->gadget, dev->driver);
else else
(dev->driver->disconnect) (dev->driver->disconnect)
(&dev->gadget); (&dev->gadget);
spin_lock(&dev->lock);
return; return;
} }
} }
@ -3336,6 +3346,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT); tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT);
if (stat & tmp) { if (stat & tmp) {
writel(tmp, &dev->regs->irqstat1); writel(tmp, &dev->regs->irqstat1);
spin_unlock(&dev->lock);
if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) { if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) {
if (dev->driver->suspend) if (dev->driver->suspend)
dev->driver->suspend(&dev->gadget); dev->driver->suspend(&dev->gadget);
@ -3346,6 +3357,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
dev->driver->resume(&dev->gadget); dev->driver->resume(&dev->gadget);
/* at high speed, note erratum 0133 */ /* at high speed, note erratum 0133 */
} }
spin_lock(&dev->lock);
stat &= ~tmp; stat &= ~tmp;
} }

View file

@ -2565,7 +2565,7 @@ static int u132_get_frame(struct usb_hcd *hcd)
} else { } else {
int frame = 0; int frame = 0;
dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n");
msleep(100); mdelay(100);
return frame; return frame;
} }
} }

View file

@ -388,7 +388,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch
mask &= 0x0f; mask &= 0x0f;
val &= 0x0f; val &= 0x0f;
d = (priv->reg[1] & (~mask)) ^ val; d = (priv->reg[1] & (~mask)) ^ val;
if (set_1284_register(pp, 2, d, GFP_KERNEL)) if (set_1284_register(pp, 2, d, GFP_ATOMIC))
return 0; return 0;
priv->reg[1] = d; priv->reg[1] = d;
return d & 0xf; return d & 0xf;
@ -398,7 +398,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp)
{ {
unsigned char ret; unsigned char ret;
if (get_1284_register(pp, 1, &ret, GFP_KERNEL)) if (get_1284_register(pp, 1, &ret, GFP_ATOMIC))
return 0; return 0;
return ret & 0xf8; return ret & 0xf8;
} }

View file

@ -439,13 +439,13 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
{ {
struct usb_yurex *dev; struct usb_yurex *dev;
int i, set = 0, retval = 0; int i, set = 0, retval = 0;
char buffer[16]; char buffer[16 + 1];
char *data = buffer; char *data = buffer;
unsigned long long c, c2 = 0; unsigned long long c, c2 = 0;
signed long timeout = 0; signed long timeout = 0;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
count = min(sizeof(buffer), count); count = min(sizeof(buffer) - 1, count);
dev = file->private_data; dev = file->private_data;
/* verify that we actually have some data to write */ /* verify that we actually have some data to write */
@ -464,6 +464,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
retval = -EFAULT; retval = -EFAULT;
goto error; goto error;
} }
buffer[count] = 0;
memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE); memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE);
switch (buffer[0]) { switch (buffer[0]) {

View file

@ -178,7 +178,7 @@ struct ump_interrupt {
} __attribute__((packed)); } __attribute__((packed));
#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) #define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
#define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
#define TIUMP_INTERRUPT_CODE_LSR 0x03 #define TIUMP_INTERRUPT_CODE_LSR 0x03
#define TIUMP_INTERRUPT_CODE_MSR 0x04 #define TIUMP_INTERRUPT_CODE_MSR 0x04

View file

@ -227,7 +227,7 @@ struct ti_interrupt {
} __attribute__((packed)); } __attribute__((packed));
/* Interrupt codes */ /* Interrupt codes */
#define TI_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) #define TI_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01)
#define TI_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) #define TI_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
#define TI_CODE_HARDWARE_ERROR 0xFF #define TI_CODE_HARDWARE_ERROR 0xFF
#define TI_CODE_DATA_ERROR 0x03 #define TI_CODE_DATA_ERROR 0x03

View file

@ -341,6 +341,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
return 0; return 0;
} }
if ((us->fflags & US_FL_NO_ATA_1X) &&
(srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
sizeof(usb_stor_sense_invalidCDB));
srb->result = SAM_STAT_CHECK_CONDITION;
done(srb);
return 0;
}
/* enqueue the command and wake up the control thread */ /* enqueue the command and wake up the control thread */
srb->scsi_done = done; srb->scsi_done = done;
us->srb = srb; us->srb = srb;

View file

@ -2213,6 +2213,13 @@ UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100,
"Micro Mini 1GB", "Micro Mini 1GB",
USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
/* Reported-by: Tim Anderson <tsa@biglakesoftware.com> */
UNUSUAL_DEV( 0x2ca3, 0x0031, 0x0000, 0x9999,
"DJI",
"CineSSD",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NO_ATA_1X),
/* /*
* Nick Bowler <nbowler@elliptictech.com> * Nick Bowler <nbowler@elliptictech.com>
* SCSI stack spams (otherwise harmless) error messages. * SCSI stack spams (otherwise harmless) error messages.

View file

@ -644,7 +644,7 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
* *
* Valid mode specifiers for @mode_option: * Valid mode specifiers for @mode_option:
* *
* <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or * <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][p][m] or
* <name>[-<bpp>][@<refresh>] * <name>[-<bpp>][@<refresh>]
* *
* with <xres>, <yres>, <bpp> and <refresh> decimal numbers and * with <xres>, <yres>, <bpp> and <refresh> decimal numbers and
@ -653,10 +653,10 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
* If 'M' is present after yres (and before refresh/bpp if present), * If 'M' is present after yres (and before refresh/bpp if present),
* the function will compute the timings using VESA(tm) Coordinated * the function will compute the timings using VESA(tm) Coordinated
* Video Timings (CVT). If 'R' is present after 'M', will compute with * Video Timings (CVT). If 'R' is present after 'M', will compute with
* reduced blanking (for flatpanels). If 'i' is present, compute * reduced blanking (for flatpanels). If 'i' or 'p' are present, compute
* interlaced mode. If 'm' is present, add margins equal to 1.8% * interlaced or progressive mode. If 'm' is present, add margins equal
* of xres rounded down to 8 pixels, and 1.8% of yres. The char * to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The chars
* 'i' and 'm' must be after 'M' and 'R'. Example: * 'i', 'p' and 'm' must be after 'M' and 'R'. Example:
* *
* 1024x768MR-8@60m - Reduced blank with margins at 60Hz. * 1024x768MR-8@60m - Reduced blank with margins at 60Hz.
* *
@ -697,7 +697,8 @@ int fb_find_mode(struct fb_var_screeninfo *var,
unsigned int namelen = strlen(name); unsigned int namelen = strlen(name);
int res_specified = 0, bpp_specified = 0, refresh_specified = 0; int res_specified = 0, bpp_specified = 0, refresh_specified = 0;
unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0; unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0;
int yres_specified = 0, cvt = 0, rb = 0, interlace = 0; int yres_specified = 0, cvt = 0, rb = 0;
int interlace_specified = 0, interlace = 0;
int margins = 0; int margins = 0;
u32 best, diff, tdiff; u32 best, diff, tdiff;
@ -748,9 +749,17 @@ int fb_find_mode(struct fb_var_screeninfo *var,
if (!cvt) if (!cvt)
margins = 1; margins = 1;
break; break;
case 'p':
if (!cvt) {
interlace = 0;
interlace_specified = 1;
}
break;
case 'i': case 'i':
if (!cvt) if (!cvt) {
interlace = 1; interlace = 1;
interlace_specified = 1;
}
break; break;
default: default:
goto done; goto done;
@ -819,11 +828,21 @@ done:
if ((name_matches(db[i], name, namelen) || if ((name_matches(db[i], name, namelen) ||
(res_specified && res_matches(db[i], xres, yres))) && (res_specified && res_matches(db[i], xres, yres))) &&
!fb_try_mode(var, info, &db[i], bpp)) { !fb_try_mode(var, info, &db[i], bpp)) {
if (refresh_specified && db[i].refresh == refresh) const int db_interlace = (db[i].vmode &
return 1; FB_VMODE_INTERLACED ? 1 : 0);
int score = abs(db[i].refresh - refresh);
if (abs(db[i].refresh - refresh) < diff) { if (interlace_specified)
diff = abs(db[i].refresh - refresh); score += abs(db_interlace - interlace);
if (!interlace_specified ||
db_interlace == interlace)
if (refresh_specified &&
db[i].refresh == refresh)
return 1;
if (score < diff) {
diff = score;
best = i; best = i;
} }
} }

View file

@ -368,6 +368,7 @@ static int goldfish_fb_remove(struct platform_device *pdev)
dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base, dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base,
fb->fb.fix.smem_start); fb->fb.fix.smem_start);
iounmap(fb->reg_base); iounmap(fb->reg_base);
kfree(fb);
return 0; return 0;
} }

View file

@ -977,7 +977,7 @@ int omapfb_register_client(struct omapfb_notifier_block *omapfb_nb,
{ {
int r; int r;
if ((unsigned)omapfb_nb->plane_idx > OMAPFB_PLANE_NUM) if ((unsigned)omapfb_nb->plane_idx >= OMAPFB_PLANE_NUM)
return -EINVAL; return -EINVAL;
if (!notifier_inited) { if (!notifier_inited) {

View file

@ -19,6 +19,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <linux/compiler.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -1468,7 +1469,7 @@ static const struct file_operations viafb_vt1636_proc_fops = {
#endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
static int viafb_sup_odev_proc_show(struct seq_file *m, void *v) static int __maybe_unused viafb_sup_odev_proc_show(struct seq_file *m, void *v)
{ {
via_odev_to_seq(m, supported_odev_map[ via_odev_to_seq(m, supported_odev_map[
viaparinfo->shared->chip_info.gfx_chip_name]); viaparinfo->shared->chip_info.gfx_chip_name]);

View file

@ -1711,7 +1711,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
const struct user_regset *regset = &view->regsets[i]; const struct user_regset *regset = &view->regsets[i];
do_thread_regset_writeback(t->task, regset); do_thread_regset_writeback(t->task, regset);
if (regset->core_note_type && regset->get && if (regset->core_note_type && regset->get &&
(!regset->active || regset->active(t->task, regset))) { (!regset->active || regset->active(t->task, regset) > 0)) {
int ret; int ret;
size_t size = regset->n * regset->size; size_t size = regset->n * regset->size;
void *data = kmalloc(size, GFP_KERNEL); void *data = kmalloc(size, GFP_KERNEL);

View file

@ -373,8 +373,15 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) + new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) +
pfData->FileNameLength; pfData->FileNameLength;
} else } else {
new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); u32 next_offset = le32_to_cpu(pDirInfo->NextEntryOffset);
if (old_entry + next_offset < old_entry) {
cifs_dbg(VFS, "invalid offset %u\n", next_offset);
return NULL;
}
new_entry = old_entry + next_offset;
}
cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry); cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry);
/* validate that new_entry is not past end of SMB */ /* validate that new_entry is not past end of SMB */
if (new_entry >= end_of_smb) { if (new_entry >= end_of_smb) {

View file

@ -2402,33 +2402,38 @@ num_entries(char *bufstart, char *end_of_buf, char **lastentry, size_t size)
int len; int len;
unsigned int entrycount = 0; unsigned int entrycount = 0;
unsigned int next_offset = 0; unsigned int next_offset = 0;
FILE_DIRECTORY_INFO *entryptr; char *entryptr;
FILE_DIRECTORY_INFO *dir_info;
if (bufstart == NULL) if (bufstart == NULL)
return 0; return 0;
entryptr = (FILE_DIRECTORY_INFO *)bufstart; entryptr = bufstart;
while (1) { while (1) {
entryptr = (FILE_DIRECTORY_INFO *) if (entryptr + next_offset < entryptr ||
((char *)entryptr + next_offset); entryptr + next_offset > end_of_buf ||
entryptr + next_offset + size > end_of_buf) {
if ((char *)entryptr + size > end_of_buf) {
cifs_dbg(VFS, "malformed search entry would overflow\n"); cifs_dbg(VFS, "malformed search entry would overflow\n");
break; break;
} }
len = le32_to_cpu(entryptr->FileNameLength); entryptr = entryptr + next_offset;
if ((char *)entryptr + len + size > end_of_buf) { dir_info = (FILE_DIRECTORY_INFO *)entryptr;
len = le32_to_cpu(dir_info->FileNameLength);
if (entryptr + len < entryptr ||
entryptr + len > end_of_buf ||
entryptr + len + size > end_of_buf) {
cifs_dbg(VFS, "directory entry name would overflow frame end of buf %p\n", cifs_dbg(VFS, "directory entry name would overflow frame end of buf %p\n",
end_of_buf); end_of_buf);
break; break;
} }
*lastentry = (char *)entryptr; *lastentry = entryptr;
entrycount++; entrycount++;
next_offset = le32_to_cpu(entryptr->NextEntryOffset); next_offset = le32_to_cpu(dir_info->NextEntryOffset);
if (!next_offset) if (!next_offset)
break; break;
} }

View file

@ -1476,7 +1476,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift; end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift;
lblock = offset >> shift; lblock = offset >> shift;
lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift; lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
if (lblock_stop > end_of_file) if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex))
return 1; return 1;
size = (lblock_stop - lblock) << shift; size = (lblock_stop - lblock) << shift;

View file

@ -421,7 +421,12 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
vaddr = vmap(pages, page_count, VM_MAP, prot); vaddr = vmap(pages, page_count, VM_MAP, prot);
kfree(pages); kfree(pages);
return vaddr; /*
* Since vmap() uses page granularity, we must add the offset
* into the page here, to get the byte granularity address
* into the mapping to represent the actual "start" location.
*/
return vaddr + offset_in_page(start);
} }
static void *persistent_ram_iomap(phys_addr_t start, size_t size, static void *persistent_ram_iomap(phys_addr_t start, size_t size,
@ -440,6 +445,11 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size,
else else
va = ioremap_wc(start, size); va = ioremap_wc(start, size);
/*
* Since request_mem_region() and ioremap() are byte-granularity
* there is no need handle anything special like we do when the
* vmap() case in persistent_ram_vmap() above.
*/
return va; return va;
} }
@ -460,7 +470,7 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
return -ENOMEM; return -ENOMEM;
} }
prz->buffer = prz->vaddr + offset_in_page(start); prz->buffer = prz->vaddr;
prz->buffer_size = size - sizeof(struct persistent_ram_buffer); prz->buffer_size = size - sizeof(struct persistent_ram_buffer);
return 0; return 0;
@ -507,7 +517,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
if (prz->vaddr) { if (prz->vaddr) {
if (pfn_valid(prz->paddr >> PAGE_SHIFT)) { if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
vunmap(prz->vaddr); /* We must vunmap() at page-granularity. */
vunmap(prz->vaddr - offset_in_page(prz->paddr));
} else { } else {
iounmap(prz->vaddr); iounmap(prz->vaddr);
release_mem_region(prz->paddr, prz->size); release_mem_region(prz->paddr, prz->size);

View file

@ -115,4 +115,23 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr,
#else #else
#define PANIC_CORRUPTION 0 #define PANIC_CORRUPTION 0
#endif /* CONFIG_PANIC_ON_DATA_CORRUPTION */ #endif /* CONFIG_PANIC_ON_DATA_CORRUPTION */
/*
* Since detected data corruption should stop operation on the affected
* structures. Return value must be checked and sanely acted on by caller.
*/
static inline __must_check bool check_data_corruption(bool v) { return v; }
#define CHECK_DATA_CORRUPTION(condition, fmt, ...) \
check_data_corruption(({ \
bool corruption = unlikely(condition); \
if (corruption) { \
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
pr_err(fmt, ##__VA_ARGS__); \
BUG(); \
} else \
WARN(1, fmt, ##__VA_ARGS__); \
} \
corruption; \
}))
#endif /* _LINUX_BUG_H */ #endif /* _LINUX_BUG_H */

View file

@ -28,27 +28,42 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
list->prev = list; list->prev = list;
} }
#ifdef CONFIG_DEBUG_LIST
extern bool __list_add_valid(struct list_head *new,
struct list_head *prev,
struct list_head *next);
extern bool __list_del_entry_valid(struct list_head *entry);
#else
static inline bool __list_add_valid(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
return true;
}
static inline bool __list_del_entry_valid(struct list_head *entry)
{
return true;
}
#endif
/* /*
* Insert a new entry between two known consecutive entries. * Insert a new entry between two known consecutive entries.
* *
* This is only for internal list manipulation where we know * This is only for internal list manipulation where we know
* the prev/next entries already! * the prev/next entries already!
*/ */
#ifndef CONFIG_DEBUG_LIST
static inline void __list_add(struct list_head *new, static inline void __list_add(struct list_head *new,
struct list_head *prev, struct list_head *prev,
struct list_head *next) struct list_head *next)
{ {
if (!__list_add_valid(new, prev, next))
return;
next->prev = new; next->prev = new;
new->next = next; new->next = next;
new->prev = prev; new->prev = prev;
prev->next = new; prev->next = new;
} }
#else
extern void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next);
#endif
/** /**
* list_add - add a new entry * list_add - add a new entry
@ -96,22 +111,20 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
* Note: list_empty() on entry does not return true after this, the entry is * Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state. * in an undefined state.
*/ */
#ifndef CONFIG_DEBUG_LIST
static inline void __list_del_entry(struct list_head *entry) static inline void __list_del_entry(struct list_head *entry)
{ {
if (!__list_del_entry_valid(entry))
return;
__list_del(entry->prev, entry->next); __list_del(entry->prev, entry->next);
} }
static inline void list_del(struct list_head *entry) static inline void list_del(struct list_head *entry)
{ {
__list_del(entry->prev, entry->next); __list_del_entry(entry);
entry->next = LIST_POISON1; entry->next = LIST_POISON1;
entry->prev = LIST_POISON2; entry->prev = LIST_POISON2;
} }
#else
extern void __list_del_entry(struct list_head *entry);
extern void list_del(struct list_head *entry);
#endif
/** /**
* list_replace - replace old entry by new one * list_replace - replace old entry by new one

View file

@ -45,19 +45,17 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
* This is only for internal list manipulation where we know * This is only for internal list manipulation where we know
* the prev/next entries already! * the prev/next entries already!
*/ */
#ifndef CONFIG_DEBUG_LIST
static inline void __list_add_rcu(struct list_head *new, static inline void __list_add_rcu(struct list_head *new,
struct list_head *prev, struct list_head *next) struct list_head *prev, struct list_head *next)
{ {
if (!__list_add_valid(new, prev, next))
return;
new->next = next; new->next = next;
new->prev = prev; new->prev = prev;
rcu_assign_pointer(list_next_rcu(prev), new); rcu_assign_pointer(list_next_rcu(prev), new);
next->prev = new; next->prev = new;
} }
#else
void __list_add_rcu(struct list_head *new,
struct list_head *prev, struct list_head *next);
#endif
/** /**
* list_add_rcu - add a new entry to rcu-protected list * list_add_rcu - add a new entry to rcu-protected list

View file

@ -205,6 +205,26 @@ extern struct trace_event_functions exit_syscall_print_funcs;
} \ } \
static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
/*
* Called before coming back to user-mode. Returning to user-mode with an
* address limit different than USER_DS can allow to overwrite kernel memory.
*/
static inline void addr_limit_user_check(void)
{
#ifdef TIF_FSCHECK
if (!test_thread_flag(TIF_FSCHECK))
return;
#endif
if (CHECK_DATA_CORRUPTION(!segment_eq(get_fs(), USER_DS),
"Invalid address limit on user-mode return"))
force_sig(SIGKILL, current);
#ifdef TIF_FSCHECK
clear_thread_flag(TIF_FSCHECK);
#endif
}
asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special, asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
qid_t id, void __user *addr); qid_t id, void __user *addr);
asmlinkage long sys_time(time_t __user *tloc); asmlinkage long sys_time(time_t __user *tloc);

View file

@ -246,6 +246,15 @@ struct binder_node_debug_info {
__u32 has_weak_ref; __u32 has_weak_ref;
}; };
struct binder_node_info_for_ref {
__u32 handle;
__u32 strong_count;
__u32 weak_count;
__u32 reserved1;
__u32 reserved2;
__u32 reserved3;
};
#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
@ -254,6 +263,7 @@ struct binder_node_debug_info {
#define BINDER_THREAD_EXIT _IOW('b', 8, __s32) #define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
#define BINDER_VERSION _IOWR('b', 9, struct binder_version) #define BINDER_VERSION _IOWR('b', 9, struct binder_version)
#define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info) #define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info)
#define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref)
/* /*
* NOTE: Two special error codes you should check for when calling * NOTE: Two special error codes you should check for when calling

View file

@ -419,6 +419,13 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
struct path parent_path; struct path parent_path;
int h, ret = 0; int h, ret = 0;
/*
* When we will be calling audit_add_to_parent, krule->watch might have
* been updated and watch might have been freed.
* So we need to keep a reference of watch.
*/
audit_get_watch(watch);
mutex_unlock(&audit_filter_mutex); mutex_unlock(&audit_filter_mutex);
/* Avoid calling path_lookup under audit_filter_mutex. */ /* Avoid calling path_lookup under audit_filter_mutex. */
@ -427,8 +434,10 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
/* caller expects mutex locked */ /* caller expects mutex locked */
mutex_lock(&audit_filter_mutex); mutex_lock(&audit_filter_mutex);
if (ret) if (ret) {
audit_put_watch(watch);
return ret; return ret;
}
/* either find an old parent or attach a new one */ /* either find an old parent or attach a new one */
parent = audit_find_parent(d_backing_inode(parent_path.dentry)); parent = audit_find_parent(d_backing_inode(parent_path.dentry));
@ -446,6 +455,7 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
*list = &audit_inode_hash[h]; *list = &audit_inode_hash[h];
error: error:
path_put(&parent_path); path_put(&parent_path);
audit_put_watch(watch);
return ret; return ret;
} }

View file

@ -2000,6 +2000,16 @@ config PANIC_ON_DATA_CORRUPTION
recoverable data corruption scenarios to system-halting panics, recoverable data corruption scenarios to system-halting panics,
for easier detection and debug. for easier detection and debug.
config BUG_ON_DATA_CORRUPTION
bool "Trigger a BUG when data corruption is detected"
select CONFIG_DEBUG_LIST
help
Select this option if the kernel should BUG when it encounters
data corruption in kernel memory structures when they get checked
for validity.
If unsure, say N.
source "samples/Kconfig" source "samples/Kconfig"
source "lib/Kconfig.kgdb" source "lib/Kconfig.kgdb"

View file

@ -2,8 +2,7 @@
* Copyright 2006, Red Hat, Inc., Dave Jones * Copyright 2006, Red Hat, Inc., Dave Jones
* Released under the General Public License (GPL). * Released under the General Public License (GPL).
* *
* This file contains the linked list implementations for * This file contains the linked list validation for DEBUG_LIST.
* DEBUG_LIST.
*/ */
#include <linux/export.h> #include <linux/export.h>
@ -14,94 +13,51 @@
#include <linux/bug.h> #include <linux/bug.h>
/* /*
* Insert a new entry between two known consecutive entries. * Check that the data structures for the list manipulations are reasonably
* * valid. Failures here indicate memory corruption (and possibly an exploit
* This is only for internal list manipulation where we know * attempt).
* the prev/next entries already!
*/ */
void __list_add(struct list_head *new, bool __list_add_valid(struct list_head *new, struct list_head *prev,
struct list_head *prev, struct list_head *next)
struct list_head *next)
{ {
WARN(next->prev != prev, if (CHECK_DATA_CORRUPTION(next->prev != prev,
"list_add corruption. next->prev should be " "list_add corruption. next->prev should be prev (%p), but was %p. (next=%p).\n",
"prev (%p), but was %p. (next=%p).\n", prev, next->prev, next) ||
prev, next->prev, next); CHECK_DATA_CORRUPTION(prev->next != next,
WARN(prev->next != next, "list_add corruption. prev->next should be next (%p), but was %p. (prev=%p).\n",
"list_add corruption. prev->next should be " next, prev->next, prev) ||
"next (%p), but was %p. (prev=%p).\n", CHECK_DATA_CORRUPTION(new == prev || new == next,
next, prev->next, prev); "list_add double add: new=%p, prev=%p, next=%p.\n",
WARN(new == prev || new == next, new, prev, next))
"list_add double add: new=%p, prev=%p, next=%p.\n", return false;
new, prev, next);
BUG_ON((prev->next != next || next->prev != prev || return true;
new == prev || new == next) && PANIC_CORRUPTION);
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
} }
EXPORT_SYMBOL(__list_add); EXPORT_SYMBOL(__list_add_valid);
void __list_del_entry(struct list_head *entry) bool __list_del_entry_valid(struct list_head *entry)
{ {
struct list_head *prev, *next; struct list_head *prev, *next;
prev = entry->prev; prev = entry->prev;
next = entry->next; next = entry->next;
if (WARN(next == LIST_POISON1, if (CHECK_DATA_CORRUPTION(next == LIST_POISON1,
"list_del corruption, %p->next is LIST_POISON1 (%p)\n", "list_del corruption, %p->next is LIST_POISON1 (%p)\n",
entry, LIST_POISON1) || entry, LIST_POISON1) ||
WARN(prev == LIST_POISON2, CHECK_DATA_CORRUPTION(prev == LIST_POISON2,
"list_del corruption, %p->prev is LIST_POISON2 (%p)\n", "list_del corruption, %p->prev is LIST_POISON2 (%p)\n",
entry, LIST_POISON2) || entry, LIST_POISON2) ||
WARN(prev->next != entry, CHECK_DATA_CORRUPTION(prev->next != entry,
"list_del corruption. prev->next should be %p, " "list_del corruption. prev->next should be %p, but was %p\n",
"but was %p\n", entry, prev->next) || entry, prev->next) ||
WARN(next->prev != entry, CHECK_DATA_CORRUPTION(next->prev != entry,
"list_del corruption. next->prev should be %p, " "list_del corruption. next->prev should be %p, but was %p\n",
"but was %p\n", entry, next->prev)) { entry, next->prev))
BUG_ON(PANIC_CORRUPTION); return false;
return;
}
__list_del(prev, next); return true;
}
EXPORT_SYMBOL(__list_del_entry);
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty on entry does not return true after this, the entry is
* in an undefined state.
*/
void list_del(struct list_head *entry)
{
__list_del_entry(entry);
entry->next = LIST_POISON1;
entry->prev = LIST_POISON2;
} }
EXPORT_SYMBOL(list_del); EXPORT_SYMBOL(__list_del_entry_valid);
/*
* RCU variants.
*/
void __list_add_rcu(struct list_head *new,
struct list_head *prev, struct list_head *next)
{
WARN(next->prev != prev,
"list_add_rcu corruption. next->prev should be prev (%p), but was %p. (next=%p).\n",
prev, next->prev, next);
WARN(prev->next != next,
"list_add_rcu corruption. prev->next should be next (%p), but was %p. (prev=%p).\n",
next, prev->next, prev);
new->next = next;
new->prev = prev;
rcu_assign_pointer(list_next_rcu(prev), new);
next->prev = new;
}
EXPORT_SYMBOL(__list_add_rcu);

View file

@ -286,7 +286,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
goto out_unlock; goto out_unlock;
} }
ieee80211_key_free(key, true); ieee80211_key_free(key, sdata->vif.type == NL80211_IFTYPE_STATION);
ret = 0; ret = 0;
out_unlock: out_unlock:

View file

@ -647,11 +647,15 @@ int ieee80211_key_link(struct ieee80211_key *key,
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct ieee80211_key *old_key; struct ieee80211_key *old_key;
int idx, ret; int idx = key->conf.keyidx;
bool pairwise; bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
/*
pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; * We want to delay tailroom updates only for station - in that
idx = key->conf.keyidx; * case it helps roaming speed, but in other cases it hurts and
* can cause warnings to appear.
*/
bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION;
int ret;
mutex_lock(&sdata->local->key_mtx); mutex_lock(&sdata->local->key_mtx);
@ -679,14 +683,14 @@ int ieee80211_key_link(struct ieee80211_key *key,
increment_tailroom_need_count(sdata); increment_tailroom_need_count(sdata);
ieee80211_key_replace(sdata, sta, pairwise, old_key, key); ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
ieee80211_key_destroy(old_key, true); ieee80211_key_destroy(old_key, delay_tailroom);
ieee80211_debugfs_key_add(key); ieee80211_debugfs_key_add(key);
if (!local->wowlan) { if (!local->wowlan) {
ret = ieee80211_key_enable_hw_accel(key); ret = ieee80211_key_enable_hw_accel(key);
if (ret) if (ret)
ieee80211_key_free(key, true); ieee80211_key_free(key, delay_tailroom);
} else { } else {
ret = 0; ret = 0;
} }
@ -874,7 +878,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
ieee80211_key_replace(key->sdata, key->sta, ieee80211_key_replace(key->sdata, key->sta,
key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
key, NULL); key, NULL);
__ieee80211_key_destroy(key, true); __ieee80211_key_destroy(key, key->sdata->vif.type ==
NL80211_IFTYPE_STATION);
} }
for (i = 0; i < NUM_DEFAULT_KEYS; i++) { for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
@ -884,7 +889,8 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
ieee80211_key_replace(key->sdata, key->sta, ieee80211_key_replace(key->sdata, key->sta,
key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE,
key, NULL); key, NULL);
__ieee80211_key_destroy(key, true); __ieee80211_key_destroy(key, key->sdata->vif.type ==
NL80211_IFTYPE_STATION);
} }
mutex_unlock(&local->key_mtx); mutex_unlock(&local->key_mtx);

View file

@ -1846,7 +1846,10 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
/* Try to instantiate a bundle */ /* Try to instantiate a bundle */
err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family); err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
if (err <= 0) { if (err <= 0) {
if (err != 0 && err != -EAGAIN) if (err == 0)
return NULL;
if (err != -EAGAIN)
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR); XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
return ERR_PTR(err); return ERR_PTR(err);
} }

View file

@ -373,3 +373,6 @@ endif
endef endef
# #
############################################################################### ###############################################################################
# delete partially updated (i.e. corrupted) files on error
.DELETE_ON_ERROR:

View file

@ -652,27 +652,33 @@ EXPORT_SYMBOL(snd_interval_refine);
static int snd_interval_refine_first(struct snd_interval *i) static int snd_interval_refine_first(struct snd_interval *i)
{ {
const unsigned int last_max = i->max;
if (snd_BUG_ON(snd_interval_empty(i))) if (snd_BUG_ON(snd_interval_empty(i)))
return -EINVAL; return -EINVAL;
if (snd_interval_single(i)) if (snd_interval_single(i))
return 0; return 0;
i->max = i->min; i->max = i->min;
i->openmax = i->openmin; if (i->openmin)
if (i->openmax)
i->max++; i->max++;
/* only exclude max value if also excluded before refine */
i->openmax = (i->openmax && i->max >= last_max);
return 1; return 1;
} }
static int snd_interval_refine_last(struct snd_interval *i) static int snd_interval_refine_last(struct snd_interval *i)
{ {
const unsigned int last_min = i->min;
if (snd_BUG_ON(snd_interval_empty(i))) if (snd_BUG_ON(snd_interval_empty(i)))
return -EINVAL; return -EINVAL;
if (snd_interval_single(i)) if (snd_interval_single(i))
return 0; return 0;
i->min = i->max; i->min = i->max;
i->openmin = i->openmax; if (i->openmax)
if (i->openmin)
i->min--; i->min--;
/* only exclude min value if also excluded before refine */
i->openmin = (i->openmin && i->min <= last_min);
return 1; return 1;
} }

View file

@ -82,10 +82,10 @@
static void set_default_audio_parameters(struct snd_msnd *chip) static void set_default_audio_parameters(struct snd_msnd *chip)
{ {
chip->play_sample_size = DEFSAMPLESIZE; chip->play_sample_size = snd_pcm_format_width(DEFSAMPLESIZE);
chip->play_sample_rate = DEFSAMPLERATE; chip->play_sample_rate = DEFSAMPLERATE;
chip->play_channels = DEFCHANNELS; chip->play_channels = DEFCHANNELS;
chip->capture_sample_size = DEFSAMPLESIZE; chip->capture_sample_size = snd_pcm_format_width(DEFSAMPLESIZE);
chip->capture_sample_rate = DEFSAMPLERATE; chip->capture_sample_rate = DEFSAMPLERATE;
chip->capture_channels = DEFCHANNELS; chip->capture_channels = DEFCHANNELS;
} }

View file

@ -2875,7 +2875,8 @@ YAMAHA_DEVICE(0x7010, "UB99"),
*/ */
#define AU0828_DEVICE(vid, pid, vname, pname) { \ #define AU0828_DEVICE(vid, pid, vname, pname) { \
USB_DEVICE_VENDOR_SPEC(vid, pid), \ .idVendor = vid, \
.idProduct = pid, \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_CLASS | \ USB_DEVICE_ID_MATCH_INT_CLASS | \
USB_DEVICE_ID_MATCH_INT_SUBCLASS, \ USB_DEVICE_ID_MATCH_INT_SUBCLASS, \

View file

@ -286,7 +286,7 @@ static int kvp_key_delete(int pool, const __u8 *key, int key_size)
* Found a match; just move the remaining * Found a match; just move the remaining
* entries up. * entries up.
*/ */
if (i == num_records) { if (i == (num_records - 1)) {
kvp_file_info[pool].num_records--; kvp_file_info[pool].num_records--;
kvp_update_file(pool); kvp_update_file(pool);
return 0; return 0;

View file

@ -58,9 +58,13 @@ static int check_return_reg(int ra_regno, Dwarf_Frame *frame)
} }
/* /*
* Check if return address is on the stack. * Check if return address is on the stack. If return address
* is in a register (typically R0), it is yet to be saved on
* the stack.
*/ */
if (nops != 0 || ops != NULL) if ((nops != 0 || ops != NULL) &&
!(nops == 1 && ops[0].atom == DW_OP_regx &&
ops[0].number2 == 0 && ops[0].offset == 0))
return 0; return 0;
/* /*
@ -246,7 +250,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
if (!chain || chain->nr < 3) if (!chain || chain->nr < 3)
return skip_slot; return skip_slot;
ip = chain->ips[2]; ip = chain->ips[1];
thread__find_addr_location(thread, PERF_RECORD_MISC_USER, thread__find_addr_location(thread, PERF_RECORD_MISC_USER,
MAP__FUNCTION, ip, &al); MAP__FUNCTION, ip, &al);

View file

@ -146,6 +146,11 @@ int main(int argv, char **argc)
printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000))); printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000)));
if (llabs(eppm - ppm) > 1000) { if (llabs(eppm - ppm) > 1000) {
if (tx1.offset || tx2.offset ||
tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
printf(" [SKIP]\n");
return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
}
printf(" [FAILED]\n"); printf(" [FAILED]\n");
return ksft_exit_fail(); return ksft_exit_fail();
} }