3.14.55-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 3.14.55-stable review
This is the start of the stable review cycle for the 3.14.55 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Oct 20 02:00:11 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.55-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.14.55-rc1
Christoph Hellwig <[email protected]>
3w-9xxx: don't unmap bounce buffered commands
Joonsoo Kim <[email protected]>
mm/slab: fix unexpected index mapping result of kmalloc_size(INDEX_NODE+1)
[email protected] <[email protected]>
staging: speakup: fix speakup-r regression
Joe Thornber <[email protected]>
dm cache: fix NULL pointer when switching from cleaner policy
Ben Dooks <[email protected]>
clk: ti: fix dual-registration of uart4_ick
Jan Kara <[email protected]>
jbd2: avoid infinite loop when destroying aborted journal
Ben Hutchings <[email protected]>
genirq: Fix race in register_irq_proc()
Roland Dreier <[email protected]>
fib_rules: Fix dump_rules() not to exit early
Andreas Schwab <[email protected]>
m68k: Define asmlinkage_protect
Mark Salyzyn <[email protected]>
arm64: readahead: fault retry breaks mmap file read random detection
Eric W. Biederman <[email protected]>
vfs: Test for and handle paths that are unreachable from their mnt_root
Eric W. Biederman <[email protected]>
dcache: Handle escaped paths in prepend_path
shengyong <[email protected]>
UBI: return ENOSPC if no enough space available
Richard Weinberger <[email protected]>
UBI: Validate data_size
Paul Mackerras <[email protected]>
powerpc/MSI: Fix race condition in tearing down MSI interrupts
NeilBrown <[email protected]>
md: flush ->event_work before stopping array.
Ian Abbott <[email protected]>
staging: comedi: usbduxsigma: don't clobber ao_timer in command test
Ian Abbott <[email protected]>
staging: comedi: usbduxsigma: don't clobber ai_timer in command test
Peter Zijlstra <[email protected]>
arch,hexagon: Convert smp_mb__*()
James Hogan <[email protected]>
MIPS: dma-default: Fix 32-bit fall back to GFP_DMA
Yao-Wen Mao <[email protected]>
USB: Add reset-resume quirk for two Plantronics usb headphones.
Vincent Palatin <[email protected]>
usb: Add device quirk for Logitech PTZ cameras
Mathias Nyman <[email protected]>
usb: Use the USB_SS_MULT() macro to get the burst multiplier.
Jann Horn <[email protected]>
security: fix typo in security_task_prctl
Mark Brown <[email protected]>
regmap: debugfs: Don't bother actually printing when calculating max length
Mark Brown <[email protected]>
regmap: debugfs: Ensure we don't underflow when printing access masks
Antoine Ténart <[email protected]>
mtd: pxa3xx_nand: add a default chunk size
Peter Seiderer <[email protected]>
cifs: use server timestamp for ntlmv2 authentication
Julian Anastasov <[email protected]>
ipvs: fix crash with sync protocol v0 and FTP
Julian Anastasov <[email protected]>
ipvs: do not use random local source address for tunnels
Linus Torvalds <[email protected]>
Initialize msg/shm IPC objects before doing ipc_addid()
Reyad Attiyat <[email protected]>
usb: xhci: Add support for URB_ZERO_PACKET to bulk/sg transfers
Mathias Nyman <[email protected]>
xhci: change xhci 1.0 only restrictions to support xhci 1.1
Roger Quadros <[email protected]>
usb: xhci: Clear XHCI_STATE_DYING on start
Johan Hovold <[email protected]>
USB: whiteheat: fix potential null-deref at probe
Daniel Vetter <[email protected]>
drm: Reject DRI1 hw lock ioctl functions for kms drivers
Fabiano Fidêncio <[email protected]>
drm/qxl: recreate the primary surface when the bo is not primary
Dave Airlie <[email protected]>
drm/qxl: only report first monitor as connected if we have no state
Steve French <[email protected]>
disabling oplocks/leases via module parm enable_oplocks broken for SMB3
Pablo Neira Ayuso <[email protected]>
netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC
Pablo Neira Ayuso <[email protected]>
netfilter: ctnetlink: put back references to master ct and expect objects
Joe Stringer <[email protected]>
netfilter: nf_conntrack: Support expectations in different zones
Mikulas Patocka <[email protected]>
dm raid: fix round up of default region size
Liu.Zhao <[email protected]>
USB: option: add ZTE PIDs
Shawn Lin <[email protected]>
staging: ion: fix corruption of ion_import_dma_buf
Joe Thornber <[email protected]>
dm btree: add ref counting ops for the leaves of top level btrees
Filipe Manana <[email protected]>
Btrfs: update fix for read corruption of compressed and shared extents
Filipe Manana <[email protected]>
Btrfs: fix read corruption of compressed and shared extents
Jeff Mahoney <[email protected]>
btrfs: skip waiting on ordered range for special files
Yitian Bu <[email protected]>
ASoC: dwc: correct irq clear method
Robert Jarzmik <[email protected]>
ASoC: fix broken pxa SoC support
Robert Jarzmik <[email protected]>
ASoC: pxa: pxa2xx-ac97: fix dma requestor lines
John Flatness <[email protected]>
ALSA: hda - Apply SPDIF pin ctl to MacBookPro 12,1
Takashi Iwai <[email protected]>
ALSA: synth: Fix conflicting OSS device registration on AWE32
Mel Gorman <[email protected]>
mm: hugetlbfs: skip shared VMAs when unmapping private pages to satisfy a fault
Tan, Jui Nee <[email protected]>
spi: spi-pxa2xx: Check status register to determine if SSSR_TINT is disabled
Guenter Roeck <[email protected]>
spi: Fix documentation of spi_alloc_master()
Peter Zijlstra <[email protected]>
sched/core: Fix TASK_DEAD race in finish_task_switch()
Vitaly Kuznetsov <[email protected]>
x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
Stephen Smalley <[email protected]>
x86/mm: Set NX on gap between __ex_table and rodata
Matt Fleming <[email protected]>
x86/efi: Fix boot crash by mapping EFI memmap entries bottom-up at runtime, instead of top-down
Dirk Müller <[email protected]>
Use WARN_ON_ONCE for missing X86_FEATURE_NRIPS
Andy Lutomirski <[email protected]>
x86/nmi/64: Fix a paravirt stack-clobbering bug in the NMI code
Andy Lutomirski <[email protected]>
x86/paravirt: Replace the paravirt nop with a bona fide empty function
David Woodhouse <[email protected]>
x86/platform: Fix Geode LX timekeeping in the generic x86 build
Shaohua Li <[email protected]>
x86/apic: Serialize LVTT and TSC_DEADLINE writes
Andy Shevchenko <[email protected]>
dmaengine: dw: properly read DWC_PARAMS register
Grazvydas Ignotas <[email protected]>
ARM: dts: omap5-uevm.dts: fix i2c5 pinctrl offsets
Paul Bolle <[email protected]>
windfarm: decrement client count when unregistering
Ard Biesheuvel <[email protected]>
ARM: 8429/1: disable GCC SRA optimization
Russell King <[email protected]>
ARM: fix Thumb2 signal handling when ARMv6 is enabled
Guenter Roeck <[email protected]>
hwmon: (nct6775) Swap STEP_UP_TIME and STEP_DOWN_TIME registers for most chips
Arnaldo Carvalho de Melo <[email protected]>
perf header: Fixup reading of HEADER_NRCPUS feature
Kan Liang <[email protected]>
perf stat: Get correct cpu id for print_aggr
Arnaldo Carvalho de Melo <[email protected]>
perf hists: Update the column width for the "srcline" sort key
Adrian Hunter <[email protected]>
perf tools: Fix copying of /proc/kcore
Jenny Derzhavetz <[email protected]>
iser-target: remove command with state ISTATE_REMOVE
Michal Hocko <[email protected]>
scsi: fix scsi_error_handler vs. scsi_host_dev_release race
Jason Wang <[email protected]>
kvm: fix zero length mmio searching
-------------
Diffstat:
Makefile | 4 +- arch/arm/Makefile | 8 +++ arch/arm/boot/dts/omap5-uevm.dts | 4 +- arch/arm/kernel/signal.c | 15 ++-- arch/arm64/mm/fault.c | 1 + arch/hexagon/include/asm/atomic.h | 6 +- arch/hexagon/include/asm/bitops.h | 4 +- arch/m68k/include/asm/linkage.h | 30 ++++++++ arch/mips/mm/dma-default.c | 2 +- arch/powerpc/platforms/powernv/pci.c | 5 +- arch/powerpc/sysdev/fsl_msi.c | 5 +- arch/powerpc/sysdev/mpic_pasemi_msi.c | 6 +- arch/powerpc/sysdev/mpic_u3msi.c | 5 +- arch/powerpc/sysdev/ppc4xx_msi.c | 5 +- arch/x86/kernel/apic/apic.c | 7 ++ arch/x86/kernel/entry_64.S | 16 ++++- arch/x86/kernel/paravirt.c | 16 +++-- arch/x86/kernel/tsc.c | 17 +++-- arch/x86/kvm/svm.c | 2 +- arch/x86/mm/init_64.c | 2 +- arch/x86/platform/efi/efi.c | 67 ++++++++++++++++- arch/x86/xen/enlighten.c | 23 ++++++ drivers/base/regmap/regmap-debugfs.c | 5 +- drivers/clk/ti/clk-3xxx.c | 2 +- drivers/dma/dw/core.c | 4 +- drivers/gpu/drm/drm_lock.c | 6 ++ drivers/gpu/drm/qxl/qxl_display.c | 14 ++-- drivers/hwmon/nct6775.c | 16 +++-- drivers/infiniband/ulp/isert/ib_isert.c | 9 ++- drivers/macintosh/windfarm_core.c | 2 +- drivers/md/dm-cache-policy-cleaner.c | 2 +- drivers/md/dm-raid.c | 3 +- drivers/md/md.c | 2 + drivers/md/persistent-data/dm-btree-internal.h | 6 ++ drivers/md/persistent-data/dm-btree-remove.c | 12 +--- drivers/md/persistent-data/dm-btree-spine.c | 37 ++++++++++ drivers/md/persistent-data/dm-btree.c | 7 +- drivers/mtd/nand/pxa3xx_nand.c | 3 + drivers/mtd/ubi/io.c | 5 ++ drivers/mtd/ubi/vtbl.c | 1 + drivers/mtd/ubi/wl.c | 1 + drivers/scsi/3w-9xxx.c | 28 ++++++-- drivers/scsi/scsi_error.c | 11 ++- drivers/spi/spi-pxa2xx.c | 4 ++ drivers/spi/spi.c | 3 +- drivers/staging/android/ion/ion.c | 6 +- drivers/staging/comedi/drivers/usbduxsigma.c | 99 ++++++++++++-------------- drivers/staging/speakup/fakekey.c | 1 + drivers/usb/core/config.c | 5 +- drivers/usb/core/quirks.c | 13 ++++ drivers/usb/host/xhci-mem.c | 6 +- drivers/usb/host/xhci-ring.c | 70 +++++++++++++----- drivers/usb/host/xhci.c | 8 ++- drivers/usb/serial/option.c | 24 +++++++ drivers/usb/serial/whiteheat.c | 31 ++++++++ fs/btrfs/extent_io.c | 80 +++++++++++++++++---- fs/btrfs/inode.c | 3 +- fs/cifs/cifsencrypt.c | 53 +++++++++++++- fs/cifs/smb2ops.c | 8 ++- fs/dcache.c | 7 ++ fs/jbd2/checkpoint.c | 39 ++++++++-- fs/jbd2/commit.c | 2 +- fs/jbd2/journal.c | 11 ++- fs/namei.c | 31 +++++++- include/linux/jbd2.h | 3 +- include/linux/security.h | 2 +- include/xen/interface/sched.h | 8 +++ ipc/msg.c | 14 ++-- ipc/shm.c | 12 ++-- ipc/util.c | 8 +-- kernel/irq/proc.c | 19 ++++- kernel/sched/core.c | 10 +-- kernel/sched/sched.h | 5 +- mm/hugetlb.c | 8 +++ mm/slab.c | 13 +++- net/core/fib_rules.c | 2 +- net/netfilter/ipvs/ip_vs_sync.c | 2 +- net/netfilter/ipvs/ip_vs_xmit.c | 1 - net/netfilter/nf_conntrack_expect.c | 3 +- net/netfilter/nf_conntrack_netlink.c | 5 -- net/netfilter/nft_compat.c | 24 +++++-- sound/arm/Kconfig | 15 ++-- sound/pci/hda/patch_cirrus.c | 1 + sound/soc/dwc/designware_i2s.c | 4 +- sound/soc/pxa/Kconfig | 2 - sound/soc/pxa/pxa2xx-ac97.c | 4 +- sound/synth/emux/emux_oss.c | 3 +- tools/perf/builtin-stat.c | 5 +- tools/perf/util/header.c | 4 +- tools/perf/util/hist.c | 3 + tools/perf/util/symbol-elf.c | 35 ++++----- virt/kvm/kvm_main.c | 19 ++++- 92 files changed, 874 insertions(+), 290 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/79 kvm: fix zero length mmio searching
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit 8f4216c7d28976f7ec1b2bcbfa0a9f787133c45e upstream.
Currently, if we had a zero length mmio eventfd assigned on KVM_MMIO_BUS. It will never be found by kvm_io_bus_cmp() since it always compares the kvm_io_range() with the length that guest wrote. This will cause e.g for vhost, kick will be trapped by qemu userspace instead of vhost. Fixing this by using zero length if an iodevice is zero length.
--- virt/kvm/kvm_main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
virt/kvm/kvm_main.c +17 -2
@@ -2797,10 +2797,25 @@ static void kvm_io_bus_destroy(struct kvstatic inline int kvm_io_bus_cmp (const struct kvm_io_range *r1,const struct kvm_io_range *r2) { -if (r1->addr < r2->addr) +gpa_t addr1 = r1->addr; +gpa_t addr2 = r2->addr; + +if (addr1 < addr2)return -1 ; -if (r1->addr + r1->len > r2->addr + r2->len) + +/* If r2->len == 0, match the exact address. If r2->len != 0, +* accept any overlapping write. Any order is acceptable for +* overlapping ranges, because kvm_io_bus_get_first_dev ensures +* we process all of them. +*/ +if (r2->len) { + addr1 += r1->len; + addr2 += r2->len; + } + +if (addr1 > addr2)return 1 ; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 2/79 scsi: fix scsi_error_handler vs. scsi_host_dev_release race
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit 537b604c8b3aa8b96fe35f87dd085816552e294c upstream.
b9d5c6b7ef57 ("[SCSI] cleanup setting task state in scsi_error_handler()") has introduced a race between scsi_error_handler and scsi_host_dev_release resulting in the hang when the device goes away because scsi_error_handler might miss a wake up:
CPU0 CPU1scsi_error_handler scsi_host_dev_release
kthread_stop()
kthread_should_stop()
test_bit(KTHREAD_SHOULD_STOP)
set_bit(KTHREAD_SHOULD_STOP) wake_up_process() wait_for_completion()
set_current_state(TASK_INTERRUPTIBLE)
schedule()
The most straightforward solution seems to be to invert the ordering of the set_current_state and kthread_should_stop.
The issue has been noticed during reboot test on a 3.0 based kernel but the current code seems to be affected in the same way.
--- drivers/scsi/scsi_error.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/scsi/scsi_error.c +10 -1
@@ -2149,8 +2149,17 @@ int scsi_error_handler(void *data)* We never actually get interrupted because kthread_run * disables signal delivery for the created thread. */ -while (!kthread_should_stop ()) { +while (true) { +/* +* The sequence in kthread_stop() sets the stop flag first +* then wakes the process. To avoid missed wakeups, the task +* should always be in a non running state before the stop +* flag is checked +*/ set_current_state (TASK_INTERRUPTIBLE ); +if (kthread_should_stop ()) +break ; +if ((shost->host_failed ==0 && shost->host_eh_scheduled ==0 ) || shost->host_failed != shost->host_busy) { SCSI_LOG_ERROR_RECOVERY(1,
Greg Kroah-Hartman
maintainerPATCH 3/79 iser-target: remove command with state ISTATE_REMOVE
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jenny Derzhavetz <[email protected]>
commit a4c15cd957cbd728f685645de7a150df5912591a upstream.
As documented in iscsit_sequence_cmd:
/*
* Existing callers for iscsit_sequence_cmd() will silently
* ignore commands with CMDSN_LOWER_THAN_EXP, so force this
* return for CMDSN_MAXCMDSN_OVERRUN as well..
*/
We need to silently finish a command when it's in ISTATE_REMOVE. This fixes an teardown hang we were seeing where a mis-behaved initiator (triggered by allocation error injections) sent us a cmdsn which was lower than expected.
--- drivers/infiniband/ulp/isert/ib_isert.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/infiniband/ulp/isert/ib_isert.c +8 -1
@@ -2634,9 +2634,16 @@ isert_get_dataout(struct iscsi_conn *constatic int isert_immediate_queue (struct iscsi_conn *conn,struct iscsi_cmd *cmd,int state) { -int ret; +struct isert_cmd *isert_cmd =iscsit_priv_cmd (cmd); +int ret =0 ;switch (state) { +case ISTATE_REMOVE : +spin_lock_bh (&conn->cmd_lock); +list_del_init (&cmd->i_conn_node); +spin_unlock_bh (&conn->cmd_lock); +isert_put_cmd (isert_cmd, true); +break ;case ISTATE_SEND_NOPIN_WANT_RESPONSE : ret =isert_put_nopin (cmd, conn, false);break ;
Greg Kroah-Hartman
maintainerPATCH 4/79 perf tools: Fix copying of /proc/kcore
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit b5cabbcbd157a4bf5a92dfc85134999a3b55342d upstream.
A copy of /proc/kcore containing the kernel text can be made to the buildid cache. e.g.
perf buildid-cache -v -k /proc/kcore
To workaround objdump limitations, a copy is also made when annotating against /proc/kcore.
The copying process stops working from libelf about v1.62 onwards (the problem was found with v1.63).
The cause is that a call to gelf_getphdr() in kcore__add_phdr() fails because additional validation has been added to gelf_getphdr().
The use of gelf_getphdr() is a misguided attempt to get default initialization of the Gelf_Phdr structure. That should not be necessary because every member of the Gelf_Phdr structure is subsequently assigned. So just remove the call to gelf_getphdr().
Similarly, a call to gelf_getehdr() in gelf_kcore__init() can be removed also.
Committer notes:
Note to [email protected], from Adrian in the cover letter for this patchkit:
The "Fix copying of /proc/kcore" problem goes back to v3.13 if you think it is important enough for stable.
--- tools/perf/util/symbol-elf.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
tools/perf/util/symbol-elf.c +12 -21
@@ -1100,8 +1100,6 @@ out_close:static int kcore__init (struct kcore *kcore,char *filename,int elfclass,bool temp) { -GElf_Ehdr *ehdr; - kcore->elfclass = elfclass;if (temp)
@@ -1118,9 +1116,7 @@ static int kcore__init(struct kcore *kcoif (!gelf_newehdr (kcore->elf, elfclass)) goto out_end; - ehdr =gelf_getehdr (kcore->elf, &kcore->ehdr); -if (!ehdr) - goto out_end; +memset (&kcore->ehdr,0 ,sizeof (GElf_Ehdr));return 0 ;
@@ -1177,23 +1173,18 @@ static int kcore__copy_hdr(struct kcorestatic int kcore__add_phdr (struct kcore *kcore,int idx,off_t offset,u64 addr,u64 len) { -GElf_Phdr gphdr; -GElf_Phdr *phdr; - - phdr =gelf_getphdr (kcore->elf, idx, &gphdr); -if (!phdr) -return -1 ; - - phdr->p_type =PT_LOAD ; - phdr->p_flags =PF_R |PF_W |PF_X ; - phdr->p_offset = offset; - phdr->p_vaddr = addr; - phdr->p_paddr =0 ; - phdr->p_filesz = len; - phdr->p_memsz = len; - phdr->p_align = page_size; +GElf_Phdr phdr = { + .p_type =PT_LOAD , + .p_flags =PF_R |PF_W |PF_X , + .p_offset = offset, + .p_vaddr = addr, + .p_paddr =0 , + .p_filesz = len, + .p_memsz = len, + .p_align = page_size, + }; -if (!gelf_update_phdr (kcore->elf, idx, phdr)) +if (!gelf_update_phdr (kcore->elf, idx, &phdr))return -1 ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 5/79 perf hists: Update the column width for the "srcline" sort key
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit e8e6d37e73e6b950c891c780745460b87f4755b6 upstream.
When we introduce a new sort key, we need to update the hists__calc_col_len() function accordingly, otherwise the width will be limited to strlen(header).
We can't update it when obtaining a line value for a column (for instance, in sort__srcline_cmp()), because we reset it all when doing a resort (see hists__output_recalc_col_len()), so we need to, from what is in the hist_entry fields, set each of the column widths.
--- tools/perf/util/hist.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/hist.c +3 -0
@@ -160,6 +160,9 @@ void hists__calc_col_len(struct hists *hhists__new_col_len (hists,HISTC_LOCAL_WEIGHT ,12 );hists__new_col_len (hists,HISTC_GLOBAL_WEIGHT ,12 ); +if (h->srcline) +hists__new_col_len (hists,HISTC_SRCLINE ,strlen (h->srcline)); +if (h->transaction)hists__new_col_len (hists,HISTC_TRANSACTION ,hist_entry__transaction_len ());
Greg Kroah-Hartman
maintainerPATCH 6/79 perf stat: Get correct cpu id for print_aggr
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
commit 601083cffb7cabdcc55b8195d732f0f7028570fa upstream.
print_aggr() fails to print per-core/per-socket statistics after commit 582ec0829b3d ("perf stat: Fix per-socket output bug for uncore events") if events have differnt cpus. Because in print_aggr(), aggr_get_id needs index (not cpu id) to find core/pkg id. Also, evsel cpu maps should be used to get aggregated id.
Here is an example:
Counting events cycles,uncore_imc_0/cas_count_read/. (Uncore event has cpumask 0,18)
$ perf stat -e cycles,uncore_imc_0/cas_count_read/ -C0,18 --per-core sleep 2
Without this patch, it failes to get CPU 18 result.
Performance counter stats for 'CPU(s) 0,18':
S0-C0 1 7526851 cycles S0-C0 1 1.05 MiB uncore_imc_0/cas_count_read/ S1-C0 0 <not counted> cycles S1-C0 0 <not counted> MiB uncore_imc_0/cas_count_read/
With this patch, it can get both CPU0 and CPU18 result.
Performance counter stats for 'CPU(s) 0,18':
S0-C0 1 6327768 cycles S0-C0 1 0.47 MiB uncore_imc_0/cas_count_read/ S1-C0 1 330228 cycles S1-C0 1 0.29 MiB uncore_imc_0/cas_count_read/
--- tools/perf/builtin-stat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/perf/builtin-stat.c +2 -3
@@ -1108,7 +1108,7 @@ static void abs_printout(int cpu, int nrstatic void print_aggr (char *prefix) {struct perf_evsel *counter; -int cpu, cpu2, s, s2, id, nr; +int cpu, s, s2, id, nr;double uval;u64 ena, run, val;
@@ -1121,8 +1121,7 @@ static void print_aggr(char *prefix) val = ena = run =0 ; nr =0 ;for (cpu =0 ; cpu <perf_evsel__nr_cpus (counter); cpu++) { - cpu2 =perf_evsel__cpus (counter)->map[cpu]; - s2 =aggr_get_id (evsel_list->cpus, cpu2); + s2 =aggr_get_id (perf_evsel__cpus (counter), cpu);if (s2 != id)continue ; val += counter->counts->cpu[cpu].val;
Greg Kroah-Hartman
maintainerPATCH 7/79 perf header: Fixup reading of HEADER_NRCPUS feature
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit caa470475d9b59eeff093ae650800d34612c4379 upstream.
The original patch introducing this header wrote the number of CPUs available and online in one order and then swapped those values when reading, fix it.
Before:
# perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 4 # echo 0 > /sys/devices/system/cpu/cpu2/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 3 # echo 0 > /sys/devices/system/cpu/cpu1/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 2
After the fix, bringing back the CPUs online:
# perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 2 # nrcpus avail : 4 # echo 1 > /sys/devices/system/cpu/cpu2/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 3 # nrcpus avail : 4 # echo 1 > /sys/devices/system/cpu/cpu1/online # perf record usleep 1 # perf report --header-only | grep 'nrcpus \(online\|avail\)' # nrcpus online : 4 # nrcpus avail : 4
--- tools/perf/util/header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/header.c +2 -2
@@ -1715,7 +1715,7 @@ static int process_nrcpus(struct perf_fiif (ph->needs_swap) nr =bswap_32 (nr); - ph->env.nr_cpus_online = nr; + ph->env.nr_cpus_avail = nr; ret =readn (fd, &nr,sizeof (nr));if (ret !=sizeof (nr))
@@ -1724,7 +1724,7 @@ static int process_nrcpus(struct perf_fiif (ph->needs_swap) nr =bswap_32 (nr); - ph->env.nr_cpus_avail = nr; + ph->env.nr_cpus_online = nr;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 8/79 hwmon: (nct6775) Swap STEP_UP_TIME and STEP_DOWN_TIME registers for most chips
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 728d29400488d54974d3317fe8a232b45fdb42ee upstream.
The STEP_UP_TIME and STEP_DOWN_TIME registers are swapped for all chips but NCT6775.
--- drivers/hwmon/nct6775.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/hwmon/nct6775.c +10 -6
@@ -350,6 +350,10 @@ static const u16 NCT6775_REG_TEMP_CRIT[A/* NCT6776 specific data */ +/* STEP_UP_TIME and STEP_DOWN_TIME regs are swapped for all chips but NCT6775 */ +#define NCT6776_REG_FAN_STEP_UP_TIME NCT6775_REG_FAN_STEP_DOWN_TIME +#define NCT6776_REG_FAN_STEP_DOWN_TIME NCT6775_REG_FAN_STEP_UP_TIME +static const s8 NCT6776_ALARM_BITS [] = {0 ,1 ,2 ,3 ,8 ,21 ,20 ,16 ,/* in0.. in7 */ 17 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,/* in8..in14 */
@@ -3476,8 +3480,8 @@ static int nct6775_probe(struct platform data->REG_FAN_PULSES =NCT6776_REG_FAN_PULSES ; data->FAN_PULSE_SHIFT =NCT6775_FAN_PULSE_SHIFT ; data->REG_FAN_TIME[0 ] =NCT6775_REG_FAN_STOP_TIME ; - data->REG_FAN_TIME[1 ] =NCT6775_REG_FAN_STEP_UP_TIME ; - data->REG_FAN_TIME[2 ] =NCT6775_REG_FAN_STEP_DOWN_TIME ; + data->REG_FAN_TIME[1 ] =NCT6776_REG_FAN_STEP_UP_TIME ; + data->REG_FAN_TIME[2 ] =NCT6776_REG_FAN_STEP_DOWN_TIME ; data->REG_TOLERANCE_H =NCT6776_REG_TOLERANCE_H ; data->REG_PWM[0 ] =NCT6775_REG_PWM ; data->REG_PWM[1 ] =NCT6775_REG_FAN_START_OUTPUT ;
@@ -3548,8 +3552,8 @@ static int nct6775_probe(struct platform data->REG_FAN_PULSES =NCT6779_REG_FAN_PULSES ; data->FAN_PULSE_SHIFT =NCT6775_FAN_PULSE_SHIFT ; data->REG_FAN_TIME[0 ] =NCT6775_REG_FAN_STOP_TIME ; - data->REG_FAN_TIME[1 ] =NCT6775_REG_FAN_STEP_UP_TIME ; - data->REG_FAN_TIME[2 ] =NCT6775_REG_FAN_STEP_DOWN_TIME ; + data->REG_FAN_TIME[1 ] =NCT6776_REG_FAN_STEP_UP_TIME ; + data->REG_FAN_TIME[2 ] =NCT6776_REG_FAN_STEP_DOWN_TIME ; data->REG_TOLERANCE_H =NCT6776_REG_TOLERANCE_H ; data->REG_PWM[0 ] =NCT6775_REG_PWM ; data->REG_PWM[1 ] =NCT6775_REG_FAN_START_OUTPUT ;
@@ -3624,8 +3628,8 @@ static int nct6775_probe(struct platform data->REG_FAN_PULSES =NCT6779_REG_FAN_PULSES ; data->FAN_PULSE_SHIFT =NCT6775_FAN_PULSE_SHIFT ; data->REG_FAN_TIME[0 ] =NCT6775_REG_FAN_STOP_TIME ; - data->REG_FAN_TIME[1 ] =NCT6775_REG_FAN_STEP_UP_TIME ; - data->REG_FAN_TIME[2 ] =NCT6775_REG_FAN_STEP_DOWN_TIME ; + data->REG_FAN_TIME[1 ] =NCT6776_REG_FAN_STEP_UP_TIME ; + data->REG_FAN_TIME[2 ] =NCT6776_REG_FAN_STEP_DOWN_TIME ; data->REG_TOLERANCE_H =NCT6776_REG_TOLERANCE_H ; data->REG_PWM[0 ] =NCT6775_REG_PWM ; data->REG_PWM[1 ] =NCT6775_REG_FAN_START_OUTPUT ;
Greg Kroah-Hartman
maintainerPATCH 9/79 ARM: fix Thumb2 signal handling when ARMv6 is enabled
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 9b55613f42e8d40d5c9ccb8970bde6af4764b2ab upstream.
When a kernel is built covering ARMv6 to ARMv7, we omit to clear the IT state when entering a signal handler. This can cause the first few instructions to be conditionally executed depending on the parent context.
In any case, the original test for >= ARMv7 is broken - ARMv6 can have Thumb-2 support as well, and an ARMv6T2 specific build would omit this code too.
Relax the test back to ARMv6 or greater. This results in us always clearing the IT state bits in the PSR, even on CPUs where these bits are reserved. However, they're reserved for the IT state, so this should cause no harm.
--- arch/arm/kernel/signal.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
arch/arm/kernel/signal.c +10 -5
@@ -353,12 +353,17 @@ setup_return(struct pt_regs *regs, struc*/ thumb = handler &1 ; -#if __LINUX_ARM_ARCH__ >=7 +#if __LINUX_ARM_ARCH__ >=6 /* -* Clear the If-Then Thumb-2 execution state -* ARM spec requires this to be all 000s in ARM mode -* Snapdragon S4/Krait misbehaves on a Thumb=>ARM -* signal transition without this. +* Clear the If-Then Thumb-2 execution state. ARM spec +* requires this to be all 000s in ARM mode. Snapdragon +* S4/Krait misbehaves on a Thumb=>ARM signal transition +* without this. +* +* We must do this whenever we are running on a Thumb-2 +* capable CPU, which includes ARMv6T2. However, we elect +* to do this whenever we're on an ARMv6 or later CPU for +* simplicity. */ cpsr &= ~PSR_IT_MASK ;#endif
Greg Kroah-Hartman
maintainerPATCH 10/79 ARM: 8429/1: disable GCC SRA optimization
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit a077224fd35b2f7fbc93f14cf67074fc792fbac2 upstream.
While working on the 32-bit ARM port of UEFI, I noticed a strange corruption in the kernel log. The following snprintf() statement (in drivers/firmware/efi/efi.c:efi_md_typeattr_format())
snprintf(pos, size, "|%3s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
was producing the following output in the log:
| | | | | |WB|WT|WC|UC] | | | | | |WB|WT|WC|UC] | | | | | |WB|WT|WC|UC] |RUN| | | | |WB|WT|WC|UC]* |RUN| | | | |WB|WT|WC|UC]* | | | | | |WB|WT|WC|UC] |RUN| | | | |WB|WT|WC|UC]* | | | | | |WB|WT|WC|UC] |RUN| | | | | | | |UC] |RUN| | | | | | | |UC]
As it turns out, this is caused by incorrect code being emitted for the string() function in lib/vsprintf.c. The following code
if (!(spec.flags & LEFT)) {
while (len < spec.field_width--) {
if (buf < end)
*buf = ' ';
++buf;
}
}
for (i = 0; i < len; ++i) {
if (buf < end)
*buf = *s;
++buf; ++s;
}
while (len < spec.field_width--) {
if (buf < end)
*buf = ' ';
++buf;
}when called with len == 0, triggers an issue in the GCC SRA optimization pass (Scalar Replacement of Aggregates), which handles promotion of signed struct members incorrectly. This is a known but as yet unresolved issue.
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932). In this particular case, it is causing the second while loop to be executed erroneously a single time, causing the additional space characters to be printed.
So disable the optimization by passing -fno-ipa-sra.
--- arch/arm/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/Makefile +8 -0
@@ -52,6 +52,14 @@ endif comma = , +# +# The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and +# later may result in code being generated that handles signed short and signed +# char struct members incorrectly. So disable it. +# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932) +# +KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra) + # This selects which instruction set is used. # Note that GCC does not numerically define an architecture version # macro, but instead defines a whole series of macros which makes
Greg Kroah-Hartman
maintainerPATCH 11/79 windfarm: decrement client count when unregistering
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Bolle <[email protected]>
commit fe2b592173ff0274e70dc44d1d28c19bb995aa7c upstream.
wf_unregister_client() increments the client count when a client unregisters. That is obviously incorrect. Decrement that client count instead.
--- drivers/macintosh/windfarm_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/windfarm_core.c +1 -1
@@ -435,7 +435,7 @@ int wf_unregister_client(struct notifier {mutex_lock (&wf_lock);blocking_notifier_chain_unregister (&wf_client_list, nb); - wf_client_count++; + wf_client_count--;if (wf_client_count ==0 )wf_stop_thread ();mutex_unlock (&wf_lock);
Greg Kroah-Hartman
maintainerPATCH 12/79 ARM: dts: omap5-uevm.dts: fix i2c5 pinctrl offsets
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Grazvydas Ignotas <[email protected]>
commit 1dbdad75074d16c3e3005180f81a01cdc04a7872 upstream.
The i2c5 pinctrl offsets are wrong. If the bootloader doesn't set the pins up, communication with tca6424a doesn't work (controller timeouts) and it is not possible to enable HDMI.
--- arch/arm/boot/dts/omap5-uevm.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap5-uevm.dts +2 -2
@@ -111,8 +111,8 @@ i2c5_pins: pinmux_i2c5_pins { pinctrl-single,pins = < - 0x184 (PIN_INPUT | MUX_MODE0) /* i2c5_scl */ - 0x186 (PIN_INPUT | MUX_MODE0) /* i2c5_sda */ + 0x186 (PIN_INPUT | MUX_MODE0) /* i2c5_scl */ + 0x188 (PIN_INPUT | MUX_MODE0) /* i2c5_sda */ >; };
Greg Kroah-Hartman
maintainerPATCH 13/79 dmaengine: dw: properly read DWC_PARAMS register
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 6bea0f6d1c47b07be88dfd93f013ae05fcb3d8bf upstream.
In case we have less than maximum allowed channels (8) and autoconfiguration is enabled the DWC_PARAMS read is wrong because it uses different arithmetic to what is needed for channel priority setup.
Re-do the caclulations properly. This now works on AVR32 board well.
--- drivers/dma/dw/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dw/core.c +2 -2
@@ -1561,7 +1561,6 @@ int dw_dma_probe(struct dw_dma_chip *chiINIT_LIST_HEAD (&dw->dma.channels);for (i =0 ; i < nr_channels; i++) {struct dw_dma_chan *dwc = &dw->chan[i]; -int r = nr_channels - i -1 ; dwc->chan.device = &dw->dma;dma_cookie_init (&dwc->chan);
@@ -1573,7 +1572,7 @@ int dw_dma_probe(struct dw_dma_chip *chi/* 7 is highest priority & 0 is lowest. */ if (pdata->chan_priority ==CHAN_PRIORITY_ASCENDING ) - dwc->priority = r; + dwc->priority = nr_channels - i -1 ;else dwc->priority = i;
@@ -1593,6 +1592,7 @@ int dw_dma_probe(struct dw_dma_chip *chi/* Hardware configuration */ if (autocfg) {unsigned int dwc_params; +unsigned int r =DW_DMA_MAX_NR_CHANNELS - i -1 ;void __iomem *addr = chip->regs + r *sizeof (u32); dwc_params =dma_read_byaddr (addr,DWC_PARAMS );
Greg Kroah-Hartman
maintainerPATCH 14/79 x86/apic: Serialize LVTT and TSC_DEADLINE writes
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaohua Li <[email protected]>
commit 5d7c631d926b59aa16f3c56eaeb83f1036c81dc7 upstream.
The APIC LVTT register is MMIO mapped but the TSC_DEADLINE register is an MSR. The write to the TSC_DEADLINE MSR is not serializing, so it's not guaranteed that the write to LVTT has reached the APIC before the TSC_DEADLINE MSR is written. In such a case the write to the MSR is ignored and as a consequence the local timer interrupt never fires.
The SDM decribes this issue for xAPIC and x2APIC modes. The serialization methods recommended by the SDM differ.
xAPIC:
"1. Memory-mapped write to LVT Timer Register, setting bits 18:17 to 10b.
2. WRMSR to the IA32_TSC_DEADLINE MSR a value much larger than current time-stamp counter.
3. If RDMSR of the IA32_TSC_DEADLINE MSR returns zero, go to step 2.
4. WRMSR to the IA32_TSC_DEADLINE MSR the desired deadline."
x2APIC:
"To allow for efficient access to the APIC registers in x2APIC mode,
the serializing semantics of WRMSR are relaxed when writing to the APIC registers. Thus, system software should not use 'WRMSR to APIC registers in x2APIC mode' as a serializing instruction. Read and write accesses to the APIC registers will occur in program order. A WRMSR to an APIC register may complete before all preceding stores are globally visible; software can prevent this by inserting a serializing instruction, an SFENCE, or an MFENCE before the WRMSR."
The xAPIC method is to just wait for the memory mapped write to hit the LVTT by checking whether the MSR write has reached the hardware. There is no reason why a proper MFENCE after the memory mapped write would not do the same. Andi Kleen confirmed that MFENCE is sufficient for the xAPIC case as well.
Issue MFENCE before writing to the TSC_DEADLINE MSR. This can be done unconditionally as all CPUs which have TSC_DEADLINE also have MFENCE support.
[ tglx: Massaged the changelog ]
--- arch/x86/kernel/apic/apic.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kernel/apic/apic.c +7 -0
@@ -359,6 +359,13 @@ static void __setup_APIC_LVTT(unsigned iapic_write (APIC_LVTT , lvtt_value);if (lvtt_value &APIC_LVT_TIMER_TSCDEADLINE ) { +/* +* See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode, +* writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized. +* According to Intel, MFENCE can do the serialization here. +*/ + asmvolatile ("mfence" : : :"memory" ); +printk_once (KERN_DEBUG "TSC deadline timer enabled\n" );return ; }
Greg Kroah-Hartman
maintainerPATCH 15/79 x86/platform: Fix Geode LX timekeeping in the generic x86 build
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Woodhouse <[email protected]>
commit 03da3ff1cfcd7774c8780d2547ba0d995f7dc03d upstream.
In 2007, commit 07190a08eef36 ("Mark TSC on GeodeLX reliable") bypassed verification of the TSC on Geode LX. However, this code (now in the check_system_tsc_reliable() function in arch/x86/kernel/tsc.c) was only present if CONFIG_MGEODE_LX was set.
OpenWRT has recently started building its generic Geode target for Geode GX, not LX, to include support for additional platforms. This broke the timekeeping on LX-based devices, because the TSC wasn't marked as reliable:
https://dev.openwrt.org/ticket/20531
By adding a runtime check on is_geode_lx(), we can also include the fix if CONFIG_MGEODEGX1 or CONFIG_X86_GENERIC are set, thus fixing the problem.
--- arch/x86/kernel/tsc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
arch/x86/kernel/tsc.c +10 -7
@@ -21,6 +21,7 @@#include <asm/hypervisor.h> #include <asm/nmi.h> #include <asm/x86_init.h> +#include <asm/geode.h> unsigned int __read_mostly cpu_khz;/* TSC clocks / usec, not used here */ EXPORT_SYMBOL (cpu_khz);
@@ -1011,15 +1012,17 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);static void __init check_system_tsc_reliable (void ) { -#ifdef CONFIG_MGEODE_LX -/* RTSC counts during suspend */ +#if defined(CONFIG_MGEODEGX1 ) || defined(CONFIG_MGEODE_LX ) || defined(CONFIG_X86_GENERIC ) +if (is_geode_lx ()) { +/* RTSC counts during suspend */ #define RTSC_SUSP 0x100 -unsigned long res_low, res_high; +unsigned long res_low, res_high; -rdmsr_safe (MSR_GEODE_BUSCONT_CONF0 , &res_low, &res_high); -/* Geode_LX - the OLPC CPU has a very reliable TSC */ -if (res_low &RTSC_SUSP ) - tsc_clocksource_reliable =1 ; +rdmsr_safe (MSR_GEODE_BUSCONT_CONF0 , &res_low, &res_high); +/* Geode_LX - the OLPC CPU has a very reliable TSC */ +if (res_low &RTSC_SUSP ) + tsc_clocksource_reliable =1 ; + }#endif if (boot_cpu_has (X86_FEATURE_TSC_RELIABLE )) tsc_clocksource_reliable =1 ;
Greg Kroah-Hartman
maintainerPATCH 16/79 x86/paravirt: Replace the paravirt nop with a bona fide empty function
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit fc57a7c68020dcf954428869eafd934c0ab1536f upstream.
PARAVIRT_ADJUST_EXCEPTION_FRAME generates this code (using nmi as an example, trimmed for readability):
ff 15 00 00 00 00 callq *0x0(%rip) # 2796 <nmi+0x6>
2792: R_X86_64_PC32 pv_irq_ops+0x2cThat's a call through a function pointer to regular C function that does nothing on native boots, but that function isn't protected against kprobes, isn't marked notrace, and is certainly not guaranteed to preserve any registers if the compiler is feeling perverse. This is bad news for a CLBR_NONE operation.
Of course, if everything works correctly, once paravirt ops are patched, it gets nopped out, but what if we hit this code before paravirt ops are patched in? This can potentially cause breakage that is very difficult to debug.
A more subtle failure is possible here, too: if _paravirt_nop uses the stack at all (even just to push RBP), it will overwrite the "NMI executing" variable if it's called in the NMI prologue.
The Xen case, perhaps surprisingly, is fine, because it's already written in asm.
Fix all of the cases that default to paravirt_nop (including adjust_exception_frame) with a big hammer: replace paravirt_nop with an asm function that is just a ret instruction.
The Xen case may have other problems, so document them.
This is part of a fix for some random crashes that Sasha saw.
--- arch/x86/kernel/entry_64.S | 11 +++++++++++ arch/x86/kernel/paravirt.c | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-)
arch/x86/kernel/entry_64.S +11 -0
@@ -1684,7 +1684,18 @@ END(error_exit) /* runs on exception stack */ ENTRY(nmi) INTR_FRAME + /* + * Fix up the exception frame if we're on Xen. + * PARAVIRT_ADJUST_EXCEPTION_FRAME is guaranteed to push at most + * one value to the stack on native, so it may clobber the rdx + * scratch slot, but it won't clobber any of the important + * slots past it. + * + * Xen is a different story, because the Xen frame itself overlaps + * the "NMI executing" variable. + */ PARAVIRT_ADJUST_EXCEPTION_FRAME + /* * We allow breakpoints in NMIs. If a breakpoint occurs, then * the iretq it performs will take us out of NMI context.
arch/x86/kernel/paravirt.c +12 -4
@@ -40,10 +40,18 @@#include <asm/timer.h> #include <asm/special_insns.h> -/* nop stub */ -void _paravirt_nop (void ) -{ -} +/* +* nop stub, which must not clobber anything *including the stack* to +* avoid confusing the entry prologues. +*/ +extern void _paravirt_nop (void ); +asm (".pushsection .entry.text, \"ax\"\n" +".global _paravirt_nop\n" +"_paravirt_nop:\n\t" +"ret\n\t" +".size _paravirt_nop, . - _paravirt_nop\n\t" +".type _paravirt_nop, @function\n\t" +".popsection" );/* identity function, which can be inlined */ u32 _paravirt_ident_32 (u32 x)
Greg Kroah-Hartman
maintainerPATCH 17/79 x86/nmi/64: Fix a paravirt stack-clobbering bug in the NMI code
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 83c133cf11fb0e68a51681447e372489f052d40e upstream.
The NMI entry code that switches to the normal kernel stack needs to be very careful not to clobber any extra stack slots on the NMI stack. The code is fine under the assumption that SWAPGS is just a normal instruction, but that assumption isn't really true. Use SWAPGS_UNSAFE_STACK instead.
This is part of a fix for some random crashes that Sasha saw.
--- arch/x86/kernel/entry_64.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/entry_64.S +4 -1
@@ -1747,8 +1747,11 @@ ENTRY(nmi) * we don't want to enable interrupts, because then we'll end * up in an awkward situation in which IRQs are on but NMIs * are off. + * + * We also must not push anything to the stack before switching + * stacks lest we corrupt the "NMI executing" variable. */ - SWAPGS + SWAPGS_UNSAFE_STACK cld movq %rsp, %rdx movq PER_CPU_VAR(kernel_stack), %rsp
Greg Kroah-Hartman
maintainerPATCH 18/79 Use WARN_ON_ONCE for missing X86_FEATURE_NRIPS
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <[email protected]>
commit d2922422c48df93f3edff7d872ee4f3191fefb08 upstream.
The cpu feature flags are not ever going to change, so warning everytime can cause a lot of kernel log spam
(in our case more than 10GB/hour).
The warning seems to only occur when nested virtualization is enabled, so it's probably triggered by a KVM bug. This is a sensible and safe change anyway, and the KVM bug fix might not be suitable for stable releases anyway.
--- arch/x86/kvm/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm.c +1 -1
@@ -496,7 +496,7 @@ static void skip_emulated_instruction(ststruct vcpu_svm *svm =to_svm (vcpu);if (svm->vmcb->control.next_rip !=0 ) { -WARN_ON (!static_cpu_has (X86_FEATURE_NRIPS )); +WARN_ON_ONCE (!static_cpu_has (X86_FEATURE_NRIPS )); svm->next_rip = svm->vmcb->control.next_rip; }
Greg Kroah-Hartman
maintainerPATCH 19/79 x86/efi: Fix boot crash by mapping EFI memmap entries bottom-up at runtime, instead of top-down
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit a5caa209ba9c29c6421292e7879d2387a2ef39c9 upstream.
Beginning with UEFI v2.5 EFI_PROPERTIES_TABLE was introduced that signals that the firmware PE/COFF loader supports splitting code and data sections of PE/COFF images into separate EFI memory map entries. This allows the kernel to map those regions with strict memory protections, e.g. EFI_MEMORY_RO for code, EFI_MEMORY_XP for data, etc.
Unfortunately, an unwritten requirement of this new feature is that the regions need to be mapped with the same offsets relative to each other as observed in the EFI memory map. If this is not done crashes like this may occur,
BUG: unable to handle kernel paging request at fffffffefe6086dd IP: [<fffffffefe6086dd>] 0xfffffffefe6086dd Call Trace: [<ffffffff8104c90e>] efi_call+0x7e/0x100 [<ffffffff81602091>] ? virt_efi_set_variable+0x61/0x90 [<ffffffff8104c583>] efi_delete_dummy_variable+0x63/0x70 [<ffffffff81f4e4aa>] efi_enter_virtual_mode+0x383/0x392 [<ffffffff81f37e1b>] start_kernel+0x38a/0x417 [<ffffffff81f37495>] x86_64_start_reservations+0x2a/0x2c [<ffffffff81f37582>] x86_64_start_kernel+0xeb/0xef
Here 0xfffffffefe6086dd refers to an address the firmware expects to be mapped but which the OS never claimed was mapped. The issue is that included in these regions are relative addresses to other regions which were emitted by the firmware toolchain before the "splitting" of sections occurred at runtime.
Needless to say, we don't satisfy this unwritten requirement on x86_64 and instead map the EFI memory map entries in reverse order. The above crash is almost certainly triggerable with any kernel newer than v3.13 because that's when we rewrote the EFI runtime region mapping code, in commit d2f7cbe7b26a ("x86/efi:
Runtime services virtual mapping"). For kernel versions before v3.13 things may work by pure luck depending on the fragmentation of the kernel virtual address space at the time we map the EFI regions.
Instead of mapping the EFI memory map entries in reverse order, where entry N has a higher virtual address than entry N+1, map them in the same order as they appear in the EFI memory map to preserve this relative offset between regions.
This patch has been kept as small as possible with the intention that it should be applied aggressively to stable and distribution kernels. It is very much a bugfix rather than support for a new feature, since when EFI_PROPERTIES_TABLE is enabled we must map things as outlined above to even boot - we have no way of asking the firmware not to split the code/data regions.
In fact, this patch doesn't even make use of the more strict memory protections available in UEFI v2.5. That will come later.
--- arch/x86/platform/efi/efi.c | 67 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-)
arch/x86/platform/efi/efi.c +66 -1
@@ -961,6 +961,70 @@ out: }/* +* Iterate the EFI memory map in reverse order because the regions +* will be mapped top-down. The end result is the same as if we had +* mapped things forward, but doesn't require us to change the +* existing implementation of efi_map_region(). +*/ +static inline void *efi_map_next_entry_reverse (void *entry) +{ +/* Initial call */ +if (!entry) +return memmap.map_end - memmap.desc_size; + + entry -= memmap.desc_size; +if (entry < memmap.map) +return NULL ; + +return entry; +} + +/* +* efi_map_next_entry - Return the next EFI memory map descriptor +* @entry: Previous EFI memory map descriptor +* +* This is a helper function to iterate over the EFI memory map, which +* we do in different orders depending on the current configuration. +* +* To begin traversing the memory map @entry must be %NULL. +* +* Returns %NULL when we reach the end of the memory map. +*/ +static void *efi_map_next_entry (void *entry) +{ +if (!efi_enabled (EFI_OLD_MEMMAP ) &&efi_enabled (EFI_64BIT )) { +/* +* Starting in UEFI v2.5 the EFI_PROPERTIES_TABLE +* config table feature requires us to map all entries +* in the same order as they appear in the EFI memory +* map. That is to say, entry N must have a lower +* virtual address than entry N+1. This is because the +* firmware toolchain leaves relative references in +* the code/data sections, which are split and become +* separate EFI memory regions. Mapping things +* out-of-order leads to the firmware accessing +* unmapped addresses. +* +* Since we need to map things this way whether or not +* the kernel actually makes use of +* EFI_PROPERTIES_TABLE, let's just switch to this +* scheme by default for 64-bit. +*/ +return efi_map_next_entry_reverse (entry); + } + +/* Initial call */ +if (!entry) +return memmap.map; + + entry += memmap.desc_size; +if (entry >= memmap.map_end) +return NULL ; + +return entry; +} + +/* * Map the efi memory ranges of the runtime services and update new_mmap with * virtual addresses. */
@@ -970,7 +1034,8 @@ static void * __init efi_map_regions(intunsigned long left =0 ;efi_memory_desc_t *md; -for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { + p =NULL ; +while ((p =efi_map_next_entry (p))) { md = p;if (!(md->attribute &EFI_MEMORY_RUNTIME )) {#ifdef CONFIG_X86_64
Greg Kroah-Hartman
maintainerPATCH 20/79 x86/mm: Set NX on gap between __ex_table and rodata
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Smalley <[email protected]>
commit ab76f7b4ab2397ffdd2f1eb07c55697d19991d10 upstream.
Unused space between the end of __ex_table and the start of rodata can be left W+x in the kernel page tables. Extend the setting of the NX bit to cover this gap by starting from text_end rather than rodata_start.
Before:
---[ High Kernel Mapping ]---
0xffffffff80000000-0xffffffff81000000 16M pmd 0xffffffff81000000-0xffffffff81600000 6M ro PSE GLB x pmd 0xffffffff81600000-0xffffffff81754000 1360K ro GLB x pte 0xffffffff81754000-0xffffffff81800000 688K RW GLB x pte 0xffffffff81800000-0xffffffff81a00000 2M ro PSE GLB NX pmd 0xffffffff81a00000-0xffffffff81b3b000 1260K ro GLB NX pte 0xffffffff81b3b000-0xffffffff82000000 4884K RW GLB NX pte 0xffffffff82000000-0xffffffff82200000 2M RW PSE GLB NX pmd
0xffffffff82200000-0xffffffffa0000000 478M pmd
After:
---[ High Kernel Mapping ]---
0xffffffff80000000-0xffffffff81000000 16M pmd 0xffffffff81000000-0xffffffff81600000 6M ro PSE GLB x pmd 0xffffffff81600000-0xffffffff81754000 1360K ro GLB x pte 0xffffffff81754000-0xffffffff81800000 688K RW GLB NX pte 0xffffffff81800000-0xffffffff81a00000 2M ro PSE GLB NX pmd 0xffffffff81a00000-0xffffffff81b3b000 1260K ro GLB NX pte 0xffffffff81b3b000-0xffffffff82000000 4884K RW GLB NX pte 0xffffffff82000000-0xffffffff82200000 2M RW PSE GLB NX pmd
0xffffffff82200000-0xffffffffa0000000 478M pmd
--- arch/x86/mm/init_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/init_64.c +1 -1
@@ -1131,7 +1131,7 @@ void mark_rodata_ro(void)* has been zapped already via cleanup_highmem(). */ all_end =roundup ((unsigned long )_brk_end,PMD_SIZE ); -set_memory_nx (rodata_start, (all_end - rodata_start) >>PAGE_SHIFT ); +set_memory_nx (text_end, (all_end - text_end) >>PAGE_SHIFT );rodata_test ();
Greg Kroah-Hartman
maintainerPATCH 21/79 x86/xen: Support kexec/kdump in HVM guests by doing a soft reset
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Kuznetsov <[email protected]>
commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream.
Currently there is a number of issues preventing PVHVM Xen guests from doing successful kexec/kdump:
- Bound event channels.
- Registered vcpu_info.
- PIRQ/emuirq mappings.
- shared_info frame after XENMAPSPACE_shared_info operation.
- Active grant mappings.
Basically, newly booted kernel stumbles upon already set up Xen interfaces and there is no way to reestablish them. In Xen-4.7 a new feature called 'soft reset' is coming. A guest performing kexec/kdump operation is supposed to call SCHEDOP_shutdown hypercall with SHUTDOWN_soft_reset reason before jumping to new kernel. Hypervisor (with some help from toolstack) will do full domain cleanup (but keeping its memory and vCPU contexts intact) returning the guest to the state it had when it was first booted and thus allowing it to start over.
Doing SHUTDOWN_soft_reset on Xen hypervisors which don't support it is probably OK as by default all unknown shutdown reasons cause domain destroy with a message in toolstack log: 'Unknown shutdown reason code
5. Destroying domain.' which gives a clue to what the problem is and eliminates false expectations.
--- arch/x86/xen/enlighten.c | 23 +++++++++++++++++++++++ include/xen/interface/sched.h | 8 ++++++++ 2 files changed, 31 insertions(+)
arch/x86/xen/enlighten.c +23 -0
@@ -33,6 +33,10 @@#include <linux/memblock.h> #include <linux/edd.h> +#ifdef CONFIG_KEXEC_CORE +#include <linux/kexec.h> +#endif +#include <xen/xen.h> #include <xen/events.h> #include <xen/interface/xen.h>
@@ -1844,6 +1848,21 @@ static struct notifier_block xen_hvm_cpu .notifier_call = xen_hvm_cpu_notify, }; +#ifdef CONFIG_KEXEC_CORE +static void xen_hvm_shutdown (void ) +{ +native_machine_shutdown (); +if (kexec_in_progress) +xen_reboot (SHUTDOWN_soft_reset); +} + +static void xen_hvm_crash_shutdown (struct pt_regs *regs) +{ +native_machine_crash_shutdown (regs); +xen_reboot (SHUTDOWN_soft_reset); +} +#endif +static void __init xen_hvm_guest_init (void ) {init_hvm_pv_info ();
@@ -1860,6 +1879,10 @@ static void __init xen_hvm_guest_init(vo x86_init.irqs.intr_init = xen_init_IRQ;xen_hvm_init_time_ops ();xen_hvm_init_mmu_ops (); +#ifdef CONFIG_KEXEC_CORE + machine_ops.shutdown = xen_hvm_shutdown; + machine_ops.crash_shutdown = xen_hvm_crash_shutdown; +#endif }static uint32_t __init xen_hvm_platform (void )
include/xen/interface/sched.h +8 -0
@@ -107,5 +107,13 @@ struct sched_watchdog {#define SHUTDOWN_suspend 2/* Clean up, save suspend info, kill. */ #define SHUTDOWN_crash 3/* Tell controller we've crashed. */ #define SHUTDOWN_watchdog 4/* Restart because watchdog time expired. */ +/* +* Domain asked to perform 'soft reset' for it. The expected behavior is to +* reset internal Xen state for the domain returning it to the point where it +* was created but leaving the domain's memory contents and vCPU contexts +* intact. This will allow the domain to start over and set up all Xen specific +* interfaces again. +*/ +#define SHUTDOWN_soft_reset 5#endif /* __XEN_PUBLIC_SCHED_H__ */
Greg Kroah-Hartman
maintainerPATCH 22/79 sched/core: Fix TASK_DEAD race in finish_task_switch()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 95913d97914f44db2b81271c2e2ebd4d2ac2df83 upstream.
So the problem this patch is trying to address is as follows:
CPU0 CPU1
context_switch(A, B)
ttwu(A)
LOCK A->pi_lock
A->on_cpu == 0
finish_task_switch(A)
prev_state = A->state <-.
WMB |
A->on_cpu = 0; |
UNLOCK rq0->lock |
| context_switch(C, A)
`-- A->state = TASK_DEAD
prev_state == TASK_DEAD
put_task_struct(A)
context_switch(A, C)
finish_task_switch(A)
A->state == TASK_DEAD
put_task_struct(A)The argument being that the WMB will allow the load of A->state on CPU0 to cross over and observe CPU1's store of A->state, which will then result in a double-drop and use-after-free.
Now the comment states (and this was true once upon a long time ago) that we need to observe A->state while holding rq->lock because that will order us against the wakeup; however the wakeup will not in fact acquire (that) rq->lock; it takes A->pi_lock these days.
We can obviously fix this by upgrading the WMB to an MB, but that is expensive, so we'd rather avoid that.
The alternative this patch takes is: smp_store_release(&A->on_cpu, 0), which avoids the MB on some archs, but not important ones like ARM.
--- kernel/sched/core.c | 10 +++++----- kernel/sched/sched.h | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-)
kernel/sched/core.c +5 -5
@@ -2136,11 +2136,11 @@ static void finish_task_switch(struct rq* If a task dies, then it sets TASK_DEAD in tsk->state and calls * schedule one last time. The schedule call will never return, and * the scheduled task must drop that reference. -* The test for TASK_DEAD must occur while the runqueue locks are -* still held, otherwise prev could be scheduled on another cpu, die -* there before we look at prev->state, and then the reference would -* be dropped twice. -* Manfred Spraul <[email protected]> +* +* We must observe prev->state before clearing prev->on_cpu (in +* finish_lock_switch), otherwise a concurrent wakeup can get prev +* running on another CPU and we could rave with its RUNNING -> DEAD +* transition, resulting in a double drop. */ prev_state = prev->state;vtime_task_switch (prev);
kernel/sched/sched.h +3 -2
@@ -994,9 +994,10 @@ static inline void finish_lock_switch(st* After ->on_cpu is cleared, the task can be moved to a different CPU. * We must ensure this doesn't happen until the switch is completely * finished. +* +* Pairs with the control dependency and rmb in try_to_wake_up(). */ -smp_wmb (); - prev->on_cpu =0 ; +smp_store_release (&prev->on_cpu,0 );#endif #ifdef CONFIG_DEBUG_SPINLOCK /* this is a valid case when another task releases the spinlock */
Greg Kroah-Hartman
maintainerPATCH 23/79 spi: Fix documentation of spi_alloc_master()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit a394d635193b641f2c86ead5ada5b115d57c51f8 upstream.
Actually, spi_master_put() after spi_alloc_master() must _not_ be followed by kfree(). The memory is already freed with the call to spi_master_put() through spi_master_class, which registers a release function. Calling both spi_master_put() and kfree() results in often nasty (and delayed) crashes elsewhere in the kernel, often in the networking stack.
This reverts commit eb4af0f5349235df2e4a5057a72fc8962d00308a.
Link to patch and concerns: https://lkml.org/lkml/2012/9/3/269
or
http://lkml.iu.edu/hypermail/linux/kernel/1209.0/00790.html
Alexey Klimov: This revert becomes valid after 94c69f765f1b4a658d96905ec59928e3e3e07e6a when spi-imx.c has been fixed and there is no need to call kfree() so comment for spi_alloc_master() should be fixed.
--- drivers/spi/spi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/spi/spi.c +1 -2
@@ -1251,8 +1251,7 @@ static struct class spi_master_class = {* * The caller is responsible for assigning the bus number and initializing * the master's methods before calling spi_register_master(); and (after errors -* adding the device) calling spi_master_put() and kfree() to prevent a memory -* leak. +* adding the device) calling spi_master_put() to prevent a memory leak. */ struct spi_master *spi_alloc_master (struct device *dev,unsigned size) {
Greg Kroah-Hartman
maintainerPATCH 24/79 spi: spi-pxa2xx: Check status register to determine if SSSR_TINT is disabled
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Tan, Jui Nee" <[email protected]>
commit 02bc933ebb59208f42c2e6305b2c17fd306f695d upstream.
On Intel Baytrail, there is case when interrupt handler get called, no SPI message is captured. The RX FIFO is indeed empty when RX timeout pending interrupt (SSSR_TINT) happens.
Use the BIOS version where both HSUART and SPI are on the same IRQ. Both drivers are using IRQF_SHARED when calling the request_irq function. When running two separate and independent SPI and HSUART application that generate data traffic on both components, user will see messages like below on the console:
pxa2xx-spi pxa2xx-spi.0: bad message state in interrupt handler
This commit will fix this by first checking Receiver Time-out Interrupt, if it is disabled, ignore the request and return without servicing.
--- drivers/spi/spi-pxa2xx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi-pxa2xx.c +4 -0
@@ -562,6 +562,10 @@ static irqreturn_t ssp_int(int irq, voidif (!(sccr1_reg &SSCR1_TIE )) mask &= ~SSSR_TFS ; +/* Ignore RX timeout interrupt if it is disabled */ +if (!(sccr1_reg &SSCR1_TINTE )) + mask &= ~SSSR_TINT ; +if (!(status & mask))return IRQ_NONE ;
Greg Kroah-Hartman
maintainerPATCH 25/79 mm: hugetlbfs: skip shared VMAs when unmapping private pages to satisfy a fault
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit 2f84a8990ebbe235c59716896e017c6b2ca1200f upstream.
SunDong reported the following on
https://bugzilla.kernel.org/show_bug.cgi?id=103841
I think I find a linux bug, I have the test cases is constructed. I can stable recurring problems in fedora22(4.0.4) kernel version, arch for x86_64. I construct transparent huge page, when the parent and child process with MAP_SHARE, MAP_PRIVATE way to access the same huge page area, it has the opportunity to lead to huge page copy on write failure, and then it will munmap the child corresponding mmap area, but then the child mmap area with VM_MAYSHARE attributes, child process munmap this area can trigger VM_BUG_ON in set_vma_resv_flags functions (vma - > vm_flags & VM_MAYSHARE).
There were a number of problems with the report (e.g. it's hugetlbfs that triggers this, not transparent huge pages) but it was fundamentally correct in that a VM_BUG_ON in set_vma_resv_flags() can be triggered that looks like this
vma ffff8804651fd0d0 start 00007fc474e00000 end 00007fc475e00000 next ffff8804651fd018 prev ffff8804651fd188 mm ffff88046b1b1800 prot 8000000000000027 anon_vma (null) vm_ops ffffffff8182a7a0 pgoff 0 file ffff88106bdb9800 private_data (null) flags: 0x84400fb(read|write|shared|mayread|maywrite|mayexec|mayshare|dontexpand|hugetlb) ------------ kernel BUG at mm/hugetlb.c:462! SMP Modules linked in: xt_pkttype xt_LOG xt_limit [..] CPU: 38 PID: 26839 Comm: map Not tainted 4.0.4-default #1 Hardware name: Dell Inc. PowerEdge R810/0TT6JF, BIOS 2.7.4 04/26/2012 set_vma_resv_flags+0x2d/0x30
The VM_BUG_ON is correct because private and shared mappings have different reservation accounting but the warning clearly shows that the VMA is shared.
When a private COW fails to allocate a new page then only the process that created the VMA gets the page -- all the children unmap the page. If the children access that data in the future then they get killed.
The problem is that the same file is mapped shared and private. During the COW, the allocation fails, the VMAs are traversed to unmap the other private pages but a shared VMA is found and the bug is triggered. This patch identifies such VMAs and skips them.
--- mm/hugetlb.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/hugetlb.c +8 -0
@@ -2615,6 +2615,14 @@ static int unmap_ref_private(struct mm_scontinue ;/* +* Shared VMAs have their own reserves and do not affect +* MAP_PRIVATE accounting but it is possible that a shared +* VMA is using the same page so check and skip such VMAs. +*/ +if (iter_vma->vm_flags &VM_MAYSHARE ) +continue ; + +/* * Unmap the page from other VMAs without their own reserves. * They get marked to be SIGKILLed if they fault in these * areas. This is because a future no-page fault on this VMA
Greg Kroah-Hartman
maintainerPATCH 26/79 ALSA: synth: Fix conflicting OSS device registration on AWE32
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 225db5762dc1a35b26850477ffa06e5cd0097243 upstream.
When OSS emulation is loaded on ISA SB AWE32 chip, we get now kernel warnings like:
WARNING: CPU: 0 PID: 2791 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x51/0x80() sysfs: cannot create duplicate filename '/devices/isa/sbawe.0/sound/card0/seq-oss-0-0'
It's because both emux synth and opl3 drivers try to register their OSS device object with the same static index number 0. This hasn't been a big problem until the recent rewrite of device management code (that exposes sysfs at the same time), but it's been an obvious bug.
This patch works around it just by using a different index number of emux synth object. There can be a more elegant way to fix, but it's enough for now, as this code won't be touched so often, in anyway.
--- sound/synth/emux/emux_oss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/synth/emux/emux_oss.c +2 -1
@@ -69,7 +69,8 @@ snd_emux_init_seq_oss(struct snd_emux *estruct snd_seq_oss_reg *arg;struct snd_seq_device *dev; -if (snd_seq_device_new (emu->card,0 ,SNDRV_SEQ_DEV_ID_OSS , +/* using device#1 here for avoiding conflicts with OPL3 */ +if (snd_seq_device_new (emu->card,1 ,SNDRV_SEQ_DEV_ID_OSS ,sizeof (struct snd_seq_oss_reg ), &dev) <0 )return ;
Greg Kroah-Hartman
maintainerPATCH 27/79 ALSA: hda - Apply SPDIF pin ctl to MacBookPro 12,1
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Flatness <[email protected]>
commit e8ff581f7ac2bc3b8886094b7ca635dcc4d1b0e9 upstream.
The MacBookPro 12,1 has the same setup as the 11 for controlling the status of the optical audio light. Simply apply the existing workaround to the subsystem ID for the 12,1.
[sorted the fixup entry by tiwai]
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=105401
--- sound/pci/hda/patch_cirrus.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_cirrus.c +1 -0
@@ -637,6 +637,7 @@ static const struct snd_pci_quirk cs4208SND_PCI_QUIRK (0x106b ,0x5e00 ,"MacBookPro 11,2" ,CS4208_MBP11 ),SND_PCI_QUIRK (0x106b ,0x7100 ,"MacBookAir 6,1" ,CS4208_MBA6 ),SND_PCI_QUIRK (0x106b ,0x7200 ,"MacBookAir 6,2" ,CS4208_MBA6 ), + SND_PCI_QUIRK(0x106b, 0x7b00, "MacBookPro 12,1", CS4208_MBP11), {} /* terminator */ };
Greg Kroah-Hartman
maintainerPATCH 28/79 ASoC: pxa: pxa2xx-ac97: fix dma requestor lines
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Jarzmik <[email protected]>
commit 8811191fdf7ed02ee07cb8469428158572d355a2 upstream.
PCM receive and transmit DMA requestor lines were reverted, breaking the PCM playback interface for PXA platforms using the sound/soc/ variant instead of the sound/arm variant.
The commit below shows the inversion in the requestor lines.
--- sound/soc/pxa/pxa2xx-ac97.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/pxa/pxa2xx-ac97.c +2 -2
@@ -49,7 +49,7 @@ static struct snd_ac97_bus_ops pxa2xx_ac .reset = pxa2xx_ac97_cold_reset, }; -static unsigned long pxa2xx_ac97_pcm_stereo_in_req =12 ; +static unsigned long pxa2xx_ac97_pcm_stereo_in_req =11 ;static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = { .addr =__PREG (PCDR ), .addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ,
@@ -57,7 +57,7 @@ static struct snd_dmaengine_dai_dma_data .filter_data = &pxa2xx_ac97_pcm_stereo_in_req, }; -static unsigned long pxa2xx_ac97_pcm_stereo_out_req =11 ; +static unsigned long pxa2xx_ac97_pcm_stereo_out_req =12 ;static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = { .addr =__PREG (PCDR ), .addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ,
Greg Kroah-Hartman
maintainerPATCH 29/79 ASoC: fix broken pxa SoC support
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Jarzmik <[email protected]>
commit 3c8f7710c1c44fb650bc29b6ef78ed8b60cfaa28 upstream.
The previous fix of pxa library support, which was introduced to fix the library dependency, broke the previous SoC behavior, where a machine code binding pxa2xx-ac97 with a coded relied on :
- sound/soc/pxa/pxa2xx-ac97.c
- sound/soc/codecs/XXX.c
For example, the mioa701_wm9713.c machine code is currently broken. The "select ARM" statement wrongly selects the soc/arm/pxa2xx-ac97 for compilation, as per an unfortunate fate SND_PXA2XX_AC97 is both declared in sound/arm/Kconfig and sound/soc/pxa/Kconfig.
Fix this by ensuring that SND_PXA2XX_SOC correctly triggers the correct pxa2xx-ac97 compilation.
--- sound/arm/Kconfig | 15 ++++++++------- sound/soc/pxa/Kconfig | 2 -- 2 files changed, 8 insertions(+), 9 deletions(-)
sound/arm/Kconfig +8 -7
@@ -9,6 +9,14 @@ menuconfig SND_ARM Drivers that are implemented on ASoC can be found in "ALSA for SoC audio support" section. +config SND_PXA2XX_LIB + tristate + select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97 + select SND_DMAENGINE_PCM + +config SND_PXA2XX_LIB_AC97 + bool + if SND_ARM config SND_ARMAACI
@@ -21,13 +29,6 @@ config SND_PXA2XX_PCM tristate select SND_PCM -config SND_PXA2XX_LIB - tristate - select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97 - -config SND_PXA2XX_LIB_AC97 - bool - config SND_PXA2XX_AC97 tristate "AC97 driver for the Intel PXA2xx chip" depends on ARCH_PXA
sound/soc/pxa/Kconfig +0 -2
@@ -1,7 +1,6 @@ config SND_PXA2XX_SOC tristate "SoC Audio for the Intel PXA2xx chip" depends on ARCH_PXA - select SND_ARM select SND_PXA2XX_LIB help Say Y or M if you want to add support for codecs attached to
@@ -24,7 +23,6 @@ config SND_PXA2XX_AC97 config SND_PXA2XX_SOC_AC97 tristate select AC97_BUS - select SND_ARM select SND_PXA2XX_LIB_AC97 select SND_SOC_AC97_BUS
Greg Kroah-Hartman
maintainerPATCH 30/79 ASoC: dwc: correct irq clear method
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yitian Bu <[email protected]>
commit 4873867e5f2bd90faad861dd94865099fc3140f3 upstream.
from Designware I2S datasheet, tx/rx XRUN irq is cleared by reading register TOR/ROR, rather than by writing into them.
--- sound/soc/dwc/designware_i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/dwc/designware_i2s.c +2 -2
@@ -100,10 +100,10 @@ static inline void i2s_clear_irqs(structif (stream ==SNDRV_PCM_STREAM_PLAYBACK ) {for (i =0 ; i <4 ; i++) -i2s_write_reg (dev->i2s_base,TOR (i),0 ); +i2s_read_reg (dev->i2s_base,TOR (i)); }else {for (i =0 ; i <4 ; i++) -i2s_write_reg (dev->i2s_base,ROR (i),0 ); +i2s_read_reg (dev->i2s_base,ROR (i)); } }
Greg Kroah-Hartman
maintainerPATCH 31/79 btrfs: skip waiting on ordered range for special files
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit a30e577c96f59b1e1678ea5462432b09bf7d5cbc upstream.
In btrfs_evict_inode, we properly truncate the page cache for evicted inodes but then we call btrfs_wait_ordered_range for every inode as well. It's the right thing to do for regular files but results in incorrect behavior for device inodes for block devices.
filemap_fdatawrite_range gets called with inode->i_mapping which gets resolved to the block device inode before getting passed to wbc_attach_fdatawrite_inode and ultimately to inode_to_bdi. What happens next depends on whether there's an open file handle associated with the inode. If there is, we write to the block device, which is unexpected behavior. If there isn't, we through normally and inode->i_data is used. We can also end up racing against open/close which can result in crashes when i_mapping points to a block device inode that has been closed.
Since there can't be any page cache associated with special file inodes, it's safe to skip the btrfs_wait_ordered_range call entirely and avoid the problem.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=100911
--- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +2 -1
@@ -4668,7 +4668,8 @@ void btrfs_evict_inode(struct inode *ino goto no_delete; }/* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */ -btrfs_wait_ordered_range (inode,0 , (u64)-1 ); +if (!special_file (inode->i_mode)) +btrfs_wait_ordered_range (inode,0 , (u64)-1 );if (root->fs_info->log_root_recovering) { BUG_ON(test_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
Greg Kroah-Hartman
maintainerPATCH 32/79 Btrfs: fix read corruption of compressed and shared extents
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 005efedf2c7d0a270ffbe28d8997b03844f3e3e7 upstream.
If a file has a range pointing to a compressed extent, followed by another range that points to the same compressed extent and a read operation attempts to read both ranges (either completely or part of them), the pages that correspond to the second range are incorrectly filled with zeroes.
Consider the following example:
File layout
[0 - 8K] [8K - 24K]
| |
| |
points to extent X, points to extent X,
offset 4K, length of 8K offset 0, length 16K[extent X, compressed length = 4K uncompressed length = 16K]
If a readpages() call spans the 2 ranges, a single bio to read the extent is submitted - extent_io.c:submit_extent_page() would only create a new bio to cover the second range pointing to the extent if the extent it points to had a different logical address than the extent associated with the first range. This has a consequence of the compressed read end io handler (compression.c:end_compressed_bio_read()) finish once the extent is decompressed into the pages covering the first range, leaving the remaining pages (belonging to the second range) filled with zeroes (done by compression.c:btrfs_clear_biovec_end()).
So fix this by submitting the current bio whenever we find a range pointing to a compressed extent that was preceded by a range with a different extent map. This is the simplest solution for this corner case. Making the end io callback populate both ranges (or more, if we have multiple pointing to the same extent) is a much more complex solution since each bio is tightly coupled with a single extent map and the extent maps associated to the ranges pointing to the shared extent can have different offsets and lengths.
The following test case for fstests triggers the issue:
seq=basename $0
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
rm -f $tmp.*
}# get standard environment, filters and checks . ./common/rc . ./common/filter
# real QA test starts here _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch _require_cloner
rm -f $seqres.full
test_clone_and_read_compressed_extent()
{
local mount_opts=$1 _scratch_mkfs >>$seqres.full 2>&1
_scratch_mount $mount_opts
# Create a test file with a single extent that is compressed (the # data we write into it is highly compressible no matter which # compression algorithm is used, zlib or lzo).
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0K 4K" \
-c "pwrite -S 0xbb 4K 8K" \
-c "pwrite -S 0xcc 12K 4K" \
$SCRATCH_MNT/foo | _filter_xfs_io
# Now clone our extent into an adjacent offset. $CLONER_PROG -s $((4 * 1024)) -d $((16 * 1024)) -l $((8 * 1024)) \
$SCRATCH_MNT/foo $SCRATCH_MNT/foo
# Same as before but for this file we clone the extent into a lower # file offset.
$XFS_IO_PROG -f -c "pwrite -S 0xaa 8K 4K" \
-c "pwrite -S 0xbb 12K 8K" \
-c "pwrite -S 0xcc 20K 4K" \
$SCRATCH_MNT/bar | _filter_xfs_io
$CLONER_PROG -s $((12 * 1024)) -d 0 -l $((8 * 1024)) \
$SCRATCH_MNT/bar $SCRATCH_MNT/bar
echo "File digests before unmounting filesystem:" md5sum $SCRATCH_MNT/foo | _filter_scratch md5sum $SCRATCH_MNT/bar | _filter_scratch
# Evicting the inode or clearing the page cache before reading # again the file would also trigger the bug - reads were returning # all bytes in the range corresponding to the second reference to # the extent with a value of 0, but the correct data was persisted # (it was a bug exclusively in the read path). The issue happened # only if the same readpages() call targeted pages belonging to the # first and second ranges that point to the same compressed extent. _scratch_remount
echo "File digests after mounting filesystem again:" # Must match the same digests we got before. md5sum $SCRATCH_MNT/foo | _filter_scratch md5sum $SCRATCH_MNT/bar | _filter_scratch
}
echo -e "\nTesting with zlib compression..." test_clone_and_read_compressed_extent "-o compress=zlib"
_scratch_unmount
echo -e "\nTesting with lzo compression..." test_clone_and_read_compressed_extent "-o compress=lzo"
status=0
exit
--- fs/btrfs/extent_io.c | 65 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 8 deletions(-)
fs/btrfs/extent_io.c +57 -8
@@ -2681,7 +2681,8 @@ static int submit_extent_page(int rw, stbio_end_io_t end_io_func, int mirror_num, unsigned long prev_bio_flags, - unsigned long bio_flags) + unsigned long bio_flags, + bool force_bio_submit) { int ret = 0;struct bio *bio;
@@ -2699,6 +2700,7 @@ static int submit_extent_page(int rw, st contig =bio_end_sector (bio) == sector;if (prev_bio_flags != bio_flags || !contig || + force_bio_submit ||merge_bio (rw, tree, page, offset, page_size, bio, bio_flags) ||bio_add_page (bio, page, page_size, offset) < page_size) { ret = submit_one_bio(rw, bio, mirror_num,
@@ -2790,7 +2792,8 @@ static int __do_readpage(struct extent_iget_extent_t *get_extent, struct extent_map **em_cached, struct bio **bio, int mirror_num, - unsigned long *bio_flags, int rw) + unsigned long *bio_flags, int rw, + u64 *prev_em_start) { struct inode *inode = page->mapping->host;u64 start =page_offset (page);
@@ -2838,6 +2841,7 @@ static int __do_readpage(struct extent_i }while (cur <= end) {unsigned long pnr = (last_byte >>PAGE_CACHE_SHIFT ) +1 ; +bool force_bio_submit = false;if (cur >= last_byte) {char *userpage;
@@ -2888,6 +2892,49 @@ static int __do_readpage(struct extent_i block_start = em->block_start;if (test_bit (EXTENT_FLAG_PREALLOC , &em->flags)) block_start =EXTENT_MAP_HOLE ; + +/* +* If we have a file range that points to a compressed extent +* and it's followed by a consecutive file range that points to +* to the same compressed extent (possibly with a different +* offset and/or length, so it either points to the whole extent +* or only part of it), we must make sure we do not submit a +* single bio to populate the pages for the 2 ranges because +* this makes the compressed extent read zero out the pages +* belonging to the 2nd range. Imagine the following scenario: +* +* File layout +* [0 - 8K] [8K - 24K] +* | | +* | | +* points to extent X, points to extent X, +* offset 4K, length of 8K offset 0, length 16K +* +* [extent X, compressed length = 4K uncompressed length = 16K] +* +* If the bio to read the compressed extent covers both ranges, +* it will decompress extent X into the pages belonging to the +* first range and then it will stop, zeroing out the remaining +* pages that belong to the other range that points to extent X. +* So here we make sure we submit 2 bios, one for the first +* range and another one for the third range. Both will target +* the same physical extent from disk, but we can't currently +* make the compressed bio endio callback populate the pages +* for both ranges because each compressed bio is tightly +* coupled with a single extent map, and each range can have +* an extent map with a different offset value relative to the +* uncompressed data of our extent and different lengths. This +* is a corner case so we prioritize correctness over +* non-optimal behavior (submitting 2 bios for the same extent). +*/ +if (test_bit (EXTENT_FLAG_COMPRESSED , &em->flags) && + prev_em_start && *prev_em_start != (u64)-1 && + *prev_em_start != em->orig_start) + force_bio_submit = true; + +if (prev_em_start) + *prev_em_start = em->orig_start; +free_extent_map (em); em =NULL ;
@@ -2937,7 +2984,8 @@ static int __do_readpage(struct extent_i bdev, bio, pnr, end_bio_extent_readpage, mirror_num, *bio_flags, - this_bio_flag); + this_bio_flag, + force_bio_submit);if (!ret) { nr++; *bio_flags = this_bio_flag;
@@ -2969,6 +3017,7 @@ static inline void __do_contiguous_readpstruct inode *inode;struct btrfs_ordered_extent *ordered;int index; +u64 prev_em_start = (u64)-1 ; inode = pages[0 ]->mapping->host;while (1 ) {
@@ -2984,7 +3033,7 @@ static inline void __do_contiguous_readpfor (index =0 ; index < nr_pages; index++) {__do_readpage (tree, pages[index], get_extent, em_cached, bio, - mirror_num, bio_flags, rw); + mirror_num, bio_flags, rw, &prev_em_start);page_cache_release (pages[index]); } }
@@ -3052,7 +3101,7 @@ static int __extent_read_full_page(struc } ret =__do_readpage (tree, page, get_extent,NULL , bio, mirror_num, - bio_flags, rw); + bio_flags, rw,NULL );return ret; }
@@ -3078,7 +3127,7 @@ int extent_read_full_page_nolock(structint ret; ret =__do_readpage (tree, page, get_extent,NULL , &bio, mirror_num, - &bio_flags,READ ); + &bio_flags,READ ,NULL );if (bio) ret =submit_one_bio (READ , bio, mirror_num, bio_flags);return ret;
@@ -3347,7 +3396,7 @@ static int __extent_writepage(struct pag sector, iosize, pg_offset, bdev, &epd->bio, max_nr, end_bio_extent_writepage, - 0, 0, 0); + 0, 0, 0, false);if (ret)SetPageError (page); }
@@ -3516,7 +3565,7 @@ static int write_one_eb(struct extent_bu ret =submit_extent_page (rw, tree, p, offset >>9 ,PAGE_CACHE_SIZE ,0 , bdev, &epd->bio,-1 , end_bio_extent_buffer_writepage, -0 , epd->bio_flags, bio_flags); +0 , epd->bio_flags, bio_flags, false); epd->bio_flags = bio_flags;if (ret) {set_bit (EXTENT_BUFFER_IOERR , &eb->bflags);
Greg Kroah-Hartman
maintainerPATCH 33/79 Btrfs: update fix for read corruption of compressed and shared extents
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 808f80b46790f27e145c72112189d6a3be2bc884 upstream.
My previous fix in commit 005efedf2c7d ("Btrfs: fix read corruption of compressed and shared extents") was effective only if the compressed extents cover a file range with a length that is not a multiple of 16 pages. That's because the detection of when we reached a different range of the file that shares the same compressed extent as the previously processed range was done at extent_io.c:__do_contiguous_readpages(), which covers subranges with a length up to 16 pages, because extent_readpages() groups the pages in clusters no larger than 16 pages. So fix this by tracking the start of the previously processed file range's extent map at extent_readpages().
The following test case for fstests reproduces the issue:
seq=basename $0
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
rm -f $tmp.*
}# get standard environment, filters and checks . ./common/rc . ./common/filter
# real QA test starts here _need_to_be_root _supported_fs btrfs _supported_os Linux _require_scratch _require_cloner
rm -f $seqres.full
test_clone_and_read_compressed_extent()
{
local mount_opts=$1 _scratch_mkfs >>$seqres.full 2>&1
_scratch_mount $mount_opts
# Create our test file with a single extent of 64Kb that is going to # be compressed no matter which compression algo is used (zlib/lzo). $XFS_IO_PROG -f -c "pwrite -S 0xaa 0K 64K" \
$SCRATCH_MNT/foo | _filter_xfs_io
# Now clone the compressed extent into an adjacent file offset. $CLONER_PROG -s 0 -d $((64 * 1024)) -l $((64 * 1024)) \
$SCRATCH_MNT/foo $SCRATCH_MNT/foo
echo "File digest before unmount:"
md5sum $SCRATCH_MNT/foo | _filter_scratch
# Remount the fs or clear the page cache to trigger the bug in # btrfs. Because the extent has an uncompressed length that is a # multiple of 16 pages, all the pages belonging to the second range # of the file (64K to 128K), which points to the same extent as the # first range (0K to 64K), had their contents full of zeroes instead # of the byte 0xaa. This was a bug exclusively in the read path of # compressed extents, the correct data was stored on disk, btrfs # just failed to fill in the pages correctly. _scratch_remount
echo "File digest after remount:"
# Must match the digest we got before.
md5sum $SCRATCH_MNT/foo | _filter_scratch
}
echo -e "\nTesting with zlib compression..." test_clone_and_read_compressed_extent "-o compress=zlib"
_scratch_unmount
echo -e "\nTesting with lzo compression..." test_clone_and_read_compressed_extent "-o compress=lzo"
status=0
exit
--- fs/btrfs/extent_io.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
fs/btrfs/extent_io.c +11 -8
@@ -3012,12 +3012,12 @@ static inline void __do_contiguous_readpget_extent_t *get_extent, struct extent_map **em_cached, struct bio **bio, int mirror_num, - unsigned long *bio_flags, int rw) + unsigned long *bio_flags, int rw, + u64 *prev_em_start) { struct inode *inode;struct btrfs_ordered_extent *ordered;int index; -u64 prev_em_start = (u64)-1 ; inode = pages[0 ]->mapping->host;while (1 ) {
@@ -3033,7 +3033,7 @@ static inline void __do_contiguous_readpfor (index =0 ; index < nr_pages; index++) {__do_readpage (tree, pages[index], get_extent, em_cached, bio, - mirror_num, bio_flags, rw, &prev_em_start); + mirror_num, bio_flags, rw, prev_em_start);page_cache_release (pages[index]); } }
@@ -3043,7 +3043,8 @@ static void __extent_readpages(struct ex int nr_pages, get_extent_t *get_extent, struct extent_map **em_cached, struct bio **bio, int mirror_num, - unsigned long *bio_flags, int rw) + unsigned long *bio_flags, int rw, + u64 *prev_em_start) { u64 start = 0;u64 end =0 ;
@@ -3064,7 +3065,7 @@ static void __extent_readpages(struct ex index - first_index, start, end, get_extent, em_cached, bio, mirror_num, bio_flags, - rw); + rw, prev_em_start); start = page_start; end = start +PAGE_CACHE_SIZE -1 ; first_index = index;
@@ -3075,7 +3076,8 @@ static void __extent_readpages(struct ex__do_contiguous_readpages (tree, &pages[first_index], index - first_index, start, end, get_extent, em_cached, bio, - mirror_num, bio_flags, rw); + mirror_num, bio_flags, rw, + prev_em_start); } static int __extent_read_full_page(struct extent_io_tree *tree,
@@ -3967,6 +3969,7 @@ int extent_readpages(struct extent_io_trstruct page *page;struct extent_map *em_cached =NULL ;int nr =0 ; +u64 prev_em_start = (u64)-1 ;for (page_idx =0 ; page_idx < nr_pages; page_idx++) { page = list_entry(pages->prev, struct page, lru);
@@ -3983,12 +3986,12 @@ int extent_readpages(struct extent_io_trif (nr <ARRAY_SIZE (pagepool))continue ;__extent_readpages (tree, pagepool, nr, get_extent, &em_cached, - &bio,0 , &bio_flags,READ ); + &bio,0 , &bio_flags,READ , &prev_em_start); nr =0 ; }if (nr)__extent_readpages (tree, pagepool, nr, get_extent, &em_cached, - &bio,0 , &bio_flags,READ ); + &bio,0 , &bio_flags,READ , &prev_em_start);if (em_cached)free_extent_map (em_cached);
Greg Kroah-Hartman
maintainerPATCH 34/79 dm btree: add ref counting ops for the leaves of top level btrees
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit b0dc3c8bc157c60b1d470163882be8c13e1950af upstream.
When using nested btrees, the top leaves of the top levels contain block addresses for the root of the next tree down. If we shadow a shared leaf node the leaf values (sub tree roots) should be incremented accordingly.
This is only an issue if there is metadata sharing in the top levels. Which only occurs if metadata snapshots are being used (as is possible with dm-thinp). And could result in a block from the thinp metadata snap being reused early, thus corrupting the thinp metadata snap.
--- drivers/md/persistent-data/dm-btree-internal.h | 6 ++++ drivers/md/persistent-data/dm-btree-remove.c | 12 ++------ drivers/md/persistent-data/dm-btree-spine.c | 37 +++++++++++++++++++++++++ drivers/md/persistent-data/dm-btree.c | 7 ---- 4 files changed, 47 insertions(+), 15 deletions(-)
drivers/md/persistent-data/dm-btree-internal.h +6 -0
@@ -138,4 +138,10 @@ int lower_bound(struct btree_node *n, uiextern struct dm_block_validator btree_node_validator; +/* +* Value type for upper levels of multi-level btrees. +*/ +extern void init_le64_type (struct dm_transaction_manager *tm, +struct dm_btree_value_type *vt); +#endif /* DM_BTREE_INTERNAL_H */
drivers/md/persistent-data/dm-btree-remove.c +3 -9
@@ -544,14 +544,6 @@ static int remove_raw(struct shadow_spinreturn r; } -static struct dm_btree_value_type le64_type = { - .context =NULL , - .size =sizeof (__le64), - .inc =NULL , - .dec =NULL , - .equal =NULL -}; -int dm_btree_remove (struct dm_btree_info *info,dm_block_t root,uint64_t *keys,dm_block_t *new_root) {
@@ -559,12 +551,14 @@ int dm_btree_remove(struct dm_btree_infoint index =0 , r =0 ;struct shadow_spine spine;struct btree_node *n; +struct dm_btree_value_type le64_vt; +init_le64_type (info->tm, &le64_vt);init_shadow_spine (&spine, info);for (level =0 ; level < info->levels; level++) { r =remove_raw (&spine, info, (level == last_level ? - &info->value_type : &le64_type), + &info->value_type : &le64_vt), root, keys[level], (unsigned *)&index);if (r <0 )break ;
drivers/md/persistent-data/dm-btree-spine.c +37 -0
@@ -249,3 +249,40 @@ int shadow_root(struct shadow_spine *s) {return s->root; } + +static void le64_inc (void *context,const void *value_le) +{ +struct dm_transaction_manager *tm = context; +__le64 v_le; + +memcpy (&v_le, value_le,sizeof (v_le)); +dm_tm_inc (tm,le64_to_cpu (v_le)); +} + +static void le64_dec (void *context,const void *value_le) +{ +struct dm_transaction_manager *tm = context; +__le64 v_le; + +memcpy (&v_le, value_le,sizeof (v_le)); +dm_tm_dec (tm,le64_to_cpu (v_le)); +} + +static int le64_equal (void *context,const void *value1_le,const void *value2_le) +{ +__le64 v1_le, v2_le; + +memcpy (&v1_le, value1_le,sizeof (v1_le)); +memcpy (&v2_le, value2_le,sizeof (v2_le)); +return v1_le == v2_le; +} + +void init_le64_type (struct dm_transaction_manager *tm, +struct dm_btree_value_type *vt) +{ + vt->context = tm; + vt->size =sizeof (__le64); + vt->inc = le64_inc; + vt->dec = le64_dec; + vt->equal = le64_equal; +}
drivers/md/persistent-data/dm-btree.c +1 -6
@@ -667,12 +667,7 @@ static int insert(struct dm_btree_info *struct btree_node *n;struct dm_btree_value_type le64_type; - le64_type.context =NULL ; - le64_type.size =sizeof (__le64); - le64_type.inc =NULL ; - le64_type.dec =NULL ; - le64_type.equal =NULL ; - +init_le64_type (info->tm, &le64_type);init_shadow_spine (&spine, info);for (level =0 ; level < (info->levels -1 ); level++) {
Greg Kroah-Hartman
maintainerPATCH 35/79 staging: ion: fix corruption of ion_import_dma_buf
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
commit 6fa92e2bcf6390e64895b12761e851c452d87bd8 upstream.
we found this issue but still exit in lastest kernel. Simply keep ion_handle_create under mutex_lock to avoid this race.
WARNING: CPU: 2 PID: 2648 at drivers/staging/android/ion/ion.c:512 ion_handle_add+0xb4/0xc0() ion_handle_add: buffer already found. Modules linked in: iwlmvm iwlwifi mac80211 cfg80211 compat CPU: 2 PID: 2648 Comm: TimedEventQueue Tainted: G W 3.14.0 #7 00000000 00000000 9a3efd2c 80faf273 9a3efd6c 9a3efd5c 80935dc9 811d7fd3 9a3efd88 00000a58 812208a0 00000200 80e128d4 80e128d4 8d4ae00c a8cd8600 a8cd8094 9a3efd74 80935e0e 00000009 9a3efd6c 811d7fd3 9a3efd88 9a3efd9c Call Trace: [<80faf273>] dump_stack+0x48/0x69 [<80935dc9>] warn_slowpath_common+0x79/0x90 [<80e128d4>] ? ion_handle_add+0xb4/0xc0 [<80e128d4>] ? ion_handle_add+0xb4/0xc0 [<80935e0e>] warn_slowpath_fmt+0x2e/0x30 [<80e128d4>] ion_handle_add+0xb4/0xc0 [<80e144cc>] ion_import_dma_buf+0x8c/0x110 [<80c517c4>] reg_init+0x364/0x7d0 [<80993363>] ? futex_wait+0x123/0x210 [<80992e0e>] ? get_futex_key+0x16e/0x1e0 [<8099308f>] ? futex_wake+0x5f/0x120 [<80c51e19>] vpu_service_ioctl+0x1e9/0x500 [<80994aec>] ? do_futex+0xec/0x8e0 [<80971080>] ? prepare_to_wait_event+0xc0/0xc0 [<80c51c30>] ? reg_init+0x7d0/0x7d0 [<80a22562>] do_vfs_ioctl+0x2d2/0x4c0 [<80b198ad>] ? inode_has_perm.isra.41+0x2d/0x40 [<80b199cf>] ? file_has_perm+0x7f/0x90 [<80b1a5f7>] ? selinux_file_ioctl+0x47/0xf0 [<80a227a8>] SyS_ioctl+0x58/0x80 [<80fb45e8>] syscall_call+0x7/0x7 [<80fb0000>] ? mmc_do_calc_max_discard+0xab/0xe4
--- drivers/staging/android/ion/ion.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/android/ion/ion.c +3 -3
@@ -1119,13 +1119,13 @@ struct ion_handle *ion_import_dma_buf(stmutex_unlock (&client->lock); goto end; } -mutex_unlock (&client->lock); handle =ion_handle_create (client, buffer); -if (IS_ERR (handle)) +if (IS_ERR (handle)) { +mutex_unlock (&client->lock); goto end; + } -mutex_lock (&client->lock); ret =ion_handle_add (client, handle);mutex_unlock (&client->lock);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 36/79 USB: option: add ZTE PIDs
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Liu.Zhao" <[email protected]>
commit 19ab6bc5674a30fdb6a2436b068d19a3c17dc73e upstream.
This is intended to add ZTE device PIDs on kernel.
--- drivers/usb/serial/option.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/usb/serial/option.c +24 -0
@@ -276,6 +276,10 @@ static void option_instat_callback(struc#define ZTE_PRODUCT_MF622 0x0001#define ZTE_PRODUCT_MF628 0x0015#define ZTE_PRODUCT_MF626 0x0031 +#define ZTE_PRODUCT_ZM8620_X 0x0396 +#define ZTE_PRODUCT_ME3620_MBIM 0x0426 +#define ZTE_PRODUCT_ME3620_X 0x1432 +#define ZTE_PRODUCT_ME3620_L 0x1433#define ZTE_PRODUCT_AC2726 0xfff1#define ZTE_PRODUCT_CDMA_TECH 0xfffe#define ZTE_PRODUCT_AC8710T 0xffff
@@ -549,6 +553,18 @@ static const struct option_blacklist_inf .sendsetup = BIT(1) | BIT(2) | BIT(3), }; +static const struct option_blacklist_info zte_me3620_mbim_blacklist = { + .reserved =BIT (2 ) |BIT (3 ) |BIT (4 ), +}; + +static const struct option_blacklist_info zte_me3620_xl_blacklist = { + .reserved =BIT (3 ) |BIT (4 ) |BIT (5 ), +}; + +static const struct option_blacklist_info zte_zm8620_x_blacklist = { + .reserved =BIT (3 ) |BIT (4 ) |BIT (5 ), +}; +static const struct option_blacklist_info huawei_cdc12_blacklist = { .reserved =BIT (1 ) |BIT (2 ), };
@@ -1579,6 +1595,14 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_L), + .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_MBIM), + .driver_info = (kernel_ulong_t)&zte_me3620_mbim_blacklist }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_X), + .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ZM8620_X), + .driver_info = (kernel_ulong_t)&zte_zm8620_x_blacklist }, { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
Greg Kroah-Hartman
maintainerPATCH 37/79 dm raid: fix round up of default region size
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 042745ee53a0a7c1f5aff191a4a24213c6dcfb52 upstream.
Commit 3a0f9aaee028 ("dm raid: round region_size to power of two") intended to make sure that the default region size is a power of two. However, the logic in that commit is incorrect and sets the variable region_size to 0 or 1, depending on whether min_region_size is a power of two.
Fix this logic, using roundup_pow_of_two(), so that region_size is properly rounded up to the next power of two.
--- drivers/md/dm-raid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/dm-raid.c +1 -2
@@ -325,8 +325,7 @@ static int validate_region_size(struct r*/ if (min_region_size > (1 <<13 )) {/* If not a power of 2, make it the next power of 2 */ -if (min_region_size & (min_region_size -1 )) - region_size =1 <<fls (region_size); + region_size =roundup_pow_of_two (min_region_size);DMINFO ("Choosing default region size of %lu sectors" , region_size); }else {
Greg Kroah-Hartman
maintainerPATCH 38/79 netfilter: nf_conntrack: Support expectations in different zones
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Stringer <[email protected]>
commit 4b31814d20cbe5cd4ccf18089751e77a04afe4f2 upstream.
When zones were originally introduced, the expectation functions were all extended to perform lookup using the zone. However, insertion was not modified to check the zone. This means that two expectations which are intended to apply for different connections that have the same tuple but exist in different zones cannot both be tracked.
--- net/netfilter/nf_conntrack_expect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_expect.c +2 -1
@@ -202,7 +202,8 @@ static inline int expect_clash(const str a->mask.src.u3.all[count] & b->mask.src.u3.all[count]; } -return nf_ct_tuple_mask_cmp (&a->tuple, &b->tuple, &intersect_mask); +return nf_ct_tuple_mask_cmp (&a->tuple, &b->tuple, &intersect_mask) && +nf_ct_zone (a->master) ==nf_ct_zone (b->master); } static inline int expect_matches(const struct nf_conntrack_expect *a,
Greg Kroah-Hartman
maintainerPATCH 39/79 netfilter: ctnetlink: put back references to master ct and expect objects
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
commit 95dd8653de658143770cb0e55a58d2aab97c79d2 upstream.
We have to put back the references to the master conntrack and the expectation that we just created, otherwise we'll leak them.
--- net/netfilter/nf_conntrack_netlink.c | 5 ----- 1 file changed, 5 deletions(-)
net/netfilter/nf_conntrack_netlink.c +0 -5
@@ -2927,11 +2927,6 @@ ctnetlink_create_expect(struct net *net, } err =nf_ct_expect_related_report (exp, portid, report); -if (err <0 ) - goto err_exp; - -return 0 ; -err_exp:nf_ct_expect_put (exp); err_ct:nf_ct_put (ct);
Greg Kroah-Hartman
maintainerPATCH 40/79 netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
commit ba378ca9c04a5fc1b2cf0f0274a9d02eb3d1bad9 upstream.
Fix lookup of existing match/target structures in the corresponding list by skipping the family check if NFPROTO_UNSPEC is used.
This is resulting in the allocation and insertion of one match/target structure for each use of them. So this not only bloats memory consumption but also severely affects the time to reload the ruleset from the iptables-compat utility.
After this patch, iptables-compat-restore and iptables-compat take almost the same time to reload large rulesets.
--- net/netfilter/nft_compat.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
net/netfilter/nft_compat.c +18 -6
@@ -594,6 +594,13 @@ struct nft_xt {static struct nft_expr_type nft_match_type; +static bool nft_match_cmp (const struct xt_match *match, +const char *name,u32 rev,u32 family) +{ +return strcmp (match->name, name) ==0 && match->revision == rev && + (match->family ==NFPROTO_UNSPEC || match->family == family); +} +static const struct nft_expr_ops *nft_match_select_ops (const struct nft_ctx *ctx,const struct nlattr *const tb[])
@@ -601,7 +608,7 @@ nft_match_select_ops(const struct nft_ctstruct nft_xt *nft_match;struct xt_match *match;char *mt_name; -__u32 rev, family; +u32 rev, family; if (tb[NFTA_MATCH_NAME] == NULL || tb[NFTA_MATCH_REV] == NULL ||
@@ -616,8 +623,7 @@ nft_match_select_ops(const struct nft_ctlist_for_each_entry (nft_match, &nft_match_list, head) {struct xt_match *match = nft_match->ops.data; -if (strcmp (match->name, mt_name) ==0 && - match->revision == rev && match->family == family) { +if (nft_match_cmp (match, mt_name, rev, family)) {if (!try_module_get (match->me))return ERR_PTR (-ENOENT );
@@ -669,6 +675,13 @@ static LIST_HEAD(nft_target_list);static struct nft_expr_type nft_target_type; +static bool nft_target_cmp (const struct xt_target *tg, +const char *name,u32 rev,u32 family) +{ +return strcmp (tg->name, name) ==0 && tg->revision == rev && + (tg->family ==NFPROTO_UNSPEC || tg->family == family); +} +static const struct nft_expr_ops *nft_target_select_ops (const struct nft_ctx *ctx,const struct nlattr *const tb[])
@@ -676,7 +689,7 @@ nft_target_select_ops(const struct nft_cstruct nft_xt *nft_target;struct xt_target *target;char *tg_name; -__u32 rev, family; +u32 rev, family; if (tb[NFTA_TARGET_NAME] == NULL || tb[NFTA_TARGET_REV] == NULL ||
@@ -691,8 +704,7 @@ nft_target_select_ops(const struct nft_clist_for_each_entry (nft_target, &nft_target_list, head) {struct xt_target *target = nft_target->ops.data; -if (strcmp (target->name, tg_name) ==0 && - target->revision == rev && target->family == family) { +if (nft_target_cmp (target, tg_name, rev, family)) {if (!try_module_get (target->me))return ERR_PTR (-ENOENT );
Greg Kroah-Hartman
maintainerPATCH 41/79 disabling oplocks/leases via module parm enable_oplocks broken for SMB3
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit e0ddde9d44e37fbc21ce893553094ecf1a633ab5 upstream.
leases (oplocks) were always requested for SMB2/SMB3 even when oplocks disabled in the cifs.ko module.
--- fs/cifs/smb2ops.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/cifs/smb2ops.c +6 -2
@@ -49,9 +49,13 @@ change_conf(struct TCP_Server_Info *servbreak ;default : server->echoes = true; - server->oplocks = true; +if (enable_oplocks) { + server->oplocks = true; + server->oplock_credits =1 ; + }else + server->oplocks = false; + server->echo_credits =1 ; - server->oplock_credits =1 ; } server->credits -= server->echo_credits + server->oplock_credits;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 42/79 drm/qxl: only report first monitor as connected if we have no state
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 69e5d3f893e19613486f300fd6e631810338aa4b upstream.
If the server isn't new enough to give us state, report the first monitor as always connected, otherwise believe the server side.
--- drivers/gpu/drm/qxl/qxl_display.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +7 -5
@@ -816,13 +816,15 @@ static enum drm_connector_status qxl_condrm_connector_to_qxl_output (connector);struct drm_device *ddev = connector->dev;struct qxl_device *qdev = ddev->dev_private; -int connected; +bool connected = false;/* The first monitor is always connected */ - connected = (output->index ==0 ) || - (qdev->client_monitors_config && - qdev->client_monitors_config->count > output->index && -qxl_head_enabled (&qdev->client_monitors_config->heads[output->index])); +if (!qdev->client_monitors_config) { +if (output->index ==0 ) + connected = true; + }else + connected = qdev->client_monitors_config->count > output->index && +qxl_head_enabled (&qdev->client_monitors_config->heads[output->index]);DRM_DEBUG ("#%d connected: %d\n" , output->index, connected);if (!connected)
Re: [PATCH 3.14 42/79] drm/qxl: only report first monitor as connected if we have no state
Quoted 10 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit
69e5d3f893e19613486f300fd6e631810338aa4bupstream.If the server isn't new enough to give us state, report the first monitor as always connected, otherwise believe the server side.
Hi,
I've got a bug report, that this commit breaks 3.12-stable:
===============
While testing KDE5 packages which will be landing in Package Hub for SP1, we found a issue with qxl drm driver in kernel.
When booting SLES (or SLED) 12 SP1, in a libvirt KVM environment, with QXL as video driver, KDE5 plasma was not rendered on screen, you could only see mouse cursor.
Booting with nomodeset=1 or qxl.modeset=0 fixes the issue.
===============
Does it make sense? Is 3.12 missing some prerequisite? Or should we just revert the commit in 3.12? And what about 3.14, 4.1?
Thanks.
Quoted 30 lines
Signed-off-by Dave Airlie <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/qxl/qxl_display.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/qxl/qxl_display.c +7
-5@@ -816,13 +816,15 @@ static enum drm_connector_status qxl_condrm_connector_to_qxl_output (connector);struct drm_device *ddev = connector->dev;struct qxl_device *qdev = ddev->dev_private; -int connected; +bool connected = false;/* The first monitor is always connected */ - connected = (output->index ==0 ) || - (qdev->client_monitors_config && - qdev->client_monitors_config->count > output->index && -qxl_head_enabled (&qdev->client_monitors_config->heads[output->index])); +if (!qdev->client_monitors_config) { +if (output->index ==0 ) + connected = true; + }else + connected = qdev->client_monitors_config->count > output->index && +qxl_head_enabled (&qdev->client_monitors_config->heads[output->index]);DRM_DEBUG ("#%d connected: %d\n" , output->index, connected);if (!connected)
Signature · 2 lines
js suse labs
Re: [PATCH 3.14 42/79] drm/qxl: only report first monitor as connected if we have no state
Quoted 23 lines · Jiri Slaby
Quoted 10 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit
69e5d3f893e19613486f300fd6e631810338aa4bupstream.If the server isn't new enough to give us state, report the first monitor as always connected, otherwise believe the server side.
Hi,
I've got a bug report, that this commit breaks 3.12-stable:
===============
While testing KDE5 packages which will be landing in Package Hub for SP1, we found a issue with qxl drm driver in kernel.When booting SLES (or SLED) 12 SP1, in a libvirt KVM environment, with QXL as video driver, KDE5 plasma was not rendered on screen, you could only see mouse cursor.
Quoted 5 lines
Booting with nomodeset=1 or qxl.modeset=0 fixes the issue.
===============Does it make sense? Is 3.12 missing some prerequisite? Or should we just revert the commit in 3.12? And what about 3.14, 4.1?
Also, I am attaching xrandr outputs:
(bad) xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192 Virtual-0 disconnected primary 1024x768+0+0 0mm x 0mm Virtual-1 disconnected
Virtual-2 disconnected
Virtual-3 disconnected
1024x768 (0x47) 63.5MHz
h: width 1024 start 1072 end 1176 total 1328 skew 0 clock
47.8KHz
v: height 768 start 771 end 775 total 798 clock
59.9Hz
(good) xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192 Virtual-0 connected primary 1024x768+0+0 0mm x 0mm
1024x768 59.9*+
0x0 0.0 +
1920x1200 59.9 1920x1080 60.0 1600x1200 59.9 1680x1050 60.0 1400x1050 60.0 1280x1024 59.9 1440x900 59.9 1280x960 59.9 1280x854 59.9 1280x800 59.8 1280x720 59.9 1152x768 59.8 800x600 59.9 848x480 59.7 720x480 59.7 640x480 59.4
Virtual-1 disconnected
Virtual-2 disconnected
Virtual-3 disconnected
Quoted 35 lines
Thanks.
Quoted 30 lines
Signed-off-by Dave Airlie <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/gpu/drm/qxl/qxl_display.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/qxl/qxl_display.c +7
-5@@ -816,13 +816,15 @@ static enum drm_connector_status qxl_condrm_connector_to_qxl_output (connector);struct drm_device *ddev = connector->dev;struct qxl_device *qdev = ddev->dev_private; -int connected; +bool connected = false;/* The first monitor is always connected */ - connected = (output->index ==0 ) || - (qdev->client_monitors_config && - qdev->client_monitors_config->count > output->index && -qxl_head_enabled (&qdev->client_monitors_config->heads[output->index])); +if (!qdev->client_monitors_config) { +if (output->index ==0 ) + connected = true; + }else + connected = qdev->client_monitors_config->count > output->index && +qxl_head_enabled (&qdev->client_monitors_config->heads[output->index]);DRM_DEBUG ("#%d connected: %d\n" , output->index, connected);if (!connected)
Signature · 2 lines
js suse labs
Greg Kroah-Hartman
maintainerRe: [PATCH 3.14 42/79] drm/qxl: only report first monitor as connected if we have no state
In reply to Jiri SlabyQuoted 23 lines · Jiri Slaby
Quoted 10 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit
69e5d3f893e19613486f300fd6e631810338aa4bupstream.If the server isn't new enough to give us state, report the first monitor as always connected, otherwise believe the server side.
Hi,
I've got a bug report, that this commit breaks 3.12-stable:
===============
While testing KDE5 packages which will be landing in Package Hub for SP1, we found a issue with qxl drm driver in kernel.When booting SLES (or SLED) 12 SP1, in a libvirt KVM environment, with QXL as video driver, KDE5 plasma was not rendered on screen, you could only see mouse cursor.
Quoted 5 lines
Booting with nomodeset=1 or qxl.modeset=0 fixes the issue.
===============Does it make sense? Is 3.12 missing some prerequisite? Or should we just revert the commit in 3.12? And what about 3.14, 4.1?
What ever happened to this? Did you revert this in 3.12-stable?
thanks,
greg k-h
Re: [PATCH 3.14 42/79] drm/qxl: only report first monitor as connected if we have no state
Quoted 24 lines · Greg Kroah-Hartman
Quoted 23 lines · Jiri Slaby
Quoted 10 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit
69e5d3f893e19613486f300fd6e631810338aa4bupstream.If the server isn't new enough to give us state, report the first monitor as always connected, otherwise believe the server side.
Hi,
I've got a bug report, that this commit breaks 3.12-stable:
===============
While testing KDE5 packages which will be landing in Package Hub for SP1, we found a issue with qxl drm driver in kernel.When booting SLES (or SLED) 12 SP1, in a libvirt KVM environment, with QXL as video driver, KDE5 plasma was not rendered on screen, you could only see mouse cursor.
Quoted 7 lines
Quoted 5 lines
Booting with nomodeset=1 or qxl.modeset=0 fixes the issue.
===============Does it make sense? Is 3.12 missing some prerequisite? Or should we just revert the commit in 3.12? And what about 3.14, 4.1?
What ever happened to this? Did you revert this in 3.12-stable?
I forgot about this completely, so I took no action back then. Neither was this reverted in SLE. Neither I saw any other report since then. And given it was released in Nov 2015, perhaps, I won't do anything with that, assuming this was kvm issue or something.
thanks,
Signature · 2 lines
js suse labs
Greg Kroah-Hartman
maintainerPATCH 44/79 drm: Reject DRI1 hw lock ioctl functions for kms drivers
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit da168d81b44898404d281d5dbe70154ab5f117c1 upstream.
I've done some extensive history digging across libdrm, mesa and xf86-video-{intel,nouveau,ati}. The only potential user of this with kms drivers I could find was ttmtest, which once used drmGetLock still. But that mistake was quickly fixed up. Even the intel xvmc library (which otherwise was really good with using dri1 stuff in kms mode) managed to never take the hw lock for dri2 (and hence kms).
Hence it should be save to unconditionally disallow this.
--- drivers/gpu/drm/drm_lock.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_lock.c +6 -0
@@ -58,6 +58,9 @@ int drm_lock(struct drm_device *dev, voistruct drm_master *master = file_priv->master;int ret =0 ; +if (drm_core_check_feature (dev,DRIVER_MODESET )) +return -EINVAL ; + ++file_priv->lock_count;if (lock->context ==DRM_KERNEL_CONTEXT ) {
@@ -150,6 +153,9 @@ int drm_unlock(struct drm_device *dev, vstruct drm_lock *lock = data;struct drm_master *master = file_priv->master; +if (drm_core_check_feature (dev,DRIVER_MODESET )) +return -EINVAL ; +if (lock->context ==DRM_KERNEL_CONTEXT ) {DRM_ERROR ("Process %d using kernel context %d\n" ,task_pid_nr (current), lock->context);
Greg Kroah-Hartman
maintainerPATCH 45/79 USB: whiteheat: fix potential null-deref at probe
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit cbb4be652d374f64661137756b8f357a1827d6a4 upstream.
Fix potential null-pointer dereference at probe by making sure that the required endpoints are present.
The whiteheat driver assumes there are at least five pairs of bulk endpoints, of which the final pair is used for the "command port". An attempt to bind to an interface with fewer bulk endpoints would currently lead to an oops.
Fixes CVE-2015-5257.
--- drivers/usb/serial/whiteheat.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/usb/serial/whiteheat.c +31 -0
@@ -80,6 +80,8 @@ static int whiteheat_firmware_download(static int whiteheat_firmware_attach (struct usb_serial *serial);/* function prototypes for the Connect Tech WhiteHEAT serial converter */ +static int whiteheat_probe (struct usb_serial *serial, +const struct usb_device_id *id);static int whiteheat_attach (struct usb_serial *serial);static void whiteheat_release (struct usb_serial *serial);static int whiteheat_port_probe (struct usb_serial_port *port);
@@ -116,6 +118,7 @@ static struct usb_serial_driver whitehea .description = "Connect Tech - WhiteHEAT", .id_table = id_table_std, .num_ports = 4, + .probe = whiteheat_probe, .attach = whiteheat_attach, .release = whiteheat_release, .port_probe = whiteheat_port_probe,
@@ -217,6 +220,34 @@ static int whiteheat_firmware_attach(str/***************************************************************************** * Connect Tech's White Heat serial driver functions *****************************************************************************/ + +static int whiteheat_probe (struct usb_serial *serial, +const struct usb_device_id *id) +{ +struct usb_host_interface *iface_desc; +struct usb_endpoint_descriptor *endpoint; +size_t num_bulk_in =0 ; +size_t num_bulk_out =0 ; +size_t min_num_bulk; +unsigned int i; + + iface_desc = serial->interface->cur_altsetting; + +for (i =0 ; i < iface_desc->desc.bNumEndpoints; i++) { + endpoint = &iface_desc->endpoint[i].desc; +if (usb_endpoint_is_bulk_in (endpoint)) + ++num_bulk_in; +if (usb_endpoint_is_bulk_out (endpoint)) + ++num_bulk_out; + } + + min_num_bulk =COMMAND_PORT +1 ; +if (num_bulk_in < min_num_bulk || num_bulk_out < min_num_bulk) +return -ENODEV ; + +return 0 ; +} +static int whiteheat_attach (struct usb_serial *serial) {struct usb_serial_port *command_port;
Greg Kroah-Hartman
maintainerPATCH 46/79 usb: xhci: Clear XHCI_STATE_DYING on start
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit e5bfeab0ad515b4f6df39fe716603e9dc6d3dfd0 upstream.
For whatever reason if XHCI died in the previous instant then it will never recover on the next xhci_start unless we clear the DYING flag.
--- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +2 -1
@@ -147,7 +147,8 @@ static int xhci_start(struct xhci_hcd *x"waited %u microseconds.\n" , XHCI_MAX_HALT_USEC);if (!ret) - xhci->xhc_state &= ~XHCI_STATE_HALTED ; + xhci->xhc_state &= ~(XHCI_STATE_HALTED |XHCI_STATE_DYING ); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 47/79 xhci: change xhci 1.0 only restrictions to support xhci 1.1
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit dca7794539eff04b786fb6907186989e5eaaa9c2 upstream.
Some changes between xhci 0.96 and xhci 1.0 specifications forced us to check the hci version in code, some of these checks were implemented as hci_version == 1.0, which will not work with new xhci 1.1 controllers.
xhci 1.1 behaves similar to xhci 1.0 in these cases, so change these checks to hci_version >= 1.0
--- drivers/usb/host/xhci-mem.c | 6 +++--- drivers/usb/host/xhci-ring.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-mem.c +3 -3
@@ -1402,10 +1402,10 @@ int xhci_endpoint_init(struct xhci_hcd ** use Event Data TRBs, and we don't chain in a link TRB on short * transfers, we're basically dividing by 1. * -* xHCI 1.0 specification indicates that the Average TRB Length should -* be set to 8 for control endpoints. +* xHCI 1.0 and 1.1 specification indicates that the Average TRB Length +* should be set to 8 for control endpoints. */ -if (usb_endpoint_xfer_control (&ep->desc) && xhci->hci_version ==0x100 ) +if (usb_endpoint_xfer_control (&ep->desc) && xhci->hci_version >=0x100 ) ep_ctx->tx_info |=cpu_to_le32 (AVG_TRB_LENGTH_FOR_EP (8 ));else ep_ctx->tx_info |=
drivers/usb/host/xhci-ring.c +2 -2
@@ -3567,8 +3567,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *if (start_cycle ==0 ) field |=0x1 ; -/* xHCI 1.0 6.4.1.2.1: Transfer Type field */ -if (xhci->hci_version ==0x100 ) { +/* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */ +if (xhci->hci_version >=0x100 ) {if (urb->transfer_buffer_length >0 ) {if (setup->bRequestType &USB_DIR_IN ) field |=TRB_TX_TYPE (TRB_DATA_IN );
Greg Kroah-Hartman
maintainerPATCH 48/79 usb: xhci: Add support for URB_ZERO_PACKET to bulk/sg transfers
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Reyad Attiyat <[email protected]>
commit 4758dcd19a7d9ba9610b38fecb93f65f56f86346 upstream.
This commit checks for the URB_ZERO_PACKET flag and creates an extra zero-length td if the urb transfer length is a multiple of the endpoint's max packet length.
--- drivers/usb/host/xhci-ring.c | 66 +++++++++++++++++++++++++++++++++---------- drivers/usb/host/xhci.c | 5 +++ 2 files changed, 57 insertions(+), 14 deletions(-)
drivers/usb/host/xhci-ring.c +52 -14
@@ -3223,9 +3223,11 @@ static int queue_bulk_sg_tx(struct xhci_struct xhci_td *td;struct scatterlist *sg;int num_sgs; -int trb_buff_len, this_sg_len, running_total; +int trb_buff_len, this_sg_len, running_total, ret;unsigned int total_packet_count; +bool zero_length_needed;bool first_trb; +int last_trb_num;u64 addr;bool more_trbs_coming;
@@ -3241,13 +3243,27 @@ static int queue_bulk_sg_tx(struct xhci_ total_packet_count =DIV_ROUND_UP (urb->transfer_buffer_length,usb_endpoint_maxp (&urb->ep->desc)); - trb_buff_len =prepare_transfer (xhci, xhci->devs[slot_id], + ret =prepare_transfer (xhci, xhci->devs[slot_id], ep_index, urb->stream_id, num_trbs, urb,0 , mem_flags); -if (trb_buff_len <0 ) -return trb_buff_len; +if (ret <0 ) +return ret; urb_priv = urb->hcpriv; + +/* Deal with URB_ZERO_PACKET - need one more td/trb */ + zero_length_needed = urb->transfer_flags &URB_ZERO_PACKET && + urb_priv->length ==2 ; +if (zero_length_needed) { + num_trbs++; +xhci_dbg (xhci,"Creating zero length td.\n" ); + ret =prepare_transfer (xhci, xhci->devs[slot_id], + ep_index, urb->stream_id, +1 , urb,1 , mem_flags); +if (ret <0 ) +return ret; + } + td = urb_priv->td[0 ];/*
@@ -3277,6 +3293,7 @@ static int queue_bulk_sg_tx(struct xhci_ trb_buff_len = urb->transfer_buffer_length; first_trb = true; + last_trb_num = zero_length_needed ?2 :1 ;/* Queue the first TRB, even if it's zero-length */ do { u32 field = 0;
@@ -3294,12 +3311,15 @@ static int queue_bulk_sg_tx(struct xhci_/* Chain all the TRBs together; clear the chain bit in the last * TRB to indicate it's the last TRB in the chain. */ -if (num_trbs >1 ) { +if (num_trbs > last_trb_num) { field |=TRB_CHAIN ; - }else { -/* FIXME - add check for ZERO_PACKET flag before this */ + }else if (num_trbs == last_trb_num) { td->last_trb = ep_ring->enqueue; field |=TRB_IOC ; + }else if (zero_length_needed && num_trbs ==1 ) { + trb_buff_len =0 ; + urb_priv->td[1 ]->last_trb = ep_ring->enqueue; + field |=TRB_IOC ; }/* Only set interrupt on short packet for IN endpoints */
@@ -3361,7 +3381,7 @@ static int queue_bulk_sg_tx(struct xhci_if (running_total + trb_buff_len > urb->transfer_buffer_length) trb_buff_len = urb->transfer_buffer_length - running_total; - }while (running_total < urb->transfer_buffer_length); + }while (num_trbs >0 );check_trb_math (urb, num_trbs, running_total); giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id,
@@ -3379,7 +3399,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *int num_trbs;struct xhci_generic_trb *start_trb;bool first_trb; +int last_trb_num;bool more_trbs_coming; +bool zero_length_needed;int start_cycle;u32 field, length_field;
@@ -3410,7 +3432,6 @@ int xhci_queue_bulk_tx(struct xhci_hcd * num_trbs++; running_total +=TRB_MAX_BUFF_SIZE ; } -/* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ ret = prepare_transfer(xhci, xhci->devs[slot_id], ep_index, urb->stream_id,
@@ -3419,6 +3440,20 @@ int xhci_queue_bulk_tx(struct xhci_hcd *return ret; urb_priv = urb->hcpriv; + +/* Deal with URB_ZERO_PACKET - need one more td/trb */ + zero_length_needed = urb->transfer_flags &URB_ZERO_PACKET && + urb_priv->length ==2 ; +if (zero_length_needed) { + num_trbs++; +xhci_dbg (xhci,"Creating zero length td.\n" ); + ret =prepare_transfer (xhci, xhci->devs[slot_id], + ep_index, urb->stream_id, +1 , urb,1 , mem_flags); +if (ret <0 ) +return ret; + } + td = urb_priv->td[0 ];/*
@@ -3440,7 +3475,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * trb_buff_len = urb->transfer_buffer_length; first_trb = true; - + last_trb_num = zero_length_needed ?2 :1 ;/* Queue the first TRB, even if it's zero-length */ do { u32 remainder = 0;
@@ -3457,12 +3492,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd */* Chain all the TRBs together; clear the chain bit in the last * TRB to indicate it's the last TRB in the chain. */ -if (num_trbs >1 ) { +if (num_trbs > last_trb_num) { field |=TRB_CHAIN ; - }else { -/* FIXME - add check for ZERO_PACKET flag before this */ + }else if (num_trbs == last_trb_num) { td->last_trb = ep_ring->enqueue; field |=TRB_IOC ; + }else if (zero_length_needed && num_trbs ==1 ) { + trb_buff_len =0 ; + urb_priv->td[1 ]->last_trb = ep_ring->enqueue; + field |=TRB_IOC ; }/* Only set interrupt on short packet for IN endpoints */
@@ -3500,7 +3538,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * trb_buff_len = urb->transfer_buffer_length - running_total;if (trb_buff_len >TRB_MAX_BUFF_SIZE ) trb_buff_len =TRB_MAX_BUFF_SIZE ; - }while (running_total < urb->transfer_buffer_length); + }while (num_trbs >0 );check_trb_math (urb, num_trbs, running_total); giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id,
drivers/usb/host/xhci.c +5 -0
@@ -1320,6 +1320,11 @@ int xhci_urb_enqueue(struct usb_hcd *hcdif (usb_endpoint_xfer_isoc (&urb->ep->desc)) size = urb->number_of_packets; +else if (usb_endpoint_is_bulk_out (&urb->ep->desc) && + urb->transfer_buffer_length >0 && + urb->transfer_flags &URB_ZERO_PACKET && + !(urb->transfer_buffer_length %usb_endpoint_maxp (&urb->ep->desc))) + size =2 ;else size =1 ;
Greg Kroah-Hartman
maintainerPATCH 49/79 Initialize msg/shm IPC objects before doing ipc_addid()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit b9a532277938798b53178d5a66af6e2915cb27cf upstream.
As reported by Dmitry Vyukov, we really shouldn't do ipc_addid() before having initialized the IPC object state. Yes, we initialize the IPC object in a locked state, but with all the lockless RCU lookup work, that IPC object lock no longer means that the state cannot be seen.
We already did this for the IPC semaphore code (see commit e8577d1f0329:
"ipc/sem.c: fully initialize sem_array before making it visible") but we clearly forgot about msg and shm.
--- ipc/msg.c | 14 +++++++------- ipc/shm.c | 12 ++++++------ ipc/util.c | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-)
ipc/msg.c +7 -7
@@ -202,13 +202,6 @@ static int newque(struct ipc_namespace *return retval; } -/* ipc_addid() locks msq upon success. */ - id =ipc_addid (&msg_ids (ns), &msq->q_perm, ns->msg_ctlmni); -if (id <0 ) { -ipc_rcu_putref (msq, msg_rcu_free); -return id; - } - msq->q_stime = msq->q_rtime =0 ; msq->q_ctime =get_seconds (); msq->q_cbytes = msq->q_qnum =0 ;
@@ -218,6 +211,13 @@ static int newque(struct ipc_namespace *INIT_LIST_HEAD (&msq->q_receivers);INIT_LIST_HEAD (&msq->q_senders); +/* ipc_addid() locks msq upon success. */ + id =ipc_addid (&msg_ids (ns), &msq->q_perm, ns->msg_ctlmni); +if (id <0 ) { +ipc_rcu_putref (msq, msg_rcu_free); +return id; + } +ipc_unlock_object (&msq->q_perm);rcu_read_unlock ();
ipc/shm.c +6 -6
@@ -543,12 +543,6 @@ static int newseg(struct ipc_namespace *if (IS_ERR (file)) goto no_file; - id =ipc_addid (&shm_ids (ns), &shp->shm_perm, ns->shm_ctlmni); -if (id <0 ) { - error = id; - goto no_id; - } - shp->shm_cprid =task_tgid_vnr (current); shp->shm_lprid =0 ; shp->shm_atim = shp->shm_dtim =0 ;
@@ -558,6 +552,12 @@ static int newseg(struct ipc_namespace * shp->shm_file = file; shp->shm_creator = current; + id =ipc_addid (&shm_ids (ns), &shp->shm_perm, ns->shm_ctlmni); +if (id <0 ) { + error = id; + goto no_id; + } +/* * shmid gets reported as "inode#" in /proc/pid/maps. * proc-ps tools use this. Changing this will break them.
ipc/util.c +4 -4
@@ -277,6 +277,10 @@ int ipc_addid(struct ipc_ids *ids, strucrcu_read_lock ();spin_lock (&new->lock); +current_euid_egid (&euid, &egid); + new->cuid = new->uid = euid; + new->gid = new->cgid = egid; + id =idr_alloc (&ids->ipcs_idr, new, (next_id <0 ) ?0 :ipcid_to_idx (next_id),0 ,GFP_NOWAIT );
@@ -289,10 +293,6 @@ int ipc_addid(struct ipc_ids *ids, struc ids->in_use++; -current_euid_egid (&euid, &egid); - new->cuid = new->uid = euid; - new->gid = new->cgid = egid; -if (next_id <0 ) { new->seq = ids->seq++;if (ids->seq >IPCID_SEQ_MAX )
Greg Kroah-Hartman
maintainerPATCH 50/79 ipvs: do not use random local source address for tunnels
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
commit 4754957f04f5f368792a0eb7dab0ae89fb93dcfd upstream.
Michael Vallaly reports about wrong source address used in rare cases for tunneled traffic. Looks like __ip_vs_get_out_rt in 3.10+ is providing uninitialized dest_dst->dst_saddr.ip because ip_vs_dest_dst_alloc uses kmalloc. While we retry after seeing EINVAL from routing for data that does not look like valid local address, it still succeeded when this memory was previously used from other dests and with different local addresses. As result, we can use valid local address that is not suitable for our real server.
Fix it by providing 0.0.0.0 every time our cache is refreshed. By this way we will get preferred source address from routing.
--- net/netfilter/ipvs/ip_vs_xmit.c | 1 - 1 file changed, 1 deletion(-)
net/netfilter/ipvs/ip_vs_xmit.c +0 -1
@@ -129,7 +129,6 @@ static struct rtable *do_output_route4(smemset (&fl4,0 ,sizeof (fl4)); fl4.daddr = daddr; - fl4.saddr = (rt_mode &IP_VS_RT_MODE_CONNECT ) ? *saddr :0 ; fl4.flowi4_flags = (rt_mode &IP_VS_RT_MODE_KNOWN_NH ) ?FLOWI_FLAG_KNOWN_NH :0 ;
Greg Kroah-Hartman
maintainerPATCH 51/79 ipvs: fix crash with sync protocol v0 and FTP
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
commit 56184858d1fc95c46723436b455cb7261cd8be6f upstream.
Fix crash in 3.5+ if FTP is used after switchingsync_version to 0.
--- net/netfilter/ipvs/ip_vs_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_sync.c +1 -1
@@ -612,7 +612,7 @@ static void ip_vs_sync_conn_v0(struct ne pkts =atomic_add_return (1 , &cp->in_pkts); else pkts =sysctl_sync_threshold (ipvs); -ip_vs_sync_conn (net, cp->control, pkts); +ip_vs_sync_conn (net, cp, pkts); } }
Greg Kroah-Hartman
maintainerPATCH 52/79 cifs: use server timestamp for ntlmv2 authentication
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Seiderer <[email protected]>
commit 98ce94c8df762d413b3ecb849e2b966b21606d04 upstream.
Linux cifs mount with ntlmssp against an Mac OS X (Yosemite 10.10.5) share fails in case the clocks differ more than +/-2h:
digest-service: digest-request: od failed with 2 proto=ntlmv2
digest-service: digest-request: kdc failed with -1561745592 proto=ntlmv2
Fix this by (re-)using the given server timestamp for the ntlmv2 authentication (as Windows 7 does).
A related problem was also reported earlier by Namjae Jaen (see below):
Windows machine has extended security feature which refuse to allow authentication when there is time difference between server time and client time when ntlmv2 negotiation is used. This problem is prevalent in embedded enviornment where system time is set to default 1970.
Modern servers send the server timestamp in the TargetInfo Av_Pair structure in the challenge message [see MS-NLMP 2.2.2.1]
In [MS-NLMP 3.1.5.1.2] it is explicitly mentioned that the client must use the server provided timestamp if present OR current time if it is not
--- fs/cifs/cifsencrypt.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
fs/cifs/cifsencrypt.c +51 -2
@@ -441,6 +441,48 @@ find_domain_name(struct cifs_ses *ses, creturn 0 ; } +/* Server has provided av pairs/target info in the type 2 challenge +* packet and we have plucked it and stored within smb session. +* We parse that blob here to find the server given timestamp +* as part of ntlmv2 authentication (or local current time as +* default in case of failure) +*/ +static __le64 +find_timestamp (struct cifs_ses *ses) +{ +unsigned int attrsize; +unsigned int type; +unsigned int onesize =sizeof (struct ntlmssp2_name ); +unsigned char *blobptr; +unsigned char *blobend; +struct ntlmssp2_name *attrptr; + +if (!ses->auth_key.len || !ses->auth_key.response) +return 0 ; + + blobptr = ses->auth_key.response; + blobend = blobptr + ses->auth_key.len; + +while (blobptr + onesize < blobend) { + attrptr = (struct ntlmssp2_name *) blobptr; + type =le16_to_cpu (attrptr->type); +if (type ==NTLMSSP_AV_EOL ) +break ; + blobptr +=2 ;/* advance attr type */ + attrsize =le16_to_cpu (attrptr->length); + blobptr +=2 ;/* advance attr size */ +if (blobptr + attrsize > blobend) +break ; +if (type ==NTLMSSP_AV_TIMESTAMP ) { +if (attrsize ==sizeof (u64)) +return *((__le64 *)blobptr); + } + blobptr += attrsize;/* advance attr value */ + } + +return cpu_to_le64 (cifs_UnixTimeToNT (CURRENT_TIME )); +} +static int calc_ntlmv2_hash (struct cifs_ses *ses,char *ntlmv2_hash,const struct nls_table *nls_cp) {
@@ -637,6 +679,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, cstruct ntlmv2_resp *ntlmv2;char ntlmv2_hash[16 ];unsigned char *tiblob =NULL ;/* target info blob */ +__le64 rsp_timestamp;if (ses->server->negflavor ==CIFS_NEGFLAVOR_EXTENDED ) {if (!ses->domainName) {
@@ -655,6 +698,12 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, c } } +/* Must be within 5 minutes of the server (or in range +/-2h +* in case of Mac OS X), so simply carry over server timestamp +* (as Windows 7 does) +*/ + rsp_timestamp =find_timestamp (ses); + baselen =CIFS_SESS_KEY_SIZE +sizeof (struct ntlmv2_resp ); tilen = ses->auth_key.len; tiblob = ses->auth_key.response;
@@ -671,8 +720,8 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, c (ses->auth_key.response +CIFS_SESS_KEY_SIZE ); ntlmv2->blob_signature =cpu_to_le32 (0x00000101 ); ntlmv2->reserved =0 ; -/* Must be within 5 minutes of the server */ - ntlmv2->time =cpu_to_le64 (cifs_UnixTimeToNT (CURRENT_TIME )); + ntlmv2->time = rsp_timestamp; +get_random_bytes (&ntlmv2->client_chal,sizeof (ntlmv2->client_chal)); ntlmv2->reserved2 =0 ;
Greg Kroah-Hartman
maintainerPATCH 53/79 mtd: pxa3xx_nand: add a default chunk size
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Antoine=20T=C3=A9nart?= <[email protected]>
commit bc3e00f04cc1fe033a289c2fc2e5c73c0168d360 upstream.
When keeping the configuration set by the bootloader (by using the marvell,nand-keep-config property), the pxa3xx_nand_detect_config() function is called and set the chunk size to 512 as a default value if NDCR_PAGE_SZ is not set.
In the other case, when not keeping the bootloader configuration, no chunk size is set. Fix this by adding a default chunk size of 512.
support")
--- drivers/mtd/nand/pxa3xx_nand.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/pxa3xx_nand.c +3 -0
@@ -1463,6 +1463,9 @@ static int pxa3xx_nand_scan(struct mtd_iif (pdata->keep_config && !pxa3xx_nand_detect_config (info)) goto KEEP_CONFIG; +/* Set a default chunk size */ + info->chunk_size =512 ; + ret =pxa3xx_nand_sensing (info);if (ret) { dev_info(&info->pdev->dev, "There is no chip on cs %d!\n",
Greg Kroah-Hartman
maintainerPATCH 54/79 regmap: debugfs: Ensure we dont underflow when printing access masks
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit b763ec17ac762470eec5be8ebcc43e4f8b2c2b82 upstream.
If a read is attempted which is smaller than the line length then we may underflow the subtraction we're doing with the unsigned size_t type so move some of the calculation to be additions on the right hand side instead in order to avoid this.
--- drivers/base/regmap/regmap-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap-debugfs.c +1 -1
@@ -432,7 +432,7 @@ static ssize_t regmap_access_read_file(s/* If we're in the region the user is trying to read */ if (p >= *ppos) {/* ...but not beyond it */ -if (buf_pos >= count -1 - tot_len) +if (buf_pos + tot_len +1 >= count)break ;/* Format the register */
Greg Kroah-Hartman
maintainerPATCH 55/79 regmap: debugfs: Dont bother actually printing when calculating max length
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 176fc2d5770a0990eebff903ba680d2edd32e718 upstream.
The in kernel snprintf() will conveniently return the actual length of the printed string even if not given an output beffer at all so just do that rather than relying on the user to pass in a suitable buffer, ensuring that we don't need to worry if the buffer was truncated due to the size of the buffer passed in.
--- drivers/base/regmap/regmap-debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/base/regmap/regmap-debugfs.c +1 -2
@@ -32,8 +32,7 @@ static DEFINE_MUTEX(regmap_debugfs_early/* Calculate the length of a fixed format */ static size_t regmap_calc_reg_len (int max_val,char *buf,size_t buf_size) { -snprintf (buf, buf_size,"%x" , max_val); -return strlen (buf); +return snprintf (NULL ,0 ,"%x" , max_val); } static ssize_t regmap_name_read_file(struct file *file,
Greg Kroah-Hartman
maintainerPATCH 56/79 security: fix typo in security_task_prctl
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit b7f76ea2ef6739ee484a165ffbac98deb855d3d3 upstream.
--- include/linux/security.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/security.h +1 -1
@@ -2452,7 +2452,7 @@ static inline int security_task_prctl(inunsigned long arg4, unsigned long arg5) { - return cap_task_prctl(option, arg2, arg3, arg3, arg5); + return cap_task_prctl(option, arg2, arg3, arg4, arg5); }static inline void security_task_to_inode (struct task_struct *p,struct inode *inode)
Greg Kroah-Hartman
maintainerPATCH 57/79 usb: Use the USB_SS_MULT() macro to get the burst multiplier.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit ff30cbc8da425754e8ab96904db1d295bd034f27 upstream.
Bits 1:0 of the bmAttributes are used for the burst multiplier. The rest of the bits used to be reserved (zero), but USB3.1 takes bit 7 into use.
Use the existing USB_SS_MULT() macro instead to make sure the mult value and hence max packet calculations are correct for USB3.1 devices.
Note that burst multiplier in bmAttributes is zero based and that the USB_SS_MULT() macro adds one.
--- drivers/usb/core/config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/core/config.c +3 -2
@@ -113,7 +113,7 @@ static void usb_parse_ss_endpoint_compan cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes =16 ; }else if (usb_endpoint_xfer_isoc (&ep->desc) && - desc->bmAttributes >2 ) { +USB_SS_MULT (desc->bmAttributes) >3 ) { dev_warn(ddev, "Isoc endpoint has Mult of %d in " "config %d interface %d altsetting %d ep %d: " "setting to 3\n", desc->bmAttributes + 1,
@@ -122,7 +122,8 @@ static void usb_parse_ss_endpoint_compan }if (usb_endpoint_xfer_isoc (&ep->desc)) - max_tx = (desc->bMaxBurst +1 ) * (desc->bmAttributes +1 ) * + max_tx = (desc->bMaxBurst +1 ) * + (USB_SS_MULT (desc->bmAttributes)) *usb_endpoint_maxp (&ep->desc);else if (usb_endpoint_xfer_int (&ep->desc)) max_tx = usb_endpoint_maxp(&ep->desc) *
Greg Kroah-Hartman
maintainerPATCH 58/79 usb: Add device quirk for Logitech PTZ cameras
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Palatin <[email protected]>
commit 72194739f54607bbf8cfded159627a2015381557 upstream.
Add a device quirk for the Logitech PTZ Pro Camera and its sibling the ConferenceCam CC3000e Camera.
This fixes the failed camera enumeration on some boot, particularly on machines with fast CPU.
Tested by connecting a Logitech PTZ Pro Camera to a machine with a Haswell Core i7-4600U CPU @ 2.10GHz, and doing thousands of reboot cycles while recording the kernel logs and taking camera picture after each boot. Before the patch, more than 7% of the boots show some enumeration transfer failures and in a few of them, the kernel is giving up before actually enumerating the webcam. After the patch, the enumeration has been correct on every reboot.
--- drivers/usb/core/quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/core/quirks.c +7 -0
@@ -54,6 +54,13 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Logitech ConferenceCam CC3000e */ + { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT }, + + /* Logitech PTZ Pro Camera */ + { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Logitech Quickcam Fusion */ { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 59/79 USB: Add reset-resume quirk for two Plantronics usb headphones.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao-Wen Mao <[email protected]>
commit 8484bf2981b3d006426ac052a3642c9ce1d8d980 upstream.
These two headphones need a reset-resume quirk to properly resume to original volume level.
--- drivers/usb/core/quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/core/quirks.c +6 -0
@@ -85,6 +85,12 @@ static const struct usb_device_id usb_qu/* Philips PSC805 audio device */ { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Plantronic Audio 655 DSP */ + { USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME }, + + /* Plantronic Audio 648 USB */ + { USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Artisman Watchdog Dongle */ { USB_DEVICE(0x04b4, 0x0526), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Greg Kroah-Hartman
maintainerPATCH 60/79 MIPS: dma-default: Fix 32-bit fall back to GFP_DMA
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 53960059d56ecef67d4ddd546731623641a3d2d1 upstream.
If there is a DMA zone (usually 24bit = 16MB I believe), but no DMA32 zone, as is the case for some 32-bit kernels, then massage_gfp_flags() will cause DMA memory allocated for devices with a 32..63-bit coherent_dma_mask to fall back to using __GFP_DMA, even though there may only be 32-bits of physical address available anyway.
Correct that case to compare against a mask the size of phys_addr_t instead of always using a 64-bit mask.
Patchwork: https://patchwork.linux-mips.org/patch/9610/
--- arch/mips/mm/dma-default.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/mm/dma-default.c +1 -1
@@ -94,7 +94,7 @@ static gfp_t massage_gfp_flags(const str else#endif #if defined(CONFIG_ZONE_DMA ) && !defined(CONFIG_ZONE_DMA32 ) -if (dev->coherent_dma_mask <DMA_BIT_MASK (64 )) +if (dev->coherent_dma_mask <DMA_BIT_MASK (sizeof (phys_addr_t) *8 )) dma_flag = __GFP_DMA; else#endif
Greg Kroah-Hartman
maintainerPATCH 61/79 arch,hexagon: Convert smp_mb__*()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 94cf42f823bc904305b0ee93a09bcd51ba380497 upstream.
Hexagon uses asm-gemeric/barrier.h and its smp_mb() is barrier(). Therefore we can use the default implementation that uses smp_mb().
--- arch/hexagon/include/asm/atomic.h | 6 +----- arch/hexagon/include/asm/bitops.h | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-)
arch/hexagon/include/asm/atomic.h +1 -5
@@ -24,6 +24,7 @@#include <linux/types.h> #include <asm/cmpxchg.h> +#include <asm/barrier.h> #define ATOMIC_INIT (i) { (i) }#define atomic_set (v, i) ((v)->counter = (i))
@@ -163,9 +164,4 @@ static inline int __atomic_add_unless(at#define atomic_inc_return (v) (atomic_add_return(1, v))#define atomic_dec_return (v) (atomic_sub_return(1, v)) -#define smp_mb__before_atomic_dec () barrier() -#define smp_mb__after_atomic_dec () barrier() -#define smp_mb__before_atomic_inc () barrier() -#define smp_mb__after_atomic_inc () barrier() -#endif
arch/hexagon/include/asm/bitops.h +1 -3
@@ -25,12 +25,10 @@#include <linux/compiler.h> #include <asm/byteorder.h> #include <asm/atomic.h> +#include <asm/barrier.h> #ifdef __KERNEL__ -#define smp_mb__before_clear_bit () barrier() -#define smp_mb__after_clear_bit () barrier() -/* * The offset calculations for these are based on BITS_PER_LONG == 32 * (i.e. I get to shift by #5-2 (32 bits per long, 4 bytes per access),
Greg Kroah-Hartman
maintainerPATCH 62/79 staging: comedi: usbduxsigma: dont clobber ai_timer in command test
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 423b24c37dd5794a674c74b0ed56392003a69891 upstream.
devpriv->ai_timer is used while an asynchronous command is running on the AI subdevice. It also gets modified by the subdevice's cmdtest handler for checking new asynchronous commands (usbduxsigma_ai_cmdtest()), which is not correct as it's allowed to check new commands while an old command is still running. Fix it by moving the code which sets up devpriv->ai_timer and devpriv->ai_interval into the subdevice's cmd handler, usbduxsigma_ai_cmd().
Note that the removed code in usbduxsigma_ai_cmdtest() checked that devpriv->ai_timer did not end up less than than 1, but that could not happen because cmd->scan_begin_arg had already been checked to be at least the minimum required value (at least when cmd->scan_begin_src == TRIG_TIMER, which had also been checked to be the case).
--- drivers/staging/comedi/drivers/usbduxsigma.c | 58 ++++++++++++--------------- 1 file changed, 27 insertions(+), 31 deletions(-)
drivers/staging/comedi/drivers/usbduxsigma.c +27 -31
@@ -575,37 +575,6 @@ static int usbduxsigma_ai_cmdtest(structif (err)return 3 ; -/* Step 4: fix up any arguments */ - -if (high_speed) { -/* -* every 2 channels get a time window of 125us. Thus, if we -* sample all 16 channels we need 1ms. If we sample only one -* channel we need only 125us -*/ - devpriv->ai_interval = interval; - devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval); - }else { -/* interval always 1ms */ - devpriv->ai_interval =1 ; - devpriv->ai_timer = cmd->scan_begin_arg /1000000 ; - } -if (devpriv->ai_timer <1 ) - err |= -EINVAL ; - -if (cmd->stop_src ==TRIG_COUNT ) { -/* data arrives as one packet */ - devpriv->ai_sample_count = cmd->stop_arg; - devpriv->ai_continuous =0 ; - }else { -/* continuous acquisition */ - devpriv->ai_continuous =1 ; - devpriv->ai_sample_count =0 ; - } - -if (err) -return 4 ; -return 0 ; }
@@ -704,6 +673,33 @@ static int usbduxsigma_ai_cmd(struct com/* set current channel of the running acquisition to zero */ s->async->cur_chan =0 ; + +if (devpriv->high_speed) { +/* +* every 2 channels get a time window of 125us. Thus, if we +* sample all 16 channels we need 1ms. If we sample only one +* channel we need only 125us +*/ +unsigned int interval =usbduxsigma_chans_to_interval (len); + + devpriv->ai_interval = interval; + devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval); + }else { +/* interval always 1ms */ + devpriv->ai_interval =1 ; + devpriv->ai_timer = cmd->scan_begin_arg /1000000 ; + } + +if (cmd->stop_src ==TRIG_COUNT ) { +/* data arrives as one packet */ + devpriv->ai_sample_count = cmd->stop_arg; + devpriv->ai_continuous =0 ; + }else { +/* continuous acquisition */ + devpriv->ai_continuous =1 ; + devpriv->ai_sample_count =0 ; + } +for (i =0 ; i < len; i++) {unsigned int chan =CR_CHAN (cmd->chanlist[i]);
Greg Kroah-Hartman
maintainerPATCH 63/79 staging: comedi: usbduxsigma: dont clobber ao_timer in command test
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit c04a1f17803e0d3eeada586ca34a6b436959bc20 upstream.
devpriv->ao_timer is used while an asynchronous command is running on the AO subdevice. It also gets modified by the subdevice's cmdtest handler for checking new asynchronous commands, usbduxsigma_ao_cmdtest(), which is not correct as it's allowed to check new commands while an old command is still running. Fix it by moving the code which sets up devpriv->ao_timer into the subdevice's cmd handler, usbduxsigma_ao_cmd().
Note that the removed code in usbduxsigma_ao_cmdtest() checked that devpriv->ao_timer did not end up less that 1, but that could not happen due because cmd->scan_begin_arg or cmd->convert_arg had already been range-checked.
Also note that we tested the high_speed variable in the old code, but that is currently always 0 and means that we always use "scan" timing (cmd->scan_begin_src == TRIG_TIMER and cmd->convert_src == TRIG_NOW) and never "convert" (individual sample) timing (cmd->scan_begin_src == TRIG_FOLLOW and cmd->convert_src == TRIG_TIMER). The moved code tests cmd->convert_src instead to decide whether "scan" or "convert" timing is being used, although currently only "scan" timing is supported.
--- drivers/staging/comedi/drivers/usbduxsigma.c | 41 +++++++++++---------------- 1 file changed, 17 insertions(+), 24 deletions(-)
drivers/staging/comedi/drivers/usbduxsigma.c +17 -24
@@ -951,10 +951,24 @@ static int usbduxsigma_ao_cmdtest(structif (err)return 3 ; -/* Step 4: fix up any arguments */ +return 0 ; +} + +static int usbduxsigma_ao_cmd (struct comedi_device *dev, +struct comedi_subdevice *s) +{ +struct usbduxsigma_private *devpriv = dev->private; +struct comedi_cmd *cmd = &s->async->cmd; +int ret; +int i; + +down (&devpriv->sem); + +/* set current channel of the running acquisition to zero */ + s->async->cur_chan =0 ;/* we count in timer steps */ -if (high_speed) { +if (cmd->convert_src ==TRIG_TIMER ) {/* timing of the conversion itself: every 125 us */ devpriv->ao_timer = cmd->convert_arg /125000 ; }else {
@@ -964,12 +978,9 @@ static int usbduxsigma_ao_cmdtest(struct*/ devpriv->ao_timer = cmd->scan_begin_arg /1000000 ; } -if (devpriv->ao_timer <1 ) - err |= -EINVAL ; -if (cmd->stop_src ==TRIG_COUNT ) {/* not continuous, use counter */ -if (high_speed) { +if (cmd->convert_src ==TRIG_TIMER ) {/* high speed also scans everything at once */ devpriv->ao_sample_count = cmd->stop_arg * cmd->scan_end_arg;
@@ -988,24 +999,6 @@ static int usbduxsigma_ao_cmdtest(struct devpriv->ao_sample_count =0 ; } -if (err) -return 4 ; - -return 0 ; -} - -static int usbduxsigma_ao_cmd (struct comedi_device *dev, -struct comedi_subdevice *s) -{ -struct usbduxsigma_private *devpriv = dev->private; -struct comedi_cmd *cmd = &s->async->cmd; -int ret; -int i; - -down (&devpriv->sem); - -/* set current channel of the running acquisition to zero */ - s->async->cur_chan =0 ;for (i =0 ; i < cmd->chanlist_len; ++i) devpriv->ao_chanlist[i] =CR_CHAN (cmd->chanlist[i]);
Greg Kroah-Hartman
maintainerPATCH 64/79 md: flush ->event_work before stopping array.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit ee5d004fd0591536a061451eba2b187092e9127c upstream.
The 'event_work' worker used by dm-raid may still be running when the array is stopped. This can result in an oops.
So flush the workqueue on which it is run after detaching and before destroying the device.
--- drivers/md/md.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/md.c +2 -0
@@ -5285,6 +5285,8 @@ EXPORT_SYMBOL_GPL(md_stop_writes);static void __md_stop (struct mddev *mddev) { mddev->ready =0 ; +/* Ensure ->event_work is done */ +flush_workqueue (md_misc_wq); mddev->pers->stop (mddev);if (mddev->pers->sync_request && mddev->to_remove ==NULL ) mddev->to_remove = &md_redundancy_group;
Greg Kroah-Hartman
maintainerPATCH 65/79 powerpc/MSI: Fix race condition in tearing down MSI interrupts
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit e297c939b745e420ef0b9dc989cb87bda617b399 upstream.
This fixes a race which can result in the same virtual IRQ number being assigned to two different MSI interrupts. The most visible consequence of that is usually a warning and stack trace from the sysfs code about an attempt to create a duplicate entry in sysfs.
The race happens when one CPU (say CPU 0) is disposing of an MSI while another CPU (say CPU 1) is setting up an MSI. CPU 0 calls (for example) pnv_teardown_msi_irqs(), which calls msi_bitmap_free_hwirqs() to indicate that the MSI (i.e. its hardware IRQ number) is no longer in use. Then, before CPU 0 gets to calling irq_dispose_mapping() to free up the virtal IRQ number, CPU 1 comes in and calls msi_bitmap_alloc_hwirqs() to allocate an MSI, and gets the same hardware IRQ number that CPU 0 just freed. CPU 1 then calls irq_create_mapping() to get a virtual IRQ number, which sees that there is currently a mapping for that hardware IRQ number and returns the corresponding virtual IRQ number (which is the same virtual IRQ number that CPU 0 was using). CPU 0 then calls irq_dispose_mapping() and frees that virtual IRQ number. Now, if another CPU comes along and calls irq_create_mapping(), it is likely to get the virtual IRQ number that was just freed, resulting in the same virtual IRQ number apparently being used for two different hardware interrupts.
To fix this race, we just move the call to msi_bitmap_free_hwirqs() to after the call to irq_dispose_mapping(). Since virq_to_hw() doesn't work for the virtual IRQ number after irq_dispose_mapping() has been called, we need to call it before irq_dispose_mapping() and remember the result for the msi_bitmap_free_hwirqs() call.
The pattern of calling msi_bitmap_free_hwirqs() before irq_dispose_mapping() appears in 5 places under arch/powerpc, and appears to have originated in commit 05af7bd2d75e ("[POWERPC] MPIC U3/U4 MSI backend") from 2007.
--- arch/powerpc/platforms/powernv/pci.c | 5 +++-- arch/powerpc/sysdev/fsl_msi.c | 5 +++-- arch/powerpc/sysdev/mpic_pasemi_msi.c | 6 ++++-- arch/powerpc/sysdev/mpic_u3msi.c | 5 +++-- arch/powerpc/sysdev/ppc4xx_msi.c | 5 +++-- 5 files changed, 16 insertions(+), 10 deletions(-)
arch/powerpc/platforms/powernv/pci.c +3 -2
@@ -109,6 +109,7 @@ static void pnv_teardown_msi_irqs(structstruct pci_controller *hose =pci_bus_to_host (pdev->bus);struct pnv_phb *phb = hose->private_data;struct msi_desc *entry; +irq_hw_number_t hwirq;if (WARN_ON (!phb))return ;
@@ -116,10 +117,10 @@ static void pnv_teardown_msi_irqs(structlist_for_each_entry (entry, &pdev->msi_list, list) {if (entry->irq ==NO_IRQ )continue ; + hwirq =virq_to_hw (entry->irq);irq_set_msi_desc (entry->irq,NULL ); -msi_bitmap_free_hwirqs (&phb->msi_bmp, -virq_to_hw (entry->irq) - phb->msi_base,1 );irq_dispose_mapping (entry->irq); +msi_bitmap_free_hwirqs (&phb->msi_bmp, hwirq - phb->msi_base,1 ); } }#endif /* CONFIG_PCI_MSI */
arch/powerpc/sysdev/fsl_msi.c +3 -2
@@ -121,15 +121,16 @@ static void fsl_teardown_msi_irqs(struct {struct msi_desc *entry;struct fsl_msi *msi_data; +irq_hw_number_t hwirq;list_for_each_entry (entry, &pdev->msi_list, list) {if (entry->irq ==NO_IRQ )continue ; + hwirq =virq_to_hw (entry->irq); msi_data =irq_get_chip_data (entry->irq);irq_set_msi_desc (entry->irq,NULL ); -msi_bitmap_free_hwirqs (&msi_data->bitmap, -virq_to_hw (entry->irq),1 );irq_dispose_mapping (entry->irq); +msi_bitmap_free_hwirqs (&msi_data->bitmap, hwirq,1 ); }return ;
arch/powerpc/sysdev/mpic_pasemi_msi.c +4 -2
@@ -74,6 +74,7 @@ static int pasemi_msi_check_device(strucstatic void pasemi_msi_teardown_msi_irqs (struct pci_dev *pdev) {struct msi_desc *entry; +irq_hw_number_t hwirq;pr_debug ("pasemi_msi_teardown_msi_irqs, pdev %p\n" , pdev);
@@ -81,10 +82,11 @@ static void pasemi_msi_teardown_msi_irqsif (entry->irq ==NO_IRQ )continue ; + hwirq =virq_to_hw (entry->irq);irq_set_msi_desc (entry->irq,NULL ); -msi_bitmap_free_hwirqs (&msi_mpic->msi_bitmap, -virq_to_hw (entry->irq),ALLOC_CHUNK );irq_dispose_mapping (entry->irq); +msi_bitmap_free_hwirqs (&msi_mpic->msi_bitmap, + hwirq,ALLOC_CHUNK ); }return ;
arch/powerpc/sysdev/mpic_u3msi.c +3 -2
@@ -124,15 +124,16 @@ static int u3msi_msi_check_device(structstatic void u3msi_teardown_msi_irqs (struct pci_dev *pdev) {struct msi_desc *entry; +irq_hw_number_t hwirq;list_for_each_entry (entry, &pdev->msi_list, list) {if (entry->irq ==NO_IRQ )continue ; + hwirq =virq_to_hw (entry->irq);irq_set_msi_desc (entry->irq,NULL ); -msi_bitmap_free_hwirqs (&msi_mpic->msi_bitmap, -virq_to_hw (entry->irq),1 );irq_dispose_mapping (entry->irq); +msi_bitmap_free_hwirqs (&msi_mpic->msi_bitmap, hwirq,1 ); }return ;
arch/powerpc/sysdev/ppc4xx_msi.c +3 -2
@@ -121,16 +121,17 @@ void ppc4xx_teardown_msi_irqs(struct pci {struct msi_desc *entry;struct ppc4xx_msi *msi_data = &ppc4xx_msi; +irq_hw_number_t hwirq;dev_dbg (&dev->dev,"PCIE-MSI: tearing down msi irqs\n" );list_for_each_entry (entry, &dev->msi_list, list) {if (entry->irq ==NO_IRQ )continue ; + hwirq =virq_to_hw (entry->irq);irq_set_msi_desc (entry->irq,NULL ); -msi_bitmap_free_hwirqs (&msi_data->bitmap, -virq_to_hw (entry->irq),1 );irq_dispose_mapping (entry->irq); +msi_bitmap_free_hwirqs (&msi_data->bitmap, hwirq,1 ); } }
Greg Kroah-Hartman
maintainerPATCH 66/79 UBI: Validate data_size
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 281fda27673f833a01d516658a64d22a32c8e072 upstream.
Make sure that data_size is less than LEB size. Otherwise a handcrafted UBI image is able to trigger an out of bounds memory access in ubi_compare_lebs().
--- drivers/mtd/ubi/io.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/ubi/io.c +5 -0
@@ -921,6 +921,11 @@ static int validate_vid_hdr(const struct goto bad; } +if (data_size > ubi->leb_size) { +ubi_err ("bad data_size" ); + goto bad; + } +if (vol_type ==UBI_VID_STATIC ) {/* * Although from high-level point of view static volumes may
Greg Kroah-Hartman
maintainerPATCH 67/79 UBI: return ENOSPC if no enough space available
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: shengyong <[email protected]>
commit 7c7feb2ebfc9c0552c51f0c050db1d1a004faac5 upstream.
UBI: attaching mtd1 to ubi0
UBI: scanning is finished
UBI error: init_volumes: not enough PEBs, required 706, available 686 UBI error: ubi_wl_init: no enough physical eraseblocks (-20, need 1) UBI error: ubi_attach_mtd_dev: failed to attach mtd1, error -12 <= NOT ENOMEM UBI error: ubi_init: cannot attach mtd1
If available PEBs are not enough when initializing volumes, return -ENOSPC directly. If available PEBs are not enough when initializing WL, return -ENOSPC instead of -ENOMEM.
--- drivers/mtd/ubi/vtbl.c | 1 + drivers/mtd/ubi/wl.c | 1 + 2 files changed, 2 insertions(+)
drivers/mtd/ubi/vtbl.c +1 -0
@@ -651,6 +651,7 @@ static int init_volumes(struct ubi_devicif (ubi->corr_peb_count)ubi_err ("%d PEBs are corrupted and not used" , ubi->corr_peb_count); +return -ENOSPC ; } ubi->rsvd_pebs += reserved_pebs; ubi->avail_pebs -= reserved_pebs;
drivers/mtd/ubi/wl.c +1 -0
@@ -1974,6 +1974,7 @@ int ubi_wl_init(struct ubi_device *ubi,if (ubi->corr_peb_count)ubi_err ("%d PEBs are corrupted and not used" , ubi->corr_peb_count); + err = -ENOSPC ; goto out_free; } ubi->avail_pebs -= reserved_pebs;
Greg Kroah-Hartman
maintainerPATCH 68/79 dcache: Handle escaped paths in prepend_path
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit cde93be45a8a90d8c264c776fab63487b5038a65 upstream.
A rename can result in a dentry that by walking up d_parent will never reach it's mnt_root. For lack of a better term I call this an escaped path.
prepend_path is called by four different functions __d_path, d_absolute_path, d_path, and getcwd.
__d_path only wants to see paths are connected to the root it passes in. So __d_path needs prepend_path to return an error.
d_absolute_path similarly wants to see paths that are connected to some root. Escaped paths are not connected to any mnt_root so d_absolute_path needs prepend_path to return an error greater than 1. So escaped paths will be treated like paths on lazily unmounted mounts.
getcwd needs to prepend "(unreachable)" so getcwd also needs prepend_path to return an error.
d_path is the interesting hold out. d_path just wants to print something, and does not care about the weird cases. Which raises the question what should be printed?
Given that <escaped_path>/<anything> should result in -ENOENT I believe it is desirable for escaped paths to be printed as empty paths. As there are not really any meaninful path components when considered from the perspective of a mount tree.
So tweak prepend_path to return an empty path with an new error code of 3 when it encounters an escaped path.
--- fs/dcache.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/dcache.c +7 -0
@@ -2787,6 +2787,13 @@ restart:if (dentry == vfsmnt->mnt_root ||IS_ROOT (dentry)) {struct mount *parent =ACCESS_ONCE (mnt->mnt_parent); +/* Escaped? */ +if (dentry != vfsmnt->mnt_root) { + bptr = *buffer; + blen = *buflen; + error =3 ; +break ; + }/* Global root? */ if (mnt != parent) { dentry =ACCESS_ONCE (mnt->mnt_mountpoint);
Greg Kroah-Hartman
maintainerPATCH 69/79 vfs: Test for and handle paths that are unreachable from their mnt_root
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 397d425dc26da728396e66d392d5dcb8dac30c37 upstream.
In rare cases a directory can be renamed out from under a bind mount. In those cases without special handling it becomes possible to walk up the directory tree to the root dentry of the filesystem and down from the root dentry to every other file or directory on the filesystem.
Like division by zero .. from an unconnected path can not be given a useful semantic as there is no predicting at which path component the code will realize it is unconnected. We certainly can not match the current behavior as the current behavior is a security hole.
Therefore when encounting .. when following an unconnected path return -ENOENT.
- Add a function path_connected to verify path->dentry is reachable from path->mnt.mnt_root. AKA to validate that rename did not do something nasty to the bind mount.
To avoid races path_connected must be called after following a path component to it's next path component.
--- fs/namei.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
fs/namei.c +28 -3
@@ -484,6 +484,24 @@ void path_put(const struct path *path) }EXPORT_SYMBOL (path_put); +/** +* path_connected - Verify that a path->dentry is below path->mnt.mnt_root +* @path: nameidate to verify +* +* Rename can sometimes move a file or directory outside of a bind +* mount, path_connected allows those cases to be detected. +*/ +static bool path_connected (const struct path *path) +{ +struct vfsmount *mnt = path->mnt; + +/* Only bind mounts can have disconnected paths */ +if (mnt->mnt_root == mnt->mnt_sb->s_root) +return true; + +return is_subdir (path->dentry, mnt->mnt_root); +} +/* * Path walking has 2 modes, rcu-walk and ref-walk (see * Documentation/filesystems/path-lookup.txt). In situations when we can't
@@ -1149,6 +1167,8 @@ static int follow_dotdot_rcu(struct name goto failed; nd->path.dentry = parent; nd->seq = seq; +if (unlikely (!path_connected (&nd->path))) + goto failed;break ; }if (!follow_up_rcu (&nd->path))
@@ -1242,7 +1262,7 @@ static void follow_mount(struct path *pa } } -static void follow_dotdot (struct nameidata *nd) +static int follow_dotdot (struct nameidata *nd) {if (!nd->root.mnt)set_root (nd);
@@ -1258,6 +1278,10 @@ static void follow_dotdot(struct nameida/* rare case of legitimate dget_parent()... */ nd->path.dentry =dget_parent (nd->path.dentry);dput (old); +if (unlikely (!path_connected (&nd->path))) { +path_put (&nd->path); +return -ENOENT ; + }break ; }if (!follow_up (&nd->path))
@@ -1265,6 +1289,7 @@ static void follow_dotdot(struct nameida }follow_mount (&nd->path); nd->inode = nd->path.dentry->d_inode; +return 0 ; }/*
@@ -1488,7 +1513,7 @@ static inline int handle_dots(struct namif (follow_dotdot_rcu (nd))return -ECHILD ; }else -follow_dotdot (nd); +return follow_dotdot (nd); }return 0 ; }
@@ -2214,7 +2239,7 @@ mountpoint_last(struct nameidata *nd, stif (unlikely (nd->last_type !=LAST_NORM )) { error =handle_dots (nd, nd->last_type);if (error) - goto out; +return error; dentry =dget (nd->path.dentry); goto done; }
Greg Kroah-Hartman
maintainerPATCH 70/79 arm64: readahead: fault retry breaks mmap file read random detection
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Salyzyn <[email protected]>
commit 569ba74a7ba69f46ce2950bf085b37fea2408385 upstream.
This is the arm64 portion of commit 45cac65b0fcd ("readahead: fault retry breaks mmap file read random detection"), which was absent from the initial port and has since gone unnoticed. The original commit says:
Quoted 7 lines
.fault now can retry. The retry can break state machine of .fault. In
filemap_fault, if page is miss,ra->mmap_missis increased. In the second try, since the page is in page cache now,ra->mmap_missis decreased. And these are done in one fault, so we can't detect random mmap file access.Add a new flag to indicate .fault is tried once. In the second try, skip
ra->mmap_missdecreasing. Thefilemap_faultstate machine is ok with it.
With this change, Mark reports that:
Quoted 2 lines
Random read improves by 250%, sequential read improves by 40%, and random write by 400% to an eMMC device with dm crypto wrapped around it.
--- arch/arm64/mm/fault.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/mm/fault.c +1 -0
@@ -278,6 +278,7 @@ retry:* starvation. */ mm_flags &= ~FAULT_FLAG_ALLOW_RETRY ; + mm_flags |=FAULT_FLAG_TRIED ; goto retry; } }
Greg Kroah-Hartman
maintainerPATCH 71/79 m68k: Define asmlinkage_protect
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 8474ba74193d302e8340dddd1e16c85cc4b98caf upstream.
Make sure the compiler does not modify arguments of syscall functions. This can happen if the compiler generates a tailcall to another function. For example, without asmlinkage_protect sys_openat is compiled into this function:
sys_openat:
clr.l %d0 move.w 18(%sp),%d0 move.l %d0,16(%sp) jbra do_sys_open
Note how the fourth argument is modified in place, modifying the register %d4 that gets restored from this stack slot when the function returns to user-space. The caller may expect the register to be unmodified across system calls.
--- arch/m68k/include/asm/linkage.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/m68k/include/asm/linkage.h +30 -0
@@ -4,4 +4,34 @@#define __ALIGN .align 4#define __ALIGN_STR ".align 4" +/* +* Make sure the compiler doesn't do anything stupid with the +* arguments on the stack - they are owned by the *caller*, not +* the callee. This just fools gcc into not spilling into them, +* and keeps it from doing tailcall recursion and/or using the +* stack slots for temporaries, since they are live and "used" +* all the way to the end of the function. +*/ +#define asmlinkage_protect(n, ret, args...) \ + __asmlinkage_protect##n(ret, ##args) +#define __asmlinkage_protect_n(ret, args...) \ + __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args) +#define __asmlinkage_protect0 (ret) \ + __asmlinkage_protect_n(ret) +#define __asmlinkage_protect1 (ret, arg1) \ + __asmlinkage_protect_n(ret, "m" (arg1)) +#define __asmlinkage_protect2 (ret, arg1, arg2) \ + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2)) +#define __asmlinkage_protect3 (ret, arg1, arg2, arg3) \ + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3)) +#define __asmlinkage_protect4 (ret, arg1, arg2, arg3, arg4) \ + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ + "m" (arg4)) +#define __asmlinkage_protect5 (ret, arg1, arg2, arg3, arg4, arg5) \ + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ + "m" (arg4), "m" (arg5)) +#define __asmlinkage_protect6 (ret, arg1, arg2, arg3, arg4, arg5, arg6) \ + __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ + "m" (arg4), "m" (arg5), "m" (arg6)) +#endif
Greg Kroah-Hartman
maintainerPATCH 72/79 fib_rules: Fix dump_rules() not to exit early
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
Backports of 41fc014332d9 ("fib_rules: fix fib rule dumps across multiple skbs") introduced a regression in "ip rule show" - it ends up dumping the first rule over and over and never exiting, because 3.19 and earlier are missing commit 053c095a82cf ("netlink: make nlmsg_end() and genlmsg_end() void"), so fib_nl_fill_rule() ends up returning skb->len (i.e. > 0) in the success case.
Fix this by checking the return code for < 0 instead of != 0.
--- net/core/fib_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/fib_rules.c +1 -1
@@ -631,7 +631,7 @@ static int dump_rules(struct sk_buff *sk err =fib_nl_fill_rule (skb, rule,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq,RTM_NEWRULE ,NLM_F_MULTI , ops); -if (err) +if (err <0 )break ; skip: idx++;
Greg Kroah-Hartman
maintainerPATCH 73/79 genirq: Fix race in register_irq_proc()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 95c2b17534654829db428f11bcf4297c059a2a7e upstream.
Per-IRQ directories in procfs are created only when a handler is first added to the irqdesc, not when the irqdesc is created. In the case of a shared IRQ, multiple tasks can race to create a directory. This race condition seems to have been present forever, but is easier to hit with async probing.
--- kernel/irq/proc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
kernel/irq/proc.c +17 -2
@@ -12,6 +12,7 @@#include <linux/seq_file.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> +#include <linux/mutex.h> #include "internals.h"
@@ -326,18 +327,29 @@ void register_handler_proc(unsigned intvoid register_irq_proc (unsigned int irq,struct irq_desc *desc) { +static DEFINE_MUTEX (register_lock);char name [MAX_NAMELEN ]; -if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip) || desc->dir) +if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip))return ; +/* +* irq directories are registered only when a handler is +* added, not when the descriptor is created, so multiple +* tasks might try to register at the same time. +*/ +mutex_lock (®ister_lock); + +if (desc->dir) + goto out_unlock; +memset (name,0 ,MAX_NAMELEN );sprintf (name,"%d" , irq);/* create /proc/irq/1234 */ desc->dir =proc_mkdir (name, root_irq_dir);if (!desc->dir) -return ; + goto out_unlock;#ifdef CONFIG_SMP /* create /proc/irq/<irq>/smp_affinity */
@@ -358,6 +370,9 @@ void register_irq_proc(unsigned int irq,proc_create_data ("spurious" ,0444 , desc->dir, &irq_spurious_proc_fops, (void *)(long )irq); + +out_unlock: +mutex_unlock (®ister_lock); }void unregister_irq_proc (unsigned int irq,struct irq_desc *desc)
Greg Kroah-Hartman
maintainerPATCH 74/79 jbd2: avoid infinite loop when destroying aborted journal
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 841df7df196237ea63233f0f9eaa41db53afd70f upstream.
Commit 6f6a6fda2945 "jbd2: fix ocfs2 corrupt when updating journal superblock fails" changed jbd2_cleanup_journal_tail() to return EIO when the journal is aborted. That makes logic in jbd2_log_do_checkpoint() bail out which is fine, except that jbd2_journal_destroy() expects jbd2_log_do_checkpoint() to always make a progress in cleaning the journal. Without it jbd2_journal_destroy() just loops in an infinite loop.
Fix jbd2_journal_destroy() to cleanup journal checkpoint lists of jbd2_log_do_checkpoint() fails with error.
--- fs/jbd2/checkpoint.c | 39 +++++++++++++++++++++++++++++++++------ fs/jbd2/commit.c | 2 +- fs/jbd2/journal.c | 11 ++++++++++- include/linux/jbd2.h | 3 ++- 4 files changed, 46 insertions(+), 9 deletions(-)
fs/jbd2/checkpoint.c +33 -6
@@ -475,14 +475,15 @@ int jbd2_cleanup_journal_tail(journal_t* journal_clean_one_cp_list * * Find all the written-back checkpoint buffers in the given list and -* release them. +* release them. If 'destroy' is set, clean all buffers unconditionally. * * Called with the journal locked. * Called with j_list_lock held. * Returns number of buffers reaped (for debug) */ -static int journal_clean_one_cp_list (struct journal_head *jh,int *released) +static int journal_clean_one_cp_list (struct journal_head *jh,bool destroy, +int *released) {struct journal_head *last_jh;struct journal_head *next_jh = jh;
@@ -496,7 +497,10 @@ static int journal_clean_one_cp_list(str do { jh = next_jh; next_jh = jh->b_cpnext; - ret = __try_to_free_cp_buf(jh); + if (!destroy) + ret = __try_to_free_cp_buf(jh); + else + ret = __jbd2_journal_remove_checkpoint(jh) + 1; if (ret) { freed++; if (ret == 2) {
@@ -521,13 +525,14 @@ static int journal_clean_one_cp_list(str* journal_clean_checkpoint_list * * Find all the written-back checkpoint buffers in the journal and release them. +* If 'destroy' is set, release all buffers unconditionally. * * Called with the journal locked. * Called with j_list_lock held. * Returns number of buffers reaped (for debug) */ -int __jbd2_journal_clean_checkpoint_list (journal_t *journal) +int __jbd2_journal_clean_checkpoint_list (journal_t *journal,bool destroy) {transaction_t *transaction, *last_transaction, *next_transaction;int ret =0 ;
@@ -543,7 +548,7 @@ int __jbd2_journal_clean_checkpoint_list transaction = next_transaction; next_transaction = transaction->t_cpnext; ret +=journal_clean_one_cp_list (transaction-> - t_checkpoint_list, &released); + t_checkpoint_list, destroy, &released);/* * This function only frees up some memory if possible so we * dont have an obligation to finish processing. Bail out if
@@ -559,7 +564,7 @@ int __jbd2_journal_clean_checkpoint_list* we can possibly see not yet submitted buffers on io_list */ ret +=journal_clean_one_cp_list (transaction-> - t_checkpoint_io_list, &released); + t_checkpoint_io_list, destroy, &released);if (need_resched ()) goto out; }while (transaction != last_transaction);
@@ -568,6 +573,28 @@ out: }/* +* Remove buffers from all checkpoint lists as journal is aborted and we just +* need to free memory +*/ +void jbd2_journal_destroy_checkpoint (journal_t *journal) +{ +/* +* We loop because __jbd2_journal_clean_checkpoint_list() may abort +* early due to a need of rescheduling. +*/ +while (1 ) { +spin_lock (&journal->j_list_lock); +if (!journal->j_checkpoint_transactions) { +spin_unlock (&journal->j_list_lock); +break ; + } +__jbd2_journal_clean_checkpoint_list (journal, true); +spin_unlock (&journal->j_list_lock); +cond_resched (); + } +} + +/* * journal_remove_checkpoint: called after a buffer has been committed * to disk (either by being write-back flushed to disk, or being * committed to the log).
fs/jbd2/commit.c +1 -1
@@ -510,7 +510,7 @@ void jbd2_journal_commit_transaction(jou* frees some memory */ spin_lock (&journal->j_list_lock); -__jbd2_journal_clean_checkpoint_list (journal); +__jbd2_journal_clean_checkpoint_list (journal, false);spin_unlock (&journal->j_list_lock);jbd_debug (3 ,"JBD2: commit phase 1\n" );
fs/jbd2/journal.c +10 -1
@@ -1708,8 +1708,17 @@ int jbd2_journal_destroy(journal_t *jourwhile (journal->j_checkpoint_transactions !=NULL ) {spin_unlock (&journal->j_list_lock);mutex_lock (&journal->j_checkpoint_mutex); -jbd2_log_do_checkpoint (journal); + err =jbd2_log_do_checkpoint (journal);mutex_unlock (&journal->j_checkpoint_mutex); +/* +* If checkpointing failed, just free the buffers to avoid +* looping forever +*/ +if (err) { +jbd2_journal_destroy_checkpoint (journal); +spin_lock (&journal->j_list_lock); +break ; + }spin_lock (&journal->j_list_lock); }
include/linux/jbd2.h +2 -1
@@ -1042,8 +1042,9 @@ void jbd2_update_log_tail(journal_t *jouextern void jbd2_journal_commit_transaction (journal_t *);/* Checkpoint list management */ -int __jbd2_journal_clean_checkpoint_list (journal_t *journal); +int __jbd2_journal_clean_checkpoint_list (journal_t *journal,bool destroy);int __jbd2_journal_remove_checkpoint (struct journal_head *); +void jbd2_journal_destroy_checkpoint (journal_t *journal);void __jbd2_journal_insert_checkpoint (struct journal_head *,transaction_t *);
Greg Kroah-Hartman
maintainerPATCH 75/79 clk: ti: fix dual-registration of uart4_ick
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Dooks <[email protected]>
commit 19e79687de22f23bcfb5e79cce3daba20af228d1 upstream.
On the OMAP AM3517 platform the uart4_ick gets registered twice, causing any power management to /dev/ttyO3 to fail when trying to wake the device up.
This solves the following oops:
[] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa09e008 [] PC is at serial_omap_pm+0x48/0x15c
[] LR is at _raw_spin_unlock_irqrestore+0x30/0x5c
--- drivers/clk/ti/clk-3xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ti/clk-3xxx.c +1 -1
@@ -174,7 +174,6 @@ static struct ti_dt_clk omap3xxx_clks[]DT_CLK (NULL ,"gpio2_ick" ,"gpio2_ick" ),DT_CLK (NULL ,"wdt3_ick" ,"wdt3_ick" ),DT_CLK (NULL ,"uart3_ick" ,"uart3_ick" ), -DT_CLK (NULL ,"uart4_ick" ,"uart4_ick" ),DT_CLK (NULL ,"gpt9_ick" ,"gpt9_ick" ),DT_CLK (NULL ,"gpt8_ick" ,"gpt8_ick" ), DT_CLK(NULL, "gpt7_ick", "gpt7_ick"),
@@ -317,6 +316,7 @@ static struct ti_dt_clk am35xx_clks[] =static struct ti_dt_clk omap36xx_clks[] = {DT_CLK (NULL ,"omap_192m_alwon_fck" ,"omap_192m_alwon_fck" ),DT_CLK (NULL ,"uart4_fck" ,"uart4_fck" ), +DT_CLK (NULL ,"uart4_ick" ,"uart4_ick" ), { .node_name =NULL }, };
Greg Kroah-Hartman
maintainerPATCH 76/79 dm cache: fix NULL pointer when switching from cleaner policy
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 2bffa1503c5c06192eb1459180fac4416575a966 upstream.
The cleaner policy doesn't make use of the per cache block hint space in the metadata (unlike the other policies). When switching from the cleaner policy to mq or smq a NULL pointer crash (in dm_tm_new_block) was observed. The crash was caused by bugs in dm-cache-metadata.c when trying to skip creation of the hint btree.
The minimal fix is to change hint size for the cleaner policy to 4 bytes (only hint size supported).
--- drivers/md/dm-cache-policy-cleaner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-cache-policy-cleaner.c +1 -1
@@ -434,7 +434,7 @@ static struct dm_cache_policy *wb_createstatic struct dm_cache_policy_type wb_policy_type = { .name ="cleaner" , .version = {1 ,0 ,0 }, - .hint_size =0 , + .hint_size =4 , .owner =THIS_MODULE , .create = wb_create };
Greg Kroah-Hartman
maintainerPATCH 77/79 staging: speakup: fix speakup-r regression
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit b1d562acc78f0af46de0dfe447410bc40bdb7ece upstream.
Here is a patch to make speakup-r work again.
It broke in 3.6 due to commit 4369c64c79a22b98d3b7eff9d089196cd878a10a "Input: Send events one packet at a time)
The problem was that the fakekey.c routine to fake a down arrow no longer functioned properly and putting the input_sync fixed it.
--- drivers/staging/speakup/fakekey.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/speakup/fakekey.c +1 -0
@@ -81,6 +81,7 @@ void speakup_fake_down_arrow(void)__this_cpu_write (reporting_keystroke, true);input_report_key (virt_keyboard,KEY_DOWN ,PRESSED );input_report_key (virt_keyboard,KEY_DOWN ,RELEASED ); +input_sync (virt_keyboard);__this_cpu_write (reporting_keystroke, false);/* reenable preemption */
Greg Kroah-Hartman
maintainerPATCH 78/79 mm/slab: fix unexpected index mapping result of kmalloc_size(INDEX_NODE+1)
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonsoo Kim <[email protected]>
commit 03a2d2a3eafe4015412cf4e9675ca0e2d9204074 upstream.
Commit description is copied from the original post of this bug:
http://comments.gmane.org/gmane.linux.kernel.mm/135349
Kernels after v3.9 use kmalloc_size(INDEX_NODE + 1) to get the next larger cache size than the size index INDEX_NODE mapping. In kernels 3.9 and earlier we used malloc_sizes[INDEX_L3 + 1].cs_size.
However, sometimes we can't get the right output we expected via kmalloc_size(INDEX_NODE + 1), causing a BUG().
The mapping table in the latest kernel is like:
index = {0, 1, 2 , 3, 4, 5, 6, n}
size = {0, 96, 192, 8, 16, 32, 64, 2^n}
The mapping table before 3.10 is like this:
index = {0 , 1 , 2, 3, 4 , 5 , 6, n}
size = {32, 64, 96, 128, 192, 256, 512, 2^(n+3)}The problem on my mips64 machine is as follows:
(1) When configured DEBUG_SLAB && DEBUG_PAGEALLOC && DEBUG_LOCK_ALLOC && DEBUG_SPINLOCK, the sizeof(struct kmem_cache_node) will be "150", and the macro INDEX_NODE turns out to be "2": #define INDEX_NODE kmalloc_index(sizeof(struct kmem_cache_node))
(2) Then the result of kmalloc_size(INDEX_NODE + 1) is 8.
(3) Then "if(size >= kmalloc_size(INDEX_NODE + 1)" will lead to "size
= PAGE_SIZE".
(4) Then "if ((size >= (PAGE_SIZE >> 3))" test will be satisfied and
"flags |= CFLGS_OFF_SLAB" will be covered.
(5) if (flags & CFLGS_OFF_SLAB)" test will be satisfied and will go to "cachep->slabp_cache = kmalloc_slab(slab_size, 0u)", and the result here may be NULL while kernel bootup.
(6) Finally,"BUG_ON(ZERO_OR_NULL_PTR(cachep->slabp_cache));" causes the BUG info as the following shows (may be only mips64 has this problem):
This patch fixes the problem of kmalloc_size(INDEX_NODE + 1) and removes the BUG by adding 'size >= 256' check to guarantee that all necessary small sized slabs are initialized regardless sequence of slab size in mapping table.
--- mm/slab.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
mm/slab.c +10 -3
@@ -2271,9 +2271,16 @@ __kmem_cache_create (struct kmem_cache * size +=BYTES_PER_WORD ; }#if FORCED_DEBUG && defined(CONFIG_DEBUG_PAGEALLOC ) -if (size >=kmalloc_size (INDEX_NODE +1 ) - && cachep->object_size >cache_line_size () - &&ALIGN (size, cachep->align) <PAGE_SIZE ) { +/* +* To activate debug pagealloc, off-slab management is necessary +* requirement. In early phase of initialization, small sized slab +* doesn't get initialized so it would not be possible. So, we need +* to check size >= 256. It guarantees that all necessary small +* sized slab is initialized in current slab initialization sequence. +*/ +if (!slab_early_init && size >=kmalloc_size (INDEX_NODE ) && + size >=256 && cachep->object_size >cache_line_size () && +ALIGN (size, cachep->align) <PAGE_SIZE ) { cachep->obj_offset +=PAGE_SIZE -ALIGN (size, cachep->align); size =PAGE_SIZE ; }
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.55 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Oct 20 02:00:11 UTC 2015. Anything received after that time might be too late.
Build results:
total: 127 pass: 125 fail: 2
Failed builds:
hexagon:defconfig
hexagon:allnoconfig
Qemu test results:
total: 80 pass: 80 fail: 0
The hexagon build failures are different than before, but the builds still fail.
In file included from include/linux/mm.h:19:0,
from arch/hexagon/kernel/asm-offsets.c:28:include/linux/bit_spinlock.h: In function 'bit_spin_unlock':include/linux/bit_spinlock.h:62:2: error: implicit declaration of function 'smp_mb__before_clear_bit' In file included from arch/hexagon/kernel/asm-offsets.c:29:0:include/linux/interrupt.h: In function 'tasklet_disable_nosync':include/linux/interrupt.h:541:2: error: implicit declaration of function 'smp_mb__after_atomic_inc' include/linux/interrupt.h: In function 'tasklet_enable':include/linux/interrupt.h:553:2: error: implicit declaration of function 'smp_mb__before_atomic_dec'
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 21 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.55 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Oct 20 02:00:11 UTC 2015. Anything received after that time might be too late.
Build results:
total: 127 pass: 125 fail: 2Failed builds:
hexagon:defconfig
hexagon:allnoconfigQemu test results:
total: 80 pass: 80 fail: 0The hexagon build failures are different than before, but the builds still fail.
Quoted 9 lines
In file included from
include/linux/mm.h:19:0,
fromarch/hexagon/kernel/asm-offsets.c:28:include/linux/bit_spinlock.h: In function 'bit_spin_unlock':include/linux/bit_spinlock.h:62:2: error: implicit declaration of function 'smp_mb__before_clear_bit' In file included fromarch/hexagon/kernel/asm-offsets.c:29:0:include/linux/interrupt.h: In function 'tasklet_disable_nosync':include/linux/interrupt.h:541:2: error: implicit declaration of function 'smp_mb__after_atomic_inc'include/linux/interrupt.h: In function 'tasklet_enable':include/linux/interrupt.h:553:2: error: implicit declaration of function 'smp_mb__before_atomic_dec'
Odd, any idea what we can do to fix it?
greg k-h
Quoted 32 lines · Greg Kroah-Hartman
Quoted 21 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.55 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Oct 20 02:00:11 UTC 2015. Anything received after that time might be too late.
Build results:
total: 127 pass: 125 fail: 2Failed builds:
hexagon:defconfig
hexagon:allnoconfigQemu test results:
total: 80 pass: 80 fail: 0The hexagon build failures are different than before, but the builds still fail.
Quoted 9 lines
In file included from
include/linux/mm.h:19:0,
fromarch/hexagon/kernel/asm-offsets.c:28:include/linux/bit_spinlock.h: In function 'bit_spin_unlock':include/linux/bit_spinlock.h:62:2: error: implicit declaration of function 'smp_mb__before_clear_bit' In file included fromarch/hexagon/kernel/asm-offsets.c:29:0:include/linux/interrupt.h: In function 'tasklet_disable_nosync':include/linux/interrupt.h:541:2: error: implicit declaration of function 'smp_mb__after_atomic_inc'include/linux/interrupt.h: In function 'tasklet_enable':include/linux/interrupt.h:553:2: error: implicit declaration of function 'smp_mb__before_atomic_dec'
Quoted 3 lines
Odd, any idea what we can do to fix it?
greg k-h
Apologies, the previous patch was the wrong one.
It really should have been this one:
There was a stale barrier.h left in the directory.
I tested this patch along with "sched: Fix TASK_DEAD race in finish_task_switch" on v3.14 and it compiled for me.
Thanks,
Richard Kuo
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 33 lines · Richard Kuo
Quoted 32 lines · Greg Kroah-Hartman
Quoted 30 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.55 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Oct 20 02:00:11 UTC 2015. Anything received after that time might be too late.
Build results:
total: 127 pass: 125 fail: 2Failed builds:
hexagon:defconfig
hexagon:allnoconfigQemu test results:
total: 80 pass: 80 fail: 0The hexagon build failures are different than before, but the builds still fail.
In file included from
include/linux/mm.h:19:0,
fromarch/hexagon/kernel/asm-offsets.c:28:include/linux/bit_spinlock.h: In function 'bit_spin_unlock':include/linux/bit_spinlock.h:62:2: error: implicit declaration of function 'smp_mb__before_clear_bit' In file included fromarch/hexagon/kernel/asm-offsets.c:29:0:include/linux/interrupt.h: In function 'tasklet_disable_nosync':include/linux/interrupt.h:541:2: error: implicit declaration of function 'smp_mb__after_atomic_inc'include/linux/interrupt.h: In function 'tasklet_enable':include/linux/interrupt.h:553:2: error: implicit declaration of function 'smp_mb__before_atomic_dec'
Quoted 5 lines
Quoted 3 lines
Odd, any idea what we can do to fix it?
greg k-h
Apologies, the previous patch was the wrong one.
So should I delete it? And if so, can you refresh my memory as to which patch it was?
Quoted 5 lines
It really should have been this one:
There was a stale
barrier.hleft in the directory.
I've applied this one now as well, thanks.
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
Quoted 1 line
Apologies, the previous patch was the wrong one.
So should I delete it? And if so, can you refresh my memory as to which patch it was?
This was the errant patch that you can remove from the queue.
Quoted 1 line
From
94cf42f823bc904305b0ee93a09bcd51ba380497Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <[email protected]>
Date: Thu, 13 Mar 2014 19:00:36 +0100
Subject: arch,hexagon: Convert smp_mb__*()
Thanks,
Richard Kuo
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.55 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Responses should be made by Tue Oct 20 02:00:11 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.14.55-rc1.gzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978