Merge android-4.4.164 (564ce1b) into msm-4.4

* refs/heads/tmp-564ce1b
  Linux 4.4.164
  drm/i915/hdmi: Add HDMI 2.0 audio clock recovery N values
  drm/dp_mst: Check if primary mstb is null
  drm/rockchip: Allow driver to be shutdown on reboot/kexec
  mm: migration: fix migration of huge PMD shared pages
  hugetlbfs: fix kernel BUG at fs/hugetlbfs/inode.c:444!
  configfs: replace strncpy with memcpy
  fuse: fix leaked notify reply
  rtc: hctosys: Add missing range error reporting
  sunrpc: correct the computation for page_ptr when truncating
  mount: Prevent MNT_DETACH from disconnecting locked mounts
  mount: Don't allow copying MNT_UNBINDABLE|MNT_LOCKED mounts
  mount: Retest MNT_LOCKED in do_umount
  ext4: fix buffer leak in __ext4_read_dirblock() on error path
  ext4: fix buffer leak in ext4_xattr_move_to_block() on error path
  ext4: release bs.bh before re-using in ext4_xattr_block_find()
  ext4: fix possible leak of sbi->s_group_desc_leak in error path
  ext4: avoid possible double brelse() in add_new_gdb() on error path
  ext4: fix missing cleanup if ext4_alloc_flex_bg_array() fails while resizing
  ext4: avoid buffer leak in ext4_orphan_add() after prior errors
  ext4: fix possible inode leak in the retry loop of ext4_resize_fs()
  ext4: avoid potential extra brelse in setup_new_flex_group_blocks()
  ext4: add missing brelse() add_new_gdb_meta_bg()'s error path
  ext4: add missing brelse() in set_flexbg_block_bitmap()'s error path
  ext4: add missing brelse() update_backups()'s error path
  clockevents/drivers/i8253: Add support for PIT shutdown quirk
  Btrfs: fix data corruption due to cloning of eof block
  arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
  termios, tty/tty_baudrate.c: fix buffer overrun
  mtd: docg3: don't set conflicting BCH_CONST_PARAMS option
  mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings
  ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
  vhost/scsi: truncate T10 PI iov_iter to prot_bytes
  mach64: fix image corruption due to reading accelerator registers
  mach64: fix display corruption on big endian machines
  libceph: bump CEPH_MSG_MAX_DATA_LEN
  clk: s2mps11: Fix matching when built as module and DT node contains compatible
  xtensa: fix boot parameters address translation
  xtensa: make sure bFLT stack is 16 byte aligned
  xtensa: add NOTES section to the linker script
  MIPS: Loongson-3: Fix BRIDGE irq delivery problem
  MIPS: Loongson-3: Fix CPU UART irq delivery problem
  bna: ethtool: Avoid reading past end of buffer
  e1000: fix race condition between e1000_down() and e1000_watchdog
  e1000: avoid null pointer dereference on invalid stat type
  mm: do not bug_on on incorrect length in __mm_populate()
  fs, elf: make sure to page align bss in load_elf_library
  mm: refuse wrapped vm_brk requests
  binfmt_elf: fix calculations for bss padding
  mm, elf: handle vm_brk error
  fuse: set FR_SENT while locked
  fuse: fix blocked_waitq wakeup
  fuse: Fix use-after-free in fuse_dev_do_write()
  fuse: Fix use-after-free in fuse_dev_do_read()
  scsi: qla2xxx: Fix incorrect port speed being set for FC adapters
  cdrom: fix improper type cast, which can leat to information leak.
  9p: clear dangling pointers in p9stat_free
  9p locks: fix glock.client_id leak in do_lock
  media: tvp5150: fix width alignment during set_selection()
  sc16is7xx: Fix for multi-channel stall
  powerpc/boot: Ensure _zimage_start is a weak symbol
  MIPS: kexec: Mark CPU offline before disabling local IRQ
  media: pci: cx23885: handle adding to list failure
  drm/omap: fix memory barrier bug in DMM driver
  powerpc/nohash: fix undefined behaviour when testing page size support
  tty: check name length in tty_find_polling_driver()
  MD: fix invalid stored role for a disk - try2
  btrfs: set max_extent_size properly
  Btrfs: fix null pointer dereference on compressed write path error
  btrfs: qgroup: Dirty all qgroups before rescan
  Btrfs: fix wrong dentries after fsync of file that got its parent replaced
  btrfs: make sure we create all new block groups
  btrfs: reset max_extent_size on clear in a bitmap
  btrfs: wait on caching when putting the bg cache
  btrfs: don't attempt to trim devices that don't support it
  btrfs: iterate all devices during trim, instead of fs_devices::alloc_list
  btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock
  btrfs: Handle owner mismatch gracefully when walking up tree
  soc/tegra: pmc: Fix child-node lookup
  arm64: dts: stratix10: Correct System Manager register size
  Cramfs: fix abad comparison when wrap-arounds occur
  ext4: avoid running out of journal credits when appending to an inline file
  media: em28xx: make v4l2-compliance happier by starting sequence on zero
  media: em28xx: fix input name for Terratec AV 350
  media: em28xx: use a default format if TRY_FMT fails
  xen: fix xen_qlock_wait()
  kgdboc: Passing ekgdboc to command line causes panic
  TC: Set DMA masks for devices
  MIPS: OCTEON: fix out of bounds array access on CN68XX
  powerpc/msi: Fix compile error on mpc83xx
  dm ioctl: harden copy_params()'s copy_from_user() from malicious users
  lockd: fix access beyond unterminated strings in prints
  nfsd: Fix an Oops in free_session()
  NFSv4.1: Fix the r/wsize checking
  genirq: Fix race on spurious interrupt detection
  printk: Fix panic caused by passing log_buf_len to command line
  smb3: on kerberos mount if server doesn't specify auth type use krb5
  smb3: do not attempt cifs operation in smb3 query info error path
  smb3: allow stats which track session and share reconnects to be reset
  w1: omap-hdq: fix missing bus unregister at removal
  iio: adc: at91: fix wrong channel number in triggered buffer mode
  iio: adc: at91: fix acking DRDY irq on simple conversions
  kbuild: fix kernel/bounds.c 'W=1' warning
  hugetlbfs: dirty pages as they are added to pagecache
  ima: fix showing large 'violations' or 'runtime_measurements_count'
  crypto: lrw - Fix out-of bounds access on counter overflow
  signal/GenWQE: Fix sending of SIGKILL
  PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk
  HID: hiddev: fix potential Spectre v1
  ext4: initialize retries variable in ext4_da_write_inline_data_begin()
  gfs2_meta: ->mount() can get NULL dev_name
  jbd2: fix use after free in jbd2_log_do_checkpoint()
  libnvdimm: Hold reference on parent while scheduling async init
  net/ipv4: defensive cipso option parsing
  xen: make xen_qlock_wait() nestable
  xen: fix race in xen_qlock_wait()
  tpm: Restore functionality to xen vtpm driver.
  xen-swiotlb: use actually allocated size on check physical continuous
  ALSA: hda: Check the non-cached stream buffers more explicitly
  dmaengine: dma-jz4780: Return error if not probed from DT
  signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init
  scsi: lpfc: Correct soft lockup when running mds diagnostics
  uio: ensure class is registered before devices
  driver/dma/ioat: Call del_timer_sync() without holding prep_lock
  usb: chipidea: Prevent unbalanced IRQ disable
  MD: fix invalid stored role for a disk
  ext4: fix argument checking in EXT4_IOC_MOVE_EXT
  tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated
  scsi: megaraid_sas: fix a missing-check bug
  scsi: esp_scsi: Track residual for PIO transfers
  ath10k: schedule hardware restart if WMI command times out
  pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant
  pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant
  pinctrl: qcom: spmi-mpp: Fix drive strength setting
  ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers
  kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()
  pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux
  x86: boot: Fix EFI stub alignment
  Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth
  mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01
  perf tools: Cleanup trace-event-info 'tdata' leak
  perf tools: Free temporary 'sys' string in read_event_files()
  tun: Consistently configure generic netdev params via rtnetlink
  swim: fix cleanup on setup error
  ataflop: fix error handling during setup
  locking/lockdep: Fix debug_locks off performance problem
  selftests: ftrace: Add synthetic event syntax testcase
  net: qla3xxx: Remove overflowing shift statement
  x86/fpu: Remove second definition of fpu in __fpu__restore_sig()
  sparc: Fix single-pcr perf event counter management.
  x86/kconfig: Fall back to ticket spinlocks
  x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided
  ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops
  ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)
  parisc: Fix map_pages() to not overwrite existing pte entries
  parisc: Fix address in HPMC IVA
  ipmi: Fix timer race with module unload
  pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
  jffs2: free jffs2_sb_info through jffs2_kill_sb()
  hwmon: (pmbus) Fix page count auto-detection.
  bcache: fix miss key refill->end in writeback
  ANDROID: zram: set comp_len to PAGE_SIZE when page is huge

Conflicts:
	drivers/hid/usbhid/hiddev.c

Change-Id: I42874613e3b4102ef4ed051e1e8ed25b2d4ae7f2
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
Srinivasarao P 2018-11-21 18:26:28 +05:30
commit f96a043350
149 changed files with 1114 additions and 421 deletions

View file

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

View file

@ -72,9 +72,15 @@
}) })
#define user_termios_to_kernel_termios(k, u) \ #define user_termios_to_kernel_termios(k, u) \
copy_from_user(k, u, sizeof(struct termios)) copy_from_user(k, u, sizeof(struct termios2))
#define kernel_termios_to_user_termios(u, k) \ #define kernel_termios_to_user_termios(u, k) \
copy_to_user(u, k, sizeof(struct termios2))
#define user_termios_to_kernel_termios_1(k, u) \
copy_from_user(k, u, sizeof(struct termios))
#define kernel_termios_to_user_termios_1(u, k) \
copy_to_user(u, k, sizeof(struct termios)) copy_to_user(u, k, sizeof(struct termios))
#endif /* _ALPHA_TERMIOS_H */ #endif /* _ALPHA_TERMIOS_H */

View file

@ -31,6 +31,11 @@
#define TCXONC _IO('t', 30) #define TCXONC _IO('t', 30)
#define TCFLSH _IO('t', 31) #define TCFLSH _IO('t', 31)
#define TCGETS2 _IOR('T', 42, struct termios2)
#define TCSETS2 _IOW('T', 43, struct termios2)
#define TCSETSW2 _IOW('T', 44, struct termios2)
#define TCSETSF2 _IOW('T', 45, struct termios2)
#define TIOCSWINSZ _IOW('t', 103, struct winsize) #define TIOCSWINSZ _IOW('t', 103, struct winsize)
#define TIOCGWINSZ _IOR('t', 104, struct winsize) #define TIOCGWINSZ _IOR('t', 104, struct winsize)
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ #define TIOCSTART _IO('t', 110) /* start output, like ^Q */

View file

@ -25,6 +25,19 @@ struct termios {
speed_t c_ospeed; /* output speed */ speed_t c_ospeed; /* output speed */
}; };
/* Alpha has identical termios and termios2 */
struct termios2 {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_cc[NCCS]; /* control characters */
cc_t c_line; /* line discipline (== c_cc[19]) */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
};
/* Alpha has matching termios and ktermios */ /* Alpha has matching termios and ktermios */
struct ktermios { struct ktermios {
@ -147,6 +160,7 @@ struct ktermios {
#define B3000000 00034 #define B3000000 00034
#define B3500000 00035 #define B3500000 00035
#define B4000000 00036 #define B4000000 00036
#define BOTHER 00037
#define CSIZE 00001400 #define CSIZE 00001400
#define CS5 00000000 #define CS5 00000000
@ -164,6 +178,9 @@ struct ktermios {
#define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CMSPAR 010000000000 /* mark or space (stick) parity */
#define CRTSCTS 020000000000 /* flow control */ #define CRTSCTS 020000000000 /* flow control */
#define CIBAUD 07600000
#define IBSHIFT 16
/* c_lflag bits */ /* c_lflag bits */
#define ISIG 0x00000080 #define ISIG 0x00000080
#define ICANON 0x00000100 #define ICANON 0x00000100

View file

@ -249,7 +249,7 @@
sysmgr: sysmgr@ffd12000 { sysmgr: sysmgr@ffd12000 {
compatible = "altr,sys-mgr", "syscon"; compatible = "altr,sys-mgr", "syscon";
reg = <0xffd12000 0x1000>; reg = <0xffd12000 0x228>;
}; };
/* Local timer */ /* Local timer */

View file

@ -67,7 +67,7 @@ void (*cvmx_override_pko_queue_priority) (int pko_port,
void (*cvmx_override_ipd_port_setup) (int ipd_port); void (*cvmx_override_ipd_port_setup) (int ipd_port);
/* Port count per interface */ /* Port count per interface */
static int interface_port_count[5]; static int interface_port_count[9];
/* Port last configured link info index by IPD/PKO port */ /* Port last configured link info index by IPD/PKO port */
static cvmx_helper_link_info_t static cvmx_helper_link_info_t

View file

@ -9,7 +9,7 @@
#define MIPS_CPU_IRQ_BASE 56 #define MIPS_CPU_IRQ_BASE 56
#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */
#define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ #define LOONGSON_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 3) /* CASCADE */
#define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */
#define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base

View file

@ -34,6 +34,9 @@ static void crash_shutdown_secondary(void *passed_regs)
if (!cpu_online(cpu)) if (!cpu_online(cpu))
return; return;
/* We won't be sent IPIs any more. */
set_cpu_online(cpu, false);
local_irq_disable(); local_irq_disable();
if (!cpumask_test_cpu(cpu, &cpus_in_crash)) if (!cpumask_test_cpu(cpu, &cpus_in_crash))
crash_save_cpu(regs, cpu); crash_save_cpu(regs, cpu);

View file

@ -95,6 +95,9 @@ machine_kexec(struct kimage *image)
*ptr = (unsigned long) phys_to_virt(*ptr); *ptr = (unsigned long) phys_to_virt(*ptr);
} }
/* Mark offline BEFORE disabling local irq. */
set_cpu_online(smp_processor_id(), false);
/* /*
* we do not want to be bothered. * we do not want to be bothered.
*/ */

View file

@ -42,51 +42,8 @@ void mach_irq_dispatch(unsigned int pending)
} }
} }
static struct irqaction cascade_irqaction = { static inline void mask_loongson_irq(struct irq_data *d) { }
.handler = no_action, static inline void unmask_loongson_irq(struct irq_data *d) { }
.flags = IRQF_NO_SUSPEND,
.name = "cascade",
};
static inline void mask_loongson_irq(struct irq_data *d)
{
clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
irq_disable_hazard();
/* Workaround: UART IRQ may deliver to any core */
if (d->irq == LOONGSON_UART_IRQ) {
int cpu = smp_processor_id();
int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node;
int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node;
u64 intenclr_addr = smp_group[node_id] |
(u64)(&LOONGSON_INT_ROUTER_INTENCLR);
u64 introuter_lpc_addr = smp_group[node_id] |
(u64)(&LOONGSON_INT_ROUTER_LPC);
*(volatile u32 *)intenclr_addr = 1 << 10;
*(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id);
}
}
static inline void unmask_loongson_irq(struct irq_data *d)
{
/* Workaround: UART IRQ may deliver to any core */
if (d->irq == LOONGSON_UART_IRQ) {
int cpu = smp_processor_id();
int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node;
int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node;
u64 intenset_addr = smp_group[node_id] |
(u64)(&LOONGSON_INT_ROUTER_INTENSET);
u64 introuter_lpc_addr = smp_group[node_id] |
(u64)(&LOONGSON_INT_ROUTER_LPC);
*(volatile u32 *)intenset_addr = 1 << 10;
*(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id);
}
set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE));
irq_enable_hazard();
}
/* For MIPS IRQs which shared by all cores */ /* For MIPS IRQs which shared by all cores */
static struct irq_chip loongson_irq_chip = { static struct irq_chip loongson_irq_chip = {
@ -124,12 +81,11 @@ void __init mach_init_irq(void)
mips_cpu_irq_init(); mips_cpu_irq_init();
init_i8259_irqs(); init_i8259_irqs();
irq_set_chip_and_handler(LOONGSON_UART_IRQ, irq_set_chip_and_handler(LOONGSON_UART_IRQ,
&loongson_irq_chip, handle_level_irq); &loongson_irq_chip, handle_percpu_irq);
irq_set_chip_and_handler(LOONGSON_BRIDGE_IRQ,
&loongson_irq_chip, handle_percpu_irq);
/* setup HT1 irq */ set_c0_status(STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP6);
setup_irq(LOONGSON_HT1_IRQ, &cascade_irqaction);
set_c0_status(STATUSF_IP2 | STATUSF_IP6);
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU

View file

@ -185,7 +185,7 @@
bv,n 0(%r3) bv,n 0(%r3)
nop nop
.word 0 /* checksum (will be patched) */ .word 0 /* checksum (will be patched) */
.word PA(os_hpmc) /* address of handler */ .word 0 /* address of handler */
.word 0 /* length of handler */ .word 0 /* length of handler */
.endm .endm

View file

@ -829,7 +829,8 @@ void __init initialize_ivt(const void *iva)
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
*ivap++ = 0; *ivap++ = 0;
/* Compute Checksum for HPMC handler */ /* Setup IVA and compute checksum for HPMC handler */
ivap[6] = (u32)__pa(os_hpmc);
length = os_hpmc_size; length = os_hpmc_size;
ivap[7] = length; ivap[7] = length;

View file

@ -491,12 +491,8 @@ static void __init map_pages(unsigned long start_vaddr,
pte = pte_mkhuge(pte); pte = pte_mkhuge(pte);
} }
if (address >= end_paddr) { if (address >= end_paddr)
if (force)
break; break;
else
pte_val(pte) = 0;
}
set_pte(pg_table, pte); set_pte(pg_table, pte);

View file

@ -47,8 +47,10 @@ p_end: .long _end
p_pstack: .long _platform_stack_top p_pstack: .long _platform_stack_top
#endif #endif
.weak _zimage_start
.globl _zimage_start .globl _zimage_start
/* Clang appears to require the .weak directive to be after the symbol
* is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */
.weak _zimage_start
_zimage_start: _zimage_start:
.globl _zimage_start_lib .globl _zimage_start_lib
_zimage_start_lib: _zimage_start_lib:

View file

@ -392,7 +392,14 @@ extern struct bus_type mpic_subsys;
#define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */ #define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */
/* Get the version of primary MPIC */ /* Get the version of primary MPIC */
#ifdef CONFIG_MPIC
extern u32 fsl_mpic_primary_get_version(void); extern u32 fsl_mpic_primary_get_version(void);
#else
static inline u32 fsl_mpic_primary_get_version(void)
{
return 0;
}
#endif
/* Allocate the controller structure and setup the linux irq descs /* Allocate the controller structure and setup the linux irq descs
* for the range if interrupts passed in. No HW initialization is * for the range if interrupts passed in. No HW initialization is

View file

@ -487,6 +487,9 @@ static void setup_page_sizes(void)
for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
struct mmu_psize_def *def = &mmu_psize_defs[psize]; struct mmu_psize_def *def = &mmu_psize_defs[psize];
if (!def->shift)
continue;
if (tlb1ps & (1U << (def->shift - 10))) { if (tlb1ps & (1U << (def->shift - 10))) {
def->flags |= MMU_PAGE_SIZE_DIRECT; def->flags |= MMU_PAGE_SIZE_DIRECT;

View file

@ -926,6 +926,8 @@ static void read_in_all_counters(struct cpu_hw_events *cpuc)
sparc_perf_event_update(cp, &cp->hw, sparc_perf_event_update(cp, &cp->hw,
cpuc->current_idx[i]); cpuc->current_idx[i]);
cpuc->current_idx[i] = PIC_NO_INDEX; cpuc->current_idx[i] = PIC_NO_INDEX;
if (cp->hw.state & PERF_HES_STOPPED)
cp->hw.state |= PERF_HES_ARCH;
} }
} }
} }
@ -958,10 +960,12 @@ static void calculate_single_pcr(struct cpu_hw_events *cpuc)
enc = perf_event_get_enc(cpuc->events[i]); enc = perf_event_get_enc(cpuc->events[i]);
cpuc->pcr[0] &= ~mask_for_index(idx); cpuc->pcr[0] &= ~mask_for_index(idx);
if (hwc->state & PERF_HES_STOPPED) if (hwc->state & PERF_HES_ARCH) {
cpuc->pcr[0] |= nop_for_index(idx); cpuc->pcr[0] |= nop_for_index(idx);
else } else {
cpuc->pcr[0] |= event_encoding(enc, idx); cpuc->pcr[0] |= event_encoding(enc, idx);
hwc->state = 0;
}
} }
out: out:
cpuc->pcr[0] |= cpuc->event[0]->hw.config_base; cpuc->pcr[0] |= cpuc->event[0]->hw.config_base;
@ -987,6 +991,9 @@ static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc)
cpuc->current_idx[i] = idx; cpuc->current_idx[i] = idx;
if (cp->hw.state & PERF_HES_ARCH)
continue;
sparc_pmu_start(cp, PERF_EF_RELOAD); sparc_pmu_start(cp, PERF_EF_RELOAD);
} }
out: out:
@ -1078,6 +1085,8 @@ static void sparc_pmu_start(struct perf_event *event, int flags)
event->hw.state = 0; event->hw.state = 0;
sparc_pmu_enable_event(cpuc, &event->hw, idx); sparc_pmu_enable_event(cpuc, &event->hw, idx);
perf_event_update_userpage(event);
} }
static void sparc_pmu_stop(struct perf_event *event, int flags) static void sparc_pmu_stop(struct perf_event *event, int flags)
@ -1370,9 +1379,9 @@ static int sparc_pmu_add(struct perf_event *event, int ef_flags)
cpuc->events[n0] = event->hw.event_base; cpuc->events[n0] = event->hw.event_base;
cpuc->current_idx[n0] = PIC_NO_INDEX; cpuc->current_idx[n0] = PIC_NO_INDEX;
event->hw.state = PERF_HES_UPTODATE; event->hw.state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
if (!(ef_flags & PERF_EF_START)) if (!(ef_flags & PERF_EF_START))
event->hw.state |= PERF_HES_STOPPED; event->hw.state |= PERF_HES_ARCH;
/* /*
* If group events scheduling transaction was started, * If group events scheduling transaction was started,

View file

@ -43,7 +43,6 @@ config X86
select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_BUILTIN_BSWAP
select ARCH_USE_CMPXCHG_LOCKREF if X86_64 select ARCH_USE_CMPXCHG_LOCKREF if X86_64
select ARCH_USE_QUEUED_RWLOCKS select ARCH_USE_QUEUED_RWLOCKS
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
select ARCH_WANTS_DYNAMIC_TASK_STRUCT select ARCH_WANTS_DYNAMIC_TASK_STRUCT
select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_FRAME_POINTERS

View file

@ -391,6 +391,13 @@ int main(int argc, char ** argv)
die("Unable to mmap '%s': %m", argv[2]); die("Unable to mmap '%s': %m", argv[2]);
/* Number of 16-byte paragraphs, including space for a 4-byte CRC */ /* Number of 16-byte paragraphs, including space for a 4-byte CRC */
sys_size = (sz + 15 + 4) / 16; sys_size = (sz + 15 + 4) / 16;
#ifdef CONFIG_EFI_STUB
/*
* COFF requires minimum 32-byte alignment of sections, and
* adding a signature is problematic without that alignment.
*/
sys_size = (sys_size + 1) & ~1;
#endif
/* Patch the setup code with the appropriate size parameters */ /* Patch the setup code with the appropriate size parameters */
buf[0x1f1] = setup_sectors-1; buf[0x1f1] = setup_sectors-1;

View file

@ -30,6 +30,11 @@ static __init int set_corruption_check(char *arg)
ssize_t ret; ssize_t ret;
unsigned long val; unsigned long val;
if (!arg) {
pr_err("memory_corruption_check config string not provided\n");
return -EINVAL;
}
ret = kstrtoul(arg, 10, &val); ret = kstrtoul(arg, 10, &val);
if (ret) if (ret)
return ret; return ret;
@ -44,6 +49,11 @@ static __init int set_corruption_check_period(char *arg)
ssize_t ret; ssize_t ret;
unsigned long val; unsigned long val;
if (!arg) {
pr_err("memory_corruption_check_period config string not provided\n");
return -EINVAL;
}
ret = kstrtoul(arg, 10, &val); ret = kstrtoul(arg, 10, &val);
if (ret) if (ret)
return ret; return ret;
@ -58,6 +68,11 @@ static __init int set_corruption_check_size(char *arg)
char *end; char *end;
unsigned size; unsigned size;
if (!arg) {
pr_err("memory_corruption_check_size config string not provided\n");
return -EINVAL;
}
size = memparse(arg, &end); size = memparse(arg, &end);
if (*end == '\0') if (*end == '\0')

View file

@ -294,7 +294,6 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
* thread's fpu state, reconstruct fxstate from the fsave * thread's fpu state, reconstruct fxstate from the fsave
* header. Sanitize the copied state etc. * header. Sanitize the copied state etc.
*/ */
struct fpu *fpu = &tsk->thread.fpu;
struct user_i387_ia32_struct env; struct user_i387_ia32_struct env;
int err = 0; int err = 0;

View file

@ -8,6 +8,7 @@
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/atomic.h>
#include <asm/paravirt.h> #include <asm/paravirt.h>
@ -19,6 +20,7 @@
static DEFINE_PER_CPU(int, lock_kicker_irq) = -1; static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
static DEFINE_PER_CPU(char *, irq_name); static DEFINE_PER_CPU(char *, irq_name);
static DEFINE_PER_CPU(atomic_t, xen_qlock_wait_nest);
static bool xen_pvspin = true; static bool xen_pvspin = true;
#ifdef CONFIG_QUEUED_SPINLOCKS #ifdef CONFIG_QUEUED_SPINLOCKS
@ -42,35 +44,26 @@ static void xen_qlock_kick(int cpu)
static void xen_qlock_wait(u8 *byte, u8 val) static void xen_qlock_wait(u8 *byte, u8 val)
{ {
int irq = __this_cpu_read(lock_kicker_irq); int irq = __this_cpu_read(lock_kicker_irq);
atomic_t *nest_cnt = this_cpu_ptr(&xen_qlock_wait_nest);
/* If kicker interrupts not initialized yet, just spin */ /* If kicker interrupts not initialized yet, just spin */
if (irq == -1) if (irq == -1 || in_nmi())
return; return;
/* clear pending */ /* Detect reentry. */
atomic_inc(nest_cnt);
/* If irq pending already and no nested call clear it. */
if (atomic_read(nest_cnt) == 1 && xen_test_irq_pending(irq)) {
xen_clear_irq_pending(irq); xen_clear_irq_pending(irq);
barrier(); } else if (READ_ONCE(*byte) == val) {
/* Block until irq becomes pending (or a spurious wakeup) */
/*
* We check the byte value after clearing pending IRQ to make sure
* that we won't miss a wakeup event because of the clearing.
*
* The sync_clear_bit() call in xen_clear_irq_pending() is atomic.
* So it is effectively a memory barrier for x86.
*/
if (READ_ONCE(*byte) != val)
return;
/*
* If an interrupt happens here, it will leave the wakeup irq
* pending, which will cause xen_poll_irq() to return
* immediately.
*/
/* Block until irq becomes pending (or perhaps a spurious wakeup) */
xen_poll_irq(irq); xen_poll_irq(irq);
} }
atomic_dec(nest_cnt);
}
#else /* CONFIG_QUEUED_SPINLOCKS */ #else /* CONFIG_QUEUED_SPINLOCKS */
enum xen_contention_stat { enum xen_contention_stat {

View file

@ -31,7 +31,7 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs)) $(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary
vmlinux.bin: vmlinux FORCE vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)

View file

@ -24,7 +24,11 @@
# error Linux requires the Xtensa Windowed Registers Option. # error Linux requires the Xtensa Windowed Registers Option.
#endif #endif
#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH /* Xtensa ABI requires stack alignment to be at least 16 */
#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16)
#define ARCH_SLAB_MINALIGN STACK_ALIGN
/* /*
* User space process size: 1 GB. * User space process size: 1 GB.

View file

@ -88,9 +88,12 @@ _SetupMMU:
initialize_mmu initialize_mmu
#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
rsr a2, excsave1 rsr a2, excsave1
movi a3, 0x08000000 movi a3, XCHAL_KSEG_PADDR
bltu a2, a3, 1f
sub a2, a2, a3
movi a3, XCHAL_KSEG_SIZE
bgeu a2, a3, 1f bgeu a2, a3, 1f
movi a3, 0xd0000000 movi a3, XCHAL_KSEG_CACHED_VADDR
add a2, a2, a3 add a2, a2, a3
wsr a2, excsave1 wsr a2, excsave1
1: 1:

View file

@ -110,6 +110,7 @@ SECTIONS
.fixup : { *(.fixup) } .fixup : { *(.fixup) }
EXCEPTION_TABLE(16) EXCEPTION_TABLE(16)
NOTES
/* Data section */ /* Data section */
_sdata = .; _sdata = .;

View file

@ -132,7 +132,12 @@ static inline int get_index128(be128 *block)
return x + ffz(val); return x + ffz(val);
} }
return x; /*
* If we get here, then x == 128 and we are incrementing the counter
* from all ones to all zeros. This means we must return index 127, i.e.
* the one corresponding to key2*{ 1,...,1 }.
*/
return 127;
} }
static int crypt(struct blkcipher_desc *d, static int crypt(struct blkcipher_desc *d,

View file

@ -235,9 +235,11 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "INT33FC", }, { "INT33FC", },
/* Braswell LPSS devices */ /* Braswell LPSS devices */
{ "80862286", LPSS_ADDR(lpss_dma_desc) },
{ "80862288", LPSS_ADDR(bsw_pwm_dev_desc) }, { "80862288", LPSS_ADDR(bsw_pwm_dev_desc) },
{ "8086228A", LPSS_ADDR(bsw_uart_dev_desc) }, { "8086228A", LPSS_ADDR(bsw_uart_dev_desc) },
{ "8086228E", LPSS_ADDR(bsw_spi_dev_desc) }, { "8086228E", LPSS_ADDR(bsw_spi_dev_desc) },
{ "808622C0", LPSS_ADDR(lpss_dma_desc) },
{ "808622C1", LPSS_ADDR(bsw_i2c_dev_desc) }, { "808622C1", LPSS_ADDR(bsw_i2c_dev_desc) },
/* Broadwell LPSS devices */ /* Broadwell LPSS devices */

View file

@ -1933,6 +1933,11 @@ static int __init atari_floppy_init (void)
unit[i].disk = alloc_disk(1); unit[i].disk = alloc_disk(1);
if (!unit[i].disk) if (!unit[i].disk)
goto Enomem; goto Enomem;
unit[i].disk->queue = blk_init_queue(do_fd_request,
&ataflop_lock);
if (!unit[i].disk->queue)
goto Enomem;
} }
if (UseTrackbuffer < 0) if (UseTrackbuffer < 0)
@ -1964,10 +1969,6 @@ static int __init atari_floppy_init (void)
sprintf(unit[i].disk->disk_name, "fd%d", i); sprintf(unit[i].disk->disk_name, "fd%d", i);
unit[i].disk->fops = &floppy_fops; unit[i].disk->fops = &floppy_fops;
unit[i].disk->private_data = &unit[i]; unit[i].disk->private_data = &unit[i];
unit[i].disk->queue = blk_init_queue(do_fd_request,
&ataflop_lock);
if (!unit[i].disk->queue)
goto Enomem;
set_capacity(unit[i].disk, MAX_DISK_SIZE * 2); set_capacity(unit[i].disk, MAX_DISK_SIZE * 2);
add_disk(unit[i].disk); add_disk(unit[i].disk);
} }
@ -1982,13 +1983,17 @@ static int __init atari_floppy_init (void)
return 0; return 0;
Enomem: Enomem:
while (i--) { do {
struct request_queue *q = unit[i].disk->queue; struct gendisk *disk = unit[i].disk;
put_disk(unit[i].disk); if (disk) {
if (q) if (disk->queue) {
blk_cleanup_queue(q); blk_cleanup_queue(disk->queue);
disk->queue = NULL;
} }
put_disk(unit[i].disk);
}
} while (i--);
unregister_blkdev(FLOPPY_MAJOR, "fd"); unregister_blkdev(FLOPPY_MAJOR, "fd");
return -ENOMEM; return -ENOMEM;

View file

@ -868,8 +868,17 @@ static int swim_floppy_init(struct swim_priv *swd)
exit_put_disks: exit_put_disks:
unregister_blkdev(FLOPPY_MAJOR, "fd"); unregister_blkdev(FLOPPY_MAJOR, "fd");
while (drive--) do {
put_disk(swd->unit[drive].disk); struct gendisk *disk = swd->unit[drive].disk;
if (disk) {
if (disk->queue) {
blk_cleanup_queue(disk->queue);
disk->queue = NULL;
}
put_disk(disk);
}
} while (drive--);
return err; return err;
} }

View file

@ -1125,6 +1125,7 @@ compress_again:
} }
if (unlikely(comp_len >= huge_class_size)) { if (unlikely(comp_len >= huge_class_size)) {
comp_len = PAGE_SIZE;
if (zram_wb_enabled(zram) && allow_wb) { if (zram_wb_enabled(zram) && allow_wb) {
zcomp_stream_put(zram->comp); zcomp_stream_put(zram->comp);
ret = write_to_bdev(zram, bvec, index, bio, &element); ret = write_to_bdev(zram, bvec, index, bio, &element);

View file

@ -270,6 +270,7 @@ static const struct {
{ 0x4103, "BCM4330B1" }, /* 002.001.003 */ { 0x4103, "BCM4330B1" }, /* 002.001.003 */
{ 0x410e, "BCM43341B0" }, /* 002.001.014 */ { 0x410e, "BCM43341B0" }, /* 002.001.014 */
{ 0x4406, "BCM4324B3" }, /* 002.004.006 */ { 0x4406, "BCM4324B3" }, /* 002.004.006 */
{ 0x6109, "BCM4335C0" }, /* 003.001.009 */
{ 0x610c, "BCM4354" }, /* 003.001.012 */ { 0x610c, "BCM4354" }, /* 003.001.012 */
{ } { }
}; };

View file

@ -2425,7 +2425,7 @@ static int cdrom_ioctl_select_disc(struct cdrom_device_info *cdi,
return -ENOSYS; return -ENOSYS;
if (arg != CDSL_CURRENT && arg != CDSL_NONE) { if (arg != CDSL_CURRENT && arg != CDSL_NONE) {
if ((int)arg >= cdi->capacity) if (arg >= cdi->capacity)
return -EINVAL; return -EINVAL;
} }

View file

@ -613,6 +613,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
flags = ipmi_ssif_lock_cond(ssif_info, &oflags); flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
ssif_info->waiting_alert = true; ssif_info->waiting_alert = true;
ssif_info->rtc_us_timer = SSIF_MSG_USEC; ssif_info->rtc_us_timer = SSIF_MSG_USEC;
if (!ssif_info->stopping)
mod_timer(&ssif_info->retry_timer, mod_timer(&ssif_info->retry_timer,
jiffies + SSIF_MSG_JIFFIES); jiffies + SSIF_MSG_JIFFIES);
ipmi_ssif_unlock_cond(ssif_info, flags); ipmi_ssif_unlock_cond(ssif_info, flags);
@ -951,6 +952,7 @@ static void msg_written_handler(struct ssif_info *ssif_info, int result,
ssif_info->waiting_alert = true; ssif_info->waiting_alert = true;
ssif_info->retries_left = SSIF_RECV_RETRIES; ssif_info->retries_left = SSIF_RECV_RETRIES;
ssif_info->rtc_us_timer = SSIF_MSG_PART_USEC; ssif_info->rtc_us_timer = SSIF_MSG_PART_USEC;
if (!ssif_info->stopping)
mod_timer(&ssif_info->retry_timer, mod_timer(&ssif_info->retry_timer,
jiffies + SSIF_MSG_PART_JIFFIES); jiffies + SSIF_MSG_PART_JIFFIES);
ipmi_ssif_unlock_cond(ssif_info, flags); ipmi_ssif_unlock_cond(ssif_info, flags);

View file

@ -415,7 +415,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *cmd,
header = cmd; header = cmd;
err = be32_to_cpu(header->return_code); err = be32_to_cpu(header->return_code);
if (err != 0 && desc) if (err != 0 && err != TPM_ERR_DISABLED && err != TPM_ERR_DEACTIVATED
&& desc)
dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err, dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err,
desc); desc);

View file

@ -201,7 +201,7 @@ static int setup_ring(struct xenbus_device *dev, struct tpm_private *priv)
return -ENOMEM; return -ENOMEM;
} }
rv = xenbus_grant_ring(dev, &priv->shr, 1, &gref); rv = xenbus_grant_ring(dev, priv->shr, 1, &gref);
if (rv < 0) if (rv < 0)
return rv; return rv;

View file

@ -297,6 +297,36 @@ static const struct platform_device_id s2mps11_clk_id[] = {
}; };
MODULE_DEVICE_TABLE(platform, s2mps11_clk_id); MODULE_DEVICE_TABLE(platform, s2mps11_clk_id);
#ifdef CONFIG_OF
/*
* Device is instantiated through parent MFD device and device matching is done
* through platform_device_id.
*
* However if device's DT node contains proper clock compatible and driver is
* built as a module, then the *module* matching will be done trough DT aliases.
* This requires of_device_id table. In the same time this will not change the
* actual *device* matching so do not add .of_match_table.
*/
static const struct of_device_id s2mps11_dt_match[] = {
{
.compatible = "samsung,s2mps11-clk",
.data = (void *)S2MPS11X,
}, {
.compatible = "samsung,s2mps13-clk",
.data = (void *)S2MPS13X,
}, {
.compatible = "samsung,s2mps14-clk",
.data = (void *)S2MPS14X,
}, {
.compatible = "samsung,s5m8767-clk",
.data = (void *)S5M8767X,
}, {
/* Sentinel */
},
};
MODULE_DEVICE_TABLE(of, s2mps11_dt_match);
#endif
static struct platform_driver s2mps11_clk_driver = { static struct platform_driver s2mps11_clk_driver = {
.driver = { .driver = {
.name = "s2mps11-clk", .name = "s2mps11-clk",

View file

@ -19,6 +19,13 @@
DEFINE_RAW_SPINLOCK(i8253_lock); DEFINE_RAW_SPINLOCK(i8253_lock);
EXPORT_SYMBOL(i8253_lock); EXPORT_SYMBOL(i8253_lock);
/*
* Handle PIT quirk in pit_shutdown() where zeroing the counter register
* restarts the PIT, negating the shutdown. On platforms with the quirk,
* platform specific code can set this to false.
*/
bool i8253_clear_counter_on_shutdown = true;
#ifdef CONFIG_CLKSRC_I8253 #ifdef CONFIG_CLKSRC_I8253
/* /*
* Since the PIT overflows every tick, its not very useful * Since the PIT overflows every tick, its not very useful
@ -108,8 +115,11 @@ static int pit_shutdown(struct clock_event_device *evt)
raw_spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
outb_p(0x30, PIT_MODE); outb_p(0x30, PIT_MODE);
if (i8253_clear_counter_on_shutdown) {
outb_p(0, PIT_CH0); outb_p(0, PIT_CH0);
outb_p(0, PIT_CH0); outb_p(0, PIT_CH0);
}
raw_spin_unlock(&i8253_lock); raw_spin_unlock(&i8253_lock);
return 0; return 0;

View file

@ -750,6 +750,11 @@ static int jz4780_dma_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
int i, ret; int i, ret;
if (!dev->of_node) {
dev_err(dev, "This driver must be probed from devicetree\n");
return -EINVAL;
}
jzdma = devm_kzalloc(dev, sizeof(*jzdma), GFP_KERNEL); jzdma = devm_kzalloc(dev, sizeof(*jzdma), GFP_KERNEL);
if (!jzdma) if (!jzdma)
return -ENOMEM; return -ENOMEM;

View file

@ -1210,8 +1210,15 @@ static void ioat_shutdown(struct pci_dev *pdev)
spin_lock_bh(&ioat_chan->prep_lock); spin_lock_bh(&ioat_chan->prep_lock);
set_bit(IOAT_CHAN_DOWN, &ioat_chan->state); set_bit(IOAT_CHAN_DOWN, &ioat_chan->state);
del_timer_sync(&ioat_chan->timer);
spin_unlock_bh(&ioat_chan->prep_lock); spin_unlock_bh(&ioat_chan->prep_lock);
/*
* Synchronization rule for del_timer_sync():
* - The caller must not hold locks which would prevent
* completion of the timer's handler.
* So prep_lock cannot be held before calling it.
*/
del_timer_sync(&ioat_chan->timer);
/* this should quiesce then reset */ /* this should quiesce then reset */
ioat_reset_hw(ioat_chan); ioat_reset_hw(ioat_chan);
} }

View file

@ -1225,6 +1225,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
mutex_lock(&mgr->lock); mutex_lock(&mgr->lock);
mstb = mgr->mst_primary; mstb = mgr->mst_primary;
if (!mstb)
goto out;
for (i = 0; i < lct - 1; i++) { for (i = 0; i < lct - 1; i++) {
int shift = (i % 2) ? 0 : 4; int shift = (i % 2) ? 0 : 4;
int port_num = (rad[i / 2] >> shift) & 0xf; int port_num = (rad[i / 2] >> shift) & 0xf;

View file

@ -76,6 +76,9 @@ static const struct {
/* HDMI N/CTS table */ /* HDMI N/CTS table */
#define TMDS_297M 297000 #define TMDS_297M 297000
#define TMDS_296M 296703 #define TMDS_296M 296703
#define TMDS_594M 594000
#define TMDS_593M 593407
static const struct { static const struct {
int sample_rate; int sample_rate;
int clock; int clock;
@ -96,6 +99,20 @@ static const struct {
{ 176400, TMDS_297M, 18816, 247500 }, { 176400, TMDS_297M, 18816, 247500 },
{ 192000, TMDS_296M, 23296, 281250 }, { 192000, TMDS_296M, 23296, 281250 },
{ 192000, TMDS_297M, 20480, 247500 }, { 192000, TMDS_297M, 20480, 247500 },
{ 44100, TMDS_593M, 8918, 937500 },
{ 44100, TMDS_594M, 9408, 990000 },
{ 48000, TMDS_593M, 5824, 562500 },
{ 48000, TMDS_594M, 6144, 594000 },
{ 32000, TMDS_593M, 5824, 843750 },
{ 32000, TMDS_594M, 3072, 445500 },
{ 88200, TMDS_593M, 17836, 937500 },
{ 88200, TMDS_594M, 18816, 990000 },
{ 96000, TMDS_593M, 11648, 562500 },
{ 96000, TMDS_594M, 12288, 594000 },
{ 176400, TMDS_593M, 35672, 937500 },
{ 176400, TMDS_594M, 37632, 990000 },
{ 192000, TMDS_593M, 23296, 562500 },
{ 192000, TMDS_594M, 24576, 594000 },
}; };
/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */

View file

@ -262,6 +262,17 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait)
} }
txn->last_pat->next_pa = 0; txn->last_pat->next_pa = 0;
/* ensure that the written descriptors are visible to DMM */
wmb();
/*
* NOTE: the wmb() above should be enough, but there seems to be a bug
* in OMAP's memory barrier implementation, which in some rare cases may
* cause the writes not to be observable after wmb().
*/
/* read back to ensure the data is in RAM */
readl(&txn->last_pat->next_pa);
/* write to PAT_DESCR to clear out any pending transaction */ /* write to PAT_DESCR to clear out any pending transaction */
writel(0x0, dmm->base + reg[PAT_DESCR][engine->id]); writel(0x0, dmm->base + reg[PAT_DESCR][engine->id]);

View file

@ -547,6 +547,11 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)
return 0; return 0;
} }
static void rockchip_drm_platform_shutdown(struct platform_device *pdev)
{
rockchip_drm_platform_remove(pdev);
}
static const struct of_device_id rockchip_drm_dt_ids[] = { static const struct of_device_id rockchip_drm_dt_ids[] = {
{ .compatible = "rockchip,display-subsystem", }, { .compatible = "rockchip,display-subsystem", },
{ /* sentinel */ }, { /* sentinel */ },
@ -556,6 +561,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);
static struct platform_driver rockchip_drm_platform_driver = { static struct platform_driver rockchip_drm_platform_driver = {
.probe = rockchip_drm_platform_probe, .probe = rockchip_drm_platform_probe,
.remove = rockchip_drm_platform_remove, .remove = rockchip_drm_platform_remove,
.shutdown = rockchip_drm_platform_shutdown,
.driver = { .driver = {
.name = "rockchip-drm", .name = "rockchip-drm",
.of_match_table = rockchip_drm_dt_ids, .of_match_table = rockchip_drm_dt_ids,

View file

@ -522,14 +522,24 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
if (cmd == HIDIOCGCOLLECTIONINDEX) { if (cmd == HIDIOCGCOLLECTIONINDEX) {
if (uref->usage_index >= field->maxusage) if (uref->usage_index >= field->maxusage)
goto inval; goto inval;
uref->usage_index =
array_index_nospec(uref->usage_index,
field->maxusage);
} else if (uref->usage_index >= field->report_count) } else if (uref->usage_index >= field->report_count)
goto inval; goto inval;
if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
(uref_multi->num_values > HID_MAX_MULTI_USAGES || if (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
uref->usage_index + uref_multi->num_values > field->report_count)) uref->usage_index + uref_multi->num_values >
field->report_count)
goto inval; goto inval;
uref->usage_index =
array_index_nospec(uref->usage_index,
field->report_count -
uref_multi->num_values);
}
switch (cmd) { switch (cmd) {
case HIDIOCGUSAGE: case HIDIOCGUSAGE:
uref->value = field->value[uref->usage_index]; uref->value = field->value[uref->usage_index];

View file

@ -117,6 +117,8 @@ static int pmbus_identify(struct i2c_client *client,
} else { } else {
info->pages = 1; info->pages = 1;
} }
pmbus_clear_faults(client);
} }
if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {

View file

@ -1759,7 +1759,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
client->flags |= I2C_CLIENT_PEC; client->flags |= I2C_CLIENT_PEC;
if (data->info->pages)
pmbus_clear_faults(client); pmbus_clear_faults(client);
else
pmbus_clear_fault_page(client, -1);
if (info->identify) { if (info->identify) {
ret = (*info->identify)(client, info); ret = (*info->identify)(client, info);

View file

@ -245,12 +245,14 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p; struct iio_poll_func *pf = p;
struct iio_dev *idev = pf->indio_dev; struct iio_dev *idev = pf->indio_dev;
struct at91_adc_state *st = iio_priv(idev); struct at91_adc_state *st = iio_priv(idev);
struct iio_chan_spec const *chan;
int i, j = 0; int i, j = 0;
for (i = 0; i < idev->masklength; i++) { for (i = 0; i < idev->masklength; i++) {
if (!test_bit(i, idev->active_scan_mask)) if (!test_bit(i, idev->active_scan_mask))
continue; continue;
st->buffer[j] = at91_adc_readl(st, AT91_ADC_CHAN(st, i)); chan = idev->channels + i;
st->buffer[j] = at91_adc_readl(st, AT91_ADC_CHAN(st, chan->channel));
j++; j++;
} }
@ -276,6 +278,8 @@ static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev)
iio_trigger_poll(idev->trig); iio_trigger_poll(idev->trig);
} else { } else {
st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb)); st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb));
/* Needed to ACK the DRDY interruption */
at91_adc_readl(st, AT91_ADC_LCDR);
st->done = true; st->done = true;
wake_up_interruptible(&st->wq_data_avail); wake_up_interruptible(&st->wq_data_avail);
} }

View file

@ -2372,7 +2372,7 @@ static int refill_keybuf_fn(struct btree_op *op, struct btree *b,
struct keybuf *buf = refill->buf; struct keybuf *buf = refill->buf;
int ret = MAP_CONTINUE; int ret = MAP_CONTINUE;
if (bkey_cmp(k, refill->end) >= 0) { if (bkey_cmp(k, refill->end) > 0) {
ret = MAP_DONE; ret = MAP_DONE;
goto out; goto out;
} }

View file

@ -1685,8 +1685,7 @@ static void free_params(struct dm_ioctl *param, size_t param_size, int param_fla
} }
static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kernel, static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kernel,
int ioctl_flags, int ioctl_flags, struct dm_ioctl **param, int *param_flags)
struct dm_ioctl **param, int *param_flags)
{ {
struct dm_ioctl *dmi; struct dm_ioctl *dmi;
int secure_data; int secure_data;
@ -1734,18 +1733,13 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern
return -ENOMEM; return -ENOMEM;
} }
if (copy_from_user(dmi, user, param_kernel->data_size)) /* Copy from param_kernel (which was already copied from user) */
goto bad; memcpy(dmi, param_kernel, minimum_data_size);
if (copy_from_user(&dmi->data, (char __user *)user + minimum_data_size,
param_kernel->data_size - minimum_data_size))
goto bad;
data_copied: data_copied:
/*
* Abort if something changed the ioctl data while it was being copied.
*/
if (dmi->data_size != param_kernel->data_size) {
DMERR("rejecting ioctl: data size modified while processing parameters");
goto bad;
}
/* Wipe the user buffer so we do not return it to userspace */ /* Wipe the user buffer so we do not return it to userspace */
if (secure_data && clear_user(user, param_kernel->data_size)) if (secure_data && clear_user(user, param_kernel->data_size))
goto bad; goto bad;

View file

@ -1605,6 +1605,7 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
*/ */
if (rdev->saved_raid_disk >= 0 && if (rdev->saved_raid_disk >= 0 &&
rdev->saved_raid_disk >= first && rdev->saved_raid_disk >= first &&
rdev->saved_raid_disk < conf->raid_disks &&
conf->mirrors[rdev->saved_raid_disk].rdev == NULL) conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
first = last = rdev->saved_raid_disk; first = last = rdev->saved_raid_disk;

View file

@ -1737,6 +1737,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
first = last = rdev->raid_disk; first = last = rdev->raid_disk;
if (rdev->saved_raid_disk >= first && if (rdev->saved_raid_disk >= first &&
rdev->saved_raid_disk < conf->geo.raid_disks &&
conf->mirrors[rdev->saved_raid_disk].rdev == NULL) conf->mirrors[rdev->saved_raid_disk].rdev == NULL)
mirror = rdev->saved_raid_disk; mirror = rdev->saved_raid_disk;
else else

View file

@ -870,9 +870,6 @@ static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
/* tvp5150 has some special limits */ /* tvp5150 has some special limits */
rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT);
rect.width = clamp_t(unsigned int, rect.width,
TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
TVP5150_H_MAX - rect.left);
rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP); rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP);
/* Calculate height based on current standard */ /* Calculate height based on current standard */
@ -886,9 +883,16 @@ static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
else else
hmax = TVP5150_V_MAX_OTHERS; hmax = TVP5150_V_MAX_OTHERS;
rect.height = clamp_t(unsigned int, rect.height, /*
* alignments:
* - width = 2 due to UYVY colorspace
* - height, image = no special alignment
*/
v4l_bound_align_image(&rect.width,
TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left,
TVP5150_H_MAX - rect.left, 1, &rect.height,
hmax - TVP5150_MAX_CROP_TOP - rect.top, hmax - TVP5150_MAX_CROP_TOP - rect.top,
hmax - rect.top); hmax - rect.top, 0, 0);
tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top);
tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,

View file

@ -660,6 +660,10 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr)
} }
temp_int = append_internal(inter); temp_int = append_internal(inter);
if (!temp_int) {
ret = -ENOMEM;
goto err;
}
inter->filts_used = 1; inter->filts_used = 1;
inter->dev = config->dev; inter->dev = config->dev;
inter->fpga_rw = config->fpga_rw; inter->fpga_rw = config->fpga_rw;
@ -694,6 +698,7 @@ err:
__func__, ret); __func__, ret);
kfree(pid_filt); kfree(pid_filt);
kfree(inter);
return ret; return ret;
} }
@ -728,6 +733,10 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr)
} }
temp_int = append_internal(inter); temp_int = append_internal(inter);
if (!temp_int) {
ret = -ENOMEM;
goto err;
}
inter->cis_used = 1; inter->cis_used = 1;
inter->dev = config->dev; inter->dev = config->dev;
inter->fpga_rw = config->fpga_rw; inter->fpga_rw = config->fpga_rw;
@ -796,6 +805,7 @@ err:
ci_dbg_print("%s: Cannot initialize CI: Error %d.\n", __func__, ret); ci_dbg_print("%s: Cannot initialize CI: Error %d.\n", __func__, ret);
kfree(state); kfree(state);
kfree(inter);
return ret; return ret;
} }

View file

@ -2021,13 +2021,13 @@ struct em28xx_board em28xx_boards[] = {
.input = { { .input = { {
.type = EM28XX_VMUX_COMPOSITE1, .type = EM28XX_VMUX_COMPOSITE1,
.vmux = TVP5150_COMPOSITE1, .vmux = TVP5150_COMPOSITE1,
.amux = EM28XX_AUDIO_SRC_LINE, .amux = EM28XX_AMUX_LINE_IN,
.gpio = terratec_av350_unmute_gpio, .gpio = terratec_av350_unmute_gpio,
}, { }, {
.type = EM28XX_VMUX_SVIDEO, .type = EM28XX_VMUX_SVIDEO,
.vmux = TVP5150_SVIDEO, .vmux = TVP5150_SVIDEO,
.amux = EM28XX_AUDIO_SRC_LINE, .amux = EM28XX_AMUX_LINE_IN,
.gpio = terratec_av350_unmute_gpio, .gpio = terratec_av350_unmute_gpio,
} }, } },
}, },

View file

@ -1149,6 +1149,8 @@ static void em28xx_ctrl_notify(struct v4l2_ctrl *ctrl, void *priv)
{ {
struct em28xx *dev = priv; struct em28xx *dev = priv;
dev->v4l2->field_count = 0;
/* /*
* In the case of non-AC97 volume controls, we still need * In the case of non-AC97 volume controls, we still need
* to do some setups at em28xx, in order to mute/unmute * to do some setups at em28xx, in order to mute/unmute
@ -1288,9 +1290,9 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
fmt = format_by_fourcc(f->fmt.pix.pixelformat); fmt = format_by_fourcc(f->fmt.pix.pixelformat);
if (!fmt) { if (!fmt) {
em28xx_videodbg("Fourcc format (%08x) invalid.\n", fmt = &format[0];
f->fmt.pix.pixelformat); em28xx_videodbg("Fourcc format (%08x) invalid. Using default (%08x).\n",
return -EINVAL; f->fmt.pix.pixelformat, fmt->fourcc);
} }
if (dev->board.is_em2800) { if (dev->board.is_em2800) {

View file

@ -404,7 +404,7 @@ struct genwqe_file {
struct file *filp; struct file *filp;
struct fasync_struct *async_queue; struct fasync_struct *async_queue;
struct task_struct *owner; struct pid *opener;
struct list_head list; /* entry in list of open files */ struct list_head list; /* entry in list of open files */
spinlock_t map_lock; /* lock for dma_mappings */ spinlock_t map_lock; /* lock for dma_mappings */

View file

@ -52,7 +52,7 @@ static void genwqe_add_file(struct genwqe_dev *cd, struct genwqe_file *cfile)
{ {
unsigned long flags; unsigned long flags;
cfile->owner = current; cfile->opener = get_pid(task_tgid(current));
spin_lock_irqsave(&cd->file_lock, flags); spin_lock_irqsave(&cd->file_lock, flags);
list_add(&cfile->list, &cd->file_list); list_add(&cfile->list, &cd->file_list);
spin_unlock_irqrestore(&cd->file_lock, flags); spin_unlock_irqrestore(&cd->file_lock, flags);
@ -65,6 +65,7 @@ static int genwqe_del_file(struct genwqe_dev *cd, struct genwqe_file *cfile)
spin_lock_irqsave(&cd->file_lock, flags); spin_lock_irqsave(&cd->file_lock, flags);
list_del(&cfile->list); list_del(&cfile->list);
spin_unlock_irqrestore(&cd->file_lock, flags); spin_unlock_irqrestore(&cd->file_lock, flags);
put_pid(cfile->opener);
return 0; return 0;
} }
@ -275,7 +276,7 @@ static int genwqe_kill_fasync(struct genwqe_dev *cd, int sig)
return files; return files;
} }
static int genwqe_force_sig(struct genwqe_dev *cd, int sig) static int genwqe_terminate(struct genwqe_dev *cd)
{ {
unsigned int files = 0; unsigned int files = 0;
unsigned long flags; unsigned long flags;
@ -283,7 +284,7 @@ static int genwqe_force_sig(struct genwqe_dev *cd, int sig)
spin_lock_irqsave(&cd->file_lock, flags); spin_lock_irqsave(&cd->file_lock, flags);
list_for_each_entry(cfile, &cd->file_list, list) { list_for_each_entry(cfile, &cd->file_list, list) {
force_sig(sig, cfile->owner); kill_pid(cfile->opener, SIGKILL, 1);
files++; files++;
} }
spin_unlock_irqrestore(&cd->file_lock, flags); spin_unlock_irqrestore(&cd->file_lock, flags);
@ -1356,7 +1357,7 @@ static int genwqe_inform_and_stop_processes(struct genwqe_dev *cd)
dev_warn(&pci_dev->dev, dev_warn(&pci_dev->dev,
"[%s] send SIGKILL and wait ...\n", __func__); "[%s] send SIGKILL and wait ...\n", __func__);
rc = genwqe_force_sig(cd, SIGKILL); /* force terminate */ rc = genwqe_terminate(cd);
if (rc) { if (rc) {
/* Give kill_timout more seconds to end processes */ /* Give kill_timout more seconds to end processes */
for (i = 0; (i < genwqe_kill_timeout) && for (i = 0; (i < genwqe_kill_timeout) &&

View file

@ -334,6 +334,9 @@ int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch);
break; break;
case PCI_DEVICE_ID_O2_SEABIRD0: case PCI_DEVICE_ID_O2_SEABIRD0:
if (chip->pdev->revision == 0x01)
chip->quirks |= SDHCI_QUIRK_DELAY_AFTER_POWER;
/* fall through */
case PCI_DEVICE_ID_O2_SEABIRD1: case PCI_DEVICE_ID_O2_SEABIRD1:
/* UnLock WP */ /* UnLock WP */
ret = pci_read_config_byte(chip->pdev, ret = pci_read_config_byte(chip->pdev,

View file

@ -208,7 +208,7 @@ comment "Disk-On-Chip Device Drivers"
config MTD_DOCG3 config MTD_DOCG3
tristate "M-Systems Disk-On-Chip G3" tristate "M-Systems Disk-On-Chip G3"
select BCH select BCH
select BCH_CONST_PARAMS select BCH_CONST_PARAMS if !MTD_NAND_BCH
select BITREVERSE select BITREVERSE
---help--- ---help---
This provides an MTD device driver for the M-Systems DiskOnChip This provides an MTD device driver for the M-Systems DiskOnChip

View file

@ -556,7 +556,7 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string)
for (i = 0; i < BNAD_ETHTOOL_STATS_NUM; i++) { for (i = 0; i < BNAD_ETHTOOL_STATS_NUM; i++) {
BUG_ON(!(strlen(bnad_net_stats_strings[i]) < BUG_ON(!(strlen(bnad_net_stats_strings[i]) <
ETH_GSTRING_LEN)); ETH_GSTRING_LEN));
memcpy(string, bnad_net_stats_strings[i], strncpy(string, bnad_net_stats_strings[i],
ETH_GSTRING_LEN); ETH_GSTRING_LEN);
string += ETH_GSTRING_LEN; string += ETH_GSTRING_LEN;
} }

View file

@ -1826,11 +1826,12 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
int i; int i;
char *p = NULL;
const struct e1000_stats *stat = e1000_gstrings_stats; const struct e1000_stats *stat = e1000_gstrings_stats;
e1000_update_stats(adapter); e1000_update_stats(adapter);
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++, stat++) {
char *p;
switch (stat->type) { switch (stat->type) {
case NETDEV_STATS: case NETDEV_STATS:
p = (char *)netdev + stat->stat_offset; p = (char *)netdev + stat->stat_offset;
@ -1841,15 +1842,13 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
default: default:
WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n", WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n",
stat->type, i); stat->type, i);
break; continue;
} }
if (stat->sizeof_stat == sizeof(u64)) if (stat->sizeof_stat == sizeof(u64))
data[i] = *(u64 *)p; data[i] = *(u64 *)p;
else else
data[i] = *(u32 *)p; data[i] = *(u32 *)p;
stat++;
} }
/* BUG_ON(i != E1000_STATS_LEN); */ /* BUG_ON(i != E1000_STATS_LEN); */
} }

View file

@ -521,8 +521,6 @@ void e1000_down(struct e1000_adapter *adapter)
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
u32 rctl, tctl; u32 rctl, tctl;
netif_carrier_off(netdev);
/* disable receives in the hardware */ /* disable receives in the hardware */
rctl = er32(RCTL); rctl = er32(RCTL);
ew32(RCTL, rctl & ~E1000_RCTL_EN); ew32(RCTL, rctl & ~E1000_RCTL_EN);
@ -538,6 +536,15 @@ void e1000_down(struct e1000_adapter *adapter)
E1000_WRITE_FLUSH(); E1000_WRITE_FLUSH();
msleep(10); msleep(10);
/* Set the carrier off after transmits have been disabled in the
* hardware, to avoid race conditions with e1000_watchdog() (which
* may be running concurrently to us, checking for the carrier
* bit to decide whether it should enable transmits again). Such
* a race condition would result into transmission being disabled
* in the hardware until the next IFF_DOWN+IFF_UP cycle.
*/
netif_carrier_off(netdev);
napi_disable(&adapter->napi); napi_disable(&adapter->napi);
e1000_irq_disable(adapter); e1000_irq_disable(adapter);

View file

@ -380,8 +380,6 @@ static void fm93c56a_select(struct ql3_adapter *qdev)
qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_1; qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_1;
ql_write_nvram_reg(qdev, spir, ISP_NVRAM_MASK | qdev->eeprom_cmd_data); ql_write_nvram_reg(qdev, spir, ISP_NVRAM_MASK | qdev->eeprom_cmd_data);
ql_write_nvram_reg(qdev, spir,
((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data));
} }
/* /*

View file

@ -1476,6 +1476,8 @@ static void tun_setup(struct net_device *dev)
*/ */
static int tun_validate(struct nlattr *tb[], struct nlattr *data[]) static int tun_validate(struct nlattr *tb[], struct nlattr *data[])
{ {
if (!data)
return 0;
return -EINVAL; return -EINVAL;
} }

View file

@ -1825,6 +1825,12 @@ int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id)
if (ret) if (ret)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
if (ret == -EAGAIN) {
ath10k_warn(ar, "wmi command %d timeout, restarting hardware\n",
cmd_id);
queue_work(ar->workqueue, &ar->restart_work);
}
return ret; return ret;
} }

View file

@ -158,6 +158,8 @@ static void nd_async_device_register(void *d, async_cookie_t cookie)
put_device(dev); put_device(dev);
} }
put_device(dev); put_device(dev);
if (dev->parent)
put_device(dev->parent);
} }
static void nd_async_device_unregister(void *d, async_cookie_t cookie) static void nd_async_device_unregister(void *d, async_cookie_t cookie)
@ -175,6 +177,8 @@ static void nd_async_device_unregister(void *d, async_cookie_t cookie)
void __nd_device_register(struct device *dev) void __nd_device_register(struct device *dev)
{ {
dev->bus = &nvdimm_bus_type; dev->bus = &nvdimm_bus_type;
if (dev->parent)
get_device(dev->parent);
get_device(dev); get_device(dev);
async_schedule_domain(nd_async_device_register, dev, async_schedule_domain(nd_async_device_register, dev,
&nd_async_domain); &nd_async_domain);

View file

@ -3061,7 +3061,11 @@ static void disable_igfx_irq(struct pci_dev *dev)
pci_iounmap(dev, regs); pci_iounmap(dev, regs);
} }
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0042, disable_igfx_irq);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0046, disable_igfx_irq);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x004a, disable_igfx_irq);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0106, disable_igfx_irq);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);

View file

@ -119,6 +119,10 @@
#define RL5C4XX_MISC_CONTROL 0x2F /* 8 bit */ #define RL5C4XX_MISC_CONTROL 0x2F /* 8 bit */
#define RL5C4XX_ZV_ENABLE 0x08 #define RL5C4XX_ZV_ENABLE 0x08
/* Misc Control 3 Register */
#define RL5C4XX_MISC3 0x00A2 /* 16 bit */
#define RL5C47X_MISC3_CB_CLKRUN_DIS BIT(1)
#ifdef __YENTA_H #ifdef __YENTA_H
#define rl_misc(socket) ((socket)->private[0]) #define rl_misc(socket) ((socket)->private[0])
@ -156,6 +160,35 @@ static void ricoh_set_zv(struct yenta_socket *socket)
} }
} }
static void ricoh_set_clkrun(struct yenta_socket *socket, bool quiet)
{
u16 misc3;
/*
* RL5C475II likely has this setting, too, however no datasheet
* is publicly available for this chip
*/
if (socket->dev->device != PCI_DEVICE_ID_RICOH_RL5C476 &&
socket->dev->device != PCI_DEVICE_ID_RICOH_RL5C478)
return;
if (socket->dev->revision < 0x80)
return;
misc3 = config_readw(socket, RL5C4XX_MISC3);
if (misc3 & RL5C47X_MISC3_CB_CLKRUN_DIS) {
if (!quiet)
dev_dbg(&socket->dev->dev,
"CLKRUN feature already disabled\n");
} else if (disable_clkrun) {
if (!quiet)
dev_info(&socket->dev->dev,
"Disabling CLKRUN feature\n");
misc3 |= RL5C47X_MISC3_CB_CLKRUN_DIS;
config_writew(socket, RL5C4XX_MISC3, misc3);
}
}
static void ricoh_save_state(struct yenta_socket *socket) static void ricoh_save_state(struct yenta_socket *socket)
{ {
rl_misc(socket) = config_readw(socket, RL5C4XX_MISC); rl_misc(socket) = config_readw(socket, RL5C4XX_MISC);
@ -172,6 +205,7 @@ static void ricoh_restore_state(struct yenta_socket *socket)
config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket)); config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket));
config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket)); config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket));
config_writew(socket, RL5C4XX_CONFIG, rl_config(socket)); config_writew(socket, RL5C4XX_CONFIG, rl_config(socket));
ricoh_set_clkrun(socket, true);
} }
@ -197,6 +231,7 @@ static int ricoh_override(struct yenta_socket *socket)
config_writew(socket, RL5C4XX_CONFIG, config); config_writew(socket, RL5C4XX_CONFIG, config);
ricoh_set_zv(socket); ricoh_set_zv(socket);
ricoh_set_clkrun(socket, false);
return 0; return 0;
} }

View file

@ -26,7 +26,8 @@
static bool disable_clkrun; static bool disable_clkrun;
module_param(disable_clkrun, bool, 0444); module_param(disable_clkrun, bool, 0444);
MODULE_PARM_DESC(disable_clkrun, "If PC card doesn't function properly, please try this option"); MODULE_PARM_DESC(disable_clkrun,
"If PC card doesn't function properly, please try this option (TI and Ricoh bridges only)");
static bool isa_probe = 1; static bool isa_probe = 1;
module_param(isa_probe, bool, 0444); module_param(isa_probe, bool, 0444);

View file

@ -331,6 +331,8 @@ static int pmic_mpp_set_mux(struct pinctrl_dev *pctldev, unsigned function,
pad->function = function; pad->function = function;
ret = pmic_mpp_write_mode_ctl(state, pad); ret = pmic_mpp_write_mode_ctl(state, pad);
if (ret < 0)
return ret;
val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT; val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT;
@ -355,13 +357,12 @@ static int pmic_mpp_config_get(struct pinctrl_dev *pctldev,
switch (param) { switch (param) {
case PIN_CONFIG_BIAS_DISABLE: case PIN_CONFIG_BIAS_DISABLE:
arg = pad->pullup == PMIC_MPP_PULL_UP_OPEN; if (pad->pullup != PMIC_MPP_PULL_UP_OPEN)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
switch (pad->pullup) { switch (pad->pullup) {
case PMIC_MPP_PULL_UP_OPEN:
arg = 0;
break;
case PMIC_MPP_PULL_UP_0P6KOHM: case PMIC_MPP_PULL_UP_0P6KOHM:
arg = 600; arg = 600;
break; break;
@ -376,13 +377,17 @@ static int pmic_mpp_config_get(struct pinctrl_dev *pctldev,
} }
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;
@ -394,7 +399,9 @@ static int pmic_mpp_config_get(struct pinctrl_dev *pctldev,
arg = pad->amux_input; arg = pad->amux_input;
break; break;
case PMIC_MPP_CONF_PAIRED: case PMIC_MPP_CONF_PAIRED:
arg = pad->paired; if (!pad->paired)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_DRIVE_STRENGTH: case PIN_CONFIG_DRIVE_STRENGTH:
arg = pad->drive_strength; arg = pad->drive_strength;
@ -538,6 +545,10 @@ static int pmic_mpp_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_SINK_CTL, pad->drive_strength);
if (ret < 0)
return ret;
val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT; val = pad->is_enabled << PMIC_MPP_REG_MASTER_EN_SHIFT;
return pmic_mpp_write(state, pad, PMIC_MPP_REG_EN_CTL, val); return pmic_mpp_write(state, pad, PMIC_MPP_REG_EN_CTL, val);

View file

@ -260,22 +260,32 @@ static int pm8xxx_pin_config_get(struct pinctrl_dev *pctldev,
switch (param) { switch (param) {
case PIN_CONFIG_BIAS_DISABLE: case PIN_CONFIG_BIAS_DISABLE:
arg = pin->bias == PM8XXX_GPIO_BIAS_NP; if (pin->bias != PM8XXX_GPIO_BIAS_NP)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_DOWN:
arg = pin->bias == PM8XXX_GPIO_BIAS_PD; if (pin->bias != PM8XXX_GPIO_BIAS_PD)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
arg = pin->bias <= PM8XXX_GPIO_BIAS_PU_1P5_30; if (pin->bias > PM8XXX_GPIO_BIAS_PU_1P5_30)
return -EINVAL;
arg = 1;
break; break;
case PM8XXX_QCOM_PULL_UP_STRENGTH: case PM8XXX_QCOM_PULL_UP_STRENGTH:
arg = pin->pull_up_strength; arg = pin->pull_up_strength;
break; break;
case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
arg = pin->disable; if (!pin->disable)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_INPUT_ENABLE: case PIN_CONFIG_INPUT_ENABLE:
arg = pin->mode == PM8XXX_GPIO_MODE_INPUT; if (pin->mode != PM8XXX_GPIO_MODE_INPUT)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_OUTPUT: case PIN_CONFIG_OUTPUT:
if (pin->mode & PM8XXX_GPIO_MODE_OUTPUT) if (pin->mode & PM8XXX_GPIO_MODE_OUTPUT)
@ -290,10 +300,14 @@ static int pm8xxx_pin_config_get(struct pinctrl_dev *pctldev,
arg = pin->output_strength; arg = pin->output_strength;
break; break;
case PIN_CONFIG_DRIVE_PUSH_PULL: case PIN_CONFIG_DRIVE_PUSH_PULL:
arg = !pin->open_drain; if (pin->open_drain)
return -EINVAL;
arg = 1;
break; break;
case PIN_CONFIG_DRIVE_OPEN_DRAIN: case PIN_CONFIG_DRIVE_OPEN_DRAIN:
arg = pin->open_drain; if (!pin->open_drain)
return -EINVAL;
arg = 1;
break; break;
default: default:
return -EINVAL; return -EINVAL;

View file

@ -50,8 +50,10 @@ static int __init rtc_hctosys(void)
tv64.tv_sec = rtc_tm_to_time64(&tm); tv64.tv_sec = rtc_tm_to_time64(&tm);
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
if (tv64.tv_sec > INT_MAX) if (tv64.tv_sec > INT_MAX) {
err = -ERANGE;
goto err_read; goto err_read;
}
#endif #endif
err = do_settimeofday64(&tv64); err = do_settimeofday64(&tv64);

View file

@ -1349,6 +1349,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent,
bytes_sent = esp->data_dma_len; bytes_sent = esp->data_dma_len;
bytes_sent -= ecount; bytes_sent -= ecount;
bytes_sent -= esp->send_cmd_residual;
/* /*
* The am53c974 has a DMA 'pecularity'. The doc states: * The am53c974 has a DMA 'pecularity'. The doc states:

View file

@ -540,6 +540,8 @@ struct esp {
void *dma; void *dma;
int dmarev; int dmarev;
u32 send_cmd_residual;
}; };
/* A front-end driver for the ESP chip should do the following in /* A front-end driver for the ESP chip should do the following in

View file

@ -3485,6 +3485,7 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba,
struct hbq_dmabuf *dmabuf; struct hbq_dmabuf *dmabuf;
struct lpfc_cq_event *cq_event; struct lpfc_cq_event *cq_event;
unsigned long iflag; unsigned long iflag;
int count = 0;
spin_lock_irqsave(&phba->hbalock, iflag); spin_lock_irqsave(&phba->hbalock, iflag);
phba->hba_flag &= ~HBA_SP_QUEUE_EVT; phba->hba_flag &= ~HBA_SP_QUEUE_EVT;
@ -3506,16 +3507,22 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba,
if (irspiocbq) if (irspiocbq)
lpfc_sli_sp_handle_rspiocb(phba, pring, lpfc_sli_sp_handle_rspiocb(phba, pring,
irspiocbq); irspiocbq);
count++;
break; break;
case CQE_CODE_RECEIVE: case CQE_CODE_RECEIVE:
case CQE_CODE_RECEIVE_V1: case CQE_CODE_RECEIVE_V1:
dmabuf = container_of(cq_event, struct hbq_dmabuf, dmabuf = container_of(cq_event, struct hbq_dmabuf,
cq_event); cq_event);
lpfc_sli4_handle_received_buffer(phba, dmabuf); lpfc_sli4_handle_received_buffer(phba, dmabuf);
count++;
break; break;
default: default:
break; break;
} }
/* Limit the number of events to 64 to avoid soft lockups */
if (count == 64)
break;
} }
} }

View file

@ -426,6 +426,8 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
scsi_esp_cmd(esp, ESP_CMD_TI); scsi_esp_cmd(esp, ESP_CMD_TI);
} }
} }
esp->send_cmd_residual = esp_count;
} }
static int mac_esp_irq_pending(struct esp *esp) static int mac_esp_irq_pending(struct esp *esp)

View file

@ -6510,6 +6510,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
get_user(user_sense_off, &cioc->sense_off)) get_user(user_sense_off, &cioc->sense_off))
return -EFAULT; return -EFAULT;
if (local_sense_off != user_sense_off)
return -EINVAL;
if (local_sense_len) { if (local_sense_len) {
void __user **sense_ioc_ptr = void __user **sense_ioc_ptr =
(void __user **)((u8 *)((unsigned long)&ioc->frame.raw) + local_sense_off); (void __user **)((u8 *)((unsigned long)&ioc->frame.raw) + local_sense_off);

View file

@ -3315,10 +3315,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id,
mcp->mb[0] = MBC_PORT_PARAMS; mcp->mb[0] = MBC_PORT_PARAMS;
mcp->mb[1] = loop_id; mcp->mb[1] = loop_id;
mcp->mb[2] = BIT_0; mcp->mb[2] = BIT_0;
if (IS_CNA_CAPABLE(vha->hw))
mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0);
else
mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0);
mcp->mb[9] = vha->vp_idx; mcp->mb[9] = vha->vp_idx;
mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0;
mcp->in_mb = MBX_3|MBX_1|MBX_0; mcp->in_mb = MBX_3|MBX_1|MBX_0;

View file

@ -738,7 +738,7 @@ void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
if (!pmc->soc->has_tsense_reset) if (!pmc->soc->has_tsense_reset)
return; return;
np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip"); np = of_get_child_by_name(pmc->dev->of_node, "i2c-thermtrip");
if (!np) { if (!np) {
dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled); dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
return; return;

View file

@ -2,7 +2,7 @@
* TURBOchannel bus services. * TURBOchannel bus services.
* *
* Copyright (c) Harald Koerfgen, 1998 * Copyright (c) Harald Koerfgen, 1998
* Copyright (c) 2001, 2003, 2005, 2006 Maciej W. Rozycki * Copyright (c) 2001, 2003, 2005, 2006, 2018 Maciej W. Rozycki
* Copyright (c) 2005 James Simmons * Copyright (c) 2005 James Simmons
* *
* This file is subject to the terms and conditions of the GNU * This file is subject to the terms and conditions of the GNU
@ -10,6 +10,7 @@
* directory of this archive for more details. * directory of this archive for more details.
*/ */
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/dma-mapping.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
@ -92,6 +93,11 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
tdev->dev.bus = &tc_bus_type; tdev->dev.bus = &tc_bus_type;
tdev->slot = slot; tdev->slot = slot;
/* TURBOchannel has 34-bit DMA addressing (16GiB space). */
tdev->dma_mask = DMA_BIT_MASK(34);
tdev->dev.dma_mask = &tdev->dma_mask;
tdev->dev.coherent_dma_mask = DMA_BIT_MASK(34);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
tdev->firmware[i] = tdev->firmware[i] =
readb(module + offset + TC_FIRM_VER + 4 * i); readb(module + offset + TC_FIRM_VER + 4 * i);

View file

@ -133,6 +133,11 @@ static void kgdboc_unregister_kbd(void)
static int kgdboc_option_setup(char *opt) static int kgdboc_option_setup(char *opt)
{ {
if (!opt) {
pr_err("kgdboc: config string not provided\n");
return -EINVAL;
}
if (strlen(opt) >= MAX_CONFIG_LEN) { if (strlen(opt) >= MAX_CONFIG_LEN) {
printk(KERN_ERR "kgdboc: config string too long\n"); printk(KERN_ERR "kgdboc: config string too long\n");
return -ENOSPC; return -ENOSPC;

View file

@ -648,7 +648,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port)
uart_write_wakeup(port); uart_write_wakeup(port);
} }
static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
{ {
struct uart_port *port = &s->p[portno].port; struct uart_port *port = &s->p[portno].port;
@ -657,7 +657,7 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG);
if (iir & SC16IS7XX_IIR_NO_INT_BIT) if (iir & SC16IS7XX_IIR_NO_INT_BIT)
break; return false;
iir &= SC16IS7XX_IIR_ID_MASK; iir &= SC16IS7XX_IIR_ID_MASK;
@ -685,16 +685,23 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
port->line, iir); port->line, iir);
break; break;
} }
} while (1); } while (0);
return true;
} }
static void sc16is7xx_ist(struct kthread_work *ws) static void sc16is7xx_ist(struct kthread_work *ws)
{ {
struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work); struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work);
while (1) {
bool keep_polling = false;
int i; int i;
for (i = 0; i < s->devtype->nr_uart; ++i) for (i = 0; i < s->devtype->nr_uart; ++i)
sc16is7xx_port_irq(s, i); keep_polling |= sc16is7xx_port_irq(s, i);
if (!keep_polling)
break;
}
} }
static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)

View file

@ -357,7 +357,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line)
mutex_lock(&tty_mutex); mutex_lock(&tty_mutex);
/* Search through the tty devices to look for a match */ /* Search through the tty devices to look for a match */
list_for_each_entry(p, &tty_drivers, tty_drivers) { list_for_each_entry(p, &tty_drivers, tty_drivers) {
if (strncmp(name, p->name, len) != 0) if (!len || strncmp(name, p->name, len) != 0)
continue; continue;
stp = str; stp = str;
if (*stp == ',') if (*stp == ',')

View file

@ -330,7 +330,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)
else else
cbaud += 15; cbaud += 15;
} }
return baud_table[cbaud]; return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
} }
EXPORT_SYMBOL(tty_termios_baud_rate); EXPORT_SYMBOL(tty_termios_baud_rate);
@ -366,7 +366,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
else else
cbaud += 15; cbaud += 15;
} }
return baud_table[cbaud]; return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
#else #else
return tty_termios_baud_rate(termios); return tty_termios_baud_rate(termios);
#endif #endif

View file

@ -249,6 +249,8 @@ static struct class uio_class = {
.dev_groups = uio_groups, .dev_groups = uio_groups,
}; };
bool uio_class_registered;
/* /*
* device functions * device functions
*/ */
@ -772,6 +774,9 @@ static int init_uio_class(void)
printk(KERN_ERR "class_register failed for uio\n"); printk(KERN_ERR "class_register failed for uio\n");
goto err_class_register; goto err_class_register;
} }
uio_class_registered = true;
return 0; return 0;
err_class_register: err_class_register:
@ -782,6 +787,7 @@ exit:
static void release_uio_class(void) static void release_uio_class(void)
{ {
uio_class_registered = false;
class_unregister(&uio_class); class_unregister(&uio_class);
uio_major_cleanup(); uio_major_cleanup();
} }
@ -801,6 +807,9 @@ int __uio_register_device(struct module *owner,
struct uio_device *idev; struct uio_device *idev;
int ret = 0; int ret = 0;
if (!uio_class_registered)
return -EPROBE_DEFER;
if (!parent || !info || !info->name || !info->version) if (!parent || !info || !info->name || !info->version)
return -EINVAL; return -EINVAL;

View file

@ -20,7 +20,8 @@ void ci_handle_vbus_change(struct ci_hdrc *ci);
static inline void ci_otg_queue_work(struct ci_hdrc *ci) static inline void ci_otg_queue_work(struct ci_hdrc *ci)
{ {
disable_irq_nosync(ci->irq); disable_irq_nosync(ci->irq);
queue_work(ci->wq, &ci->work); if (queue_work(ci->wq, &ci->work) == false)
enable_irq(ci->irq);
} }
#endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */ #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */

View file

@ -1009,7 +1009,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
prot_bytes = vhost32_to_cpu(vq, v_req_pi.pi_bytesin); prot_bytes = vhost32_to_cpu(vq, v_req_pi.pi_bytesin);
} }
/* /*
* Set prot_iter to data_iter, and advance past any * Set prot_iter to data_iter and truncate it to
* prot_bytes, and advance data_iter past any
* preceeding prot_bytes that may be present. * preceeding prot_bytes that may be present.
* *
* Also fix up the exp_data_len to reflect only the * Also fix up the exp_data_len to reflect only the
@ -1018,6 +1019,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
if (prot_bytes) { if (prot_bytes) {
exp_data_len -= prot_bytes; exp_data_len -= prot_bytes;
prot_iter = data_iter; prot_iter = data_iter;
iov_iter_truncate(&prot_iter, prot_bytes);
iov_iter_advance(&data_iter, prot_bytes); iov_iter_advance(&data_iter, prot_bytes);
} }
tag = vhost64_to_cpu(vq, v_req_pi.tag); tag = vhost64_to_cpu(vq, v_req_pi.tag);

View file

@ -126,7 +126,7 @@ void aty_init_engine(struct atyfb_par *par, struct fb_info *info)
/* set host attributes */ /* set host attributes */
wait_for_fifo(13, par); wait_for_fifo(13, par);
aty_st_le32(HOST_CNTL, 0, par); aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par);
/* set pattern attributes */ /* set pattern attributes */
aty_st_le32(PAT_REG0, 0, par); aty_st_le32(PAT_REG0, 0, par);
@ -232,7 +232,8 @@ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
rotation = rotation24bpp(dx, direction); rotation = rotation24bpp(dx, direction);
} }
wait_for_fifo(4, par); wait_for_fifo(5, par);
aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par);
aty_st_le32(DP_SRC, FRGD_SRC_BLIT, par); aty_st_le32(DP_SRC, FRGD_SRC_BLIT, par);
aty_st_le32(SRC_Y_X, (sx << 16) | sy, par); aty_st_le32(SRC_Y_X, (sx << 16) | sy, par);
aty_st_le32(SRC_HEIGHT1_WIDTH1, (width << 16) | area->height, par); aty_st_le32(SRC_HEIGHT1_WIDTH1, (width << 16) | area->height, par);
@ -268,7 +269,8 @@ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
rotation = rotation24bpp(dx, DST_X_LEFT_TO_RIGHT); rotation = rotation24bpp(dx, DST_X_LEFT_TO_RIGHT);
} }
wait_for_fifo(3, par); wait_for_fifo(4, par);
aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par);
aty_st_le32(DP_FRGD_CLR, color, par); aty_st_le32(DP_FRGD_CLR, color, par);
aty_st_le32(DP_SRC, aty_st_le32(DP_SRC,
BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE, BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE,
@ -283,7 +285,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct atyfb_par *par = (struct atyfb_par *) info->par; struct atyfb_par *par = (struct atyfb_par *) info->par;
u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width; u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width;
u32 pix_width_save, pix_width, host_cntl, rotation = 0, src, mix; u32 pix_width, rotation = 0, src, mix;
if (par->asleep) if (par->asleep)
return; return;
@ -295,8 +297,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
return; return;
} }
pix_width = pix_width_save = aty_ld_le32(DP_PIX_WIDTH, par); pix_width = par->crtc.dp_pix_width;
host_cntl = aty_ld_le32(HOST_CNTL, par) | HOST_BYTE_ALIGN;
switch (image->depth) { switch (image->depth) {
case 1: case 1:
@ -344,7 +345,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
* since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit * since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit
* this hwaccelerated triple has an issue with not aligned data * this hwaccelerated triple has an issue with not aligned data
*/ */
if (M64_HAS(HW_TRIPLE) && image->width % 8 == 0) if (image->depth == 1 && M64_HAS(HW_TRIPLE) && image->width % 8 == 0)
pix_width |= DP_HOST_TRIPLE_EN; pix_width |= DP_HOST_TRIPLE_EN;
} }
@ -369,19 +370,18 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
mix = FRGD_MIX_D_XOR_S | BKGD_MIX_D; mix = FRGD_MIX_D_XOR_S | BKGD_MIX_D;
} }
wait_for_fifo(6, par); wait_for_fifo(5, par);
aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF, par);
aty_st_le32(DP_PIX_WIDTH, pix_width, par); aty_st_le32(DP_PIX_WIDTH, pix_width, par);
aty_st_le32(DP_MIX, mix, par); aty_st_le32(DP_MIX, mix, par);
aty_st_le32(DP_SRC, src, par); aty_st_le32(DP_SRC, src, par);
aty_st_le32(HOST_CNTL, host_cntl, par); aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par);
aty_st_le32(DST_CNTL, DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT | rotation, par); aty_st_le32(DST_CNTL, DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT | rotation, par);
draw_rect(dx, dy, width, image->height, par); draw_rect(dx, dy, width, image->height, par);
src_bytes = (((image->width * image->depth) + 7) / 8) * image->height; src_bytes = (((image->width * image->depth) + 7) / 8) * image->height;
/* manual triple each pixel */ /* manual triple each pixel */
if (info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { if (image->depth == 1 && info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) {
int inbit, outbit, mult24, byte_id_in_dword, width; int inbit, outbit, mult24, byte_id_in_dword, width;
u8 *pbitmapin = (u8*)image->data, *pbitmapout; u8 *pbitmapin = (u8*)image->data, *pbitmapout;
u32 hostdword; u32 hostdword;
@ -414,7 +414,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
} }
} }
wait_for_fifo(1, par); wait_for_fifo(1, par);
aty_st_le32(HOST_DATA0, hostdword, par); aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par);
} }
} else { } else {
u32 *pbitmap, dwords = (src_bytes + 3) / 4; u32 *pbitmap, dwords = (src_bytes + 3) / 4;
@ -423,8 +423,4 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)
aty_st_le32(HOST_DATA0, get_unaligned_le32(pbitmap), par); aty_st_le32(HOST_DATA0, get_unaligned_le32(pbitmap), par);
} }
} }
/* restore pix_width */
wait_for_fifo(1, par);
aty_st_le32(DP_PIX_WIDTH, pix_width_save, par);
} }

View file

@ -785,6 +785,8 @@ static int omap_hdq_remove(struct platform_device *pdev)
/* remove module dependency */ /* remove module dependency */
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
w1_remove_master_device(&omap_w1_master);
return 0; return 0;
} }

View file

@ -310,6 +310,9 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
*/ */
flags &= ~(__GFP_DMA | __GFP_HIGHMEM); flags &= ~(__GFP_DMA | __GFP_HIGHMEM);
/* Convert the size to actually allocated. */
size = 1UL << (order + XEN_PAGE_SHIFT);
/* On ARM this function returns an ioremap'ped virtual address for /* On ARM this function returns an ioremap'ped virtual address for
* which virt_to_phys doesn't return the corresponding physical * which virt_to_phys doesn't return the corresponding physical
* address. In fact on ARM virt_to_phys only works for kernel direct * address. In fact on ARM virt_to_phys only works for kernel direct
@ -359,6 +362,9 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
* physical address */ * physical address */
phys = xen_bus_to_phys(dev_addr); phys = xen_bus_to_phys(dev_addr);
/* Convert the size to actually allocated. */
size = 1UL << (order + XEN_PAGE_SHIFT);
if (((dev_addr + size - 1 <= dma_mask)) || if (((dev_addr + size - 1 <= dma_mask)) ||
range_straddles_page_boundary(phys, size)) range_straddles_page_boundary(phys, size))
xen_destroy_contiguous_region(phys, order); xen_destroy_contiguous_region(phys, order);

View file

@ -204,6 +204,14 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
break; break;
if (schedule_timeout_interruptible(P9_LOCK_TIMEOUT) != 0) if (schedule_timeout_interruptible(P9_LOCK_TIMEOUT) != 0)
break; break;
/*
* p9_client_lock_dotl overwrites flock.client_id with the
* server message, free and reuse the client name
*/
if (flock.client_id != fid->clnt->name) {
kfree(flock.client_id);
flock.client_id = fid->clnt->name;
}
} }
/* map 9p status to VFS status */ /* map 9p status to VFS status */
@ -235,6 +243,8 @@ out_unlock:
locks_lock_file_wait(filp, fl); locks_lock_file_wait(filp, fl);
fl->fl_type = fl_type; fl->fl_type = fl_type;
} }
if (flock.client_id != fid->clnt->name)
kfree(flock.client_id);
out: out:
return res; return res;
} }
@ -269,7 +279,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl)
res = p9_client_getlock_dotl(fid, &glock); res = p9_client_getlock_dotl(fid, &glock);
if (res < 0) if (res < 0)
return res; goto out;
/* map 9p lock type to os lock type */ /* map 9p lock type to os lock type */
switch (glock.type) { switch (glock.type) {
case P9_LOCK_TYPE_RDLCK: case P9_LOCK_TYPE_RDLCK:
@ -290,6 +300,8 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl)
fl->fl_end = glock.start + glock.length - 1; fl->fl_end = glock.start + glock.length - 1;
fl->fl_pid = glock.proc_id; fl->fl_pid = glock.proc_id;
} }
out:
if (glock.client_id != fid->clnt->name)
kfree(glock.client_id); kfree(glock.client_id);
return res; return res;
} }

View file

@ -606,28 +606,30 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
* Do the same thing for the memory mapping - between * Do the same thing for the memory mapping - between
* elf_bss and last_bss is the bss section. * elf_bss and last_bss is the bss section.
*/ */
k = load_addr + eppnt->p_memsz + eppnt->p_vaddr; k = load_addr + eppnt->p_vaddr + eppnt->p_memsz;
if (k > last_bss) if (k > last_bss)
last_bss = k; last_bss = k;
} }
} }
if (last_bss > elf_bss) {
/* /*
* Now fill out the bss section. First pad the last page up * Now fill out the bss section: first pad the last page from
* to the page boundary, and then perform a mmap to make sure * the file up to the page boundary, and zero it from elf_bss
* that there are zero-mapped pages up to and including the * up to the end of the page.
* last bss page.
*/ */
if (padzero(elf_bss)) { if (padzero(elf_bss)) {
error = -EFAULT; error = -EFAULT;
goto out; goto out;
} }
/*
/* What we have mapped so far */ * Next, align both the file and mem bss up to the page size,
elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); * since this is where elf_bss was just zeroed up to, and where
* last_bss will end after the vm_brk() below.
/* Map the last of the bss segment */ */
elf_bss = ELF_PAGEALIGN(elf_bss);
last_bss = ELF_PAGEALIGN(last_bss);
/* Finally, if there is still more bss to allocate, do it. */
if (last_bss > elf_bss) {
error = vm_brk(elf_bss, last_bss - elf_bss); error = vm_brk(elf_bss, last_bss - elf_bss);
if (BAD_ADDR(error)) if (BAD_ADDR(error))
goto out; goto out;
@ -1216,11 +1218,13 @@ static int load_elf_library(struct file *file)
goto out_free_ph; goto out_free_ph;
} }
len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + len = ELF_PAGEALIGN(eppnt->p_filesz + eppnt->p_vaddr);
ELF_MIN_ALIGN - 1); bss = ELF_PAGEALIGN(eppnt->p_memsz + eppnt->p_vaddr);
bss = eppnt->p_memsz + eppnt->p_vaddr; if (bss > len) {
if (bss > len) error = vm_brk(len, bss - len);
vm_brk(len, bss - len); if (BAD_ADDR(error))
goto out_free_ph;
}
error = 0; error = 0;
out_free_ph: out_free_ph:

View file

@ -7835,6 +7835,20 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
buf = btrfs_find_create_tree_block(root, bytenr); buf = btrfs_find_create_tree_block(root, bytenr);
if (!buf) if (!buf)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
/*
* Extra safety check in case the extent tree is corrupted and extent
* allocator chooses to use a tree block which is already used and
* locked.
*/
if (buf->lock_owner == current->pid) {
btrfs_err_rl(root->fs_info,
"tree block %llu owner %llu already locked by pid=%d, extent tree corruption detected",
buf->start, btrfs_header_owner(buf), current->pid);
free_extent_buffer(buf);
return ERR_PTR(-EUCLEAN);
}
btrfs_set_header_generation(buf, trans->transid); btrfs_set_header_generation(buf, trans->transid);
btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
btrfs_tree_lock(buf); btrfs_tree_lock(buf);
@ -8704,15 +8718,14 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
if (eb == root->node) { if (eb == root->node) {
if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF) if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF)
parent = eb->start; parent = eb->start;
else else if (root->root_key.objectid != btrfs_header_owner(eb))
BUG_ON(root->root_key.objectid != goto owner_mismatch;
btrfs_header_owner(eb));
} else { } else {
if (wc->flags[level + 1] & BTRFS_BLOCK_FLAG_FULL_BACKREF) if (wc->flags[level + 1] & BTRFS_BLOCK_FLAG_FULL_BACKREF)
parent = path->nodes[level + 1]->start; parent = path->nodes[level + 1]->start;
else else if (root->root_key.objectid !=
BUG_ON(root->root_key.objectid != btrfs_header_owner(path->nodes[level + 1]))
btrfs_header_owner(path->nodes[level + 1])); goto owner_mismatch;
} }
btrfs_free_tree_block(trans, root, eb, parent, wc->refs[level] == 1); btrfs_free_tree_block(trans, root, eb, parent, wc->refs[level] == 1);
@ -8720,6 +8733,11 @@ out:
wc->refs[level] = 0; wc->refs[level] = 0;
wc->flags[level] = 0; wc->flags[level] = 0;
return 0; return 0;
owner_mismatch:
btrfs_err_rl(root->fs_info, "unexpected tree owner, have %llu expect %llu",
btrfs_header_owner(eb), root->root_key.objectid);
return -EUCLEAN;
} }
static noinline int walk_down_tree(struct btrfs_trans_handle *trans, static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
@ -8773,6 +8791,8 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
ret = walk_up_proc(trans, root, path, wc); ret = walk_up_proc(trans, root, path, wc);
if (ret > 0) if (ret > 0)
return 0; return 0;
if (ret < 0)
return ret;
if (path->locks[level]) { if (path->locks[level]) {
btrfs_tree_unlock_rw(path->nodes[level], btrfs_tree_unlock_rw(path->nodes[level],
@ -9501,6 +9521,7 @@ void btrfs_put_block_group_cache(struct btrfs_fs_info *info)
block_group = btrfs_lookup_first_block_group(info, last); block_group = btrfs_lookup_first_block_group(info, last);
while (block_group) { while (block_group) {
wait_block_group_cache_done(block_group);
spin_lock(&block_group->lock); spin_lock(&block_group->lock);
if (block_group->iref) if (block_group->iref)
break; break;
@ -9891,7 +9912,7 @@ error:
void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans, void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
struct btrfs_root *root) struct btrfs_root *root)
{ {
struct btrfs_block_group_cache *block_group, *tmp; struct btrfs_block_group_cache *block_group;
struct btrfs_root *extent_root = root->fs_info->extent_root; struct btrfs_root *extent_root = root->fs_info->extent_root;
struct btrfs_block_group_item item; struct btrfs_block_group_item item;
struct btrfs_key key; struct btrfs_key key;
@ -9899,7 +9920,10 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
bool can_flush_pending_bgs = trans->can_flush_pending_bgs; bool can_flush_pending_bgs = trans->can_flush_pending_bgs;
trans->can_flush_pending_bgs = false; trans->can_flush_pending_bgs = false;
list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) { while (!list_empty(&trans->new_bgs)) {
block_group = list_first_entry(&trans->new_bgs,
struct btrfs_block_group_cache,
bg_list);
if (ret) if (ret)
goto next; goto next;
@ -10609,6 +10633,10 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
*trimmed = 0; *trimmed = 0;
/* Discard not supported = nothing to do. */
if (!blk_queue_discard(bdev_get_queue(device->bdev)))
return 0;
/* Not writeable = nothing to do. */ /* Not writeable = nothing to do. */
if (!device->writeable) if (!device->writeable)
return 0; return 0;
@ -10731,8 +10759,8 @@ int btrfs_trim_fs(struct btrfs_root *root, struct fstrim_range *range)
} }
mutex_lock(&root->fs_info->fs_devices->device_list_mutex); mutex_lock(&root->fs_info->fs_devices->device_list_mutex);
devices = &root->fs_info->fs_devices->alloc_list; devices = &root->fs_info->fs_devices->devices;
list_for_each_entry(device, devices, dev_alloc_list) { list_for_each_entry(device, devices, dev_list) {
ret = btrfs_trim_free_extents(device, range->minlen, ret = btrfs_trim_free_extents(device, range->minlen,
&group_trimmed); &group_trimmed);
if (ret) if (ret)

View file

@ -1699,6 +1699,8 @@ static inline void __bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
bitmap_clear(info->bitmap, start, count); bitmap_clear(info->bitmap, start, count);
info->bytes -= bytes; info->bytes -= bytes;
if (info->max_extent_size > ctl->unit)
info->max_extent_size = 0;
} }
static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl, static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
@ -1782,6 +1784,13 @@ static int search_bitmap(struct btrfs_free_space_ctl *ctl,
return -1; return -1;
} }
static inline u64 get_max_extent_size(struct btrfs_free_space *entry)
{
if (entry->bitmap)
return entry->max_extent_size;
return entry->bytes;
}
/* Cache the size of the max extent in bytes */ /* Cache the size of the max extent in bytes */
static struct btrfs_free_space * static struct btrfs_free_space *
find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes, find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
@ -1803,8 +1812,8 @@ find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
for (node = &entry->offset_index; node; node = rb_next(node)) { for (node = &entry->offset_index; node; node = rb_next(node)) {
entry = rb_entry(node, struct btrfs_free_space, offset_index); entry = rb_entry(node, struct btrfs_free_space, offset_index);
if (entry->bytes < *bytes) { if (entry->bytes < *bytes) {
if (entry->bytes > *max_extent_size) *max_extent_size = max(get_max_extent_size(entry),
*max_extent_size = entry->bytes; *max_extent_size);
continue; continue;
} }
@ -1822,8 +1831,8 @@ find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
} }
if (entry->bytes < *bytes + align_off) { if (entry->bytes < *bytes + align_off) {
if (entry->bytes > *max_extent_size) *max_extent_size = max(get_max_extent_size(entry),
*max_extent_size = entry->bytes; *max_extent_size);
continue; continue;
} }
@ -1835,8 +1844,10 @@ find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
*offset = tmp; *offset = tmp;
*bytes = size; *bytes = size;
return entry; return entry;
} else if (size > *max_extent_size) { } else {
*max_extent_size = size; *max_extent_size =
max(get_max_extent_size(entry),
*max_extent_size);
} }
continue; continue;
} }
@ -2694,8 +2705,8 @@ static u64 btrfs_alloc_from_bitmap(struct btrfs_block_group_cache *block_group,
err = search_bitmap(ctl, entry, &search_start, &search_bytes, true); err = search_bitmap(ctl, entry, &search_start, &search_bytes, true);
if (err) { if (err) {
if (search_bytes > *max_extent_size) *max_extent_size = max(get_max_extent_size(entry),
*max_extent_size = search_bytes; *max_extent_size);
return 0; return 0;
} }
@ -2732,8 +2743,9 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group_cache *block_group,
entry = rb_entry(node, struct btrfs_free_space, offset_index); entry = rb_entry(node, struct btrfs_free_space, offset_index);
while (1) { while (1) {
if (entry->bytes < bytes && entry->bytes > *max_extent_size) if (entry->bytes < bytes)
*max_extent_size = entry->bytes; *max_extent_size = max(get_max_extent_size(entry),
*max_extent_size);
if (entry->bytes < bytes || if (entry->bytes < bytes ||
(!entry->bitmap && entry->offset < min_start)) { (!entry->bitmap && entry->offset < min_start)) {

View file

@ -481,6 +481,7 @@ again:
pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
if (!pages) { if (!pages) {
/* just bail out to the uncompressed code */ /* just bail out to the uncompressed code */
nr_pages = 0;
goto cont; goto cont;
} }

View file

@ -3950,9 +3950,17 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
goto out_unlock; goto out_unlock;
if (len == 0) if (len == 0)
olen = len = src->i_size - off; olen = len = src->i_size - off;
/* if we extend to eof, continue to block boundary */ /*
if (off + len == src->i_size) * If we extend to eof, continue to block boundary if and only if the
* destination end offset matches the destination file's size, otherwise
* we would be corrupting data by placing the eof block into the middle
* of a file.
*/
if (off + len == src->i_size) {
if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size)
goto out_unlock;
len = ALIGN(src->i_size, bs) - off; len = ALIGN(src->i_size, bs) - off;
}
if (len == 0) { if (len == 0) {
ret = 0; ret = 0;

View file

@ -2446,6 +2446,7 @@ qgroup_rescan_zero_tracking(struct btrfs_fs_info *fs_info)
qgroup->rfer_cmpr = 0; qgroup->rfer_cmpr = 0;
qgroup->excl = 0; qgroup->excl = 0;
qgroup->excl_cmpr = 0; qgroup->excl_cmpr = 0;
qgroup_dirty(fs_info, qgroup);
} }
spin_unlock(&fs_info->qgroup_lock); spin_unlock(&fs_info->qgroup_lock);
} }

View file

@ -1318,7 +1318,7 @@ static void __del_reloc_root(struct btrfs_root *root)
struct mapping_node *node = NULL; struct mapping_node *node = NULL;
struct reloc_control *rc = root->fs_info->reloc_ctl; struct reloc_control *rc = root->fs_info->reloc_ctl;
if (rc) { if (rc && root->node) {
spin_lock(&rc->reloc_root_tree.lock); spin_lock(&rc->reloc_root_tree.lock);
rb_node = tree_search(&rc->reloc_root_tree.rb_root, rb_node = tree_search(&rc->reloc_root_tree.rb_root,
root->node->start); root->node->start);

View file

@ -5240,9 +5240,33 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
dir_inode = btrfs_iget(root->fs_info->sb, &inode_key, dir_inode = btrfs_iget(root->fs_info->sb, &inode_key,
root, NULL); root, NULL);
/* If parent inode was deleted, skip it. */ /*
if (IS_ERR(dir_inode)) * If the parent inode was deleted, return an error to
continue; * fallback to a transaction commit. This is to prevent
* getting an inode that was moved from one parent A to
* a parent B, got its former parent A deleted and then
* it got fsync'ed, from existing at both parents after
* a log replay (and the old parent still existing).
* Example:
*
* mkdir /mnt/A
* mkdir /mnt/B
* touch /mnt/B/bar
* sync
* mv /mnt/B/bar /mnt/A/bar
* mv -T /mnt/A /mnt/B
* fsync /mnt/B/bar
* <power fail>
*
* If we ignore the old parent B which got deleted,
* after a log replay we would have file bar linked
* at both parents and the old parent B would still
* exist.
*/
if (IS_ERR(dir_inode)) {
ret = PTR_ERR(dir_inode);
goto out;
}
ret = btrfs_log_inode(trans, root, dir_inode, ret = btrfs_log_inode(trans, root, dir_inode,
LOG_INODE_ALL, 0, LLONG_MAX, ctx); LOG_INODE_ALL, 0, LLONG_MAX, ctx);

Some files were not shown because too many files have changed in this diff Show more