linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.10 000/143] 3.10.102-stable review
@ 2016-06-05 10:18 Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 001/143] pipe: Fix buffer offset after partially failed read Willy Tarreau
                   ` (143 more replies)
  0 siblings, 144 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Willy Tarreau

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 20397 bytes --]

This is the start of the stable review cycle for the 3.10.102 release.
All patches will be posted as a response to this one. If anyone has any
issue with these being applied, please let me know. If anyone thinks some
important patches are missing and should be added prior to the release,
please report them quickly with their respective mainline commit IDs.

Responses should be made by Sat Jun 11 11:48:43 CEST 2016.
Anything received after that time might be too late. If someone
wants a bit more time for a deeper review, please let me know.

The whole patch series can be found in one patch at :
   https://kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.10.102-rc1.gz

The shortlog and diffstat are appended below.

Thanks,
Willy

===============


Aaro Koskinen (1):
  mtd: onenand: fix deadlock in onenand_block_markbad

Adrian Hunter (1):
  mmc: mmc: Fix partition switch timeout for some eMMCs

Al Viro (1):
  get_rock_ridge_filename(): handle malformed NM entries

Alan Stern (1):
  HID: usbhid: fix inconsistent reset/resume/reset-resume behavior

Alexey Khoroshilov (2):
  [media] usbvision-video: fix memory leak of alt_max_pkt_size
  usbvision: fix leak of usb_dev on failure paths in usbvision_probe()

Andi Kleen (2):
  perf/x86/intel: Fix PEBS data source interpretation on
    Nehalem/Westmere
  asmlinkage, pnp: Make variables used from assembler code visible

Andrey Gelman (1):
  Input: ads7846 - correct the value got from SPI

Andy Lutomirski (1):
  x86/iopl: Fix iopl capability check on Xen PV

Anton Blanchard (1):
  powerpc: scan_features() updates incorrect bits for REAL_LE

Arnaldo Carvalho de Melo (1):
  net: Fix use after free in the recvmmsg exit path

Arnd Bergmann (5):
  farsync: fix off-by-one bug in fst_add_one
  ath9k: fix buffer overrun for ar9287
  ASoC: s3c24xx: use const snd_soc_component_driver pointer
  paride: make 'verbose' parameter an 'int' again
  lpfc: fix misleading indentation

Aurelien Jacquiot (1):
  rapidio/rionet: fix deadlock on SMP

Behan Webster (1):
  x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id"

Ben Hutchings (3):
  pipe: Fix buffer offset after partially failed read
  misc/bmp085: Enable building as a module
  atl2: Disable unimplemented scatter/gather feature

Bill Sommerfeld (1):
  udp6: fix UDP/IPv6 encap resubmit path

Bjorn Helgaas (1):
  PCI: Disable IO/MEM decoding for devices with non-compliant BARs

Bjørn Mork (3):
  USB: option: add "D-Link DWM-221 B1" device id
  cdc_ncm: toggle altsetting to force reset before setup
  qmi_wwan: add "D-Link DWM-221 B1" device id

Borislav Petkov (1):
  perf stat: Document --detailed option

Chanwoo Choi (1):
  serial: samsung: Reorder the sequence of clock control when call
    s3c24xx_serial_set_termios()

Chris Friesen (1):
  route: do not cache fib route info on local routes with oif

Dan Carpenter (1):
  EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr()

Dan Streetman (1):
  nbd: ratelimit error msgs after socket close

David S. Miller (1):
  decnet: Do not build routes to devices without decnet private data.

Diego Viola (1):
  net: jme: fix suspend/resume on JMC260

Dmitry Ivanov (1):
  nl80211: check netlink protocol in socket release notification

Douglas Gilbert (1):
  sg: fix dxferp in from_to case

Eric Wheeler (1):
  bcache: fix cache_set_flush() NULL pointer dereference on OOM

Eryu Guan (1):
  ext4: fix NULL pointer dereference in ext4_mark_inode_dirty()

Florian Westphal (1):
  ipv6: re-enable fragment header matching in ipv6_find_hdr

Gabriel Krisman Bertazi (1):
  ipr: Fix regression when loading firmware

Geert Uytterhoeven (1):
  rtc: vr41xx: Wire up alarm_irq_enable

Guenter Roeck (1):
  hwmon: (max1111) Return -ENODEV from max1111_read_channel if not
    instantiated

Guillaume Nault (1):
  ppp: take reference on channels netns

H. Peter Anvin (3):
  linux/const.h: Add _BITUL() and _BITULL()
  x86: Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE
  x86, processor-flags: Fix the datatypes and add bit number defines

Haishuang Yan (2):
  ipv4: l2tp: fix a potential issue in l2tp_ip_recv
  ipv6: l2tp: fix a potential issue in l2tp_ip6_recv

Hans de Goede (2):
  pwc: Add USB id for Philips Spc880nc webcam
  bttv: Width must be a multiple of 16 when capturing planar formats

Helge Deller (2):
  parisc: Avoid function pointers for kernel exception routines
  parisc: Fix kernel crash with reversed copy_from_user()

Herbert Xu (2):
  crypto: gcm - Fix rfc4543 decryption crash
  crypto: hash - Fix page length clamping in hash walk

Ian Campbell (1):
  VSOCK: do not disconnect socket when peer has shutdown SEND only

Ignat Korchagin (1):
  USB: usbip: fix potential out-of-bounds write

Insu Yun (1):
  ipr: Fix out-of-bounds null overwrite

Jasem Mutlaq (1):
  USB: serial: cp210x: add Straizona Focusers device ids

Jes Sorensen (1):
  md/raid5: Compare apples to apples (or sectors to sectors)

Jiri Slaby (2):
  Bluetooth: vhci: purge unhandled skbs
  tty: vt, return error when con_startup fails

Joe Perches (1):
  compiler-gcc: integrate the various compiler-gcc[345].h files

Johan Hovold (3):
  USB: serial: keyspan: fix use-after-free in probe error path
  USB: serial: quatech2: fix use-after-free in probe error path
  USB: serial: io_edgeport: fix memory leaks in probe error path

Joseph Qi (2):
  ocfs2/dlm: fix race between convert and recovery
  ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list

Josh Boyer (2):
  USB: iowarrior: fix oops with malicious USB descriptors
  Input: powermate - fix oops with malicious USB descriptors

Julia Lawall (1):
  scripts/coccinelle: modernize &

Kamal Mostafa (1):
  x86/iopl/64: Properly context-switch IOPL on Xen PV

Kangjie Lu (3):
  net: fix infoleak in llc
  net: fix infoleak in rtnetlink
  net: fix a kernel infoleak in x25 module

Laszlo Ersek (1):
  efi: Fix out-of-bounds read in variable_matches()

Linus Lüssing (1):
  batman-adv: Fix broadcast/ogm queue limit on a removed interface

Linus Walleij (1):
  clk: versatile: sp810: support reentrance

Lu Baolu (1):
  usb: xhci: fix wild pointers in xhci_mem_cleanup

Manish Chopra (1):
  qlge: Fix receive packets drop.

Marco Angaroni (1):
  ipvs: correct initial offset of Call-ID header search in SIP
    persistence engine

Marek Szyprowski (1):
  Input: max8997-haptic - fix NULL pointer dereference

Mario Kleiner (1):
  drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards.

Martyn Welch (1):
  USB: serial: cp210x: Adding GE Healthcare Device ID

Mathias Krause (2):
  proc: prevent accessing /proc/<PID>/environ until it's ready
  packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface

Matt Fleming (1):
  MAINTAINERS: Remove asterisk from EFI directory names

Matt Gumbel (1):
  mmc: longer timeout for long read time quirk

Maurizio Lombardi (1):
  be2iscsi: set the boot_kset pointer to NULL in case of failure

Max Filippov (2):
  xtensa: ISS: don't hang if stdin EOF is reached
  xtensa: clear all DBREAKC registers on start

Michael Ellerman (1):
  i2c: cpm: Fix build break due to incompatible pointer types

Michael Hennerich (1):
  drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors

Michael S. Tsirkin (1):
  watchdog: rc32434_wdt: fix ioctl error handling

Mike Manning (1):
  USB: serial: cp210x: add ID for Link ECU

Nicolai Hähnle (1):
  drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and
    older)

Nikolay Aleksandrov (1):
  net: bridge: fix old ioctl unlocked net device walk

OGAWA Hirofumi (1):
  jbd2: fix FS corruption possibility in jbd2_journal_destroy() on
    umount path

Oliver Neukum (8):
  usb: retry reset if a device times out
  USB: cdc-acm: more sanity checking
  USB: usb_driver_claim_interface: add sanity checking
  USB: mct_u232: add sanity checking in probe
  USB: digi_acceleport: do sanity checking for the number of ports
  USB: cypress_m8: add endpoint sanity check
  Input: ims-pcu - sanity check against missing interfaces
  usbnet: cleanup after bind() in probe()

Pali Rohár (1):
  ARM: OMAP3: Add cpuidle parameters table for omap3430

Paolo Bonzini (2):
  KVM: fix spin_lock_init order on x86
  compiler-gcc: disable -ftracer for __noclone functions

Peter Hurley (1):
  net: irda: Fix use-after-free in irtty_open()

Prarit Bhargava (1):
  ACPICA: Dispatcher: Update thread ID for recursive method calls

Rabin Vincent (1):
  splice: handle zero nr_pages in splice_to_pipe()

Radim Krčmář (1):
  KVM: i8254: change PIT discard tick policy

Raghava Aditya Renukunta (1):
  aacraid: Fix memory leak in aac_fib_map_free

Robert Dobrowolski (1):
  usb: hcd: out of bounds access in for_each_companion

Roger Quadros (1):
  mfd: omap-usb-tll: Fix scheduling while atomic BUG

Roman Pen (1):
  workqueue: fix ghost PENDING flag while doing MQ IO

Sascha Hauer (1):
  ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel

Schemmel Hans-Christoph (1):
  USB: serial: option: add support for Cinterion PH8 and AHxx

Sebastian Frias (1):
  8250: use callbacks to access UART_DLL/UART_DLM

Sergei Shtylyov (1):
  sh_eth: fix NULL pointer dereference in sh_eth_ring_format()

Stefan Metzmacher (1):
  fs/cifs: correctly to anonymous authentication via NTLMSSP

Steven Rostedt (Red Hat) (5):
  tracing: Have preempt(irqs)off trace preempt disabled functions
  tracing: Fix crash from reading trace_pipe with sendfile
  tracing: Fix trace_printk() to print when not using bprintk()
  ring-buffer: Use long for nr_pages to avoid overflow failures
  ring-buffer: Prevent overflow of size in ring_buffer_resize()

Sushaanth Srirangapathi (1):
  fbdev: da8xx-fb: fix videomodes of lcd panels

Takashi Iwai (1):
  ALSA: timer: Use mod_timer() for rearming the system timer

Thadeu Lima de Souza Cascardo (1):
  ip6_tunnel: set rtnl_link_ops before calling register_netdevice

Theodore Ts'o (1):
  ext4: add lockdep annotations for i_data_sem

Thomas Gleixner (1):
  sched/cputime: Fix steal time accounting vs. CPU hotplug

Tiffany Lin (1):
  media: v4l2-compat-ioctl32: fix missing length copy in
    put_v4l2_buffer32

Tony Lindgren (1):
  ARM: OMAP3: Fix booting with thumb2 kernel

Tony Luck (1):
  EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder
    callback

Vasily Kulikov (1):
  include/linux/poison.h: fix LIST_POISON{1,2} offset

Vitaly Kuznetsov (1):
  Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors

Vittorio Gambaletta (VittGam) (1):
  ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41.

Vladis Dronov (3):
  Input: ati_remote2 - fix crashes on detecting device with invalid
    descriptor
  usbvision: fix crash on detecting device with invalid configuration
  Input: gtco - fix crash on detecting device without endpoints

Xin Long (1):
  sctp: lack the check for ports in sctp_v6_cmp_addr

Yoshihiro Shimoda (2):
  usb: renesas_usbhs: avoid NULL pointer derefernce in
    usbhsf_pkt_handler()
  usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer

 MAINTAINERS                                       |   4 +-
 arch/arm/mach-omap2/cpuidle34xx.c                 |  69 +++++++++-
 arch/arm/mach-omap2/sleep34xx.S                   |  22 +---
 arch/arm/mach-socfpga/headsmp.S                   |   1 +
 arch/parisc/kernel/parisc_ksyms.c                 |  10 +-
 arch/parisc/kernel/traps.c                        |   3 +
 arch/powerpc/include/uapi/asm/cputable.h          |   1 +
 arch/powerpc/kernel/prom.c                        |   2 +-
 arch/x86/include/asm/kvm_host.h                   |   2 +-
 arch/x86/include/asm/xen/hypervisor.h             |   2 +
 arch/x86/include/uapi/asm/processor-flags.h       | 154 +++++++++++++++-------
 arch/x86/kernel/cpu/perf_event.h                  |   2 +
 arch/x86/kernel/cpu/perf_event_intel.c            |   2 +
 arch/x86/kernel/cpu/perf_event_intel_ds.c         |  11 +-
 arch/x86/kernel/ioport.c                          |  12 +-
 arch/x86/kernel/process_64.c                      |  12 ++
 arch/x86/kvm/i8254.c                              |  12 +-
 arch/x86/kvm/x86.c                                |   2 +-
 arch/x86/xen/enlighten.c                          |   2 +-
 arch/xtensa/kernel/head.S                         |   2 +-
 arch/xtensa/platforms/iss/console.c               |  10 +-
 crypto/ahash.c                                    |   3 +-
 crypto/gcm.c                                      |   3 +
 drivers/acpi/acpica/dsmethod.c                    |   3 +
 drivers/block/nbd.c                               |   4 +-
 drivers/block/paride/pd.c                         |   4 +-
 drivers/block/paride/pt.c                         |   4 +-
 drivers/bluetooth/hci_vhci.c                      |   1 +
 drivers/clk/versatile/clk-sp810.c                 |   4 +-
 drivers/edac/amd64_edac.c                         |   2 +-
 drivers/edac/i7core_edac.c                        |   2 +-
 drivers/edac/sb_edac.c                            |   2 +-
 drivers/firmware/efi/vars.c                       |  37 ++++--
 drivers/gpu/drm/radeon/atombios_encoders.c        |   6 +-
 drivers/gpu/drm/radeon/radeon_sa.c                |   7 +
 drivers/hid/usbhid/hid-core.c                     |  73 +++++-----
 drivers/hv/vmbus_drv.c                            |  36 +++++
 drivers/hwmon/max1111.c                           |   6 +
 drivers/i2c/busses/i2c-cpm.c                      |   4 +-
 drivers/input/misc/ati_remote2.c                  |  36 ++++-
 drivers/input/misc/ims-pcu.c                      |   4 +
 drivers/input/misc/max8997_haptic.c               |   6 +-
 drivers/input/misc/powermate.c                    |   3 +
 drivers/input/tablet/gtco.c                       |  10 +-
 drivers/input/touchscreen/ads7846.c               |   8 +-
 drivers/md/bcache/super.c                         |   3 +
 drivers/md/raid5.c                                |   4 +-
 drivers/media/pci/bt8xx/bttv-driver.c             |  26 +++-
 drivers/media/usb/pwc/pwc-if.c                    |   6 +
 drivers/media/usb/usbvision/usbvision-video.c     |  40 +++++-
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c     |  21 ++-
 drivers/mfd/omap-usb-tll.c                        |   9 +-
 drivers/misc/Kconfig                              |   2 +-
 drivers/misc/ad525x_dpot.c                        |   2 +-
 drivers/mmc/card/block.c                          |   5 +-
 drivers/mmc/core/core.c                           |   4 +-
 drivers/mmc/core/mmc.c                            |   7 +
 drivers/mtd/onenand/onenand_base.c                |   3 +-
 drivers/net/ethernet/atheros/atlx/atl2.c          |   2 +-
 drivers/net/ethernet/jme.c                        |   3 +-
 drivers/net/ethernet/qlogic/qlge/qlge_main.c      |  11 ++
 drivers/net/ethernet/renesas/sh_eth.c             |   3 +-
 drivers/net/irda/irtty-sir.c                      |  10 --
 drivers/net/ppp/ppp_generic.c                     |   4 +-
 drivers/net/rionet.c                              |   4 +-
 drivers/net/usb/cdc_ncm.c                         |   6 +-
 drivers/net/usb/qmi_wwan.c                        |   1 +
 drivers/net/usb/usbnet.c                          |   7 +
 drivers/net/wan/farsync.c                         |   2 +-
 drivers/net/wireless/ath/ath9k/eeprom.c           |   7 +-
 drivers/pci/probe.c                               |  14 ++
 drivers/pnp/pnpbios/bioscalls.c                   |   9 +-
 drivers/rtc/rtc-vr41xx.c                          |  13 +-
 drivers/scsi/aacraid/commsup.c                    |   9 +-
 drivers/scsi/be2iscsi/be_main.c                   |   1 +
 drivers/scsi/ipr.c                                |  10 +-
 drivers/scsi/lpfc/lpfc_init.c                     |   5 +-
 drivers/scsi/sg.c                                 |   3 +-
 drivers/staging/usbip/usbip_common.c              |  11 ++
 drivers/tty/serial/8250/8250_core.c               |  18 +--
 drivers/tty/serial/samsung.c                      |   4 +-
 drivers/tty/vt/vt.c                               |   5 +-
 drivers/usb/class/cdc-acm.c                       |   3 +
 drivers/usb/core/driver.c                         |   6 +-
 drivers/usb/core/hcd-pci.c                        |   9 ++
 drivers/usb/core/hub.c                            |   8 +-
 drivers/usb/host/xhci-mem.c                       |   5 +
 drivers/usb/misc/iowarrior.c                      |   6 +
 drivers/usb/renesas_usbhs/fifo.c                  |   4 +-
 drivers/usb/serial/cp210x.c                       |   5 +
 drivers/usb/serial/cypress_m8.c                   |  11 +-
 drivers/usb/serial/digi_acceleport.c              |  19 +++
 drivers/usb/serial/io_edgeport.c                  |  17 ++-
 drivers/usb/serial/keyspan.c                      |   4 +
 drivers/usb/serial/mct_u232.c                     |   9 +-
 drivers/usb/serial/option.c                       |  28 +++-
 drivers/usb/serial/quatech2.c                     |   1 +
 drivers/video/da8xx-fb.c                          |   7 +-
 drivers/watchdog/rc32434_wdt.c                    |   2 +-
 fs/cifs/sess.c                                    |  32 +++--
 fs/ext4/ext4.h                                    |  23 ++++
 fs/ext4/inode.c                                   |   6 +-
 fs/ext4/move_extent.c                             |  11 +-
 fs/ext4/super.c                                   |  25 +++-
 fs/isofs/rock.c                                   |  13 +-
 fs/jbd2/journal.c                                 |  17 ++-
 fs/ocfs2/dlm/dlmconvert.c                         |  24 +++-
 fs/ocfs2/dlm/dlmrecovery.c                        |   1 -
 fs/pipe.c                                         |   5 +-
 fs/proc/base.c                                    |   3 +-
 fs/splice.c                                       |   3 +
 include/linux/compiler-gcc.h                      | 114 +++++++++++++++-
 include/linux/compiler-gcc3.h                     |  23 ----
 include/linux/compiler-gcc4.h                     |  88 -------------
 include/linux/compiler-gcc5.h                     |  66 ----------
 include/linux/kernel.h                            |   6 +-
 include/linux/mod_devicetable.h                   |   7 +
 include/linux/pci.h                               |   1 +
 include/linux/poison.h                            |   4 +-
 include/uapi/linux/const.h                        |   3 +
 kernel/sched/core.c                               |   1 +
 kernel/sched/sched.h                              |  13 ++
 kernel/trace/ring_buffer.c                        |  35 ++---
 kernel/trace/trace.c                              |   5 +-
 kernel/trace/trace_irqsoff.c                      |   8 +-
 kernel/trace/trace_printk.c                       |   3 +
 kernel/workqueue.c                                |  29 ++++
 net/batman-adv/send.c                             |   6 +
 net/bridge/br_ioctl.c                             |   5 +-
 net/core/rtnetlink.c                              |  18 +--
 net/decnet/dn_route.c                             |   9 +-
 net/ipv4/route.c                                  |  12 ++
 net/ipv6/exthdrs_core.c                           |   6 +-
 net/ipv6/ip6_tunnel.c                             |   2 +-
 net/ipv6/udp.c                                    |   6 +-
 net/l2tp/l2tp_ip.c                                |   8 +-
 net/l2tp/l2tp_ip6.c                               |   8 +-
 net/llc/af_llc.c                                  |   1 +
 net/netfilter/ipvs/ip_vs_pe_sip.c                 |   2 +-
 net/packet/af_packet.c                            |   1 +
 net/sctp/ipv6.c                                   |   2 +
 net/socket.c                                      |  38 +++---
 net/vmw_vsock/af_vsock.c                          |  21 +--
 net/wireless/nl80211.c                            |   2 +-
 net/x25/x25_facilities.c                          |   1 +
 scripts/coccinelle/iterators/use_after_iter.cocci |   2 +-
 sound/core/timer.c                                |   4 +-
 sound/pci/intel8x0.c                              |   1 +
 sound/soc/samsung/s3c-i2s-v2.c                    |   2 +-
 sound/soc/samsung/s3c-i2s-v2.h                    |   2 +-
 tools/perf/Documentation/perf-stat.txt            |   8 ++
 virt/kvm/kvm_main.c                               |  21 +--
 152 files changed, 1193 insertions(+), 607 deletions(-)
 delete mode 100644 include/linux/compiler-gcc3.h
 delete mode 100644 include/linux/compiler-gcc4.h
 delete mode 100644 include/linux/compiler-gcc5.h

-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply	[flat|nested] 154+ messages in thread

* [PATCH 3.10 001/143] pipe: Fix buffer offset after partially failed read
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 002/143] x86/iopl/64: Properly context-switch IOPL on Xen PV Willy Tarreau
                   ` (142 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Ben Hutchings, Willy Tarreau

From: Ben Hutchings <ben@decadent.org.uk>

Quoting the RHEL advisory:

> It was found that the fix for CVE-2015-1805 incorrectly kept buffer
> offset and buffer length in sync on a failed atomic read, potentially
> resulting in a pipe buffer state corruption. A local, unprivileged user
> could use this flaw to crash the system or leak kernel memory to user
> space. (CVE-2016-0774, Moderate)

The same flawed fix was applied to stable branches from 2.6.32.y to
3.14.y inclusive, and I was able to reproduce the issue on 3.2.y.
We need to give pipe_iov_copy_to_user() a separate offset variable
and only update the buffer offset if it succeeds.

References: https://rhn.redhat.com/errata/RHSA-2016-0103.html
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/pipe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/pipe.c b/fs/pipe.c
index 3e7ab27..50267e6 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -401,6 +401,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
 			void *addr;
 			size_t chars = buf->len, remaining;
 			int error, atomic;
+			int offset;
 
 			if (chars > total_len)
 				chars = total_len;
@@ -414,9 +415,10 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
 
 			atomic = !iov_fault_in_pages_write(iov, chars);
 			remaining = chars;
+			offset = buf->offset;
 redo:
 			addr = ops->map(pipe, buf, atomic);
-			error = pipe_iov_copy_to_user(iov, addr, &buf->offset,
+			error = pipe_iov_copy_to_user(iov, addr, &offset,
 						      &remaining, atomic);
 			ops->unmap(pipe, buf, addr);
 			if (unlikely(error)) {
@@ -432,6 +434,7 @@ redo:
 				break;
 			}
 			ret += chars;
+			buf->offset += chars;
 			buf->len -= chars;
 
 			/* Was it a packet buffer? Clean up and exit */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 002/143] x86/iopl/64: Properly context-switch IOPL on Xen PV
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 001/143] pipe: Fix buffer offset after partially failed read Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 003/143] ext4: fix NULL pointer dereference in ext4_mark_inode_dirty() Willy Tarreau
                   ` (141 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kamal Mostafa, Andy Lutomirski, Andrew Cooper, Andy Lutomirski,
	Boris Ostrovsky, Borislav Petkov, Brian Gerst, David Vrabel,
	Denys Vlasenko, H . Peter Anvin, Jan Beulich, Linus Torvalds,
	Peter Zijlstra, Thomas Gleixner, Ingo Molnar, Willy Tarreau

From: Kamal Mostafa <kamal@canonical.com>

commit b7a584598aea7ca73140cb87b40319944dd3393f upstream.

From: Andy Lutomirski <luto@kernel.org>

On Xen PV, regs->flags doesn't reliably reflect IOPL and the
exit-to-userspace code doesn't change IOPL.  We need to context
switch it manually.

I'm doing this without going through paravirt because this is
specific to Xen PV.  After the dust settles, we can merge this with
the 32-bit code, tidy up the iopl syscall implementation, and remove
the set_iopl pvop entirely.

Fixes XSA-171.

Reviewewd-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/693c3bd7aeb4d3c27c92c622b7d0f554a458173c.1458162709.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ kamal: backport to 3.19-stable: no X86_FEATURE_XENPV so just call
  xen_pv_domain() directly ]
Acked-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/x86/include/asm/xen/hypervisor.h |  2 ++
 arch/x86/kernel/process_64.c          | 12 ++++++++++++
 arch/x86/xen/enlighten.c              |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
index 125f344..8ac93f0 100644
--- a/arch/x86/include/asm/xen/hypervisor.h
+++ b/arch/x86/include/asm/xen/hypervisor.h
@@ -71,4 +71,6 @@ static inline bool xen_x2apic_para_available(void)
 }
 #endif
 
+extern void xen_set_iopl_mask(unsigned mask);
+
 #endif /* _ASM_X86_XEN_HYPERVISOR_H */
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 7099ab1..580001c 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -49,6 +49,7 @@
 #include <asm/syscalls.h>
 #include <asm/debugreg.h>
 #include <asm/switch_to.h>
+#include <asm/xen/hypervisor.h>
 
 asmlinkage extern void ret_from_fork(void);
 
@@ -412,6 +413,17 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 		     task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV))
 		__switch_to_xtra(prev_p, next_p, tss);
 
+#ifdef CONFIG_XEN
+	/*
+	 * On Xen PV, IOPL bits in pt_regs->flags have no effect, and
+	 * current_pt_regs()->flags may not match the current task's
+	 * intended IOPL.  We need to switch it manually.
+	 */
+	if (unlikely(xen_pv_domain() &&
+		     prev->iopl != next->iopl))
+		xen_set_iopl_mask(next->iopl);
+#endif
+
 	return prev_p;
 }
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 91cbe75..34511cf 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -952,7 +952,7 @@ static void xen_load_sp0(struct tss_struct *tss,
 	xen_mc_issue(PARAVIRT_LAZY_CPU);
 }
 
-static void xen_set_iopl_mask(unsigned mask)
+void xen_set_iopl_mask(unsigned mask)
 {
 	struct physdev_set_iopl set_iopl;
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 003/143] ext4: fix NULL pointer dereference in ext4_mark_inode_dirty()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 001/143] pipe: Fix buffer offset after partially failed read Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 002/143] x86/iopl/64: Properly context-switch IOPL on Xen PV Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 004/143] compiler-gcc: integrate the various compiler-gcc[345].h files Willy Tarreau
                   ` (140 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Eryu Guan, Theodore Ts'o, Willy Tarreau

From: Eryu Guan <guaneryu@gmail.com>

commit 5e1021f2b6dff1a86a468a1424d59faae2bc63c1 upstream.

ext4_reserve_inode_write() in ext4_mark_inode_dirty() could fail on
error (e.g. EIO) and iloc.bh can be NULL in this case. But the error is
ignored in the following "if" condition and ext4_expand_extra_isize()
might be called with NULL iloc.bh set, which triggers NULL pointer
dereference.

This is uncovered by commit 8b4953e13f4c ("ext4: reserve code points for
the project quota feature"), which enlarges the ext4_inode size, and
run the following script on new kernel but with old mke2fs:

  #/bin/bash
  mnt=/mnt/ext4
  devname=ext4-error
  dev=/dev/mapper/$devname
  fsimg=/home/fs.img

  trap cleanup 0 1 2 3 9 15

  cleanup()
  {
          umount $mnt >/dev/null 2>&1
          dmsetup remove $devname
          losetup -d $backend_dev
          rm -f $fsimg
          exit 0
  }

  rm -f $fsimg
  fallocate -l 1g $fsimg
  backend_dev=`losetup -f --show $fsimg`
  devsize=`blockdev --getsz $backend_dev`

  good_tab="0 $devsize linear $backend_dev 0"
  error_tab="0 $devsize error $backend_dev 0"

  dmsetup create $devname --table "$good_tab"

  mkfs -t ext4 $dev
  mount -t ext4 -o errors=continue,strictatime $dev $mnt

  dmsetup load $devname --table "$error_tab" && dmsetup resume $devname
  echo 3 > /proc/sys/vm/drop_caches
  ls -l $mnt
  exit 0

[ Patch changed to simplify the function a tiny bit. -- Ted ]

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/ext4/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 10b71e4..fb7e576d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5063,6 +5063,8 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
 	might_sleep();
 	trace_ext4_mark_inode_dirty(inode, _RET_IP_);
 	err = ext4_reserve_inode_write(handle, inode, &iloc);
+	if (err)
+		return err;
 	if (ext4_handle_valid(handle) &&
 	    EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize &&
 	    !ext4_test_inode_state(inode, EXT4_STATE_NO_EXPAND)) {
@@ -5093,9 +5095,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
 			}
 		}
 	}
-	if (!err)
-		err = ext4_mark_iloc_dirty(handle, inode, &iloc);
-	return err;
+	return ext4_mark_iloc_dirty(handle, inode, &iloc);
 }
 
 /*
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 004/143] compiler-gcc: integrate the various compiler-gcc[345].h files
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (2 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 003/143] ext4: fix NULL pointer dereference in ext4_mark_inode_dirty() Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 005/143] x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id" Willy Tarreau
                   ` (139 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Joe Perches, Andi Kleen, Michal Marek, Segher Boessenkool,
	Sasha Levin, Anton Blanchard, Alan Modra, Andrew Morton,
	Linus Torvalds, Philip M�ller, Willy Tarreau

From: Joe Perches <joe@perches.com>

commit cb984d101b30eb7478d32df56a0023e4603cba7f upstream.

As gcc major version numbers are going to advance rather rapidly in the
future, there's no real value in separate files for each compiler
version.

Deduplicate some of the macros #defined in each file too.

Neaten comments using normal kernel commenting style.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Alan Modra <amodra@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ philm: backport to 3.10-stable ]
Signed-off-by: Philip Müller <philm@manjaro.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 include/linux/compiler-gcc.h  | 114 ++++++++++++++++++++++++++++++++++++++++--
 include/linux/compiler-gcc3.h |  23 ---------
 include/linux/compiler-gcc4.h |  88 --------------------------------
 include/linux/compiler-gcc5.h |  66 ------------------------
 4 files changed, 110 insertions(+), 181 deletions(-)
 delete mode 100644 include/linux/compiler-gcc3.h
 delete mode 100644 include/linux/compiler-gcc4.h
 delete mode 100644 include/linux/compiler-gcc5.h

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 02ae99e..65856c3 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -100,10 +100,116 @@
 #define __maybe_unused			__attribute__((unused))
 #define __always_unused			__attribute__((unused))
 
-#define __gcc_header(x) #x
-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
-#define gcc_header(x) _gcc_header(x)
-#include gcc_header(__GNUC__)
+/* gcc version specific checks */
+
+#if GCC_VERSION < 30200
+# error Sorry, your compiler is too old - please upgrade it.
+#endif
+
+#if GCC_VERSION < 30300
+# define __used			__attribute__((__unused__))
+#else
+# define __used			__attribute__((__used__))
+#endif
+
+#ifdef CONFIG_GCOV_KERNEL
+# if GCC_VERSION < 30400
+#   error "GCOV profiling support for gcc versions below 3.4 not included"
+# endif /* __GNUC_MINOR__ */
+#endif /* CONFIG_GCOV_KERNEL */
+
+#if GCC_VERSION >= 30400
+#define __must_check		__attribute__((warn_unused_result))
+#endif
+
+#if GCC_VERSION >= 40000
+
+/* GCC 4.1.[01] miscompiles __weak */
+#ifdef __KERNEL__
+# if GCC_VERSION >= 40100 &&  GCC_VERSION <= 40101
+#  error Your version of gcc miscompiles the __weak directive
+# endif
+#endif
+
+#define __used			__attribute__((__used__))
+#define __compiler_offsetof(a, b)					\
+	__builtin_offsetof(a, b)
+
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
+#endif
+
+#if GCC_VERSION >= 40300
+/* Mark functions as cold. gcc will assume any path leading to a call
+ * to them will be unlikely.  This means a lot of manual unlikely()s
+ * are unnecessary now for any paths leading to the usual suspects
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
+ * older compilers]
+ *
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
+ * in the preprocessor, but we can live with this because they're unreleased.
+ * Maketime probing would be overkill here.
+ *
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
+ * a special section, but I don't see any sense in this right now in
+ * the kernel context
+ */
+#define __cold			__attribute__((__cold__))
+
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+
+#ifndef __CHECKER__
+# define __compiletime_warning(message) __attribute__((warning(message)))
+# define __compiletime_error(message) __attribute__((error(message)))
+#endif /* __CHECKER__ */
+#endif /* GCC_VERSION >= 40300 */
+
+#if GCC_VERSION >= 40500
+/*
+ * Mark a position in code as unreachable.  This can be used to
+ * suppress control flow warnings after asm blocks that transfer
+ * control elsewhere.
+ *
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
+ * this in the preprocessor, but we can live with this because they're
+ * unreleased.  Really, we need to have autoconf for the kernel.
+ */
+#define unreachable() __builtin_unreachable()
+
+/* Mark a function definition as prohibited from being cloned. */
+#define __noclone	__attribute__((__noclone__))
+
+#endif /* GCC_VERSION >= 40500 */
+
+#if GCC_VERSION >= 40600
+/*
+ * Tell the optimizer that something else uses this function or variable.
+ */
+#define __visible	__attribute__((externally_visible))
+#endif
+
+/*
+ * GCC 'asm goto' miscompiles certain code sequences:
+ *
+ *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
+ *
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
+ *
+ * (asm goto is automatically volatile - the naming reflects this.)
+ */
+#define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
+
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
+#if GCC_VERSION >= 40400
+#define __HAVE_BUILTIN_BSWAP32__
+#define __HAVE_BUILTIN_BSWAP64__
+#endif
+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
+#define __HAVE_BUILTIN_BSWAP16__
+#endif
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
+
+#endif	/* gcc version >= 40000 specific checks */
 
 #if !defined(__noclone)
 #define __noclone	/* not needed */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
deleted file mode 100644
index 7d89feb..0000000
--- a/include/linux/compiler-gcc3.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
-#endif
-
-#if GCC_VERSION < 30200
-# error Sorry, your compiler is too old - please upgrade it.
-#endif
-
-#if GCC_VERSION >= 30300
-# define __used			__attribute__((__used__))
-#else
-# define __used			__attribute__((__unused__))
-#endif
-
-#if GCC_VERSION >= 30400
-#define __must_check		__attribute__((warn_unused_result))
-#endif
-
-#ifdef CONFIG_GCOV_KERNEL
-# if GCC_VERSION < 30400
-#   error "GCOV profiling support for gcc versions below 3.4 not included"
-# endif /* __GNUC_MINOR__ */
-#endif /* CONFIG_GCOV_KERNEL */
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
deleted file mode 100644
index 2507fd2..0000000
--- a/include/linux/compiler-gcc4.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
-#endif
-
-/* GCC 4.1.[01] miscompiles __weak */
-#ifdef __KERNEL__
-# if GCC_VERSION >= 40100 &&  GCC_VERSION <= 40101
-#  error Your version of gcc miscompiles the __weak directive
-# endif
-#endif
-
-#define __used			__attribute__((__used__))
-#define __must_check 		__attribute__((warn_unused_result))
-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
-
-#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
-#endif
-
-#if GCC_VERSION >= 40300
-/* Mark functions as cold. gcc will assume any path leading to a call
-   to them will be unlikely.  This means a lot of manual unlikely()s
-   are unnecessary now for any paths leading to the usual suspects
-   like BUG(), printk(), panic() etc. [but let's keep them for now for
-   older compilers]
-
-   Early snapshots of gcc 4.3 don't support this and we can't detect this
-   in the preprocessor, but we can live with this because they're unreleased.
-   Maketime probing would be overkill here.
-
-   gcc also has a __attribute__((__hot__)) to move hot functions into
-   a special section, but I don't see any sense in this right now in
-   the kernel context */
-#define __cold			__attribute__((__cold__))
-
-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
-
-#ifndef __CHECKER__
-# define __compiletime_warning(message) __attribute__((warning(message)))
-# define __compiletime_error(message) __attribute__((error(message)))
-#endif /* __CHECKER__ */
-#endif /* GCC_VERSION >= 40300 */
-
-#if GCC_VERSION >= 40500
-/*
- * Mark a position in code as unreachable.  This can be used to
- * suppress control flow warnings after asm blocks that transfer
- * control elsewhere.
- *
- * Early snapshots of gcc 4.5 don't support this and we can't detect
- * this in the preprocessor, but we can live with this because they're
- * unreleased.  Really, we need to have autoconf for the kernel.
- */
-#define unreachable() __builtin_unreachable()
-
-/* Mark a function definition as prohibited from being cloned. */
-#define __noclone	__attribute__((__noclone__))
-
-#endif /* GCC_VERSION >= 40500 */
-
-#if GCC_VERSION >= 40600
-/*
- * Tell the optimizer that something else uses this function or variable.
- */
-#define __visible __attribute__((externally_visible))
-#endif
-
-/*
- * GCC 'asm goto' miscompiles certain code sequences:
- *
- *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
- *
- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
- * Fixed in GCC 4.8.2 and later versions.
- *
- * (asm goto is automatically volatile - the naming reflects this.)
- */
-#define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
-
-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
-#if GCC_VERSION >= 40400
-#define __HAVE_BUILTIN_BSWAP32__
-#define __HAVE_BUILTIN_BSWAP64__
-#endif
-#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
-#define __HAVE_BUILTIN_BSWAP16__
-#endif
-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
deleted file mode 100644
index cdd1cc2..0000000
--- a/include/linux/compiler-gcc5.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
-#endif
-
-#define __used				__attribute__((__used__))
-#define __must_check			__attribute__((warn_unused_result))
-#define __compiler_offsetof(a, b)	__builtin_offsetof(a, b)
-
-/* Mark functions as cold. gcc will assume any path leading to a call
-   to them will be unlikely.  This means a lot of manual unlikely()s
-   are unnecessary now for any paths leading to the usual suspects
-   like BUG(), printk(), panic() etc. [but let's keep them for now for
-   older compilers]
-
-   Early snapshots of gcc 4.3 don't support this and we can't detect this
-   in the preprocessor, but we can live with this because they're unreleased.
-   Maketime probing would be overkill here.
-
-   gcc also has a __attribute__((__hot__)) to move hot functions into
-   a special section, but I don't see any sense in this right now in
-   the kernel context */
-#define __cold			__attribute__((__cold__))
-
-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
-
-#ifndef __CHECKER__
-# define __compiletime_warning(message) __attribute__((warning(message)))
-# define __compiletime_error(message) __attribute__((error(message)))
-#endif /* __CHECKER__ */
-
-/*
- * Mark a position in code as unreachable.  This can be used to
- * suppress control flow warnings after asm blocks that transfer
- * control elsewhere.
- *
- * Early snapshots of gcc 4.5 don't support this and we can't detect
- * this in the preprocessor, but we can live with this because they're
- * unreleased.  Really, we need to have autoconf for the kernel.
- */
-#define unreachable() __builtin_unreachable()
-
-/* Mark a function definition as prohibited from being cloned. */
-#define __noclone	__attribute__((__noclone__))
-
-/*
- * Tell the optimizer that something else uses this function or variable.
- */
-#define __visible __attribute__((externally_visible))
-
-/*
- * GCC 'asm goto' miscompiles certain code sequences:
- *
- *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
- *
- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
- * Fixed in GCC 4.8.2 and later versions.
- *
- * (asm goto is automatically volatile - the naming reflects this.)
- */
-#define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
-
-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
-#define __HAVE_BUILTIN_BSWAP32__
-#define __HAVE_BUILTIN_BSWAP64__
-#define __HAVE_BUILTIN_BSWAP16__
-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 005/143] x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id"
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (3 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 004/143] compiler-gcc: integrate the various compiler-gcc[345].h files Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 006/143] KVM: i8254: change PIT discard tick policy Willy Tarreau
                   ` (138 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Behan Webster, Jan-Simon M�ller, philm, Willy Tarreau

From: Behan Webster <behanw@converseincode.com>

commit c4586256f0c440bc2bdb29d2cbb915f0ca785d26 upstream.

Similar to the fix in 40413dcb7b273bda681dca38e6ff0bbb3728ef11

MODULE_DEVICE_TABLE(x86cpu, ...) expects the struct to be called struct
x86cpu_device_id, and not struct x86_cpu_id which is what is used in the rest
of the kernel code.  Although gcc seems to ignore this error, clang fails
without this define to fix the name.

Code from drivers/thermal/x86_pkg_temp_thermal.c
static const struct x86_cpu_id __initconst pkg_temp_thermal_ids[] = { ... };
MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids);

Error from clang:
drivers/thermal/x86_pkg_temp_thermal.c:577:1: error: variable has
      incomplete type 'const struct x86cpu_device_id'
MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids);
^
include/linux/module.h:145:3: note: expanded from macro
      'MODULE_DEVICE_TABLE'
  MODULE_GENERIC_TABLE(type##_device, name)
  ^
include/linux/module.h:87:32: note: expanded from macro
      'MODULE_GENERIC_TABLE'
extern const struct gtype##_id __mod_##gtype##_table            \
                               ^
<scratch space>:143:1: note: expanded from here
__mod_x86cpu_device_table
^
drivers/thermal/x86_pkg_temp_thermal.c:577:1: note: forward declaration of
      'struct x86cpu_device_id'
include/linux/module.h:145:3: note: expanded from macro
      'MODULE_DEVICE_TABLE'
  MODULE_GENERIC_TABLE(type##_device, name)
  ^
include/linux/module.h:87:21: note: expanded from macro
      'MODULE_GENERIC_TABLE'
extern const struct gtype##_id __mod_##gtype##_table            \
                    ^
<scratch space>:141:1: note: expanded from here
x86cpu_device_id
^
1 error generated.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: philm@manjaro.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 include/linux/mod_devicetable.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index b3bd7e7..d313648 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -397,6 +397,7 @@ struct virtio_device_id {
 /*
  * For Hyper-V devices we use the device guid as the id.
  */
+#define vmbus_device_id hv_vmbus_device_id
 struct hv_vmbus_device_id {
 	__u8 guid[16];
 	kernel_ulong_t driver_data;	/* Data private to the driver */
@@ -547,6 +548,11 @@ struct amba_id {
  * See documentation of "x86_match_cpu" for details.
  */
 
+/*
+ * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id.
+ * Although gcc seems to ignore this error, clang fails without this define.
+ */
+#define x86cpu_device_id x86_cpu_id
 struct x86_cpu_id {
 	__u16 vendor;
 	__u16 family;
@@ -574,6 +580,7 @@ struct ipack_device_id {
 #define MEI_CL_MODULE_PREFIX "mei:"
 #define MEI_CL_NAME_SIZE 32
 
+#define mei_device_id mei_cl_device_id
 struct mei_cl_device_id {
 	char name[MEI_CL_NAME_SIZE];
 	kernel_ulong_t driver_info;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 006/143] KVM: i8254: change PIT discard tick policy
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (4 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 005/143] x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id" Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 007/143] KVM: fix spin_lock_init order on x86 Willy Tarreau
                   ` (137 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Radim Krčmář,
	Paolo Bonzini, Willy Tarreau

From: Radim Krčmář <rkrcmar@redhat.com>

commit 7dd0fdff145c5be7146d0ac06732ae3613412ac1 upstream.

Discard policy uses ack_notifiers to prevent injection of PIT interrupts
before EOI from the last one.

This patch changes the policy to always try to deliver the interrupt,
which makes a difference when its vector is in ISR.
Old implementation would drop the interrupt, but proposed one injects to
IRR, like real hardware would.

The old policy breaks legacy NMI watchdogs, where PIT is used through
virtual wire (LVT0): PIT never sends an interrupt before receiving EOI,
thus a guest deadlock with disabled interrupts will stop NMIs.

Note that NMI doesn't do EOI, so PIT also had to send a normal interrupt
through IOAPIC.  (KVM's PIT is deeply rotten and luckily not used much
in modern systems.)

Even though there is a chance of regressions, I think we can fix the
LVT0 NMI bug without introducing a new tick policy.

Cc: <stable@vger.kernel.org>
Reported-by: Yuki Shibuya <shibuya.yk@ncos.nec.co.jp>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/x86/kvm/i8254.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 1406ffd..b0a706d 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -244,7 +244,7 @@ static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian)
 		 * PIC is being reset.  Handle it gracefully here
 		 */
 		atomic_inc(&ps->pending);
-	else if (value > 0)
+	else if (value > 0 && ps->reinject)
 		/* in this case, we had multiple outstanding pit interrupts
 		 * that we needed to inject.  Reinject
 		 */
@@ -287,7 +287,9 @@ static void pit_do_work(struct kthread_work *work)
 	 * last one has been acked.
 	 */
 	spin_lock(&ps->inject_lock);
-	if (ps->irq_ack) {
+	if (!ps->reinject)
+		inject = 1;
+	else if (ps->irq_ack) {
 		ps->irq_ack = 0;
 		inject = 1;
 	}
@@ -316,10 +318,10 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data)
 	struct kvm_kpit_state *ps = container_of(data, struct kvm_kpit_state, timer);
 	struct kvm_pit *pt = ps->kvm->arch.vpit;
 
-	if (ps->reinject || !atomic_read(&ps->pending)) {
+	if (ps->reinject)
 		atomic_inc(&ps->pending);
-		queue_kthread_work(&pt->worker, &pt->expired);
-	}
+
+	queue_kthread_work(&pt->worker, &pt->expired);
 
 	if (ps->is_periodic) {
 		hrtimer_add_expires_ns(&ps->timer, ps->period);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 007/143] KVM: fix spin_lock_init order on x86
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (5 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 006/143] KVM: i8254: change PIT discard tick policy Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 008/143] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Willy Tarreau
                   ` (136 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Paolo Bonzini, Greg Kroah-Hartman, Willy Tarreau

From: Paolo Bonzini <pbonzini@redhat.com>

commit e9ad4ec8379ad1ba6f68b8ca1c26b50b5ae0a327 upstream.

Moving the initialization earlier is needed in 4.6 because
kvm_arch_init_vm is now using mmu_lock, causing lockdep to
complain:

[  284.440294] INFO: trying to register non-static key.
[  284.445259] the code is fine but needs lockdep annotation.
[  284.450736] turning off the locking correctness validator.
...
[  284.528318]  [<ffffffff810aecc3>] lock_acquire+0xd3/0x240
[  284.533733]  [<ffffffffa0305aa0>] ? kvm_page_track_register_notifier+0x20/0x60 [kvm]
[  284.541467]  [<ffffffff81715581>] _raw_spin_lock+0x41/0x80
[  284.546960]  [<ffffffffa0305aa0>] ? kvm_page_track_register_notifier+0x20/0x60 [kvm]
[  284.554707]  [<ffffffffa0305aa0>] kvm_page_track_register_notifier+0x20/0x60 [kvm]
[  284.562281]  [<ffffffffa02ece70>] kvm_mmu_init_vm+0x20/0x30 [kvm]
[  284.568381]  [<ffffffffa02dbf7a>] kvm_arch_init_vm+0x1ea/0x200 [kvm]
[  284.574740]  [<ffffffffa02bff3f>] kvm_dev_ioctl+0xbf/0x4d0 [kvm]

However, it also helps fixing a preexisting problem, which is why this
patch is also good for stable kernels: kvm_create_vm was incrementing
current->mm->mm_count but not decrementing it at the out_err label (in
case kvm_init_mmu_notifier failed).  The new initialization order makes
it possible to add the required mmdrop without adding a new error label.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 virt/kvm/kvm_main.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1d4b8be..4f865e1 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -468,6 +468,16 @@ static struct kvm *kvm_create_vm(unsigned long type)
 	if (!kvm)
 		return ERR_PTR(-ENOMEM);
 
+	spin_lock_init(&kvm->mmu_lock);
+	atomic_inc(&current->mm->mm_count);
+	kvm->mm = current->mm;
+	kvm_eventfd_init(kvm);
+	mutex_init(&kvm->lock);
+	mutex_init(&kvm->irq_lock);
+	mutex_init(&kvm->slots_lock);
+	atomic_set(&kvm->users_count, 1);
+	INIT_LIST_HEAD(&kvm->devices);
+
 	r = kvm_arch_init_vm(kvm, type);
 	if (r)
 		goto out_err_nodisable;
@@ -497,16 +507,6 @@ static struct kvm *kvm_create_vm(unsigned long type)
 			goto out_err;
 	}
 
-	spin_lock_init(&kvm->mmu_lock);
-	kvm->mm = current->mm;
-	atomic_inc(&kvm->mm->mm_count);
-	kvm_eventfd_init(kvm);
-	mutex_init(&kvm->lock);
-	mutex_init(&kvm->irq_lock);
-	mutex_init(&kvm->slots_lock);
-	atomic_set(&kvm->users_count, 1);
-	INIT_LIST_HEAD(&kvm->devices);
-
 	r = kvm_init_mmu_notifier(kvm);
 	if (r)
 		goto out_err;
@@ -526,6 +526,7 @@ out_err_nodisable:
 		kfree(kvm->buses[i]);
 	kfree(kvm->memslots);
 	kvm_arch_free_vm(kvm);
+	mmdrop(current->mm);
 	return ERR_PTR(r);
 }
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 008/143] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (6 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 007/143] KVM: fix spin_lock_init order on x86 Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 009/143] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Willy Tarreau
                   ` (135 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dan Carpenter, Aravind Gopalakrishnan, linux-edac,
	Borislav Petkov, Willy Tarreau

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 6f3508f61c814ee852c199988a62bd954c50dfc1 upstream.

dct_sel_base_off is declared as a u64 but we're only using the lower 32
bits because of a shift wrapping bug. This can possibly truncate the
upper 16 bits of DctSelBaseOffset[47:26], causing us to misdecode the CS
row.

Fixes: c8e518d5673d ('amd64_edac: Sanitize f10_get_base_addr_offset')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20160120095451.GB19898@mwanda
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/edac/amd64_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 8b3d901..19353112 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1266,7 +1266,7 @@ static u64 f1x_get_norm_dct_addr(struct amd64_pvt *pvt, u8 range,
 	u64 chan_off;
 	u64 dram_base		= get_dram_base(pvt, range);
 	u64 hole_off		= f10_dhar_offset(pvt);
-	u64 dct_sel_base_off	= (pvt->dct_sel_hi & 0xFFFFFC00) << 16;
+	u64 dct_sel_base_off	= (u64)(pvt->dct_sel_hi & 0xFFFFFC00) << 16;
 
 	if (hi_rng) {
 		/*
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 009/143] PCI: Disable IO/MEM decoding for devices with non-compliant BARs
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (7 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 008/143] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 010/143] linux/const.h: Add _BITUL() and _BITULL() Willy Tarreau
                   ` (134 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Bjorn Helgaas, Greg Kroah-Hartman, Willy Tarreau

From: Bjorn Helgaas <bhelgaas@google.com>

commit b84106b4e2290c081cdab521fa832596cdfea246 upstream.

The PCI config header (first 64 bytes of each device's config space) is
defined by the PCI spec so generic software can identify the device and
manage its usage of I/O, memory, and IRQ resources.

Some non-spec-compliant devices put registers other than BARs where the
BARs should be.  When the PCI core sizes these "BARs", the reads and writes
it does may have unwanted side effects, and the "BAR" may appear to
describe non-sensical address space.

Add a flag bit to mark non-compliant devices so we don't touch their BARs.
Turn off IO/MEM decoding to prevent the devices from consuming address
space, since we can't read the BARs to find out what that address space
would be.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/pci/probe.c | 14 ++++++++++++++
 include/linux/pci.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 034a4d2..d332d55 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -173,6 +173,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 	struct pci_bus_region region;
 	bool bar_too_big = false, bar_disabled = false;
 
+	if (dev->non_compliant_bars)
+		return 0;
+
 	mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
 
 	/* No printks while decoding is disabled! */
@@ -981,6 +984,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
 int pci_setup_device(struct pci_dev *dev)
 {
 	u32 class;
+	u16 cmd;
 	u8 hdr_type;
 	struct pci_slot *slot;
 	int pos = 0;
@@ -1028,6 +1032,16 @@ int pci_setup_device(struct pci_dev *dev)
 	/* device class may be changed after fixup */
 	class = dev->class >> 8;
 
+	if (dev->non_compliant_bars) {
+		pci_read_config_word(dev, PCI_COMMAND, &cmd);
+		if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+			dev_info(&dev->dev, "device has non-compliant BARs; disabling IO/MEM decoding\n");
+			cmd &= ~PCI_COMMAND_IO;
+			cmd &= ~PCI_COMMAND_MEMORY;
+			pci_write_config_word(dev, PCI_COMMAND, cmd);
+		}
+	}
+
 	switch (dev->hdr_type) {		    /* header type */
 	case PCI_HEADER_TYPE_NORMAL:		    /* standard header */
 		if (class == PCI_CLASS_BRIDGE_PCI)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 102136a..655ef37 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -330,6 +330,7 @@ struct pci_dev {
 	unsigned int	__aer_firmware_first:1;
 	unsigned int	broken_intx_masking:1;
 	unsigned int	io_window_1k:1;	/* Intel P2P bridge 1K I/O windows */
+	unsigned int	non_compliant_bars:1;	/* broken BARs; ignore them */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 010/143] linux/const.h: Add _BITUL() and _BITULL()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (8 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 009/143] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 011/143] x86: Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE Willy Tarreau
                   ` (133 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: H. Peter Anvin, Willy Tarreau

From: "H. Peter Anvin" <hpa@linux.intel.com>

commit 2fc016c5bd8aad2e201cdf71b9fb4573f94775bd upstream.

Add macros for single bit definitions of a specific type.  These are
similar to the BIT() macro that already exists, but with a few
exceptions:

1. The namespace is such that they can be used in uapi definitions.
2. The type is set with the _AC() macro to allow it to be used in
   assembly.
3. The type is explicitly specified to be UL or ULL.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/n/tip-nbca8p7cg6jyjoit7klh3o91@git.kernel.org
[wt: backported to 3.10 only to keep next patch clean]

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 include/uapi/linux/const.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h
index c22c707..c872bfd 100644
--- a/include/uapi/linux/const.h
+++ b/include/uapi/linux/const.h
@@ -21,4 +21,7 @@
 #define _AT(T,X)	((T)(X))
 #endif
 
+#define _BITUL(x)	(_AC(1,UL) << (x))
+#define _BITULL(x)	(_AC(1,ULL) << (x))
+
 #endif /* !(_LINUX_CONST_H) */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 011/143] x86: Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (9 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 010/143] linux/const.h: Add _BITUL() and _BITULL() Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 012/143] x86, processor-flags: Fix the datatypes and add bit number defines Willy Tarreau
                   ` (132 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: H. Peter Anvin, Marcelo Tosatti, Gleb Natapov, Willy Tarreau

From: "H. Peter Anvin" <hpa@linux.intel.com>

commit afcbf13fa6d53d8a97eafaca1dcb344331d2ce0c upstream.

Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE to match the SDM.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Link: http://lkml.kernel.org/n/tip-buq1evi5dpykxx7ak6amaam0@git.kernel.org
[wt: backported to 3.10 only to keep next patch clean]

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/x86/include/asm/kvm_host.h             | 2 +-
 arch/x86/include/uapi/asm/processor-flags.h | 2 +-
 arch/x86/kvm/x86.c                          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 98b68c2..b76c1bf 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -59,7 +59,7 @@
 	(~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\
 			  | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE     \
 			  | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \
-			  | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_RDWRGSFS \
+			  | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \
 			  | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE))
 
 #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h
index b16e6d2..1b34df5 100644
--- a/arch/x86/include/uapi/asm/processor-flags.h
+++ b/arch/x86/include/uapi/asm/processor-flags.h
@@ -61,7 +61,7 @@
 #define X86_CR4_OSFXSR	0x00000200 /* enable fast FPU save and restore */
 #define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */
 #define X86_CR4_VMXE	0x00002000 /* enable VMX virtualization */
-#define X86_CR4_RDWRGSFS 0x00010000 /* enable RDWRGSFS support */
+#define X86_CR4_FSGSBASE 0x00010000 /* enable RDWRGSFS support */
 #define X86_CR4_PCIDE	0x00020000 /* enable PCID support */
 #define X86_CR4_OSXSAVE 0x00040000 /* enable xsave and xrestore */
 #define X86_CR4_SMEP	0x00100000 /* enable SMEP support */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7f2b6de..3c0b085 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -626,7 +626,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 	if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP))
 		return 1;
 
-	if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_RDWRGSFS))
+	if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_FSGSBASE))
 		return 1;
 
 	if (is_long_mode(vcpu)) {
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 012/143] x86, processor-flags: Fix the datatypes and add bit number defines
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (10 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 011/143] x86: Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 013/143] x86/iopl: Fix iopl capability check on Xen PV Willy Tarreau
                   ` (131 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: H. Peter Anvin, Willy Tarreau

From: "H. Peter Anvin" <hpa@linux.intel.com>

commit d1fbefcb3aa608599a3c9e4582cbeeb6ba6c8939 upstream.

The control registers are unsigned long (32 bits on i386, 64 bits on
x86-64), and so make that manifest in the data type for the various
constants.  Add defines with a _BIT suffix which defines the bit
number, as opposed to the bit mask.

This should resolve some issues with ~bitmask that Linus discovered.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/n/tip-cwckhbrib2aux1qbteaebij0@git.kernel.org
[wt: backported to 3.10 only to keep next patch clean]

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/x86/include/uapi/asm/processor-flags.h | 154 +++++++++++++++++++---------
 1 file changed, 104 insertions(+), 50 deletions(-)

diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h
index 1b34df5..180a0c3 100644
--- a/arch/x86/include/uapi/asm/processor-flags.h
+++ b/arch/x86/include/uapi/asm/processor-flags.h
@@ -2,75 +2,129 @@
 #define _UAPI_ASM_X86_PROCESSOR_FLAGS_H
 /* Various flags defined: can be included from assembler. */
 
+#include <linux/const.h>
+
 /*
  * EFLAGS bits
  */
-#define X86_EFLAGS_CF	0x00000001 /* Carry Flag */
-#define X86_EFLAGS_FIXED 0x00000002 /* Bit 1 - always on */
-#define X86_EFLAGS_PF	0x00000004 /* Parity Flag */
-#define X86_EFLAGS_AF	0x00000010 /* Auxiliary carry Flag */
-#define X86_EFLAGS_ZF	0x00000040 /* Zero Flag */
-#define X86_EFLAGS_SF	0x00000080 /* Sign Flag */
-#define X86_EFLAGS_TF	0x00000100 /* Trap Flag */
-#define X86_EFLAGS_IF	0x00000200 /* Interrupt Flag */
-#define X86_EFLAGS_DF	0x00000400 /* Direction Flag */
-#define X86_EFLAGS_OF	0x00000800 /* Overflow Flag */
-#define X86_EFLAGS_IOPL	0x00003000 /* IOPL mask */
-#define X86_EFLAGS_NT	0x00004000 /* Nested Task */
-#define X86_EFLAGS_RF	0x00010000 /* Resume Flag */
-#define X86_EFLAGS_VM	0x00020000 /* Virtual Mode */
-#define X86_EFLAGS_AC	0x00040000 /* Alignment Check */
-#define X86_EFLAGS_VIF	0x00080000 /* Virtual Interrupt Flag */
-#define X86_EFLAGS_VIP	0x00100000 /* Virtual Interrupt Pending */
-#define X86_EFLAGS_ID	0x00200000 /* CPUID detection flag */
+#define X86_EFLAGS_CF_BIT	0 /* Carry Flag */
+#define X86_EFLAGS_CF		_BITUL(X86_EFLAGS_CF_BIT)
+#define X86_EFLAGS_FIXED_BIT	1 /* Bit 1 - always on */
+#define X86_EFLAGS_FIXED	_BITUL(X86_EFLAGS_FIXED_BIT)
+#define X86_EFLAGS_PF_BIT	2 /* Parity Flag */
+#define X86_EFLAGS_PF		_BITUL(X86_EFLAGS_PF_BIT)
+#define X86_EFLAGS_AF_BIT	4 /* Auxiliary carry Flag */
+#define X86_EFLAGS_AF		_BITUL(X86_EFLAGS_AF_BIT)
+#define X86_EFLAGS_ZF_BIT	6 /* Zero Flag */
+#define X86_EFLAGS_ZF		_BITUL(X86_EFLAGS_ZF_BIT)
+#define X86_EFLAGS_SF_BIT	7 /* Sign Flag */
+#define X86_EFLAGS_SF		_BITUL(X86_EFLAGS_SF_BIT)
+#define X86_EFLAGS_TF_BIT	8 /* Trap Flag */
+#define X86_EFLAGS_TF		_BITUL(X86_EFLAGS_TF_BIT)
+#define X86_EFLAGS_IF_BIT	9 /* Interrupt Flag */
+#define X86_EFLAGS_IF		_BITUL(X86_EFLAGS_IF_BIT)
+#define X86_EFLAGS_DF_BIT	10 /* Direction Flag */
+#define X86_EFLAGS_DF		_BITUL(X86_EFLAGS_DF_BIT)
+#define X86_EFLAGS_OF_BIT	11 /* Overflow Flag */
+#define X86_EFLAGS_OF		_BITUL(X86_EFLAGS_OF_BIT)
+#define X86_EFLAGS_IOPL_BIT	12 /* I/O Privilege Level (2 bits) */
+#define X86_EFLAGS_IOPL		(_AC(3,UL) << X86_EFLAGS_IOPL_BIT)
+#define X86_EFLAGS_NT_BIT	14 /* Nested Task */
+#define X86_EFLAGS_NT		_BITUL(X86_EFLAGS_NT_BIT)
+#define X86_EFLAGS_RF_BIT	16 /* Resume Flag */
+#define X86_EFLAGS_RF		_BITUL(X86_EFLAGS_RF_BIT)
+#define X86_EFLAGS_VM_BIT	17 /* Virtual Mode */
+#define X86_EFLAGS_VM		_BITUL(X86_EFLAGS_VM_BIT)
+#define X86_EFLAGS_AC_BIT	18 /* Alignment Check/Access Control */
+#define X86_EFLAGS_AC		_BITUL(X86_EFLAGS_AC_BIT)
+#define X86_EFLAGS_AC_BIT	18 /* Alignment Check/Access Control */
+#define X86_EFLAGS_AC		_BITUL(X86_EFLAGS_AC_BIT)
+#define X86_EFLAGS_VIF_BIT	19 /* Virtual Interrupt Flag */
+#define X86_EFLAGS_VIF		_BITUL(X86_EFLAGS_VIF_BIT)
+#define X86_EFLAGS_VIP_BIT	20 /* Virtual Interrupt Pending */
+#define X86_EFLAGS_VIP		_BITUL(X86_EFLAGS_VIP_BIT)
+#define X86_EFLAGS_ID_BIT	21 /* CPUID detection */
+#define X86_EFLAGS_ID		_BITUL(X86_EFLAGS_ID_BIT)
 
 /*
  * Basic CPU control in CR0
  */
-#define X86_CR0_PE	0x00000001 /* Protection Enable */
-#define X86_CR0_MP	0x00000002 /* Monitor Coprocessor */
-#define X86_CR0_EM	0x00000004 /* Emulation */
-#define X86_CR0_TS	0x00000008 /* Task Switched */
-#define X86_CR0_ET	0x00000010 /* Extension Type */
-#define X86_CR0_NE	0x00000020 /* Numeric Error */
-#define X86_CR0_WP	0x00010000 /* Write Protect */
-#define X86_CR0_AM	0x00040000 /* Alignment Mask */
-#define X86_CR0_NW	0x20000000 /* Not Write-through */
-#define X86_CR0_CD	0x40000000 /* Cache Disable */
-#define X86_CR0_PG	0x80000000 /* Paging */
+#define X86_CR0_PE_BIT		0 /* Protection Enable */
+#define X86_CR0_PE		_BITUL(X86_CR0_PE_BIT)
+#define X86_CR0_MP_BIT		1 /* Monitor Coprocessor */
+#define X86_CR0_MP		_BITUL(X86_CR0_MP_BIT)
+#define X86_CR0_EM_BIT		2 /* Emulation */
+#define X86_CR0_EM		_BITUL(X86_CR0_EM_BIT)
+#define X86_CR0_TS_BIT		3 /* Task Switched */
+#define X86_CR0_TS		_BITUL(X86_CR0_TS_BIT)
+#define X86_CR0_ET_BIT		4 /* Extension Type */
+#define X86_CR0_ET		_BITUL(X86_CR0_ET_BIT)
+#define X86_CR0_NE_BIT		5 /* Numeric Error */
+#define X86_CR0_NE		_BITUL(X86_CR0_NE_BIT)
+#define X86_CR0_WP_BIT		16 /* Write Protect */
+#define X86_CR0_WP		_BITUL(X86_CR0_WP_BIT)
+#define X86_CR0_AM_BIT		18 /* Alignment Mask */
+#define X86_CR0_AM		_BITUL(X86_CR0_AM_BIT)
+#define X86_CR0_NW_BIT		29 /* Not Write-through */
+#define X86_CR0_NW		_BITUL(X86_CR0_NW_BIT)
+#define X86_CR0_CD_BIT		30 /* Cache Disable */
+#define X86_CR0_CD		_BITUL(X86_CR0_CD_BIT)
+#define X86_CR0_PG_BIT		31 /* Paging */
+#define X86_CR0_PG		_BITUL(X86_CR0_PG_BIT)
 
 /*
  * Paging options in CR3
  */
-#define X86_CR3_PWT	0x00000008 /* Page Write Through */
-#define X86_CR3_PCD	0x00000010 /* Page Cache Disable */
-#define X86_CR3_PCID_MASK 0x00000fff /* PCID Mask */
+#define X86_CR3_PWT_BIT		3 /* Page Write Through */
+#define X86_CR3_PWT		_BITUL(X86_CR3_PWT_BIT)
+#define X86_CR3_PCD_BIT		4 /* Page Cache Disable */
+#define X86_CR3_PCD		_BITUL(X86_CR3_PCD_BIT)
+#define X86_CR3_PCID_MASK	_AC(0x00000fff,UL) /* PCID Mask */
 
 /*
  * Intel CPU features in CR4
  */
-#define X86_CR4_VME	0x00000001 /* enable vm86 extensions */
-#define X86_CR4_PVI	0x00000002 /* virtual interrupts flag enable */
-#define X86_CR4_TSD	0x00000004 /* disable time stamp at ipl 3 */
-#define X86_CR4_DE	0x00000008 /* enable debugging extensions */
-#define X86_CR4_PSE	0x00000010 /* enable page size extensions */
-#define X86_CR4_PAE	0x00000020 /* enable physical address extensions */
-#define X86_CR4_MCE	0x00000040 /* Machine check enable */
-#define X86_CR4_PGE	0x00000080 /* enable global pages */
-#define X86_CR4_PCE	0x00000100 /* enable performance counters at ipl 3 */
-#define X86_CR4_OSFXSR	0x00000200 /* enable fast FPU save and restore */
-#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */
-#define X86_CR4_VMXE	0x00002000 /* enable VMX virtualization */
-#define X86_CR4_FSGSBASE 0x00010000 /* enable RDWRGSFS support */
-#define X86_CR4_PCIDE	0x00020000 /* enable PCID support */
-#define X86_CR4_OSXSAVE 0x00040000 /* enable xsave and xrestore */
-#define X86_CR4_SMEP	0x00100000 /* enable SMEP support */
-#define X86_CR4_SMAP	0x00200000 /* enable SMAP support */
+#define X86_CR4_VME_BIT		0 /* enable vm86 extensions */
+#define X86_CR4_VME		_BITUL(X86_CR4_VME_BIT)
+#define X86_CR4_PVI_BIT		1 /* virtual interrupts flag enable */
+#define X86_CR4_PVI		_BITUL(X86_CR4_PVI_BIT)
+#define X86_CR4_TSD_BIT		2 /* disable time stamp at ipl 3 */
+#define X86_CR4_TSD		_BITUL(X86_CR4_TSD_BIT)
+#define X86_CR4_DE_BIT		3 /* enable debugging extensions */
+#define X86_CR4_DE		_BITUL(X86_CR4_DE_BIT)
+#define X86_CR4_PSE_BIT		4 /* enable page size extensions */
+#define X86_CR4_PSE		_BITUL(X86_CR4_PSE_BIT)
+#define X86_CR4_PAE_BIT		5 /* enable physical address extensions */
+#define X86_CR4_PAE		_BITUL(X86_CR4_PAE_BIT)
+#define X86_CR4_MCE_BIT		6 /* Machine check enable */
+#define X86_CR4_MCE		_BITUL(X86_CR4_MCE_BIT)
+#define X86_CR4_PGE_BIT		7 /* enable global pages */
+#define X86_CR4_PGE		_BITUL(X86_CR4_PGE_BIT)
+#define X86_CR4_PCE_BIT		8 /* enable performance counters at ipl 3 */
+#define X86_CR4_PCE		_BITUL(X86_CR4_PCE_BIT)
+#define X86_CR4_OSFXSR_BIT	9 /* enable fast FPU save and restore */
+#define X86_CR4_OSFXSR		_BITUL(X86_CR4_OSFXSR_BIT)
+#define X86_CR4_OSXMMEXCPT_BIT	10 /* enable unmasked SSE exceptions */
+#define X86_CR4_OSXMMEXCPT	_BITUL(X86_CR4_OSXMMEXCPT_BIT)
+#define X86_CR4_VMXE_BIT	13 /* enable VMX virtualization */
+#define X86_CR4_VMXE		_BITUL(X86_CR4_VMXE_BIT)
+#define X86_CR4_SMXE_BIT	14 /* enable safer mode (TXT) */
+#define X86_CR4_SMXE		_BITUL(X86_CR4_SMXE_BIT)
+#define X86_CR4_FSGSBASE_BIT	16 /* enable RDWRFSGS support */
+#define X86_CR4_FSGSBASE	_BITUL(X86_CR4_FSGSBASE_BIT)
+#define X86_CR4_PCIDE_BIT	17 /* enable PCID support */
+#define X86_CR4_PCIDE		_BITUL(X86_CR4_PCIDE_BIT)
+#define X86_CR4_OSXSAVE_BIT	18 /* enable xsave and xrestore */
+#define X86_CR4_OSXSAVE		_BITUL(X86_CR4_OSXSAVE_BIT)
+#define X86_CR4_SMEP_BIT	20 /* enable SMEP support */
+#define X86_CR4_SMEP		_BITUL(X86_CR4_SMEP_BIT)
+#define X86_CR4_SMAP_BIT	21 /* enable SMAP support */
+#define X86_CR4_SMAP		_BITUL(X86_CR4_SMAP_BIT)
 
 /*
  * x86-64 Task Priority Register, CR8
  */
-#define X86_CR8_TPR	0x0000000F /* task priority register */
+#define X86_CR8_TPR		_AC(0x0000000f,UL) /* task priority register */
 
 /*
  * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h>
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 013/143] x86/iopl: Fix iopl capability check on Xen PV
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (11 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 012/143] x86, processor-flags: Fix the datatypes and add bit number defines Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 014/143] sg: fix dxferp in from_to case Willy Tarreau
                   ` (130 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Andy Lutomirski, Andrew Cooper, Andy Lutomirski, Boris Ostrovsky,
	Borislav Petkov, Brian Gerst, David Vrabel, Denys Vlasenko,
	H . Peter Anvin, Jan Beulich, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Willy Tarreau

From: Andy Lutomirski <luto@kernel.org>

commit c29016cf41fe9fa994a5ecca607cf5f1cd98801e upstream.

iopl(3) is supposed to work if iopl is already 3, even if
unprivileged.  This didn't work right on Xen PV.  Fix it.

Reviewewd-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/8ce12013e6e4c0a44a97e316be4a6faff31bd5ea.1458162709.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/x86/kernel/ioport.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 4ddaf66..792621a 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -96,9 +96,14 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 SYSCALL_DEFINE1(iopl, unsigned int, level)
 {
 	struct pt_regs *regs = current_pt_regs();
-	unsigned int old = (regs->flags >> 12) & 3;
 	struct thread_struct *t = &current->thread;
 
+	/*
+	 * Careful: the IOPL bits in regs->flags are undefined under Xen PV
+	 * and changing them has no effect.
+	 */
+	unsigned int old = t->iopl >> X86_EFLAGS_IOPL_BIT;
+
 	if (level > 3)
 		return -EINVAL;
 	/* Trying to gain more privileges? */
@@ -106,8 +111,9 @@ SYSCALL_DEFINE1(iopl, unsigned int, level)
 		if (!capable(CAP_SYS_RAWIO))
 			return -EPERM;
 	}
-	regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
-	t->iopl = level << 12;
+	regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) |
+		(level << X86_EFLAGS_IOPL_BIT);
+	t->iopl = level << X86_EFLAGS_IOPL_BIT;
 	set_iopl_mask(t->iopl);
 
 	return 0;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 014/143] sg: fix dxferp in from_to case
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (12 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 013/143] x86/iopl: Fix iopl capability check on Xen PV Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 015/143] aacraid: Fix memory leak in aac_fib_map_free Willy Tarreau
                   ` (129 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Douglas Gilbert, stable, Martin K . Petersen, Willy Tarreau

From: Douglas Gilbert <dgilbert@interlog.com>

commit 5ecee0a3ee8d74b6950cb41e8989b0c2174568d4 upstream.

One of the strange things that the original sg driver did was let the
user provide both a data-out buffer (it followed the sg_header+cdb)
_and_ specify a reply length greater than zero. What happened was that
the user data-out buffer was copied into some kernel buffers and then
the mid level was told a read type operation would take place with the
data from the device overwriting the same kernel buffers. The user would
then read those kernel buffers back into the user space.

>From what I can tell, the above action was broken by commit fad7f01e61bf
("sg: set dxferp to NULL for READ with the older SG interface") in 2008
and syzkaller found that out recently.

Make sure that a user space pointer is passed through when data follows
the sg_header structure and command.  Fix the abnormal case when a
non-zero reply_len is also given.

Fixes: fad7f01e61bf737fe8a3740d803f000db57ecac6
Cc: <stable@vger.kernel.org> #v2.6.28+
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/scsi/sg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 0be16bf..1f65e32 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -633,7 +633,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 	else
 		hp->dxfer_direction = (mxsize > 0) ? SG_DXFER_FROM_DEV : SG_DXFER_NONE;
 	hp->dxfer_len = mxsize;
-	if (hp->dxfer_direction == SG_DXFER_TO_DEV)
+	if ((hp->dxfer_direction == SG_DXFER_TO_DEV) ||
+	    (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV))
 		hp->dxferp = (char __user *)buf + cmd_size;
 	else
 		hp->dxferp = NULL;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 015/143] aacraid: Fix memory leak in aac_fib_map_free
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (13 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 014/143] sg: fix dxferp in from_to case Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 016/143] be2iscsi: set the boot_kset pointer to NULL in case of failure Willy Tarreau
                   ` (128 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Raghava Aditya Renukunta, Martin K . Petersen, Willy Tarreau

From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>

commit f88fa79a61726ce9434df9b4aede36961f709f17 upstream.

aac_fib_map_free() calls pci_free_consistent() without checking that
dev->hw_fib_va is not NULL and dev->max_fib_size is not zero.If they are
indeed NULL/0, this will result in a hang as pci_free_consistent() will
attempt to invalidate cache for the entire 64-bit address space
(which would take a very long time).

Fixed by adding a check to make sure that dev->hw_fib_va and
dev->max_fib_size are not NULL and 0 respectively.

Fixes: 9ad5204d6 - "[SCSI]aacraid: incorrect dma mapping mask during blinked recover or user initiated reset"
Cc: stable@vger.kernel.org

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/scsi/aacraid/commsup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 1be0776..6a0d362 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_dev *dev)
 
 void aac_fib_map_free(struct aac_dev *dev)
 {
-	pci_free_consistent(dev->pdev,
-	  dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB),
-	  dev->hw_fib_va, dev->hw_fib_pa);
+	if (dev->hw_fib_va && dev->max_fib_size) {
+		pci_free_consistent(dev->pdev,
+		(dev->max_fib_size *
+		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)),
+		dev->hw_fib_va, dev->hw_fib_pa);
+	}
 	dev->hw_fib_va = NULL;
 	dev->hw_fib_pa = 0;
 }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 016/143] be2iscsi: set the boot_kset pointer to NULL in case of failure
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (14 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 015/143] aacraid: Fix memory leak in aac_fib_map_free Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 017/143] usb: retry reset if a device times out Willy Tarreau
                   ` (127 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Maurizio Lombardi, Martin K . Petersen, Willy Tarreau

From: Maurizio Lombardi <mlombard@redhat.com>

commit 84bd64993f916bcf86270c67686ecf4cea7b8933 upstream.

In beiscsi_setup_boot_info(), the boot_kset pointer should be set to
NULL in case of failure otherwise an invalid pointer dereference may
occur later.

Cc: <stable@vger.kernel.org>
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/scsi/be2iscsi/be_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index bfe812f..a683a83 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4040,6 +4040,7 @@ put_shost:
 	scsi_host_put(phba->shost);
 free_kset:
 	iscsi_boot_destroy_kset(phba->boot_kset);
+	phba->boot_kset = NULL;
 	return -ENOMEM;
 }
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 017/143] usb: retry reset if a device times out
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (15 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 016/143] be2iscsi: set the boot_kset pointer to NULL in case of failure Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 018/143] USB: cdc-acm: more sanity checking Willy Tarreau
                   ` (126 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Oliver Neukum, Greg Kroah-Hartman, Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit 264904ccc33c604d4b3141bbd33808152dfac45b upstream.

Some devices I got show an inability to operate right after
power on if they are already connected. They are beyond recovery
if the descriptors are requested multiple times. So in case of
a timeout we rather bail early and reset again. But it must be
done only on the first loop lest we get into a reset/time out
spiral that can be overcome with a retry.

This patch is a rework of a patch that fell through the cracks.
http://www.spinics.net/lists/linux-usb/msg103263.html

Signed-off-by: Oliver Neukum <oneukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/core/hub.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 92873f2..8eb2de6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4167,7 +4167,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 						r = -EPROTO;
 					break;
 				}
-				if (r == 0)
+				/*
+				 * Some devices time out if they are powered on
+				 * when already connected. They need a second
+				 * reset. But only on the first attempt,
+				 * lest we get into a time out/reset loop
+				 */
+				if (r == 0  || (r == -ETIMEDOUT && j == 0))
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 018/143] USB: cdc-acm: more sanity checking
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (16 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 017/143] usb: retry reset if a device times out Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 019/143] USB: iowarrior: fix oops with malicious USB descriptors Willy Tarreau
                   ` (125 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, Greg Kroah-Hartman, Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit 8835ba4a39cf53f705417b3b3a94eb067673f2c9 upstream.

An attack has become available which pretends to be a quirky
device circumventing normal sanity checks and crashes the kernel
by an insufficient number of interfaces. This patch adds a check
to the code path for quirky devices.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/class/cdc-acm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d6dab8a..e7436eb 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -997,6 +997,9 @@ static int acm_probe(struct usb_interface *intf,
 	if (quirks == NO_UNION_NORMAL) {
 		data_interface = usb_ifnum_to_if(usb_dev, 1);
 		control_interface = usb_ifnum_to_if(usb_dev, 0);
+		/* we would crash */
+		if (!data_interface || !control_interface)
+			return -ENODEV;
 		goto skip_normal_probe;
 	}
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 019/143] USB: iowarrior: fix oops with malicious USB descriptors
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (17 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 018/143] USB: cdc-acm: more sanity checking Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 020/143] USB: usb_driver_claim_interface: add sanity checking Willy Tarreau
                   ` (124 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Josh Boyer, Greg Kroah-Hartman, Willy Tarreau

From: Josh Boyer <jwboyer@fedoraproject.org>

commit 4ec0ef3a82125efc36173062a50624550a900ae0 upstream.

The iowarrior driver expects at least one valid endpoint.  If given
malicious descriptors that specify 0 for the number of endpoints,
it will crash in the probe function.  Ensure there is at least
one endpoint on the interface before using it.

The full report of this issue can be found here:
http://seclists.org/bugtraq/2016/Mar/87

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/misc/iowarrior.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index d36f34e..4c24ba0 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -792,6 +792,12 @@ static int iowarrior_probe(struct usb_interface *interface,
 	iface_desc = interface->cur_altsetting;
 	dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
 
+	if (iface_desc->desc.bNumEndpoints < 1) {
+		dev_err(&interface->dev, "Invalid number of endpoints\n");
+		retval = -EINVAL;
+		goto error;
+	}
+
 	/* set up the endpoint information */
 	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
 		endpoint = &iface_desc->endpoint[i].desc;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 020/143] USB: usb_driver_claim_interface: add sanity checking
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (18 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 019/143] USB: iowarrior: fix oops with malicious USB descriptors Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 021/143] USB: mct_u232: add sanity checking in probe Willy Tarreau
                   ` (123 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, Greg Kroah-Hartman, Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit 0b818e3956fc1ad976bee791eadcbb3b5fec5bfd upstream.

Attacks that trick drivers into passing a NULL pointer
to usb_driver_claim_interface() using forged descriptors are
known. This thwarts them by sanity checking.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/core/driver.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2cdd507..f7310dd 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -461,11 +461,15 @@ static int usb_unbind_interface(struct device *dev)
 int usb_driver_claim_interface(struct usb_driver *driver,
 				struct usb_interface *iface, void *priv)
 {
-	struct device *dev = &iface->dev;
+	struct device *dev;
 	struct usb_device *udev;
 	int retval = 0;
 	int lpm_disable_error;
 
+	if (!iface)
+		return -ENODEV;
+
+	dev = &iface->dev;
 	if (dev->driver)
 		return -EBUSY;
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 021/143] USB: mct_u232: add sanity checking in probe
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (19 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 020/143] USB: usb_driver_claim_interface: add sanity checking Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 022/143] USB: digi_acceleport: do sanity checking for the number of ports Willy Tarreau
                   ` (122 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, Johan Hovold, Greg Kroah-Hartman,
	Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit 4e9a0b05257f29cf4b75f3209243ed71614d062e upstream.

An attack using the lack of sanity checking in probe is known. This
patch checks for the existence of a second port.

CVE-2016-3136

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
[johan: add error message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/mct_u232.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 6a15adf..c14c29f 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -377,14 +377,21 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port,
 
 static int mct_u232_port_probe(struct usb_serial_port *port)
 {
+	struct usb_serial *serial = port->serial;
 	struct mct_u232_private *priv;
 
+	/* check first to simplify error handling */
+	if (!serial->port[1] || !serial->port[1]->interrupt_in_urb) {
+		dev_err(&port->dev, "expected endpoint missing\n");
+		return -ENODEV;
+	}
+
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
 	/* Use second interrupt-in endpoint for reading. */
-	priv->read_urb = port->serial->port[1]->interrupt_in_urb;
+	priv->read_urb = serial->port[1]->interrupt_in_urb;
 	priv->read_urb->context = port;
 
 	spin_lock_init(&priv->lock);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 022/143] USB: digi_acceleport: do sanity checking for the number of ports
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (20 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 021/143] USB: mct_u232: add sanity checking in probe Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 023/143] USB: cypress_m8: add endpoint sanity check Willy Tarreau
                   ` (121 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, Johan Hovold, Greg Kroah-Hartman,
	Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit 5a07975ad0a36708c6b0a5b9fea1ff811d0b0c1f upstream.

The driver can be crashed with devices that expose crafted descriptors
with too few endpoints.

See: http://seclists.org/bugtraq/2016/Mar/61

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
[johan: fix OOB endpoint check and add error messages ]
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/digi_acceleport.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 7b807d3..8c34d9c 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1253,8 +1253,27 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num)
 
 static int digi_startup(struct usb_serial *serial)
 {
+	struct device *dev = &serial->interface->dev;
 	struct digi_serial *serial_priv;
 	int ret;
+	int i;
+
+	/* check whether the device has the expected number of endpoints */
+	if (serial->num_port_pointers < serial->type->num_ports + 1) {
+		dev_err(dev, "OOB endpoints missing\n");
+		return -ENODEV;
+	}
+
+	for (i = 0; i < serial->type->num_ports + 1 ; i++) {
+		if (!serial->port[i]->read_urb) {
+			dev_err(dev, "bulk-in endpoint missing\n");
+			return -ENODEV;
+		}
+		if (!serial->port[i]->write_urb) {
+			dev_err(dev, "bulk-out endpoint missing\n");
+			return -ENODEV;
+		}
+	}
 
 	serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
 	if (!serial_priv)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 023/143] USB: cypress_m8: add endpoint sanity check
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (21 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 022/143] USB: digi_acceleport: do sanity checking for the number of ports Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 024/143] USB: serial: cp210x: Adding GE Healthcare Device ID Willy Tarreau
                   ` (120 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, Johan Hovold, Greg Kroah-Hartman,
	Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit c55aee1bf0e6b6feec8b2927b43f7a09a6d5f754 upstream.

An attack using missing endpoints exists.

CVE-2016-3137

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/cypress_m8.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 0821201..09f0f63 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -449,6 +449,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port)
 	struct usb_serial *serial = port->serial;
 	struct cypress_private *priv;
 
+	if (!port->interrupt_out_urb || !port->interrupt_in_urb) {
+		dev_err(&port->dev, "required endpoint is missing\n");
+		return -ENODEV;
+	}
+
 	priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
@@ -606,12 +611,6 @@ static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)
 		cypress_set_termios(tty, port, &priv->tmp_termios);
 
 	/* setup the port and start reading from the device */
-	if (!port->interrupt_in_urb) {
-		dev_err(&port->dev, "%s - interrupt_in_urb is empty!\n",
-			__func__);
-		return -1;
-	}
-
 	usb_fill_int_urb(port->interrupt_in_urb, serial->dev,
 		usb_rcvintpipe(serial->dev, port->interrupt_in_endpointAddress),
 		port->interrupt_in_urb->transfer_buffer,
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 024/143] USB: serial: cp210x: Adding GE Healthcare Device ID
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (22 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 023/143] USB: cypress_m8: add endpoint sanity check Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 025/143] USB: option: add "D-Link DWM-221 B1" device id Willy Tarreau
                   ` (119 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Martyn Welch, Johan Hovold, Willy Tarreau

From: Martyn Welch <martyn.welch@collabora.co.uk>

commit cddc9434e3dcc37a85c4412fb8e277d3a582e456 upstream.

The CP2105 is used in the GE Healthcare Remote Alarm Box, with the
Manufacturer ID of 0x1901 and Product ID of 0x0194.

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 84b7704..a4003d4 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -164,6 +164,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */
 	{ USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */
 	{ USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */
+	{ USB_DEVICE(0x1901, 0x0194) },	/* GE Healthcare Remote Alarm Box */
 	{ USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */
 	{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
 	{ USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 025/143] USB: option: add "D-Link DWM-221 B1" device id
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (23 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 024/143] USB: serial: cp210x: Adding GE Healthcare Device ID Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 026/143] pwc: Add USB id for Philips Spc880nc webcam Willy Tarreau
                   ` (118 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Bjørn Mork, Johan Hovold, Willy Tarreau

From: Bjørn Mork <bjorn@mork.no>

commit d48d5691ebf88a15d95ba96486917ffc79256536 upstream.

Thomas reports:
"Windows:

00 diagnostics
01 modem
02 at-port
03 nmea
04 nic

Linux:

T:  Bus=02 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=2001 ProdID=7e19 Rev=02.32
S:  Manufacturer=Mobile Connect
S:  Product=Mobile Connect
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage"

Reported-by: Thomas Schäfer <tschaefer@t-online.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 24366a2..99c89d7 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1818,6 +1818,8 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
+	{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff),			/* D-Link DWM-221 B1 */
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
 	{ USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) },                /* OLICARD300 - MT6225 */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 026/143] pwc: Add USB id for Philips Spc880nc webcam
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (24 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 025/143] USB: option: add "D-Link DWM-221 B1" device id Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 027/143] Input: powermate - fix oops with malicious USB descriptors Willy Tarreau
                   ` (117 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Hans de Goede, Mauro Carvalho Chehab, Willy Tarreau

From: Hans de Goede <hdegoede@redhat.com>

commit 7445e45d19a09e5269dc85f17f9635be29d2f76c upstream.

SPC 880NC PC camera discussions:
	http://www.pclinuxos.com/forum/index.php/topic,135688.0.html

Cc: stable@vger.kernel.org
Reported-by: Kikim <klucznik0@op.pl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/media/usb/pwc/pwc-if.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
index 77bbf78..db1e8ee 100644
--- a/drivers/media/usb/pwc/pwc-if.c
+++ b/drivers/media/usb/pwc/pwc-if.c
@@ -91,6 +91,7 @@ static const struct usb_device_id pwc_device_table [] = {
 	{ USB_DEVICE(0x0471, 0x0312) },
 	{ USB_DEVICE(0x0471, 0x0313) }, /* the 'new' 720K */
 	{ USB_DEVICE(0x0471, 0x0329) }, /* Philips SPC 900NC PC Camera */
+	{ USB_DEVICE(0x0471, 0x032C) }, /* Philips SPC 880NC PC Camera */
 	{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */
 	{ USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam Pro 3000 */
 	{ USB_DEVICE(0x046D, 0x08B1) }, /* Logitech QuickCam Notebook Pro */
@@ -799,6 +800,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
 			name = "Philips SPC 900NC webcam";
 			type_id = 740;
 			break;
+		case 0x032C:
+			PWC_INFO("Philips SPC 880NC USB webcam detected.\n");
+			name = "Philips SPC 880NC webcam";
+			type_id = 740;
+			break;
 		default:
 			return -ENODEV;
 			break;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 027/143] Input: powermate - fix oops with malicious USB descriptors
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (25 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 026/143] pwc: Add USB id for Philips Spc880nc webcam Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 028/143] net: irda: Fix use-after-free in irtty_open() Willy Tarreau
                   ` (116 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Josh Boyer, Dmitry Torokhov, Willy Tarreau

From: Josh Boyer <jwboyer@fedoraproject.org>

commit 9c6ba456711687b794dcf285856fc14e2c76074f upstream.

The powermate driver expects at least one valid USB endpoint in its
probe function.  If given malicious descriptors that specify 0 for
the number of endpoints, it will crash.  Validate the number of
endpoints on the interface before using them.

The full report for this issue can be found here:
http://seclists.org/bugtraq/2016/Mar/85

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/input/misc/powermate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 49c0c3e..21ce1cf 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -308,6 +308,9 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
 	int error = -ENOMEM;
 
 	interface = intf->cur_altsetting;
+	if (interface->desc.bNumEndpoints < 1)
+		return -EINVAL;
+
 	endpoint = &interface->endpoint[0].desc;
 	if (!usb_endpoint_is_int_in(endpoint))
 		return -EIO;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 028/143] net: irda: Fix use-after-free in irtty_open()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (26 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 027/143] Input: powermate - fix oops with malicious USB descriptors Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 029/143] 8250: use callbacks to access UART_DLL/UART_DLM Willy Tarreau
                   ` (115 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Peter Hurley, Greg Kroah-Hartman, Willy Tarreau

From: Peter Hurley <peter@hurleysoftware.com>

commit 401879c57f01cbf2da204ad2e8db910525c6dbea upstream.

The N_IRDA line discipline may access the previous line discipline's closed
and already-fre private data on open [1].

The tty->disc_data field _never_ refers to valid data on entry to the
line discipline's open() method. Rather, the ldisc is expected to
initialize that field for its own use for the lifetime of the instance
(ie. from open() to close() only).

[1]
    ==================================================================
    BUG: KASAN: use-after-free in irtty_open+0x422/0x550 at addr ffff8800331dd068
    Read of size 4 by task a.out/13960
    =============================================================================
    BUG kmalloc-512 (Tainted: G    B          ): kasan: bad access detected
    -----------------------------------------------------------------------------
    ...
    Call Trace:
     [<ffffffff815fa2ae>] __asan_report_load4_noabort+0x3e/0x40 mm/kasan/report.c:279
     [<ffffffff836938a2>] irtty_open+0x422/0x550 drivers/net/irda/irtty-sir.c:436
     [<ffffffff829f1b80>] tty_ldisc_open.isra.2+0x60/0xa0 drivers/tty/tty_ldisc.c:447
     [<ffffffff829f21c0>] tty_set_ldisc+0x1a0/0x940 drivers/tty/tty_ldisc.c:567
     [<     inline     >] tiocsetd drivers/tty/tty_io.c:2650
     [<ffffffff829da49e>] tty_ioctl+0xace/0x1fd0 drivers/tty/tty_io.c:2883
     [<     inline     >] vfs_ioctl fs/ioctl.c:43
     [<ffffffff816708ac>] do_vfs_ioctl+0x57c/0xe60 fs/ioctl.c:607
     [<     inline     >] SYSC_ioctl fs/ioctl.c:622
     [<ffffffff81671204>] SyS_ioctl+0x74/0x80 fs/ioctl.c:613
     [<ffffffff852a7876>] entry_SYSCALL_64_fastpath+0x16/0x7a

Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/irda/irtty-sir.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index a412671..0d71fa9f 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -430,16 +430,6 @@ static int irtty_open(struct tty_struct *tty)
 
 	/* Module stuff handled via irda_ldisc.owner - Jean II */
 
-	/* First make sure we're not already connected. */
-	if (tty->disc_data != NULL) {
-		priv = tty->disc_data;
-		if (priv && priv->magic == IRTTY_MAGIC) {
-			ret = -EEXIST;
-			goto out;
-		}
-		tty->disc_data = NULL;		/* ### */
-	}
-
 	/* stop the underlying  driver */
 	irtty_stop_receiver(tty, TRUE);
 	if (tty->ops->stop)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 029/143] 8250: use callbacks to access UART_DLL/UART_DLM
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (27 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 028/143] net: irda: Fix use-after-free in irtty_open() Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 030/143] bttv: Width must be a multiple of 16 when capturing planar formats Willy Tarreau
                   ` (114 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Sebastian Frias, Greg Kroah-Hartman, Willy Tarreau

From: Sebastian Frias <sf84@laposte.net>

commit 0b41ce991052022c030fd868e03877700220b090 upstream.

Some UART HW has a single register combining UART_DLL/UART_DLM
(this was probably forgotten in the change that introduced the
callbacks, commit b32b19b8ffc05cbd3bf91c65e205f6a912ca15d9)

Fixes: b32b19b8ffc0 ("[SERIAL] 8250: set divisor register correctly ...")

Signed-off-by: Sebastian Frias <sf84@laposte.net>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/tty/serial/8250/8250_core.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index d8c06a3..1119d53 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -686,22 +686,16 @@ static int size_fifo(struct uart_8250_port *up)
  */
 static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
 {
-	unsigned char old_dll, old_dlm, old_lcr;
-	unsigned int id;
+	unsigned char old_lcr;
+	unsigned int id, old_dl;
 
 	old_lcr = serial_in(p, UART_LCR);
 	serial_out(p, UART_LCR, UART_LCR_CONF_MODE_A);
+	old_dl = serial_dl_read(p);
+	serial_dl_write(p, 0);
+	id = serial_dl_read(p);
+	serial_dl_write(p, old_dl);
 
-	old_dll = serial_in(p, UART_DLL);
-	old_dlm = serial_in(p, UART_DLM);
-
-	serial_out(p, UART_DLL, 0);
-	serial_out(p, UART_DLM, 0);
-
-	id = serial_in(p, UART_DLL) | serial_in(p, UART_DLM) << 8;
-
-	serial_out(p, UART_DLL, old_dll);
-	serial_out(p, UART_DLM, old_dlm);
 	serial_out(p, UART_LCR, old_lcr);
 
 	return id;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 030/143] bttv: Width must be a multiple of 16 when capturing planar formats
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (28 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 029/143] 8250: use callbacks to access UART_DLL/UART_DLM Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 031/143] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Willy Tarreau
                   ` (113 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Hans de Goede, Mauro Carvalho Chehab, Willy Tarreau

From: Hans de Goede <hdegoede@redhat.com>

commit 5c915c68763889f0183a1cc61c84bb228b60124a upstream.

On my bttv card "Hauppauge WinTV [card=10]" capturing in YV12 fmt at max
size results in a solid green rectangle being captured (all colors 0 in
YUV).

This turns out to be caused by max-width (924) not being a multiple of 16.

We've likely never hit this problem before since normally xawtv / tvtime,
etc. will prefer packed pixel formats. But when using a video card which
is using xf86-video-modesetting + glamor, only planar XVideo fmts are
available, and xawtv will chose a matching capture format to avoid needing
to do conversion, triggering the solid green window problem.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/media/pci/bt8xx/bttv-driver.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index e2633d9..aa4519e 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -2376,6 +2376,19 @@ static int bttv_g_fmt_vid_overlay(struct file *file, void *priv,
 	return 0;
 }
 
+static void bttv_get_width_mask_vid_cap(const struct bttv_format *fmt,
+					unsigned int *width_mask,
+					unsigned int *width_bias)
+{
+	if (fmt->flags & FORMAT_FLAGS_PLANAR) {
+		*width_mask = ~15; /* width must be a multiple of 16 pixels */
+		*width_bias = 8;   /* nearest */
+	} else {
+		*width_mask = ~3; /* width must be a multiple of 4 pixels */
+		*width_bias = 2;  /* nearest */
+	}
+}
+
 static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 						struct v4l2_format *f)
 {
@@ -2385,6 +2398,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 	enum v4l2_field field;
 	__s32 width, height;
 	__s32 height2;
+	unsigned int width_mask, width_bias;
 	int rc;
 
 	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
@@ -2417,9 +2431,9 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 	width = f->fmt.pix.width;
 	height = f->fmt.pix.height;
 
+	bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias);
 	rc = limit_scaled_size_lock(fh, &width, &height, field,
-			       /* width_mask: 4 pixels */ ~3,
-			       /* width_bias: nearest */ 2,
+			       width_mask, width_bias,
 			       /* adjust_size */ 1,
 			       /* adjust_crop */ 0);
 	if (0 != rc)
@@ -2452,6 +2466,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
 	struct bttv_fh *fh = priv;
 	struct bttv *btv = fh->btv;
 	__s32 width, height;
+	unsigned int width_mask, width_bias;
 	enum v4l2_field field;
 
 	retval = bttv_switch_type(fh, f->type);
@@ -2466,9 +2481,10 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
 	height = f->fmt.pix.height;
 	field = f->fmt.pix.field;
 
+	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
+	bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias);
 	retval = limit_scaled_size_lock(fh, &width, &height, f->fmt.pix.field,
-			       /* width_mask: 4 pixels */ ~3,
-			       /* width_bias: nearest */ 2,
+			       width_mask, width_bias,
 			       /* adjust_size */ 1,
 			       /* adjust_crop */ 1);
 	if (0 != retval)
@@ -2476,8 +2492,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
 
 	f->fmt.pix.field = field;
 
-	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
-
 	/* update our state informations */
 	fh->fmt              = fmt;
 	fh->cap.field        = f->fmt.pix.field;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 031/143] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (29 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 030/143] bttv: Width must be a multiple of 16 when capturing planar formats Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 032/143] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Willy Tarreau
                   ` (112 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tiffany Lin, Hans Verkuil, stable, Mauro Carvalho Chehab, Willy Tarreau

From: Tiffany Lin <tiffany.lin@mediatek.com>

commit 7df5ab8774aa383c6d2bff00688d004585d96dfd upstream.

In v4l2-compliance utility, test QUERYBUF required correct length
value to go through each planar to check planar's length in
multi-planar buffer type

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v3.7 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 35fb8f0..07d6ce4 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -392,7 +392,8 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 		get_user(kp->index, &up->index) ||
 		get_user(kp->type, &up->type) ||
 		get_user(kp->flags, &up->flags) ||
-		get_user(kp->memory, &up->memory))
+		get_user(kp->memory, &up->memory) ||
+		get_user(kp->length, &up->length))
 			return -EFAULT;
 
 	if (V4L2_TYPE_IS_OUTPUT(kp->type))
@@ -404,9 +405,6 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 			return -EFAULT;
 
 	if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) {
-		if (get_user(kp->length, &up->length))
-			return -EFAULT;
-
 		num_planes = kp->length;
 		if (num_planes == 0) {
 			kp->m.planes = NULL;
@@ -439,16 +437,14 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 	} else {
 		switch (kp->memory) {
 		case V4L2_MEMORY_MMAP:
-			if (get_user(kp->length, &up->length) ||
-				get_user(kp->m.offset, &up->m.offset))
+			if (get_user(kp->m.offset, &up->m.offset))
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_USERPTR:
 			{
 			compat_long_t tmp;
 
-			if (get_user(kp->length, &up->length) ||
-			    get_user(tmp, &up->m.userptr))
+			if (get_user(tmp, &up->m.userptr))
 				return -EFAULT;
 
 			kp->m.userptr = (unsigned long)compat_ptr(tmp);
@@ -490,7 +486,8 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 		copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) ||
 		put_user(kp->sequence, &up->sequence) ||
 		put_user(kp->reserved2, &up->reserved2) ||
-		put_user(kp->reserved, &up->reserved))
+		put_user(kp->reserved, &up->reserved) ||
+		put_user(kp->length, &up->length))
 			return -EFAULT;
 
 	if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) {
@@ -513,13 +510,11 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 	} else {
 		switch (kp->memory) {
 		case V4L2_MEMORY_MMAP:
-			if (put_user(kp->length, &up->length) ||
-				put_user(kp->m.offset, &up->m.offset))
+			if (put_user(kp->m.offset, &up->m.offset))
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_USERPTR:
-			if (put_user(kp->length, &up->length) ||
-				put_user(kp->m.userptr, &up->m.userptr))
+			if (put_user(kp->m.userptr, &up->m.userptr))
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_OVERLAY:
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 032/143] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41.
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (30 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 031/143] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 033/143] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Willy Tarreau
                   ` (111 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vittorio Gambaletta (VittGam), Takashi Iwai, Willy Tarreau

From: "Vittorio Gambaletta (VittGam)" <linuxbugs@vittgam.net>

commit 4061db03dd71d195b9973ee466f6ed32f6a3fc16 upstream.

The clock measurement on the AC'97 audio card found in the IBM ThinkPad X41
will often fail, so add a quirk entry to fix it.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=441087
Cc: <stable@vger.kernel.org>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 sound/pci/intel8x0.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index b8fe405..7022450 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2885,6 +2885,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
 
 static struct snd_pci_quirk intel8x0_clock_list[] = {
 	SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000),
+	SND_PCI_QUIRK(0x1014, 0x0581, "AD1981B", 48000),
 	SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100),
 	SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000),
 	SND_PCI_QUIRK(0x1028, 0x01ad, "AD1981B", 48000),
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 033/143] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (31 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 032/143] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 034/143] bcache: fix cache_set_flush() NULL pointer dereference on OOM Willy Tarreau
                   ` (110 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: OGAWA Hirofumi, Theodore Ts'o, Willy Tarreau

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

commit c0a2ad9b50dd80eeccd73d9ff962234590d5ec93 upstream.

On umount path, jbd2_journal_destroy() writes latest transaction ID
(->j_tail_sequence) to be used at next mount.

The bug is that ->j_tail_sequence is not holding latest transaction ID
in some cases. So, at next mount, there is chance to conflict with
remaining (not overwritten yet) transactions.

	mount (id=10)
	write transaction (id=11)
	write transaction (id=12)
	umount (id=10) <= the bug doesn't write latest ID

	mount (id=10)
	write transaction (id=11)
	crash

	mount
	[recovery process]
		transaction (id=11)
		transaction (id=12) <= valid transaction ID, but old commit
                                       must not replay

Like above, this bug become the cause of recovery failure, or FS
corruption.

So why ->j_tail_sequence doesn't point latest ID?

Because if checkpoint transactions was reclaimed by memory pressure
(i.e. bdev_try_to_free_page()), then ->j_tail_sequence is not updated.
(And another case is, __jbd2_journal_clean_checkpoint_list() is called
with empty transaction.)

So in above cases, ->j_tail_sequence is not pointing latest
transaction ID at umount path. Plus, REQ_FLUSH for checkpoint is not
done too.

So, to fix this problem with minimum changes, this patch updates
->j_tail_sequence, and issue REQ_FLUSH.  (With more complex changes,
some optimizations would be possible to avoid unnecessary REQ_FLUSH
for example though.)

BTW,

	journal->j_tail_sequence =
		++journal->j_transaction_sequence;

Increment of ->j_transaction_sequence seems to be unnecessary, but
ext3 does this.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/jbd2/journal.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 644f95e..85733dd 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1407,11 +1407,12 @@ out:
 /**
  * jbd2_mark_journal_empty() - Mark on disk journal as empty.
  * @journal: The journal to update.
+ * @write_op: With which operation should we write the journal sb
  *
  * Update a journal's dynamic superblock fields to show that journal is empty.
  * Write updated superblock to disk waiting for IO to complete.
  */
-static void jbd2_mark_journal_empty(journal_t *journal)
+static void jbd2_mark_journal_empty(journal_t *journal, int write_op)
 {
 	journal_superblock_t *sb = journal->j_superblock;
 
@@ -1429,7 +1430,7 @@ static void jbd2_mark_journal_empty(journal_t *journal)
 	sb->s_start    = cpu_to_be32(0);
 	read_unlock(&journal->j_state_lock);
 
-	jbd2_write_superblock(journal, WRITE_FUA);
+	jbd2_write_superblock(journal, write_op);
 
 	/* Log is no longer empty */
 	write_lock(&journal->j_state_lock);
@@ -1697,7 +1698,13 @@ int jbd2_journal_destroy(journal_t *journal)
 	if (journal->j_sb_buffer) {
 		if (!is_journal_aborted(journal)) {
 			mutex_lock(&journal->j_checkpoint_mutex);
-			jbd2_mark_journal_empty(journal);
+
+			write_lock(&journal->j_state_lock);
+			journal->j_tail_sequence =
+				++journal->j_transaction_sequence;
+			write_unlock(&journal->j_state_lock);
+
+			jbd2_mark_journal_empty(journal, WRITE_FLUSH_FUA);
 			mutex_unlock(&journal->j_checkpoint_mutex);
 		} else
 			err = -EIO;
@@ -1952,7 +1959,7 @@ int jbd2_journal_flush(journal_t *journal)
 	 * the magic code for a fully-recovered superblock.  Any future
 	 * commits of data to the journal will restore the current
 	 * s_start value. */
-	jbd2_mark_journal_empty(journal);
+	jbd2_mark_journal_empty(journal, WRITE_FUA);
 	mutex_unlock(&journal->j_checkpoint_mutex);
 	write_lock(&journal->j_state_lock);
 	J_ASSERT(!journal->j_running_transaction);
@@ -1998,7 +2005,7 @@ int jbd2_journal_wipe(journal_t *journal, int write)
 	if (write) {
 		/* Lock to make assertions happy... */
 		mutex_lock(&journal->j_checkpoint_mutex);
-		jbd2_mark_journal_empty(journal);
+		jbd2_mark_journal_empty(journal, WRITE_FUA);
 		mutex_unlock(&journal->j_checkpoint_mutex);
 	}
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 034/143] bcache: fix cache_set_flush() NULL pointer dereference on OOM
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (32 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 033/143] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 035/143] watchdog: rc32434_wdt: fix ioctl error handling Willy Tarreau
                   ` (109 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Eric Wheeler, Eric Wheeler, Greg Kroah-Hartman, Willy Tarreau

From: Eric Wheeler <git@linux.ewheeler.net>

commit f8b11260a445169989d01df75d35af0f56178f95 upstream.

When bch_cache_set_alloc() fails to kzalloc the cache_set, the
asyncronous closure handling tries to dereference a cache_set that
hadn't yet been allocated inside of cache_set_flush() which is called
by __cache_set_unregister() during cleanup.  This appears to happen only
during an OOM condition on bcache_register.

Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/md/bcache/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 2d2915f..2a4c13a 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1295,6 +1295,9 @@ static void cache_set_flush(struct closure *cl)
 	set_bit(CACHE_SET_STOPPING_2, &c->flags);
 	wake_up(&c->alloc_wait);
 
+	if (!c)
+		closure_return(cl);
+
 	bch_cache_accounting_destroy(&c->accounting);
 
 	kobject_put(&c->internal);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 035/143] watchdog: rc32434_wdt: fix ioctl error handling
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (33 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 034/143] bcache: fix cache_set_flush() NULL pointer dereference on OOM Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:18 ` [PATCH 3.10 036/143] splice: handle zero nr_pages in splice_to_pipe() Willy Tarreau
                   ` (108 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Michael S. Tsirkin, Guenter Roeck, Wim Van Sebroeck, Willy Tarreau

From: "Michael S. Tsirkin" <mst@redhat.com>

commit 10e7ac22cdd4d211cef99afcb9371b70cb175be6 upstream.

Calling return copy_to_user(...) in an ioctl will not do the right thing
if there's a pagefault: copy_to_user returns the number of bytes not
copied in this case.

Fix up watchdog/rc32434_wdt to do
	return copy_to_user(...)) ?  -EFAULT : 0;

instead.

Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/watchdog/rc32434_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index f78bc00..ea8f582 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -237,7 +237,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
 			return -EINVAL;
 		/* Fall through */
 	case WDIOC_GETTIMEOUT:
-		return copy_to_user(argp, &timeout, sizeof(int));
+		return copy_to_user(argp, &timeout, sizeof(int)) ? -EFAULT : 0;
 	default:
 		return -ENOTTY;
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 036/143] splice: handle zero nr_pages in splice_to_pipe()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (34 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 035/143] watchdog: rc32434_wdt: fix ioctl error handling Willy Tarreau
@ 2016-06-05 10:18 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 037/143] xtensa: ISS: don't hang if stdin EOF is reached Willy Tarreau
                   ` (107 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:18 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Rabin Vincent, Al Viro, Willy Tarreau

From: Rabin Vincent <rabin@rab.in>

commit d6785d9152147596f60234157da2b02540c3e60f upstream.

Running the following command:

 busybox cat /sys/kernel/debug/tracing/trace_pipe > /dev/null

with any tracing enabled pretty very quickly leads to various NULL
pointer dereferences and VM BUG_ON()s, such as these:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
 IP: [<ffffffff8119df6c>] generic_pipe_buf_release+0xc/0x40
 Call Trace:
  [<ffffffff811c48a3>] splice_direct_to_actor+0x143/0x1e0
  [<ffffffff811c42e0>] ? generic_pipe_buf_nosteal+0x10/0x10
  [<ffffffff811c49cf>] do_splice_direct+0x8f/0xb0
  [<ffffffff81196869>] do_sendfile+0x199/0x380
  [<ffffffff81197600>] SyS_sendfile64+0x90/0xa0
  [<ffffffff8192cbee>] entry_SYSCALL_64_fastpath+0x12/0x6d

 page dumped because: VM_BUG_ON_PAGE(atomic_read(&page->_count) == 0)
 kernel BUG at include/linux/mm.h:367!
 invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
 RIP: [<ffffffff8119df9c>] generic_pipe_buf_release+0x3c/0x40
 Call Trace:
  [<ffffffff811c48a3>] splice_direct_to_actor+0x143/0x1e0
  [<ffffffff811c42e0>] ? generic_pipe_buf_nosteal+0x10/0x10
  [<ffffffff811c49cf>] do_splice_direct+0x8f/0xb0
  [<ffffffff81196869>] do_sendfile+0x199/0x380
  [<ffffffff81197600>] SyS_sendfile64+0x90/0xa0
  [<ffffffff8192cd1e>] tracesys_phase2+0x84/0x89

(busybox's cat uses sendfile(2), unlike the coreutils version)

This is because tracing_splice_read_pipe() can call splice_to_pipe()
with spd->nr_pages == 0.  spd_pages underflows in splice_to_pipe() and
we fill the page pointers and the other fields of the pipe_buffers with
garbage.

All other callers of splice_to_pipe() avoid calling it when nr_pages ==
0, and we could make tracing_splice_read_pipe() do that too, but it
seems reasonable to have splice_to_page() handle this condition
gracefully.

Cc: stable@vger.kernel.org
Signed-off-by: Rabin Vincent <rabin@rab.in>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/splice.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/splice.c b/fs/splice.c
index 3b94a6b..2ffa7b0 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -189,6 +189,9 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
 	unsigned int spd_pages = spd->nr_pages;
 	int ret, do_wakeup, page_nr;
 
+	if (!spd_pages)
+		return 0;
+
 	ret = 0;
 	do_wakeup = 0;
 	page_nr = 0;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 037/143] xtensa: ISS: don't hang if stdin EOF is reached
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (35 preceding siblings ...)
  2016-06-05 10:18 ` [PATCH 3.10 036/143] splice: handle zero nr_pages in splice_to_pipe() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 038/143] xtensa: clear all DBREAKC registers on start Willy Tarreau
                   ` (106 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Max Filippov, Willy Tarreau

From: Max Filippov <jcmvbkbc@gmail.com>

commit 362014c8d9d51d504c167c44ac280169457732be upstream.

Simulator stdin may be connected to a file, when its end is reached
kernel hangs in infinite loop inside rs_poll, because simc_poll always
signals that descriptor 0 is readable and simc_read always returns 0.
Check simc_read return value and exit loop if it's not positive. Also
don't rewind polling timer if it's zero.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/xtensa/platforms/iss/console.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 70cb408..92d785f 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -100,21 +100,23 @@ static void rs_poll(unsigned long priv)
 {
 	struct tty_port *port = (struct tty_port *)priv;
 	int i = 0;
+	int rd = 1;
 	unsigned char c;
 
 	spin_lock(&timer_lock);
 
 	while (simc_poll(0)) {
-		simc_read(0, &c, 1);
+		rd = simc_read(0, &c, 1);
+		if (rd <= 0)
+			break;
 		tty_insert_flip_char(port, c, TTY_NORMAL);
 		i++;
 	}
 
 	if (i)
 		tty_flip_buffer_push(port);
-
-
-	mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
+	if (rd)
+		mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
 	spin_unlock(&timer_lock);
 }
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 038/143] xtensa: clear all DBREAKC registers on start
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (36 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 037/143] xtensa: ISS: don't hang if stdin EOF is reached Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 039/143] md/raid5: Compare apples to apples (or sectors to sectors) Willy Tarreau
                   ` (105 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Max Filippov, Willy Tarreau

From: Max Filippov <jcmvbkbc@gmail.com>

commit 7de7ac785ae18a2cdc78d7560f48e3213d9ea0ab upstream.

There are XCHAL_NUM_DBREAK registers, clear them all.
This also fixes cryptic assembler error message with binutils 2.25 when
XCHAL_NUM_DBREAK is 0:

  as: out of memory allocating 18446744073709551575 bytes after a total
  of 495616 bytes

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/xtensa/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 7d740eb..bb12d77 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -118,7 +118,7 @@ ENTRY(_startup)
 	wsr	a0, icountlevel
 
 	.set	_index, 0
-	.rept	XCHAL_NUM_DBREAK - 1
+	.rept	XCHAL_NUM_DBREAK
 	wsr	a0, SREG_DBREAKC + _index
 	.set	_index, _index + 1
 	.endr
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 039/143] md/raid5: Compare apples to apples (or sectors to sectors)
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (37 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 038/143] xtensa: clear all DBREAKC registers on start Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 040/143] rapidio/rionet: fix deadlock on SMP Willy Tarreau
                   ` (104 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jes Sorensen, stable, Shaohua Li, Willy Tarreau

From: Jes Sorensen <Jes.Sorensen@redhat.com>

commit e7597e69dec59b65c5525db1626b9d34afdfa678 upstream.

'max_discard_sectors' is in sectors, while 'stripe' is in bytes.

This fixes the problem where DISCARD would get disabled on some larger
RAID5 configurations (6 or more drives in my testing), while it worked
as expected with smaller configurations.

Fixes: 620125f2bf8 ("MD: raid5 trim support")
Cc: stable@vger.kernel.org v3.7+
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/md/raid5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ef18ca7..9ee3c46 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5658,8 +5658,8 @@ static int run(struct mddev *mddev)
 		}
 
 		if (discard_supported &&
-		   mddev->queue->limits.max_discard_sectors >= stripe &&
-		   mddev->queue->limits.discard_granularity >= stripe)
+		    mddev->queue->limits.max_discard_sectors >= (stripe >> 9) &&
+		    mddev->queue->limits.discard_granularity >= stripe)
 			queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
 						mddev->queue);
 		else
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 040/143] rapidio/rionet: fix deadlock on SMP
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (38 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 039/143] md/raid5: Compare apples to apples (or sectors to sectors) Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 041/143] ipr: Fix out-of-bounds null overwrite Willy Tarreau
                   ` (103 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Aurelien Jacquiot, Alexandre Bounine, Matt Porter,
	Andre van Herk, Andrew Morton, Linus Torvalds, Willy Tarreau

From: Aurelien Jacquiot <a-jacquiot@ti.com>

commit 36915976eca58f2eefa040ba8f9939672564df61 upstream.

Fix deadlocking during concurrent receive and transmit operations on SMP
platforms caused by the use of incorrect lock: on transmit 'tx_lock'
spinlock should be used instead of 'lock' which is used for receive
operation.

This fix is applicable to kernel versions starting from v2.15.

Signed-off-by: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/rionet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index f433b59..00a8128 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -269,7 +269,7 @@ static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbo
 	struct net_device *ndev = dev_id;
 	struct rionet_private *rnet = netdev_priv(ndev);
 
-	spin_lock(&rnet->lock);
+	spin_lock(&rnet->tx_lock);
 
 	if (netif_msg_intr(rnet))
 		printk(KERN_INFO
@@ -288,7 +288,7 @@ static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbo
 	if (rnet->tx_cnt < RIONET_TX_RING_SIZE)
 		netif_wake_queue(ndev);
 
-	spin_unlock(&rnet->lock);
+	spin_unlock(&rnet->tx_lock);
 }
 
 static int rionet_open(struct net_device *ndev)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 041/143] ipr: Fix out-of-bounds null overwrite
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (39 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 040/143] rapidio/rionet: fix deadlock on SMP Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 042/143] ipr: Fix regression when loading firmware Willy Tarreau
                   ` (102 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Insu Yun, Martin K . Petersen, Willy Tarreau

From: Insu Yun <wuninsu@gmail.com>

commit d63c7dd5bcb9441af0526d370c43a65ca2c980d9 upstream.

Return value of snprintf is not bound by size value, 2nd argument.
(https://www.kernel.org/doc/htmldocs/kernel-api/API-snprintf.html).
Return value is number of printed chars, can be larger than 2nd
argument.  Therefore, it can write null byte out of bounds ofbuffer.
Since snprintf puts null, it does not need to put additional null byte.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/scsi/ipr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4a79a5f..bde4771 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3908,13 +3908,12 @@ static ssize_t ipr_store_update_fw(struct device *dev,
 	struct ipr_sglist *sglist;
 	char fname[100];
 	char *src;
-	int len, result, dnld_size;
+	int result, dnld_size;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
-	len = snprintf(fname, 99, "%s", buf);
-	fname[len-1] = '\0';
+	snprintf(fname, sizeof(fname), "%s", buf);
 
 	if (request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) {
 		dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 042/143] ipr: Fix regression when loading firmware
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (40 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 041/143] ipr: Fix out-of-bounds null overwrite Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 043/143] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards Willy Tarreau
                   ` (101 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gabriel Krisman Bertazi, Insu Yun, Martin K . Petersen, Willy Tarreau

From: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>

commit 21b81716c6bff24cda52dc75588455f879ddbfe9 upstream.

Commit d63c7dd5bcb9 ("ipr: Fix out-of-bounds null overwrite") removed
the end of line handling when storing the update_fw sysfs attribute.
This changed the userpace API because it started refusing writes
terminated by a line feed, which broke the update tools we already have.

This patch re-adds that handling, so both a write terminated by a line
feed or not can make it through with the update.

Fixes: d63c7dd5bcb9 ("ipr: Fix out-of-bounds null overwrite")
Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Cc: Insu Yun <wuninsu@gmail.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/scsi/ipr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index bde4771..25ac2c0 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3908,6 +3908,7 @@ static ssize_t ipr_store_update_fw(struct device *dev,
 	struct ipr_sglist *sglist;
 	char fname[100];
 	char *src;
+	char *endline;
 	int result, dnld_size;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -3915,6 +3916,10 @@ static ssize_t ipr_store_update_fw(struct device *dev,
 
 	snprintf(fname, sizeof(fname), "%s", buf);
 
+	endline = strchr(fname, '\n');
+	if (endline)
+		*endline = '\0';
+
 	if (request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) {
 		dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname);
 		return -EIO;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 043/143] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards.
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (41 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 042/143] ipr: Fix regression when loading firmware Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 044/143] tracing: Have preempt(irqs)off trace preempt disabled functions Willy Tarreau
                   ` (100 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mario Kleiner, Alex Deucher, Willy Tarreau

From: Mario Kleiner <mario.kleiner.de@gmail.com>

commit 459ee1c3fd097ab56ababd8ff4bb7ef6a792de33 upstream.

As observed on Apple iMac10,1, DCE-3.2, RV-730,
link rate of 2.7 Ghz is not selected, because
the args.v1.ucConfig flag setting for 2.7 Ghz
gets overwritten by a following assignment of
the transmitter to use.

Move link rate setup a few lines down to fix this.
In practice this didn't have any positive or
negative effect on display setup on the tested
iMac10,1 so i don't know if backporting to stable
makes sense or not.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 1b564d7..5b8d868 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -870,8 +870,6 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mo
 			else
 				args.v1.ucLaneNum = 4;
 
-			if (ENCODER_MODE_IS_DP(args.v1.ucEncoderMode) && (dp_clock == 270000))
-				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ;
 			switch (radeon_encoder->encoder_id) {
 			case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
 				args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER1;
@@ -888,6 +886,10 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mo
 				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKB;
 			else
 				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKA;
+
+			if (ENCODER_MODE_IS_DP(args.v1.ucEncoderMode) && (dp_clock == 270000))
+				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ;
+
 			break;
 		case 2:
 		case 3:
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 044/143] tracing: Have preempt(irqs)off trace preempt disabled functions
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (42 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 043/143] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 045/143] tracing: Fix crash from reading trace_pipe with sendfile Willy Tarreau
                   ` (99 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Steven Rostedt (Red Hat), stable, Willy Tarreau

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit cb86e05390debcc084cfdb0a71ed4c5dbbec517d upstream.

Joel Fernandes reported that the function tracing of preempt disabled
sections was not being reported when running either the preemptirqsoff or
preemptoff tracers. This was due to the fact that the function tracer
callback for those tracers checked if irqs were disabled before tracing. But
this fails when we want to trace preempt off locations as well.

Joel explained that he wanted to see funcitons where interrupts are enabled
but preemption was disabled. The expected output he wanted:

   <...>-2265    1d.h1 3419us : preempt_count_sub <-irq_exit
   <...>-2265    1d..1 3419us : __do_softirq <-irq_exit
   <...>-2265    1d..1 3419us : msecs_to_jiffies <-__do_softirq
   <...>-2265    1d..1 3420us : irqtime_account_irq <-__do_softirq
   <...>-2265    1d..1 3420us : __local_bh_disable_ip <-__do_softirq
   <...>-2265    1..s1 3421us : run_timer_softirq <-__do_softirq
   <...>-2265    1..s1 3421us : hrtimer_run_pending <-run_timer_softirq
   <...>-2265    1..s1 3421us : _raw_spin_lock_irq <-run_timer_softirq
   <...>-2265    1d.s1 3422us : preempt_count_add <-_raw_spin_lock_irq
   <...>-2265    1d.s2 3422us : _raw_spin_unlock_irq <-run_timer_softirq
   <...>-2265    1..s2 3422us : preempt_count_sub <-_raw_spin_unlock_irq
   <...>-2265    1..s1 3423us : rcu_bh_qs <-__do_softirq
   <...>-2265    1d.s1 3423us : irqtime_account_irq <-__do_softirq
   <...>-2265    1d.s1 3423us : __local_bh_enable <-__do_softirq

There's a comment saying that the irq disabled check is because there's a
possible race that tracing_cpu may be set when the function is executed. But
I don't remember that race. For now, I added a check for preemption being
enabled too to not record the function, as there would be no race if that
was the case. I need to re-investigate this, as I'm now thinking that the
tracing_cpu will always be correct. But no harm in keeping the check for
now, except for the slight performance hit.

Link: http://lkml.kernel.org/r/1457770386-88717-1-git-send-email-agnel.joel@gmail.com

Fixes: 5e6d2b9cfa3a "tracing: Use one prologue for the preempt irqs off tracer function tracers"
Cc: stable@vget.kernel.org # 2.6.37+
Reported-by: Joel Fernandes <agnel.joel@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 kernel/trace/trace_irqsoff.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 2aefbee..56e083e 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -118,8 +118,12 @@ static int func_prolog_dec(struct trace_array *tr,
 		return 0;
 
 	local_save_flags(*flags);
-	/* slight chance to get a false positive on tracing_cpu */
-	if (!irqs_disabled_flags(*flags))
+	/*
+	 * Slight chance to get a false positive on tracing_cpu,
+	 * although I'm starting to think there isn't a chance.
+	 * Leave this for now just to be paranoid.
+	 */
+	if (!irqs_disabled_flags(*flags) && !preempt_count())
 		return 0;
 
 	*data = per_cpu_ptr(tr->trace_buffer.data, cpu);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 045/143] tracing: Fix crash from reading trace_pipe with sendfile
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (43 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 044/143] tracing: Have preempt(irqs)off trace preempt disabled functions Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 046/143] tracing: Fix trace_printk() to print when not using bprintk() Willy Tarreau
                   ` (98 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Steven Rostedt (Red Hat), stable, Willy Tarreau

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit a29054d9478d0435ab01b7544da4f674ab13f533 upstream.

If tracing contains data and the trace_pipe file is read with sendfile(),
then it can trigger a NULL pointer dereference and various BUG_ON within the
VM code.

There's a patch to fix this in the splice_to_pipe() code, but it's also a
good idea to not let that happen from trace_pipe either.

Link: http://lkml.kernel.org/r/1457641146-9068-1-git-send-email-rabin@rab.in

Cc: stable@vger.kernel.org # 2.6.30+
Reported-by: Rabin Vincent <rabin.vincent@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 kernel/trace/trace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 640e4c4..eff26a9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4351,7 +4351,10 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
 
 	spd.nr_pages = i;
 
-	ret = splice_to_pipe(pipe, &spd);
+	if (i)
+		ret = splice_to_pipe(pipe, &spd);
+	else
+		ret = 0;
 out:
 	splice_shrink_spd(&spd);
 	return ret;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 046/143] tracing: Fix trace_printk() to print when not using bprintk()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (44 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 045/143] tracing: Fix crash from reading trace_pipe with sendfile Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 047/143] scripts/coccinelle: modernize & Willy Tarreau
                   ` (97 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Steven Rostedt (Red Hat), stable, Willy Tarreau

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 3debb0a9ddb16526de8b456491b7db60114f7b5e upstream.

The trace_printk() code will allocate extra buffers if the compile detects
that a trace_printk() is used. To do this, the format of the trace_printk()
is saved to the __trace_printk_fmt section, and if that section is bigger
than zero, the buffers are allocated (along with a message that this has
happened).

If trace_printk() uses a format that is not a constant, and thus something
not guaranteed to be around when the print happens, the compiler optimizes
the fmt out, as it is not used, and the __trace_printk_fmt section is not
filled. This means the kernel will not allocate the special buffers needed
for the trace_printk() and the trace_printk() will not write anything to the
tracing buffer.

Adding a "__used" to the variable in the __trace_printk_fmt section will
keep it around, even though it is set to NULL. This will keep the string
from being printed in the debugfs/tracing/printk_formats section as it is
not needed.

Reported-by: Vlastimil Babka <vbabka@suse.cz>
Fixes: 07d777fe8c398 "tracing: Add percpu buffers for trace_printk()"
Cc: stable@vger.kernel.org # v3.5+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 include/linux/kernel.h      | 6 +++---
 kernel/trace/trace_printk.c | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 341551c..5f4554b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -557,7 +557,7 @@ do {							\
 
 #define do_trace_printk(fmt, args...)					\
 do {									\
-	static const char *trace_printk_fmt				\
+	static const char *trace_printk_fmt __used			\
 		__attribute__((section("__trace_printk_fmt"))) =	\
 		__builtin_constant_p(fmt) ? fmt : NULL;			\
 									\
@@ -604,7 +604,7 @@ extern int __trace_puts(unsigned long ip, const char *str, int size);
  */
 
 #define trace_puts(str) ({						\
-	static const char *trace_printk_fmt				\
+	static const char *trace_printk_fmt __used			\
 		__attribute__((section("__trace_printk_fmt"))) =	\
 		__builtin_constant_p(str) ? str : NULL;			\
 									\
@@ -624,7 +624,7 @@ extern void trace_dump_stack(int skip);
 #define ftrace_vprintk(fmt, vargs)					\
 do {									\
 	if (__builtin_constant_p(fmt)) {				\
-		static const char *trace_printk_fmt			\
+		static const char *trace_printk_fmt __used		\
 		  __attribute__((section("__trace_printk_fmt"))) =	\
 			__builtin_constant_p(fmt) ? fmt : NULL;		\
 									\
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index a9077c1..fdb23e8 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -272,6 +272,9 @@ static int t_show(struct seq_file *m, void *v)
 	const char *str = *fmt;
 	int i;
 
+	if (!*fmt)
+		return 0;
+
 	seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);
 
 	/*
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 047/143] scripts/coccinelle: modernize &
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (45 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 046/143] tracing: Fix trace_printk() to print when not using bprintk() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 048/143] Input: ims-pcu - sanity check against missing interfaces Willy Tarreau
                   ` (96 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Julia Lawall, Michal Marek, Willy Tarreau

From: Julia Lawall <Julia.Lawall@lip6.fr>

commit 1b669e713f277a4d4b3cec84e13d16544ac8286d upstream.

& is no longer allowed in column 0, since Coccinelle 1.0.4.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Tested-by: Nishanth Menon <nm@ti.com>
Cc: stable@vger.kernel.org
Signed-off-by: Michal Marek <mmarek@suse.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 scripts/coccinelle/iterators/use_after_iter.cocci | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci
index 06284c5..93e37ff 100644
--- a/scripts/coccinelle/iterators/use_after_iter.cocci
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -123,7 +123,7 @@ list_remove_head(x,c,...)
 |
 sizeof(<+...c...+>)
 |
-&c->member
+ &c->member
 |
 c = E
 |
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 048/143] Input: ims-pcu - sanity check against missing interfaces
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (46 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 047/143] scripts/coccinelle: modernize & Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 049/143] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Willy Tarreau
                   ` (95 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, Dmitry Torokhov, Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit a0ad220c96692eda76b2e3fd7279f3dcd1d8a8ff upstream.

A malicious device missing interface can make the driver oops.
Add sanity checking.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/input/misc/ims-pcu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index e204f26..77164dc 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1433,6 +1433,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 
 	pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev,
 					 union_desc->bMasterInterface0);
+	if (!pcu->ctrl_intf)
+		return -EINVAL;
 
 	alt = pcu->ctrl_intf->cur_altsetting;
 	pcu->ep_ctrl = &alt->endpoint[0].desc;
@@ -1440,6 +1442,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 
 	pcu->data_intf = usb_ifnum_to_if(pcu->udev,
 					 union_desc->bSlaveInterface0);
+	if (!pcu->data_intf)
+		return -EINVAL;
 
 	alt = pcu->data_intf->cur_altsetting;
 	if (alt->desc.bNumEndpoints != 2) {
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 049/143] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (47 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 048/143] Input: ims-pcu - sanity check against missing interfaces Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 050/143] ocfs2/dlm: fix race between convert and recovery Willy Tarreau
                   ` (94 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Vladis Dronov, Dmitry Torokhov, Willy Tarreau

From: Vladis Dronov <vdronov@redhat.com>

commit 950336ba3e4a1ffd2ca60d29f6ef386dd2c7351d upstream.

The ati_remote2 driver expects at least two interfaces with one
endpoint each. If given malicious descriptor that specify one
interface or no endpoints, it will crash in the probe function.
Ensure there is at least two interfaces and one endpoint for each
interface before using it.

The full disclosure: http://seclists.org/bugtraq/2016/Mar/90

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/input/misc/ati_remote2.c | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index f63341f..e8c6a48 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -817,26 +817,49 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 
 	ar2->udev = udev;
 
+	/* Sanity check, first interface must have an endpoint */
+	if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) {
+		dev_err(&interface->dev,
+			"%s(): interface 0 must have an endpoint\n", __func__);
+		r = -ENODEV;
+		goto fail1;
+	}
 	ar2->intf[0] = interface;
 	ar2->ep[0] = &alt->endpoint[0].desc;
 
+	/* Sanity check, the device must have two interfaces */
 	ar2->intf[1] = usb_ifnum_to_if(udev, 1);
+	if ((udev->actconfig->desc.bNumInterfaces < 2) || !ar2->intf[1]) {
+		dev_err(&interface->dev, "%s(): need 2 interfaces, found %d\n",
+			__func__, udev->actconfig->desc.bNumInterfaces);
+		r = -ENODEV;
+		goto fail1;
+	}
+
 	r = usb_driver_claim_interface(&ati_remote2_driver, ar2->intf[1], ar2);
 	if (r)
 		goto fail1;
+
+	/* Sanity check, second interface must have an endpoint */
 	alt = ar2->intf[1]->cur_altsetting;
+	if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) {
+		dev_err(&interface->dev,
+			"%s(): interface 1 must have an endpoint\n", __func__);
+		r = -ENODEV;
+		goto fail2;
+	}
 	ar2->ep[1] = &alt->endpoint[0].desc;
 
 	r = ati_remote2_urb_init(ar2);
 	if (r)
-		goto fail2;
+		goto fail3;
 
 	ar2->channel_mask = channel_mask;
 	ar2->mode_mask = mode_mask;
 
 	r = ati_remote2_setup(ar2, ar2->channel_mask);
 	if (r)
-		goto fail2;
+		goto fail3;
 
 	usb_make_path(udev, ar2->phys, sizeof(ar2->phys));
 	strlcat(ar2->phys, "/input0", sizeof(ar2->phys));
@@ -845,11 +868,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 
 	r = sysfs_create_group(&udev->dev.kobj, &ati_remote2_attr_group);
 	if (r)
-		goto fail2;
+		goto fail3;
 
 	r = ati_remote2_input_init(ar2);
 	if (r)
-		goto fail3;
+		goto fail4;
 
 	usb_set_intfdata(interface, ar2);
 
@@ -857,10 +880,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 
 	return 0;
 
- fail3:
+ fail4:
 	sysfs_remove_group(&udev->dev.kobj, &ati_remote2_attr_group);
- fail2:
+ fail3:
 	ati_remote2_urb_cleanup(ar2);
+ fail2:
 	usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
  fail1:
 	kfree(ar2);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 050/143] ocfs2/dlm: fix race between convert and recovery
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (48 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 049/143] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 051/143] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Willy Tarreau
                   ` (93 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Joseph Qi, Mark Fasheh, Joel Becker, Tariq Saeed, Junxiao Bi,
	Andrew Morton, Linus Torvalds, Willy Tarreau

From: Joseph Qi <joseph.qi@huawei.com>

commit ac7cf246dfdbec3d8fed296c7bf30e16f5099dac upstream.

There is a race window between dlmconvert_remote and
dlm_move_lockres_to_recovery_list, which will cause a lock with
OCFS2_LOCK_BUSY in grant list, thus system hangs.

dlmconvert_remote
{
        spin_lock(&res->spinlock);
        list_move_tail(&lock->list, &res->converting);
        lock->convert_pending = 1;
        spin_unlock(&res->spinlock);

        status = dlm_send_remote_convert_request();
        >>>>>> race window, master has queued ast and return DLM_NORMAL,
               and then down before sending ast.
               this node detects master down and calls
               dlm_move_lockres_to_recovery_list, which will revert the
               lock to grant list.
               Then OCFS2_LOCK_BUSY won't be cleared as new master won't
               send ast any more because it thinks already be authorized.

        spin_lock(&res->spinlock);
        lock->convert_pending = 0;
        if (status != DLM_NORMAL)
                dlm_revert_pending_convert(res, lock);
        spin_unlock(&res->spinlock);
}

In this case, check if res->state has DLM_LOCK_RES_RECOVERING bit set
(res is still in recovering) or res master changed (new master has
finished recovery), reset the status to DLM_RECOVERING, then it will
retry convert.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reported-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Tariq Saeed <tariq.x.saeed@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/ocfs2/dlm/dlmconvert.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index 29a886d..093200f 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -265,6 +265,7 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
 				  struct dlm_lock *lock, int flags, int type)
 {
 	enum dlm_status status;
+	u8 old_owner = res->owner;
 
 	mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type,
 	     lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS);
@@ -319,11 +320,19 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
 	spin_lock(&res->spinlock);
 	res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
 	lock->convert_pending = 0;
-	/* if it failed, move it back to granted queue */
+	/* if it failed, move it back to granted queue.
+	 * if master returns DLM_NORMAL and then down before sending ast,
+	 * it may have already been moved to granted queue, reset to
+	 * DLM_RECOVERING and retry convert */
 	if (status != DLM_NORMAL) {
 		if (status != DLM_NOTQUEUED)
 			dlm_error(status);
 		dlm_revert_pending_convert(res, lock);
+	} else if ((res->state & DLM_LOCK_RES_RECOVERING) ||
+			(old_owner != res->owner)) {
+		mlog(0, "res %.*s is in recovering or has been recovered.\n",
+				res->lockname.len, res->lockname.name);
+		status = DLM_RECOVERING;
 	}
 bail:
 	spin_unlock(&res->spinlock);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 051/143] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (49 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 050/143] ocfs2/dlm: fix race between convert and recovery Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 052/143] mtd: onenand: fix deadlock in onenand_block_markbad Willy Tarreau
                   ` (92 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Joseph Qi, Junxiao Bi, Mark Fasheh, Joel Becker, Tariq Saeed,
	Andrew Morton, Linus Torvalds, Willy Tarreau

From: Joseph Qi <joseph.qi@huawei.com>

commit be12b299a83fc807bbaccd2bcb8ec50cbb0cb55c upstream.

When master handles convert request, it queues ast first and then
returns status.  This may happen that the ast is sent before the request
status because the above two messages are sent by two threads.  And
right after the ast is sent, if master down, it may trigger BUG in
dlm_move_lockres_to_recovery_list in the requested node because ast
handler moves it to grant list without clear lock->convert_pending.  So
remove BUG_ON statement and check if the ast is processed in
dlmconvert_remote.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reported-by: Yiwen Jiang <jiangyiwen@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Tariq Saeed <tariq.x.saeed@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/ocfs2/dlm/dlmconvert.c  | 13 +++++++++++++
 fs/ocfs2/dlm/dlmrecovery.c |  1 -
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index 093200f..f65bdcf 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -291,6 +291,19 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
 		status = DLM_DENIED;
 		goto bail;
 	}
+
+	if (lock->ml.type == type && lock->ml.convert_type == LKM_IVMODE) {
+		mlog(0, "last convert request returned DLM_RECOVERING, but "
+		     "owner has already queued and sent ast to me. res %.*s, "
+		     "(cookie=%u:%llu, type=%d, conv=%d)\n",
+		     res->lockname.len, res->lockname.name,
+		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
+		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
+		     lock->ml.type, lock->ml.convert_type);
+		status = DLM_NORMAL;
+		goto bail;
+	}
+
 	res->state |= DLM_LOCK_RES_IN_PROGRESS;
 	/* move lock to local convert queue */
 	/* do not alter lock refcount.  switching lists. */
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 01c69f2..33e9d70 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -2034,7 +2034,6 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm,
 			dlm_lock_get(lock);
 			if (lock->convert_pending) {
 				/* move converting lock back to granted */
-				BUG_ON(i != DLM_CONVERTING_LIST);
 				mlog(0, "node died with convert pending "
 				     "on %.*s. move back to granted list.\n",
 				     res->lockname.len, res->lockname.name);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 052/143] mtd: onenand: fix deadlock in onenand_block_markbad
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (50 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 051/143] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 053/143] sched/cputime: Fix steal time accounting vs. CPU hotplug Willy Tarreau
                   ` (91 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Aaro Koskinen, Brian Norris, Willy Tarreau

From: Aaro Koskinen <aaro.koskinen@iki.fi>

commit 5e64c29e98bfbba1b527b0a164f9493f3db9e8cb upstream.

Commit 5942ddbc500d ("mtd: introduce mtd_block_markbad interface")
incorrectly changed onenand_block_markbad() to call mtd_block_markbad
instead of onenand_chip's block_markbad function. As a result the function
will now recurse and deadlock. Fix by reverting the change.

Fixes: 5942ddbc500d ("mtd: introduce mtd_block_markbad interface")
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/mtd/onenand/onenand_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index b3f41f2..0f13fd4 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2610,6 +2610,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
  */
 static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
+	struct onenand_chip *this = mtd->priv;
 	int ret;
 
 	ret = onenand_block_isbad(mtd, ofs);
@@ -2621,7 +2622,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 	}
 
 	onenand_get_device(mtd, FL_WRITING);
-	ret = mtd_block_markbad(mtd, ofs);
+	ret = this->block_markbad(mtd, ofs);
 	onenand_release_device(mtd);
 	return ret;
 }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 053/143] sched/cputime: Fix steal time accounting vs. CPU hotplug
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (51 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 052/143] mtd: onenand: fix deadlock in onenand_block_markbad Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 054/143] perf/x86/intel: Fix PEBS data source interpretation on Nehalem/Westmere Willy Tarreau
                   ` (90 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Thomas Gleixner, Frederic Weisbecker, Glauber Costa,
	Linus Torvalds, Peter Zijlstra, Ingo Molnar, Willy Tarreau

From: Thomas Gleixner <tglx@linutronix.de>

commit e9532e69b8d1d1284e8ecf8d2586de34aec61244 upstream.

On CPU hotplug the steal time accounting can keep a stale rq->prev_steal_time
value over CPU down and up. So after the CPU comes up again the delta
calculation in steal_account_process_tick() wreckages itself due to the
unsigned math:

	 u64 steal = paravirt_steal_clock(smp_processor_id());

	 steal -= this_rq()->prev_steal_time;

So if steal is smaller than rq->prev_steal_time we end up with an insane large
value which then gets added to rq->prev_steal_time, resulting in a permanent
wreckage of the accounting. As a consequence the per CPU stats in /proc/stat
become stale.

Nice trick to tell the world how idle the system is (100%) while the CPU is
100% busy running tasks. Though we prefer realistic numbers.

None of the accounting values which use a previous value to account for
fractions is reset at CPU hotplug time. update_rq_clock_task() has a sanity
check for prev_irq_time and prev_steal_time_rq, but that sanity check solely
deals with clock warps and limits the /proc/stat visible wreckage. The
prev_time values are still wrong.

Solution is simple: Reset rq->prev_*_time when the CPU is plugged in again.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: <stable@vger.kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: commit 095c0aa83e52 "sched: adjust scheduler cpu power for stolen time"
Fixes: commit aa483808516c "sched: Remove irq time from available CPU power"
Fixes: commit e6e6685accfa "KVM guest: Steal time accounting"
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1603041539490.3686@nanos
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 kernel/sched/core.c  |  1 +
 kernel/sched/sched.h | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f234c84..655d611 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5217,6 +5217,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
 
 	case CPU_UP_PREPARE:
 		rq->calc_load_update = calc_load_update;
+		account_reset_rq(rq);
 		break;
 
 	case CPU_ONLINE:
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index dfa31d5..e7f4d55 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1378,3 +1378,16 @@ static inline u64 irq_time_read(int cpu)
 }
 #endif /* CONFIG_64BIT */
 #endif /* CONFIG_IRQ_TIME_ACCOUNTING */
+
+static inline void account_reset_rq(struct rq *rq)
+{
+#ifdef CONFIG_IRQ_TIME_ACCOUNTING
+	rq->prev_irq_time = 0;
+#endif
+#ifdef CONFIG_PARAVIRT
+	rq->prev_steal_time = 0;
+#endif
+#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
+	rq->prev_steal_time_rq = 0;
+#endif
+}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 054/143] perf/x86/intel: Fix PEBS data source interpretation on Nehalem/Westmere
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (52 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 053/143] sched/cputime: Fix steal time accounting vs. CPU hotplug Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 055/143] hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated Willy Tarreau
                   ` (89 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Andi Kleen, Peter Zijlstra, Linus Torvalds, Thomas Gleixner,
	jolsa, Ingo Molnar, Greg Kroah-Hartman, Willy Tarreau

From: Andi Kleen <ak@linux.intel.com>

commit e17dc65328057c00db7e1bfea249c8771a78b30b upstream.

Jiri reported some time ago that some entries in the PEBS data source table
in perf do not agree with the SDM. We investigated and the bits
changed for Sandy Bridge, but the SDM was not updated.

perf already implements the bits correctly for Sandy Bridge
and later. This patch patches it up for Nehalem and Westmere.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: jolsa@kernel.org
Link: http://lkml.kernel.org/r/1456871124-15985-1-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/x86/kernel/cpu/perf_event.h          |  2 ++
 arch/x86/kernel/cpu/perf_event_intel.c    |  2 ++
 arch/x86/kernel/cpu/perf_event_intel_ds.c | 11 ++++++++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index ba9aadf..5fd0bbe 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -665,6 +665,8 @@ void intel_pmu_lbr_init_atom(void);
 
 void intel_pmu_lbr_init_snb(void);
 
+void intel_pmu_pebs_data_source_nhm(void);
+
 int intel_pmu_setup_lbr_filter(struct perf_event *event);
 
 int p4_pmu_init(void);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 6d6bb6f..ac05758 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -2088,6 +2088,7 @@ __init int intel_pmu_init(void)
 		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] =
 			X86_CONFIG(.event=0xb1, .umask=0x3f, .inv=1, .cmask=1);
 
+		intel_pmu_pebs_data_source_nhm();
 		x86_add_quirk(intel_nehalem_quirk);
 
 		pr_cont("Nehalem events, ");
@@ -2133,6 +2134,7 @@ __init int intel_pmu_init(void)
 		intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] =
 			X86_CONFIG(.event=0xb1, .umask=0x3f, .inv=1, .cmask=1);
 
+		intel_pmu_pebs_data_source_nhm();
 		pr_cont("Westmere events, ");
 		break;
 
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 60250f6..17b090a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -50,7 +50,8 @@ union intel_x86_pebs_dse {
 #define OP_LH (P(OP, LOAD) | P(LVL, HIT))
 #define SNOOP_NONE_MISS (P(SNOOP, NONE) | P(SNOOP, MISS))
 
-static const u64 pebs_data_source[] = {
+/* Version for Sandy Bridge and later */
+static u64 pebs_data_source[] = {
 	P(OP, LOAD) | P(LVL, MISS) | P(LVL, L3) | P(SNOOP, NA),/* 0x00:ukn L3 */
 	OP_LH | P(LVL, L1)  | P(SNOOP, NONE),	/* 0x01: L1 local */
 	OP_LH | P(LVL, LFB) | P(SNOOP, NONE),	/* 0x02: LFB hit */
@@ -69,6 +70,14 @@ static const u64 pebs_data_source[] = {
 	OP_LH | P(LVL, UNC) | P(SNOOP, NONE), /* 0x0f: uncached */
 };
 
+/* Patch up minor differences in the bits */
+void __init intel_pmu_pebs_data_source_nhm(void)
+{
+	pebs_data_source[0x05] = OP_LH | P(LVL, L3)  | P(SNOOP, HIT);
+	pebs_data_source[0x06] = OP_LH | P(LVL, L3)  | P(SNOOP, HITM);
+	pebs_data_source[0x07] = OP_LH | P(LVL, L3)  | P(SNOOP, HITM);
+}
+
 static u64 precise_store_data(u64 status)
 {
 	union intel_x86_pebs_dse dse;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 055/143] hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (53 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 054/143] perf/x86/intel: Fix PEBS data source interpretation on Nehalem/Westmere Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 056/143] parisc: Avoid function pointers for kernel exception routines Willy Tarreau
                   ` (88 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Guenter Roeck, Arnd Bergmann, Willy Tarreau

From: Guenter Roeck <linux@roeck-us.net>

commit 3c2e2266a5bd2d1cef258e6e54dca1d99946379f upstream.

arm:pxa_defconfig can result in the following crash if the max1111 driver
is not instantiated.

Unhandled fault: page domain fault (0x01b) at 0x00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: : 1b [#1] PREEMPT ARM
Modules linked in:
CPU: 0 PID: 300 Comm: kworker/0:1 Not tainted 4.5.0-01301-g1701f680407c #10
Hardware name: SHARP Akita
Workqueue: events sharpsl_charge_toggle
task: c390a000 ti: c391e000 task.ti: c391e000
PC is at max1111_read_channel+0x20/0x30
LR is at sharpsl_pm_pxa_read_max1111+0x2c/0x3c
pc : [<c03aaab0>]    lr : [<c0024b50>]    psr: 20000013
...
[<c03aaab0>] (max1111_read_channel) from [<c0024b50>]
					(sharpsl_pm_pxa_read_max1111+0x2c/0x3c)
[<c0024b50>] (sharpsl_pm_pxa_read_max1111) from [<c00262e0>]
					(spitzpm_read_devdata+0x5c/0xc4)
[<c00262e0>] (spitzpm_read_devdata) from [<c0024094>]
					(sharpsl_check_battery_temp+0x78/0x110)
[<c0024094>] (sharpsl_check_battery_temp) from [<c0024f9c>]
					(sharpsl_charge_toggle+0x48/0x110)
[<c0024f9c>] (sharpsl_charge_toggle) from [<c004429c>]
					(process_one_work+0x14c/0x48c)
[<c004429c>] (process_one_work) from [<c0044618>] (worker_thread+0x3c/0x5d4)
[<c0044618>] (worker_thread) from [<c004a238>] (kthread+0xd0/0xec)
[<c004a238>] (kthread) from [<c000a670>] (ret_from_fork+0x14/0x24)

This can occur because the SPI controller driver (SPI_PXA2XX) is built as
module and thus not necessarily loaded. While building SPI_PXA2XX into the
kernel would make the problem disappear, it appears prudent to ensure that
the driver is instantiated before accessing its data structures.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/hwmon/max1111.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index eda077d..f787f04 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -85,6 +85,9 @@ static struct max1111_data *the_max1111;
 
 int max1111_read_channel(int channel)
 {
+	if (!the_max1111 || !the_max1111->spi)
+		return -ENODEV;
+
 	return max1111_read(&the_max1111->spi->dev, channel);
 }
 EXPORT_SYMBOL(max1111_read_channel);
@@ -260,6 +263,9 @@ static int max1111_remove(struct spi_device *spi)
 {
 	struct max1111_data *data = spi_get_drvdata(spi);
 
+#ifdef CONFIG_SHARPSL_PM
+	the_max1111 = NULL;
+#endif
 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group);
 	sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 056/143] parisc: Avoid function pointers for kernel exception routines
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (54 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 055/143] hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 057/143] parisc: Fix kernel crash with reversed copy_from_user() Willy Tarreau
                   ` (87 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Helge Deller, Willy Tarreau

From: Helge Deller <deller@gmx.de>

commit e3893027a300927049efc1572f852201eb785142 upstream.

We want to avoid the kernel module loader to create function pointers
for the kernel fixup routines of get_user() and put_user(). Changing
the external reference from function type to int type fixes this.

This unbreaks exception handling for get_user() and put_user() when
called from a kernel module.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/parisc/kernel/parisc_ksyms.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 568b2c6..3cad8aa 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -47,11 +47,11 @@ EXPORT_SYMBOL(__cmpxchg_u64);
 EXPORT_SYMBOL(lclear_user);
 EXPORT_SYMBOL(lstrnlen_user);
 
-/* Global fixups */
-extern void fixup_get_user_skip_1(void);
-extern void fixup_get_user_skip_2(void);
-extern void fixup_put_user_skip_1(void);
-extern void fixup_put_user_skip_2(void);
+/* Global fixups - defined as int to avoid creation of function pointers */
+extern int fixup_get_user_skip_1;
+extern int fixup_get_user_skip_2;
+extern int fixup_put_user_skip_1;
+extern int fixup_put_user_skip_2;
 EXPORT_SYMBOL(fixup_get_user_skip_1);
 EXPORT_SYMBOL(fixup_get_user_skip_2);
 EXPORT_SYMBOL(fixup_put_user_skip_1);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 057/143] parisc: Fix kernel crash with reversed copy_from_user()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (55 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 056/143] parisc: Avoid function pointers for kernel exception routines Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 058/143] ALSA: timer: Use mod_timer() for rearming the system timer Willy Tarreau
                   ` (86 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Helge Deller, Kees Cook, Greg Kroah-Hartman, Willy Tarreau

From: Helge Deller <deller@gmx.de>

commit ef72f3110d8b19f4c098a0bff7ed7d11945e70c6 upstream.

The kernel module testcase (lib/test_user_copy.c) exhibited a kernel
crash on parisc if the parameters for copy_from_user were reversed
("illegal reversed copy_to_user" testcase).

Fix this potential crash by checking the fault handler if the faulting
address is in the exception table.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/parisc/kernel/traps.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index b3f87a3..0c329b2 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -811,6 +811,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
 
 	    if (fault_space == 0 && !in_atomic())
 	    {
+		/* Clean up and return if in exception table. */
+		if (fixup_exception(regs))
+			return;
 		pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);
 		parisc_terminate("Kernel Fault", regs, code, fault_address);
 	    }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 058/143] ALSA: timer: Use mod_timer() for rearming the system timer
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (56 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 057/143] parisc: Fix kernel crash with reversed copy_from_user() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 059/143] net: jme: fix suspend/resume on JMC260 Willy Tarreau
                   ` (85 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Takashi Iwai, Willy Tarreau

From: Takashi Iwai <tiwai@suse.de>

commit 4a07083ed613644c96c34a7dd2853dc5d7c70902 upstream.

ALSA system timer backend stops the timer via del_timer() without sync
and leaves del_timer_sync() at the close instead.  This is because of
the restriction by the design of ALSA timer: namely, the stop callback
may be called from the timer handler, and calling the sync shall lead
to a hangup.  However, this also triggers a kernel BUG() when the
timer is rearmed immediately after stopping without sync:
 kernel BUG at kernel/time/timer.c:966!
 Call Trace:
  <IRQ>
  [<ffffffff8239c94e>] snd_timer_s_start+0x13e/0x1a0
  [<ffffffff8239e1f4>] snd_timer_interrupt+0x504/0xec0
  [<ffffffff8122fca0>] ? debug_check_no_locks_freed+0x290/0x290
  [<ffffffff8239ec64>] snd_timer_s_function+0xb4/0x120
  [<ffffffff81296b72>] call_timer_fn+0x162/0x520
  [<ffffffff81296add>] ? call_timer_fn+0xcd/0x520
  [<ffffffff8239ebb0>] ? snd_timer_interrupt+0xec0/0xec0
  ....

It's the place where add_timer() checks the pending timer.  It's clear
that this may happen after the immediate restart without sync in our
cases.

So, the workaround here is just to use mod_timer() instead of
add_timer().  This looks like a band-aid fix, but it's a right move,
as snd_timer_interrupt() takes care of the continuous rearm of timer.

Reported-by: Jiri Slaby <jslaby@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 sound/core/timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/core/timer.c b/sound/core/timer.c
index d90d8f4..38742e8 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1012,8 +1012,8 @@ static int snd_timer_s_start(struct snd_timer * timer)
 		njiff += timer->sticks - priv->correction;
 		priv->correction = 0;
 	}
-	priv->last_expires = priv->tlist.expires = njiff;
-	add_timer(&priv->tlist);
+	priv->last_expires = njiff;
+	mod_timer(&priv->tlist, njiff);
 	return 0;
 }
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 059/143] net: jme: fix suspend/resume on JMC260
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (57 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 058/143] ALSA: timer: Use mod_timer() for rearming the system timer Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 060/143] sctp: lack the check for ports in sctp_v6_cmp_addr Willy Tarreau
                   ` (84 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Diego Viola, David S . Miller, Willy Tarreau

From: Diego Viola <diego.viola@gmail.com>

commit ee50c130c82175eaa0820c96b6d3763928af2241 upstream.

The JMC260 network card fails to suspend/resume because the call to
jme_start_irq() was too early, moving the call to jme_start_irq() after
the call to jme_reset_link() makes it work.

Prior this change suspend/resume would fail unless /sys/power/pm_async=0
was explicitly specified.

Relevant bug report: https://bugzilla.kernel.org/show_bug.cgi?id=112351

Signed-off-by: Diego Viola <diego.viola@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/ethernet/jme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 070a6f1..2f4cbca 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -3290,13 +3290,14 @@ jme_resume(struct device *dev)
 		jme_reset_phy_processor(jme);
 	jme_phy_calibration(jme);
 	jme_phy_setEA(jme);
-	jme_start_irq(jme);
 	netif_device_attach(netdev);
 
 	atomic_inc(&jme->link_changing);
 
 	jme_reset_link(jme);
 
+	jme_start_irq(jme);
+
 	return 0;
 }
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 060/143] sctp: lack the check for ports in sctp_v6_cmp_addr
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (58 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 059/143] net: jme: fix suspend/resume on JMC260 Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 061/143] ipv6: re-enable fragment header matching in ipv6_find_hdr Willy Tarreau
                   ` (83 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Xin Long, David S . Miller, Willy Tarreau

From: Xin Long <lucien.xin@gmail.com>

commit 40b4f0fd74e46c017814618d67ec9127ff20f157 upstream.

As the member .cmp_addr of sctp_af_inet6, sctp_v6_cmp_addr should also check
the port of addresses, just like sctp_v4_cmp_addr, cause it's invoked by
sctp_cmp_addr_exact().

Now sctp_v6_cmp_addr just check the port when two addresses have different
family, and lack the port check for two ipv6 addresses. that will make
sctp_hash_cmp() cannot work well.

so fix it by adding ports comparison in sctp_v6_cmp_addr().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/sctp/ipv6.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index bee032a..10d3e28 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -520,6 +520,8 @@ static int sctp_v6_cmp_addr(const union sctp_addr *addr1,
 		}
 		return 0;
 	}
+	if (addr1->v6.sin6_port != addr2->v6.sin6_port)
+		return 0;
 	if (!ipv6_addr_equal(&addr1->v6.sin6_addr, &addr2->v6.sin6_addr))
 		return 0;
 	/* If this is a linklocal address, compare the scope_id. */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 061/143] ipv6: re-enable fragment header matching in ipv6_find_hdr
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (59 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 060/143] sctp: lack the check for ports in sctp_v6_cmp_addr Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 062/143] cdc_ncm: toggle altsetting to force reset before setup Willy Tarreau
                   ` (82 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Florian Westphal, David S . Miller, Willy Tarreau

From: Florian Westphal <fw@strlen.de>

commit 5d150a985520bbe3cb2aa1ceef24a7e32f20c15f upstream.

When ipv6_find_hdr is used to find a fragment header
(caller specifies target NEXTHDR_FRAGMENT) we erronously return
-ENOENT for all fragments with nonzero offset.

Before commit 9195bb8e381d, when target was specified, we did not
enter the exthdr walk loop as nexthdr == target so this used to work.

Now we do (so we can skip empty route headers). When we then stumble upon
a frag with nonzero frag_off we must return -ENOENT ("header not found")
only if the caller did not specifically request NEXTHDR_FRAGMENT.

This allows nfables exthdr expression to match ipv6 fragments, e.g. via

nft add rule ip6 filter input frag frag-off gt 0

Fixes: 9195bb8e381d ("ipv6: improve ipv6_find_hdr() to skip empty routing headers")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/ipv6/exthdrs_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 51af9d0..f66c1b6 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -257,7 +257,11 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
 						*fragoff = _frag_off;
 					return hp->nexthdr;
 				}
-				return -ENOENT;
+				if (!found)
+					return -ENOENT;
+				if (fragoff)
+					*fragoff = _frag_off;
+				break;
 			}
 			hdrlen = 8;
 		} else if (nexthdr == NEXTHDR_AUTH) {
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 062/143] cdc_ncm: toggle altsetting to force reset before setup
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (60 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 061/143] ipv6: re-enable fragment header matching in ipv6_find_hdr Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 063/143] usbnet: cleanup after bind() in probe() Willy Tarreau
                   ` (81 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bjørn Mork, David S . Miller, Greg Kroah-Hartman, Willy Tarreau

From: Bjørn Mork <bjorn@mork.no>

commit 48906f62c96cc2cd35753e59310cb70eb08cc6a5 upstream.

Some devices will silently fail setup unless they are reset first.
This is necessary even if the data interface is already in
altsetting 0, which it will be when the device is probed for the
first time.  Briefly toggling the altsetting forces a function
reset regardless of the initial state.

This fixes a setup problem observed on a number of Huawei devices,
appearing to operate in NTB-32 mode even if we explicitly set them
to NTB-16 mode.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/usb/cdc_ncm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 43afde8..74581cb 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -464,7 +464,11 @@ advance:
 
 	iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
 
-	/* reset data interface */
+	/* Reset data interface. Some devices will not reset properly
+	 * unless they are configured first.  Toggle the altsetting to
+	 * force a reset
+	 */
+	usb_set_interface(dev->udev, iface_no, data_altsetting);
 	temp = usb_set_interface(dev->udev, iface_no, 0);
 	if (temp)
 		goto error2;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 063/143] usbnet: cleanup after bind() in probe()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (61 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 062/143] cdc_ncm: toggle altsetting to force reset before setup Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 064/143] udp6: fix UDP/IPv6 encap resubmit path Willy Tarreau
                   ` (80 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, Oliver Neukum, David S . Miller, Willy Tarreau

From: Oliver Neukum <oneukum@suse.com>

commit 1666984c8625b3db19a9abc298931d35ab7bc64b upstream.

In case bind() works, but a later error forces bailing
in probe() in error cases work and a timer may be scheduled.
They must be killed. This fixes an error case related to
the double free reported in
http://www.spinics.net/lists/netdev/msg367669.html
and needs to go on top of Linus' fix to cdc-ncm.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/usb/usbnet.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index fb068ad..2255d89 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1622,6 +1622,13 @@ out3:
 	if (info->unbind)
 		info->unbind (dev, udev);
 out1:
+	/* subdrivers must undo all they did in bind() if they
+	 * fail it, but we may fail later and a deferred kevent
+	 * may trigger an error resubmitting itself and, worse,
+	 * schedule a timer. So we kill it all just in case.
+	 */
+	cancel_work_sync(&dev->kevent);
+	del_timer_sync(&dev->delay);
 	free_netdev(net);
 out:
 	return status;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 064/143] udp6: fix UDP/IPv6 encap resubmit path
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (62 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 063/143] usbnet: cleanup after bind() in probe() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 065/143] sh_eth: fix NULL pointer dereference in sh_eth_ring_format() Willy Tarreau
                   ` (79 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bill Sommerfeld, David S . Miller, Greg Kroah-Hartman, Willy Tarreau

From: Bill Sommerfeld <wsommerfeld@google.com>

commit 59dca1d8a6725a121dae6c452de0b2611d5865dc upstream.

IPv4 interprets a negative return value from a protocol handler as a
request to redispatch to a new protocol.  In contrast, IPv6 interprets a
negative value as an error, and interprets a positive value as a request
for redispatch.

UDP for IPv6 was unaware of this difference.  Change __udp6_lib_rcv() to
return a positive value for redispatch.  Note that the socket's
encap_rcv hook still needs to return a negative value to request
dispatch, and in the case of IPv6 packets, adjust IP6CB(skb)->nhoff to
identify the byte containing the next protocol.

Signed-off-by: Bill Sommerfeld <wsommerfeld@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/ipv6/udp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 7e39018..3046d02 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -839,11 +839,9 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 		int ret = udpv6_queue_rcv_skb(sk, skb);
 		sock_put(sk);
 
-		/* a return value > 0 means to resubmit the input, but
-		 * it wants the return to be -protocol, or 0
-		 */
+		/* a return value > 0 means to resubmit the input */
 		if (ret > 0)
-			return -ret;
+			return ret;
 
 		return 0;
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 065/143] sh_eth: fix NULL pointer dereference in sh_eth_ring_format()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (63 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 064/143] udp6: fix UDP/IPv6 encap resubmit path Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 066/143] net: Fix use after free in the recvmmsg exit path Willy Tarreau
                   ` (78 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sergei Shtylyov, David S . Miller, Greg Kroah-Hartman, Willy Tarreau

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

commit c1b7fca65070bfadca94dd53a4e6b71cd4f69715 upstream.

In a low memory situation, if netdev_alloc_skb() fails on a first RX ring
loop iteration  in sh_eth_ring_format(), 'rxdesc' is still NULL.  Avoid
kernel oops by adding the 'rxdesc' check after the loop.

Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/ethernet/renesas/sh_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index b93a0fb..93b6525 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1161,7 +1161,8 @@ static void sh_eth_ring_format(struct net_device *ndev)
 	mdp->dirty_rx = (u32) (i - mdp->num_rx_ring);
 
 	/* Mark the last entry as wrapping the ring. */
-	rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL);
+	if (rxdesc)
+		rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL);
 
 	memset(mdp->tx_ring, 0, tx_ringsize);
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 066/143] net: Fix use after free in the recvmmsg exit path
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (64 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 065/143] sh_eth: fix NULL pointer dereference in sh_eth_ring_format() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 067/143] farsync: fix off-by-one bug in fst_add_one Willy Tarreau
                   ` (77 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnaldo Carvalho de Melo, Alexander Potapenko, Eric Dumazet,
	Kostya Serebryany, Sasha Levin, David S . Miller,
	Greg Kroah-Hartman, Willy Tarreau

From: Arnaldo Carvalho de Melo <acme@redhat.com>

commit 34b88a68f26a75e4fded796f1a49c40f82234b7d upstream.

The syzkaller fuzzer hit the following use-after-free:

  Call Trace:
   [<ffffffff8175ea0e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:295
   [<ffffffff851cc31a>] __sys_recvmmsg+0x6fa/0x7f0 net/socket.c:2261
   [<     inline     >] SYSC_recvmmsg net/socket.c:2281
   [<ffffffff851cc57f>] SyS_recvmmsg+0x16f/0x180 net/socket.c:2270
   [<ffffffff86332bb6>] entry_SYSCALL_64_fastpath+0x16/0x7a
  arch/x86/entry/entry_64.S:185

And, as Dmitry rightly assessed, that is because we can drop the
reference and then touch it when the underlying recvmsg calls return
some packets and then hit an error, which will make recvmmsg to set
sock->sk->sk_err, oops, fix it.

Reported-and-Tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Fixes: a2e2725541fa ("net: Introduce recvmmsg socket syscall")
http://lkml.kernel.org/r/20160122211644.GC2470@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/socket.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 53b6e41..e91e8ed 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2381,31 +2381,31 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
 			break;
 	}
 
-out_put:
-	fput_light(sock->file, fput_needed);
-
 	if (err == 0)
-		return datagrams;
+		goto out_put;
 
-	if (datagrams != 0) {
+	if (datagrams == 0) {
+		datagrams = err;
+		goto out_put;
+	}
+
+	/*
+	 * We may return less entries than requested (vlen) if the
+	 * sock is non block and there aren't enough datagrams...
+	 */
+	if (err != -EAGAIN) {
 		/*
-		 * We may return less entries than requested (vlen) if the
-		 * sock is non block and there aren't enough datagrams...
+		 * ... or  if recvmsg returns an error after we
+		 * received some datagrams, where we record the
+		 * error to return on the next call or if the
+		 * app asks about it using getsockopt(SO_ERROR).
 		 */
-		if (err != -EAGAIN) {
-			/*
-			 * ... or  if recvmsg returns an error after we
-			 * received some datagrams, where we record the
-			 * error to return on the next call or if the
-			 * app asks about it using getsockopt(SO_ERROR).
-			 */
-			sock->sk->sk_err = -err;
-		}
-
-		return datagrams;
+		sock->sk->sk_err = -err;
 	}
+out_put:
+	fput_light(sock->file, fput_needed);
 
-	return err;
+	return datagrams;
 }
 
 SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 067/143] farsync: fix off-by-one bug in fst_add_one
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (65 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 066/143] net: Fix use after free in the recvmmsg exit path Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 068/143] ath9k: fix buffer overrun for ar9287 Willy Tarreau
                   ` (76 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Arnd Bergmann, David S . Miller, Willy Tarreau

From: Arnd Bergmann <arnd@arndb.de>

commit e725a66c0202b5f36c2f9d59d26a65c53bbf21f7 upstream.

gcc-6 finds an out of bounds access in the fst_add_one function
when calculating the end of the mmio area:

drivers/net/wan/farsync.c: In function 'fst_add_one':
drivers/net/wan/farsync.c:418:53: error: index 2 denotes an offset greater than size of 'u8[2][8192] {aka unsigned char[2][8192]}' [-Werror=array-bounds]
 #define BUF_OFFSET(X)   (BFM_BASE + offsetof(struct buf_window, X))
                                                     ^
include/linux/compiler-gcc.h:158:21: note: in definition of macro '__compiler_offsetof'
  __builtin_offsetof(a, b)
                     ^
drivers/net/wan/farsync.c:418:37: note: in expansion of macro 'offsetof'
 #define BUF_OFFSET(X)   (BFM_BASE + offsetof(struct buf_window, X))
                                     ^~~~~~~~
drivers/net/wan/farsync.c:2519:36: note: in expansion of macro 'BUF_OFFSET'
                                  + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER][0]);
                                    ^~~~~~~~~~

The warning is correct, but not critical because this appears
to be a write-only variable that is set by each WAN driver but
never accessed afterwards.

I'm taking the minimal fix here, using the correct pointer by
pointing 'mem_end' to the last byte inside of the register area
as all other WAN drivers do, rather than the first byte outside of
it. An alternative would be to just remove the mem_end member
entirely.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/wan/farsync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index bcfff0d..2dfa147 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -2545,7 +2545,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                 dev->mem_start   = card->phys_mem
                                  + BUF_OFFSET ( txBuffer[i][0][0]);
                 dev->mem_end     = card->phys_mem
-                                 + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER][0]);
+                                 + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER - 1][LEN_RX_BUFFER - 1]);
                 dev->base_addr   = card->pci_conf;
                 dev->irq         = card->irq;
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 068/143] ath9k: fix buffer overrun for ar9287
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (66 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 067/143] farsync: fix off-by-one bug in fst_add_one Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 069/143] qlge: Fix receive packets drop Willy Tarreau
                   ` (75 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Arnd Bergmann, David S . Miller, Willy Tarreau

From: Arnd Bergmann <arnd@arndb.de>

commit 83d6f1f15f8cce844b0a131cbc63e444620e48b5 upstream.

Code that was added back in 2.6.38 has an obvious overflow
when accessing a static array, and at the time it was added
only a code comment was put in front of it as a reminder
to have it reviewed properly.

This has not happened, but gcc-6 now points to the specific
overflow:

drivers/net/wireless/ath/ath9k/eeprom.c: In function 'ath9k_hw_get_gain_boundaries_pdadcs':
drivers/net/wireless/ath/ath9k/eeprom.c:483:44: error: array subscript is above array bounds [-Werror=array-bounds]
     maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~

It turns out that the correct array length exists in the local
'intercepts' variable of this function, so we can just use that
instead of hardcoding '4', so this patch changes all three
instances to use that variable. The other two instances were
already correct, but it's more consistent this way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 940cd2c12ebf ("ath9k_hw: merge the ar9287 version of ath9k_hw_get_gain_boundaries_pdadcs")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/wireless/ath/ath9k/eeprom.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index 971d770..2ac0548 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -408,10 +408,9 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 
 	if (match) {
 		if (AR_SREV_9287(ah)) {
-			/* FIXME: array overrun? */
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_9287[idxL].pwrPdg[i],
 						data_9287[idxL].vpdPdg[i],
@@ -421,7 +420,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 		} else if (eeprom_4k) {
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_4k[idxL].pwrPdg[i],
 						data_4k[idxL].vpdPdg[i],
@@ -431,7 +430,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 		} else {
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_def[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_def[idxL].pwrPdg[i],
 						data_def[idxL].vpdPdg[i],
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 069/143] qlge: Fix receive packets drop.
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (67 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 068/143] ath9k: fix buffer overrun for ar9287 Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 070/143] ppp: take reference on channels netns Willy Tarreau
                   ` (74 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Manish Chopra, Sony Chacko, David S . Miller, Willy Tarreau

From: Manish Chopra <manish.chopra@qlogic.com>

commit 2c9a266afefe137bff06bbe0fc48b4d3b3cb348c upstream.

When running small packets [length < 256 bytes] traffic, packets were
being dropped due to invalid data in those packets which were
delivered by the driver upto the stack. Using pci_dma_sync_single_for_cpu
ensures copying latest and updated data into skb from the receive buffer.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index f87cc21..a978cc2 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1620,7 +1620,18 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev,
 		return;
 	}
 	skb_reserve(new_skb, NET_IP_ALIGN);
+
+	pci_dma_sync_single_for_cpu(qdev->pdev,
+				    dma_unmap_addr(sbq_desc, mapaddr),
+				    dma_unmap_len(sbq_desc, maplen),
+				    PCI_DMA_FROMDEVICE);
+
 	memcpy(skb_put(new_skb, length), skb->data, length);
+
+	pci_dma_sync_single_for_device(qdev->pdev,
+				       dma_unmap_addr(sbq_desc, mapaddr),
+				       dma_unmap_len(sbq_desc, maplen),
+				       PCI_DMA_FROMDEVICE);
 	skb = new_skb;
 
 	/* Frame error, so drop the packet. */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 070/143] ppp: take reference on channels netns
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (68 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 069/143] qlge: Fix receive packets drop Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 071/143] qmi_wwan: add "D-Link DWM-221 B1" device id Willy Tarreau
                   ` (73 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Guillaume Nault, David S . Miller, Willy Tarreau

From: Guillaume Nault <g.nault@alphalink.fr>

commit 1f461dcdd296eecedaffffc6bae2bfa90bd7eb89 upstream.

Let channels hold a reference on their network namespace.
Some channel types, like ppp_async and ppp_synctty, can have their
userspace controller running in a different namespace. Therefore they
can't rely on them to preclude their netns from being removed from
under them.

==================================================================
BUG: KASAN: use-after-free in ppp_unregister_channel+0x372/0x3a0 at
addr ffff880064e217e0
Read of size 8 by task syz-executor/11581
=============================================================================
BUG net_namespace (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Allocated in copy_net_ns+0x6b/0x1a0 age=92569 cpu=3 pid=6906
[<      none      >] ___slab_alloc+0x4c7/0x500 kernel/mm/slub.c:2440
[<      none      >] __slab_alloc+0x4c/0x90 kernel/mm/slub.c:2469
[<     inline     >] slab_alloc_node kernel/mm/slub.c:2532
[<     inline     >] slab_alloc kernel/mm/slub.c:2574
[<      none      >] kmem_cache_alloc+0x23a/0x2b0 kernel/mm/slub.c:2579
[<     inline     >] kmem_cache_zalloc kernel/include/linux/slab.h:597
[<     inline     >] net_alloc kernel/net/core/net_namespace.c:325
[<      none      >] copy_net_ns+0x6b/0x1a0 kernel/net/core/net_namespace.c:360
[<      none      >] create_new_namespaces+0x2f6/0x610 kernel/kernel/nsproxy.c:95
[<      none      >] copy_namespaces+0x297/0x320 kernel/kernel/nsproxy.c:150
[<      none      >] copy_process.part.35+0x1bf4/0x5760 kernel/kernel/fork.c:1451
[<     inline     >] copy_process kernel/kernel/fork.c:1274
[<      none      >] _do_fork+0x1bc/0xcb0 kernel/kernel/fork.c:1723
[<     inline     >] SYSC_clone kernel/kernel/fork.c:1832
[<      none      >] SyS_clone+0x37/0x50 kernel/kernel/fork.c:1826
[<      none      >] entry_SYSCALL_64_fastpath+0x16/0x7a kernel/arch/x86/entry/entry_64.S:185

INFO: Freed in net_drop_ns+0x67/0x80 age=575 cpu=2 pid=2631
[<      none      >] __slab_free+0x1fc/0x320 kernel/mm/slub.c:2650
[<     inline     >] slab_free kernel/mm/slub.c:2805
[<      none      >] kmem_cache_free+0x2a0/0x330 kernel/mm/slub.c:2814
[<     inline     >] net_free kernel/net/core/net_namespace.c:341
[<      none      >] net_drop_ns+0x67/0x80 kernel/net/core/net_namespace.c:348
[<      none      >] cleanup_net+0x4e5/0x600 kernel/net/core/net_namespace.c:448
[<      none      >] process_one_work+0x794/0x1440 kernel/kernel/workqueue.c:2036
[<      none      >] worker_thread+0xdb/0xfc0 kernel/kernel/workqueue.c:2170
[<      none      >] kthread+0x23f/0x2d0 kernel/drivers/block/aoe/aoecmd.c:1303
[<      none      >] ret_from_fork+0x3f/0x70 kernel/arch/x86/entry/entry_64.S:468
INFO: Slab 0xffffea0001938800 objects=3 used=0 fp=0xffff880064e20000
flags=0x5fffc0000004080
INFO: Object 0xffff880064e20000 @offset=0 fp=0xffff880064e24200

CPU: 1 PID: 11581 Comm: syz-executor Tainted: G    B           4.4.0+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 00000000ffffffff ffff8800662c7790 ffffffff8292049d ffff88003e36a300
 ffff880064e20000 ffff880064e20000 ffff8800662c77c0 ffffffff816f2054
 ffff88003e36a300 ffffea0001938800 ffff880064e20000 0000000000000000
Call Trace:
 [<     inline     >] __dump_stack kernel/lib/dump_stack.c:15
 [<ffffffff8292049d>] dump_stack+0x6f/0xa2 kernel/lib/dump_stack.c:50
 [<ffffffff816f2054>] print_trailer+0xf4/0x150 kernel/mm/slub.c:654
 [<ffffffff816f875f>] object_err+0x2f/0x40 kernel/mm/slub.c:661
 [<     inline     >] print_address_description kernel/mm/kasan/report.c:138
 [<ffffffff816fb0c5>] kasan_report_error+0x215/0x530 kernel/mm/kasan/report.c:236
 [<     inline     >] kasan_report kernel/mm/kasan/report.c:259
 [<ffffffff816fb4de>] __asan_report_load8_noabort+0x3e/0x40 kernel/mm/kasan/report.c:280
 [<     inline     >] ? ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ? ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ? ppp_pernet kernel/drivers/net/ppp/ppp_generic.c:293
 [<ffffffff83ad6f26>] ? ppp_unregister_channel+0xe6/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<ffffffff83ae18f3>] ppp_asynctty_close+0xa3/0x130 kernel/drivers/net/ppp/ppp_async.c:241
 [<ffffffff83ae1850>] ? async_lcp_peek+0x5b0/0x5b0 kernel/drivers/net/ppp/ppp_async.c:1000
 [<ffffffff82c33239>] tty_ldisc_close.isra.1+0x99/0xe0 kernel/drivers/tty/tty_ldisc.c:478
 [<ffffffff82c332c0>] tty_ldisc_kill+0x40/0x170 kernel/drivers/tty/tty_ldisc.c:744
 [<ffffffff82c34943>] tty_ldisc_release+0x1b3/0x260 kernel/drivers/tty/tty_ldisc.c:772
 [<ffffffff82c1ef21>] tty_release+0xac1/0x13e0 kernel/drivers/tty/tty_io.c:1901
 [<ffffffff82c1e460>] ? release_tty+0x320/0x320 kernel/drivers/tty/tty_io.c:1688
 [<ffffffff8174de36>] __fput+0x236/0x780 kernel/fs/file_table.c:208
 [<ffffffff8174e405>] ____fput+0x15/0x20 kernel/fs/file_table.c:244
 [<ffffffff813595ab>] task_work_run+0x16b/0x200 kernel/kernel/task_work.c:115
 [<     inline     >] exit_task_work kernel/include/linux/task_work.h:21
 [<ffffffff81307105>] do_exit+0x8b5/0x2c60 kernel/kernel/exit.c:750
 [<ffffffff813fdd20>] ? debug_check_no_locks_freed+0x290/0x290 kernel/kernel/locking/lockdep.c:4123
 [<ffffffff81306850>] ? mm_update_next_owner+0x6f0/0x6f0 kernel/kernel/exit.c:357
 [<ffffffff813215e6>] ? __dequeue_signal+0x136/0x470 kernel/kernel/signal.c:550
 [<ffffffff8132067b>] ? recalc_sigpending_tsk+0x13b/0x180 kernel/kernel/signal.c:145
 [<ffffffff81309628>] do_group_exit+0x108/0x330 kernel/kernel/exit.c:880
 [<ffffffff8132b9d4>] get_signal+0x5e4/0x14f0 kernel/kernel/signal.c:2307
 [<     inline     >] ? kretprobe_table_lock kernel/kernel/kprobes.c:1113
 [<ffffffff8151d355>] ? kprobe_flush_task+0xb5/0x450 kernel/kernel/kprobes.c:1158
 [<ffffffff8115f7d3>] do_signal+0x83/0x1c90 kernel/arch/x86/kernel/signal.c:712
 [<ffffffff8151d2a0>] ? recycle_rp_inst+0x310/0x310 kernel/include/linux/list.h:655
 [<ffffffff8115f750>] ? setup_sigcontext+0x780/0x780 kernel/arch/x86/kernel/signal.c:165
 [<ffffffff81380864>] ? finish_task_switch+0x424/0x5f0 kernel/kernel/sched/core.c:2692
 [<     inline     >] ? finish_lock_switch kernel/kernel/sched/sched.h:1099
 [<ffffffff81380560>] ? finish_task_switch+0x120/0x5f0 kernel/kernel/sched/core.c:2678
 [<     inline     >] ? context_switch kernel/kernel/sched/core.c:2807
 [<ffffffff85d794e9>] ? __schedule+0x919/0x1bd0 kernel/kernel/sched/core.c:3283
 [<ffffffff81003901>] exit_to_usermode_loop+0xf1/0x1a0 kernel/arch/x86/entry/common.c:247
 [<     inline     >] prepare_exit_to_usermode kernel/arch/x86/entry/common.c:282
 [<ffffffff810062ef>] syscall_return_slowpath+0x19f/0x210 kernel/arch/x86/entry/common.c:344
 [<ffffffff85d88022>] int_ret_from_sys_call+0x25/0x9f kernel/arch/x86/entry/entry_64.S:281
Memory state around the buggy address:
 ffff880064e21680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff880064e21780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff880064e21800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
Reported-by: Baozeng Ding <sploving1@gmail.com>
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/ppp/ppp_generic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index a2d7d5f..14a8d29 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -2220,7 +2220,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan)
 
 	pch->ppp = NULL;
 	pch->chan = chan;
-	pch->chan_net = net;
+	pch->chan_net = get_net(net);
 	chan->ppp = pch;
 	init_ppp_file(&pch->file, CHANNEL);
 	pch->file.hdrlen = chan->hdrlen;
@@ -2317,6 +2317,8 @@ ppp_unregister_channel(struct ppp_channel *chan)
 	spin_lock_bh(&pn->all_channels_lock);
 	list_del(&pch->list);
 	spin_unlock_bh(&pn->all_channels_lock);
+	put_net(pch->chan_net);
+	pch->chan_net = NULL;
 
 	pch->file.dead = 1;
 	wake_up_interruptible(&pch->file.rwait);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 071/143] qmi_wwan: add "D-Link DWM-221 B1" device id
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (69 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 070/143] ppp: take reference on channels netns Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 072/143] ipv4: l2tp: fix a potential issue in l2tp_ip_recv Willy Tarreau
                   ` (72 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Bjørn Mork, David S . Miller, Willy Tarreau

From: Bjørn Mork <bjorn@mork.no>

commit e84810c7b85a2d7897797b3ad3e879168a8e032a upstream.

Thomas reports:
"Windows:

00 diagnostics
01 modem
02 at-port
03 nmea
04 nic

Linux:

T:  Bus=02 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=2001 ProdID=7e19 Rev=02.32
S:  Manufacturer=Mobile Connect
S:  Product=Mobile Connect
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
I:  If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
I:  If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage"

Reported-by: Thomas Schäfer <tschaefer@t-online.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/usb/qmi_wwan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 0244a1f..12aaf1f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -724,6 +724,7 @@ static const struct usb_device_id products[] = {
 	{QMI_FIXED_INTF(0x19d2, 0x1426, 2)},	/* ZTE MF91 */
 	{QMI_FIXED_INTF(0x19d2, 0x1428, 2)},	/* Telewell TW-LTE 4G v2 */
 	{QMI_FIXED_INTF(0x19d2, 0x2002, 4)},	/* ZTE (Vodafone) K3765-Z */
+	{QMI_FIXED_INTF(0x2001, 0x7e19, 4)},	/* D-Link DWM-221 B1 */
 	{QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)},    /* Sierra Wireless MC7700 */
 	{QMI_FIXED_INTF(0x114f, 0x68a2, 8)},    /* Sierra Wireless MC7750 */
 	{QMI_FIXED_INTF(0x1199, 0x68a2, 8)},	/* Sierra Wireless MC7710 in QMI mode */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 072/143] ipv4: l2tp: fix a potential issue in l2tp_ip_recv
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (70 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 071/143] qmi_wwan: add "D-Link DWM-221 B1" device id Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 073/143] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv Willy Tarreau
                   ` (71 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Haishuang Yan, David S . Miller, Willy Tarreau

From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

commit 5745b8232e942abd5e16e85fa9b27cc21324acf0 upstream.

pskb_may_pull() can change skb->data, so we have to load ptr/optr at the
right place.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/l2tp/l2tp_ip.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index da1a1ce..07f8b97 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -123,12 +123,11 @@ static int l2tp_ip_recv(struct sk_buff *skb)
 	struct l2tp_tunnel *tunnel = NULL;
 	int length;
 
-	/* Point to L2TP header */
-	optr = ptr = skb->data;
-
 	if (!pskb_may_pull(skb, 4))
 		goto discard;
 
+	/* Point to L2TP header */
+	optr = ptr = skb->data;
 	session_id = ntohl(*((__be32 *) ptr));
 	ptr += 4;
 
@@ -156,6 +155,9 @@ static int l2tp_ip_recv(struct sk_buff *skb)
 		if (!pskb_may_pull(skb, length))
 			goto discard;
 
+		/* Point to L2TP header */
+		optr = ptr = skb->data;
+		ptr += 4;
 		pr_debug("%s: ip recv\n", tunnel->name);
 		print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length);
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 073/143] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (71 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 072/143] ipv4: l2tp: fix a potential issue in l2tp_ip_recv Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 074/143] ip6_tunnel: set rtnl_link_ops before calling register_netdevice Willy Tarreau
                   ` (70 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Haishuang Yan, David S . Miller, Willy Tarreau

From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

commit be447f305494e019dfc37ea4cdf3b0e4200b4eba upstream.

pskb_may_pull() can change skb->data, so we have to load ptr/optr at the
right place.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/l2tp/l2tp_ip6.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index e6e8408..db96af9 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -135,12 +135,11 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
 	struct l2tp_tunnel *tunnel = NULL;
 	int length;
 
-	/* Point to L2TP header */
-	optr = ptr = skb->data;
-
 	if (!pskb_may_pull(skb, 4))
 		goto discard;
 
+	/* Point to L2TP header */
+	optr = ptr = skb->data;
 	session_id = ntohl(*((__be32 *) ptr));
 	ptr += 4;
 
@@ -168,6 +167,9 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
 		if (!pskb_may_pull(skb, length))
 			goto discard;
 
+		/* Point to L2TP header */
+		optr = ptr = skb->data;
+		ptr += 4;
 		pr_debug("%s: ip recv\n", tunnel->name);
 		print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length);
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 074/143] ip6_tunnel: set rtnl_link_ops before calling register_netdevice
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (72 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 073/143] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 075/143] usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler() Willy Tarreau
                   ` (69 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Thadeu Lima de Souza Cascardo, David S . Miller, Willy Tarreau

From: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>

commit b6ee376cb0b7fb4e7e07d6cd248bd40436fb9ba6 upstream.

When creating an ip6tnl tunnel with ip tunnel, rtnl_link_ops is not set
before ip6_tnl_create2 is called. When register_netdevice is called, there
is no linkinfo attribute in the NEWLINK message because of that.

Setting rtnl_link_ops before calling register_netdevice fixes that.

Fixes: 0b112457229d ("ip6tnl: add support of link creation via rtnl")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/ipv6/ip6_tunnel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 14f46af..31bab1a 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -266,12 +266,12 @@ static int ip6_tnl_create2(struct net_device *dev)
 
 	t = netdev_priv(dev);
 
+	dev->rtnl_link_ops = &ip6_link_ops;
 	err = register_netdevice(dev);
 	if (err < 0)
 		goto out;
 
 	strcpy(t->parms.name, dev->name);
-	dev->rtnl_link_ops = &ip6_link_ops;
 
 	dev_hold(dev);
 	ip6_tnl_link(ip6n, t);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 075/143] usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (73 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 074/143] ip6_tunnel: set rtnl_link_ops before calling register_netdevice Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 076/143] usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer Willy Tarreau
                   ` (68 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yoshihiro Shimoda, stable, Felipe Balbi, Willy Tarreau

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 894f2fc44f2f3f48c36c973b1123f6ab298be160 upstream.

When unexpected situation happened (e.g. tx/rx irq happened while
DMAC is used), the usbhsf_pkt_handler() was possible to cause NULL
pointer dereference like the followings:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000007 [#1] SMP ARM
Modules linked in: usb_f_acm u_serial g_serial libcomposite
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.5.0-rc6-00842-gac57066-dirty #63
Hardware name: Generic R8A7790 (Flattened Device Tree)
task: c0729c00 ti: c0724000 task.ti: c0724000
PC is at 0x0
LR is at usbhsf_pkt_handler+0xac/0x118
pc : [<00000000>]    lr : [<c03257e0>]    psr: 60000193
sp : c0725db8  ip : 00000000  fp : c0725df4
r10: 00000001  r9 : 00000193  r8 : ef3ccab4
r7 : ef3cca10  r6 : eea4586c  r5 : 00000000  r4 : ef19ceb4
r3 : 00000000  r2 : 0000009c  r1 : c0725dc4  r0 : ef19ceb4

This patch adds a condition to avoid the dereference.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/renesas_usbhs/fifo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 45b9401..540e688 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -166,7 +166,8 @@ static int usbhsf_pkt_handler(struct usbhs_pipe *pipe, int type)
 		goto __usbhs_pkt_handler_end;
 	}
 
-	ret = func(pkt, &is_done);
+	if (likely(func))
+		ret = func(pkt, &is_done);
 
 	if (is_done)
 		__usbhsf_pkt_del(pkt);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 076/143] usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (74 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 075/143] usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 077/143] ext4: add lockdep annotations for i_data_sem Willy Tarreau
                   ` (67 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yoshihiro Shimoda, stable, Felipe Balbi, Willy Tarreau

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

commit 6490865c67825277b29638e839850882600b48ec upstream.

This patch adds a code to surely disable TX IRQ of the pipe before
starting TX DMAC transfer. Otherwise, a lot of unnecessary TX IRQs
may happen in rare cases when DMAC is used.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <stable@vger.kernel.org> # v3.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/renesas_usbhs/fifo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 540e688..157a9f9 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -934,6 +934,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done)
 
 	pkt->trans = len;
 
+	usbhsf_tx_irq_ctrl(pipe, 0);
 	INIT_WORK(&pkt->work, xfer_work);
 	schedule_work(&pkt->work);
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 077/143] ext4: add lockdep annotations for i_data_sem
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (75 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 076/143] usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 078/143] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior Willy Tarreau
                   ` (66 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Theodore Ts'o, Greg Kroah-Hartman, Willy Tarreau

From: Theodore Ts'o <tytso@mit.edu>

commit daf647d2dd58cec59570d7698a45b98e580f2076 upstream.

With the internal Quota feature, mke2fs creates empty quota inodes and
quota usage tracking is enabled as soon as the file system is mounted.
Since quotacheck is no longer preallocating all of the blocks in the
quota inode that are likely needed to be written to, we are now seeing
a lockdep false positive caused by needing to allocate a quota block
from inside ext4_map_blocks(), while holding i_data_sem for a data
inode.  This results in this complaint:

  Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(&ei->i_data_sem);
                                lock(&s->s_dquot.dqio_mutex);
                                lock(&ei->i_data_sem);
   lock(&s->s_dquot.dqio_mutex);

Google-Bug-Id: 27907753

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/ext4/ext4.h        | 23 +++++++++++++++++++++++
 fs/ext4/move_extent.c | 11 +++++++++--
 fs/ext4/super.c       | 25 +++++++++++++++++++++++--
 3 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 6f74b89..046e3e9 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -851,6 +851,29 @@ do {									       \
 #include "extents_status.h"
 
 /*
+ * Lock subclasses for i_data_sem in the ext4_inode_info structure.
+ *
+ * These are needed to avoid lockdep false positives when we need to
+ * allocate blocks to the quota inode during ext4_map_blocks(), while
+ * holding i_data_sem for a normal (non-quota) inode.  Since we don't
+ * do quota tracking for the quota inode, this avoids deadlock (as
+ * well as infinite recursion, since it isn't turtles all the way
+ * down...)
+ *
+ *  I_DATA_SEM_NORMAL - Used for most inodes
+ *  I_DATA_SEM_OTHER  - Used by move_inode.c for the second normal inode
+ *			  where the second inode has larger inode number
+ *			  than the first
+ *  I_DATA_SEM_QUOTA  - Used for quota inodes only
+ */
+enum {
+	I_DATA_SEM_NORMAL = 0,
+	I_DATA_SEM_OTHER,
+	I_DATA_SEM_QUOTA,
+};
+
+
+/*
  * fourth extended file system inode data in memory
  */
 struct ext4_inode_info {
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 3dcbf36..ad52ace 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -154,10 +154,10 @@ ext4_double_down_write_data_sem(struct inode *first, struct inode *second)
 {
 	if (first < second) {
 		down_write(&EXT4_I(first)->i_data_sem);
-		down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING);
+		down_write_nested(&EXT4_I(second)->i_data_sem, I_DATA_SEM_OTHER);
 	} else {
 		down_write(&EXT4_I(second)->i_data_sem);
-		down_write_nested(&EXT4_I(first)->i_data_sem, SINGLE_DEPTH_NESTING);
+		down_write_nested(&EXT4_I(first)->i_data_sem, I_DATA_SEM_OTHER);
 
 	}
 }
@@ -1117,6 +1117,13 @@ mext_check_arguments(struct inode *orig_inode,
 		return -EINVAL;
 	}
 
+	if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) {
+		ext4_debug("ext4 move extent: The argument files should "
+			"not be quota files [ino:orig %lu, donor %lu]\n",
+			orig_inode->i_ino, donor_inode->i_ino);
+		return -EBUSY;
+	}
+
 	/* Ext4 move extent supports only extent based file */
 	if (!(ext4_test_inode_flag(orig_inode, EXT4_INODE_EXTENTS))) {
 		ext4_debug("ext4 move extent: orig file is not extents "
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a7e0797..063eb50 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4984,6 +4984,20 @@ static int ext4_quota_on_mount(struct super_block *sb, int type)
 					EXT4_SB(sb)->s_jquota_fmt, type);
 }
 
+static void lockdep_set_quota_inode(struct inode *inode, int subclass)
+{
+	struct ext4_inode_info *ei = EXT4_I(inode);
+
+	/* The first argument of lockdep_set_subclass has to be
+	 * *exactly* the same as the argument to init_rwsem() --- in
+	 * this case, in init_once() --- or lockdep gets unhappy
+	 * because the name of the lock is set using the
+	 * stringification of the argument to init_rwsem().
+	 */
+	(void) ei;	/* shut up clang warning if !CONFIG_LOCKDEP */
+	lockdep_set_subclass(&ei->i_data_sem, subclass);
+}
+
 /*
  * Standard function to be called on quota_on
  */
@@ -5023,8 +5037,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
 		if (err)
 			return err;
 	}
-
-	return dquot_quota_on(sb, type, format_id, path);
+	lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA);
+	err = dquot_quota_on(sb, type, format_id, path);
+	if (err)
+		lockdep_set_quota_inode(path->dentry->d_inode,
+					     I_DATA_SEM_NORMAL);
+	return err;
 }
 
 static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
@@ -5050,8 +5068,11 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
 
 	/* Don't account quota for quota files to avoid recursion */
 	qf_inode->i_flags |= S_NOQUOTA;
+	lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA);
 	err = dquot_enable(qf_inode, type, format_id, flags);
 	iput(qf_inode);
+	if (err)
+		lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL);
 
 	return err;
 }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 078/143] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (76 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 077/143] ext4: add lockdep annotations for i_data_sem Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 079/143] drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and older) Willy Tarreau
                   ` (65 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Alan Stern, Jiri Kosina, Willy Tarreau

From: Alan Stern <stern@rowland.harvard.edu>

commit 972e6a993f278b416a8ee3ec65475724fc36feb2 upstream.

The usbhid driver has inconsistently duplicated code in its post-reset,
resume, and reset-resume pathways.

	reset-resume doesn't check HID_STARTED before trying to
	restart the I/O queues.

	resume fails to clear the HID_SUSPENDED flag if HID_STARTED
	isn't set.

	resume calls usbhid_restart_queues() with usbhid->lock held
	and the others call it without holding the lock.

The first item in particular causes a problem following a reset-resume
if the driver hasn't started up its I/O.  URB submission fails because
usbhid->urbin is NULL, and this triggers an unending reset-retry loop.

This patch fixes the problem by creating a new subroutine,
hid_restart_io(), to carry out all the common activities.  It also
adds some checks that were missing in the original code:

	After a reset, there's no need to clear any halted endpoints.

	After a resume, if a reset is pending there's no need to
	restart any I/O until the reset is finished.

	After a resume, if the interrupt-IN endpoint is halted there's
	no need to submit the input URB until the halt has been
	cleared.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Daniel Fraga <fragabr@gmail.com>
Tested-by: Daniel Fraga <fragabr@gmail.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/hid/usbhid/hid-core.c | 73 ++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 5da58e3..92aef982 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -988,14 +988,6 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co
 	return ret;
 }
 
-static void usbhid_restart_queues(struct usbhid_device *usbhid)
-{
-	if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl))
-		usbhid_restart_out_queue(usbhid);
-	if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl))
-		usbhid_restart_ctrl_queue(usbhid);
-}
-
 static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
 {
 	struct usbhid_device *usbhid = hid->driver_data;
@@ -1412,6 +1404,37 @@ static void hid_cease_io(struct usbhid_device *usbhid)
 	usb_kill_urb(usbhid->urbout);
 }
 
+static void hid_restart_io(struct hid_device *hid)
+{
+	struct usbhid_device *usbhid = hid->driver_data;
+	int clear_halt = test_bit(HID_CLEAR_HALT, &usbhid->iofl);
+	int reset_pending = test_bit(HID_RESET_PENDING, &usbhid->iofl);
+
+	spin_lock_irq(&usbhid->lock);
+	clear_bit(HID_SUSPENDED, &usbhid->iofl);
+	usbhid_mark_busy(usbhid);
+
+	if (clear_halt || reset_pending)
+		schedule_work(&usbhid->reset_work);
+	usbhid->retry_delay = 0;
+	spin_unlock_irq(&usbhid->lock);
+
+	if (reset_pending || !test_bit(HID_STARTED, &usbhid->iofl))
+		return;
+
+	if (!clear_halt) {
+		if (hid_start_in(hid) < 0)
+			hid_io_error(hid);
+	}
+
+	spin_lock_irq(&usbhid->lock);
+	if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl))
+		usbhid_restart_out_queue(usbhid);
+	if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl))
+		usbhid_restart_ctrl_queue(usbhid);
+	spin_unlock_irq(&usbhid->lock);
+}
+
 /* Treat USB reset pretty much the same as suspend/resume */
 static int hid_pre_reset(struct usb_interface *intf)
 {
@@ -1461,14 +1484,14 @@ static int hid_post_reset(struct usb_interface *intf)
 		return 1;
 	}
 
+	/* No need to do another reset or clear a halted endpoint */
 	spin_lock_irq(&usbhid->lock);
 	clear_bit(HID_RESET_PENDING, &usbhid->iofl);
+	clear_bit(HID_CLEAR_HALT, &usbhid->iofl);
 	spin_unlock_irq(&usbhid->lock);
 	hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0);
-	status = hid_start_in(hid);
-	if (status < 0)
-		hid_io_error(hid);
-	usbhid_restart_queues(usbhid);
+
+	hid_restart_io(hid);
 
 	return 0;
 }
@@ -1491,25 +1514,9 @@ void usbhid_put_power(struct hid_device *hid)
 #ifdef CONFIG_PM
 static int hid_resume_common(struct hid_device *hid, bool driver_suspended)
 {
-	struct usbhid_device *usbhid = hid->driver_data;
-	int status;
-
-	spin_lock_irq(&usbhid->lock);
-	clear_bit(HID_SUSPENDED, &usbhid->iofl);
-	usbhid_mark_busy(usbhid);
-
-	if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) ||
-			test_bit(HID_RESET_PENDING, &usbhid->iofl))
-		schedule_work(&usbhid->reset_work);
-	usbhid->retry_delay = 0;
-
-	usbhid_restart_queues(usbhid);
-	spin_unlock_irq(&usbhid->lock);
-
-	status = hid_start_in(hid);
-	if (status < 0)
-		hid_io_error(hid);
+	int status = 0;
 
+	hid_restart_io(hid);
 	if (driver_suspended && hid->driver && hid->driver->resume)
 		status = hid->driver->resume(hid);
 	return status;
@@ -1576,12 +1583,8 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
 static int hid_resume(struct usb_interface *intf)
 {
 	struct hid_device *hid = usb_get_intfdata (intf);
-	struct usbhid_device *usbhid = hid->driver_data;
 	int status;
 
-	if (!test_bit(HID_STARTED, &usbhid->iofl))
-		return 0;
-
 	status = hid_resume_common(hid, true);
 	dev_dbg(&intf->dev, "resume status %d\n", status);
 	return 0;
@@ -1590,10 +1593,8 @@ static int hid_resume(struct usb_interface *intf)
 static int hid_reset_resume(struct usb_interface *intf)
 {
 	struct hid_device *hid = usb_get_intfdata(intf);
-	struct usbhid_device *usbhid = hid->driver_data;
 	int status;
 
-	clear_bit(HID_SUSPENDED, &usbhid->iofl);
 	status = hid_post_reset(intf);
 	if (status >= 0 && hid->driver && hid->driver->reset_resume) {
 		int ret = hid->driver->reset_resume(hid);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 079/143] drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and older)
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (77 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 078/143] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 080/143] [media] usbvision-video: fix memory leak of alt_max_pkt_size Willy Tarreau
                   ` (64 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Nicolai Hähnle, Greg Kroah-Hartman, Willy Tarreau

From: Nicolai Hähnle <nicolai.haehnle@amd.com>

[Backport of upstream commit f6ff4f67cdf8455d0a4226eeeaf5af17c37d05eb, with
 an additional NULL pointer guard that is required for kernels 3.17 and older.

 To be precise, any kernel that does *not* have commit 954605ca3 "drm/radeon:
 use common fence implementation for fences, v4" requires this additional
 NULL pointer guard.]

An arbitrary amount of time can pass between spin_unlock and
radeon_fence_wait_any, so we need to ensure that nobody frees the
fences from under us.

Based on the analogous fix for amdgpu.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1 + fix)
Tested-by: Lutz Euler <lutz.euler@freenet.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/gpu/drm/radeon/radeon_sa.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c
index f0bac68..8962411 100644
--- a/drivers/gpu/drm/radeon/radeon_sa.c
+++ b/drivers/gpu/drm/radeon/radeon_sa.c
@@ -349,8 +349,15 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
 			/* see if we can skip over some allocations */
 		} while (radeon_sa_bo_next_hole(sa_manager, fences, tries));
 
+		for (i = 0; i < RADEON_NUM_RINGS; ++i) {
+			if (fences[i])
+				radeon_fence_ref(fences[i]);
+		}
+
 		spin_unlock(&sa_manager->wq.lock);
 		r = radeon_fence_wait_any(rdev, fences, false);
+		for (i = 0; i < RADEON_NUM_RINGS; ++i)
+			radeon_fence_unref(&fences[i]);
 		spin_lock(&sa_manager->wq.lock);
 		/* if we have nothing to wait for block */
 		if (r == -ENOENT && block) {
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 080/143] [media] usbvision-video: fix memory leak of alt_max_pkt_size
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (78 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 079/143] drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and older) Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 081/143] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Willy Tarreau
                   ` (63 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexey Khoroshilov, Hans Verkuil, Mauro Carvalho Chehab, Willy Tarreau

From: Alexey Khoroshilov <khoroshilov@ispras.ru>

commit 090c65b694c362adb19ec9c27de216a808ee443c upstream.

1. usbvision->alt_max_pkt_size is not deallocated anywhere.
2. if allocation of usbvision->alt_max_pkt_size fails,
there is no proper deallocation of already acquired resources.
The patch adds kfree(usbvision->alt_max_pkt_size) to
usbvision_release() as soon as other deallocations happen there.
It calls usbvision_release() if allocation of
usbvision->alt_max_pkt_size fails as soon as usbvision_release()
is safe to work with incompletely initialized usbvision structure.
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/media/usb/usbvision/usbvision-video.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c
index d34c2af..443e7833 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1459,6 +1459,7 @@ static void usbvision_release(struct usb_usbvision *usbvision)
 
 	usbvision_remove_sysfs(usbvision->vdev);
 	usbvision_unregister_video(usbvision);
+	kfree(usbvision->alt_max_pkt_size);
 
 	usb_free_urb(usbvision->ctrl_urb);
 
@@ -1574,6 +1575,7 @@ static int usbvision_probe(struct usb_interface *intf,
 	usbvision->alt_max_pkt_size = kmalloc(32 * usbvision->num_alt, GFP_KERNEL);
 	if (usbvision->alt_max_pkt_size == NULL) {
 		dev_err(&intf->dev, "usbvision: out of memory!\n");
+		usbvision_release(usbvision);
 		return -ENOMEM;
 	}
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 081/143] usbvision: fix leak of usb_dev on failure paths in usbvision_probe()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (79 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 080/143] [media] usbvision-video: fix memory leak of alt_max_pkt_size Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 082/143] usbvision: fix crash on detecting device with invalid configuration Willy Tarreau
                   ` (62 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexey Khoroshilov, Hans Verkuil, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, Willy Tarreau

From: Alexey Khoroshilov <khoroshilov@ispras.ru>

commit afd270d1a45043cef14341bcceff62ed50e8dc9a upstream.

There is no usb_put_dev() on failure paths in usbvision_probe().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/media/usb/usbvision/usbvision-video.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c
index 443e7833..017f4d1 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1521,7 +1521,7 @@ static int usbvision_probe(struct usb_interface *intf,
 	const struct usb_host_interface *interface;
 	struct usb_usbvision *usbvision = NULL;
 	const struct usb_endpoint_descriptor *endpoint;
-	int model, i;
+	int model, i, ret;
 
 	PDEBUG(DBG_PROBE, "VID=%#04x, PID=%#04x, ifnum=%u",
 				dev->descriptor.idVendor,
@@ -1530,7 +1530,8 @@ static int usbvision_probe(struct usb_interface *intf,
 	model = devid->driver_info;
 	if (model < 0 || model >= usbvision_device_data_size) {
 		PDEBUG(DBG_PROBE, "model out of bounds %d", model);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err_usb;
 	}
 	printk(KERN_INFO "%s: %s found\n", __func__,
 				usbvision_device_data[model].model_string);
@@ -1545,18 +1546,21 @@ static int usbvision_probe(struct usb_interface *intf,
 		    __func__, ifnum);
 		dev_err(&intf->dev, "%s: Endpoint attributes %d",
 		    __func__, endpoint->bmAttributes);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err_usb;
 	}
 	if (usb_endpoint_dir_out(endpoint)) {
 		dev_err(&intf->dev, "%s: interface %d. has ISO OUT endpoint!\n",
 		    __func__, ifnum);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err_usb;
 	}
 
 	usbvision = usbvision_alloc(dev, intf);
 	if (usbvision == NULL) {
 		dev_err(&intf->dev, "%s: couldn't allocate USBVision struct\n", __func__);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto err_usb;
 	}
 
 	if (dev->descriptor.bNumConfigurations > 1)
@@ -1575,8 +1579,8 @@ static int usbvision_probe(struct usb_interface *intf,
 	usbvision->alt_max_pkt_size = kmalloc(32 * usbvision->num_alt, GFP_KERNEL);
 	if (usbvision->alt_max_pkt_size == NULL) {
 		dev_err(&intf->dev, "usbvision: out of memory!\n");
-		usbvision_release(usbvision);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto err_pkt;
 	}
 
 	for (i = 0; i < usbvision->num_alt; i++) {
@@ -1611,6 +1615,12 @@ static int usbvision_probe(struct usb_interface *intf,
 
 	PDEBUG(DBG_PROBE, "success");
 	return 0;
+
+err_pkt:
+	usbvision_release(usbvision);
+err_usb:
+	usb_put_dev(dev);
+	return ret;
 }
 
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 082/143] usbvision: fix crash on detecting device with invalid configuration
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (80 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 081/143] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 083/143] usb: xhci: fix wild pointers in xhci_mem_cleanup Willy Tarreau
                   ` (61 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Vladis Dronov, Mauro Carvalho Chehab, Willy Tarreau

From: Vladis Dronov <vdronov@redhat.com>

commit fa52bd506f274b7619955917abfde355e3d19ffe upstream.

The usbvision driver crashes when a specially crafted usb device with invalid
number of interfaces or endpoints is detected. This fix adds checks that the
device has proper configuration expected by the driver.

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/media/usb/usbvision/usbvision-video.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c
index 017f4d1..bcfefe6 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1538,9 +1538,23 @@ static int usbvision_probe(struct usb_interface *intf,
 
 	if (usbvision_device_data[model].interface >= 0)
 		interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0];
-	else
+	else if (ifnum < dev->actconfig->desc.bNumInterfaces)
 		interface = &dev->actconfig->interface[ifnum]->altsetting[0];
+	else {
+		dev_err(&intf->dev, "interface %d is invalid, max is %d\n",
+		    ifnum, dev->actconfig->desc.bNumInterfaces - 1);
+		ret = -ENODEV;
+		goto err_usb;
+	}
+
+	if (interface->desc.bNumEndpoints < 2) {
+		dev_err(&intf->dev, "interface %d has %d endpoints, but must"
+		    " have minimum 2\n", ifnum, interface->desc.bNumEndpoints);
+		ret = -ENODEV;
+		goto err_usb;
+	}
 	endpoint = &interface->endpoint[1].desc;
+
 	if (!usb_endpoint_xfer_isoc(endpoint)) {
 		dev_err(&intf->dev, "%s: interface %d. has non-ISO endpoint!\n",
 		    __func__, ifnum);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 083/143] usb: xhci: fix wild pointers in xhci_mem_cleanup
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (81 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 082/143] usbvision: fix crash on detecting device with invalid configuration Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 084/143] usb: hcd: out of bounds access in for_each_companion Willy Tarreau
                   ` (60 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Lu Baolu, Mathias Nyman, Greg Kroah-Hartman, Willy Tarreau

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 71504062a7c34838c3fccd92c447f399d3cb5797 upstream.

This patch fixes some wild pointers produced by xhci_mem_cleanup.
These wild pointers will cause system crash if xhci_mem_cleanup()
is called twice.

Reported-and-tested-by: Pengcheng Li <lpc.li@hisilicon.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[wt: struct xhci_hcd has no ext_caps members in 3.10 ]

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/host/xhci-mem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 87e82e6..af9e4e8 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1861,6 +1861,11 @@ no_bw:
 	kfree(xhci->port_array);
 	kfree(xhci->rh_bw);
 
+	xhci->usb2_ports = NULL;
+	xhci->usb3_ports = NULL;
+	xhci->port_array = NULL;
+	xhci->rh_bw = NULL;
+
 	xhci->page_size = 0;
 	xhci->page_shift = 0;
 	xhci->bus_state[0].bus_suspended = 0;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 084/143] usb: hcd: out of bounds access in for_each_companion
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (82 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 083/143] usb: xhci: fix wild pointers in xhci_mem_cleanup Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 085/143] crypto: gcm - Fix rfc4543 decryption crash Willy Tarreau
                   ` (59 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Robert Dobrowolski, Greg Kroah-Hartman, Willy Tarreau

From: Robert Dobrowolski <robert.dobrowolski@linux.intel.com>

commit e86103a75705c7c530768f4ffaba74cf382910f2 upstream.

On BXT platform Host Controller and Device Controller figure as
same PCI device but with different device function. HCD should
not pass data to Device Controller but only to Host Controllers.
Checking if companion device is Host Controller, otherwise skip.

Cc: <stable@vger.kernel.org>
Signed-off-by: Robert Dobrowolski <robert.dobrowolski@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/core/hcd-pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 4676917..1eac8dd 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -74,6 +74,15 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd,
 		if (companion->bus != pdev->bus ||
 				PCI_SLOT(companion->devfn) != slot)
 			continue;
+
+		/*
+		 * Companion device should be either UHCI,OHCI or EHCI host
+		 * controller, otherwise skip.
+		 */
+		if (companion->class != CL_UHCI && companion->class != CL_OHCI &&
+				companion->class != CL_EHCI)
+			continue;
+
 		companion_hcd = pci_get_drvdata(companion);
 		if (!companion_hcd || !companion_hcd->self.root_hub)
 			continue;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 085/143] crypto: gcm - Fix rfc4543 decryption crash
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (83 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 084/143] usb: hcd: out of bounds access in for_each_companion Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 086/143] nl80211: check netlink protocol in socket release notification Willy Tarreau
                   ` (58 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Herbert Xu, Greg Kroah-Hartman, Willy Tarreau

From: Herbert Xu <herbert@gondor.apana.org.au>

This bug has already bee fixed upstream since 4.2.  However, it
was fixed during the AEAD conversion so no fix was backported to
the older kernels.

When we do an RFC 4543 decryption, we will end up writing the
ICV beyond the end of the dst buffer.  This should lead to a
crash but for some reason it was never noticed.

This patch fixes it by only writing back the ICV for encryption.

Fixes: d733ac90f9fe ("crypto: gcm - fix rfc4543 to handle async...")
Reported-by: Patrick Meyer <patrick.meyer@vasgard.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 crypto/gcm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crypto/gcm.c b/crypto/gcm.c
index b4c2520..cd97cdd 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -1173,6 +1173,9 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
 	aead_request_set_tfm(subreq, ctx->child);
 	aead_request_set_callback(subreq, req->base.flags, crypto_rfc4543_done,
 				  req);
+	if (!enc)
+		aead_request_set_callback(subreq, req->base.flags,
+					  req->base.complete, req->base.data);
 	aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv);
 	aead_request_set_assoc(subreq, assoc, assoclen);
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 086/143] nl80211: check netlink protocol in socket release notification
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (84 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 085/143] crypto: gcm - Fix rfc4543 decryption crash Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 087/143] Input: gtco - fix crash on detecting device without endpoints Willy Tarreau
                   ` (57 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dmitry Ivanov, Dmitry Ivanov, Johannes Berg, Willy Tarreau

From: Dmitry Ivanov <dmitrijs.ivanovs@ubnt.com>

commit 8f815cdde3e550e10c2736990d791f60c2ce43eb upstream.

A non-privileged user can create a netlink socket with the same port_id as
used by an existing open nl80211 netlink socket (e.g. as used by a hostapd
process) with a different protocol number.

Closing this socket will then lead to the notification going to nl80211's
socket release notification handler, and possibly cause an action such as
removing a virtual interface.

Fix this issue by checking that the netlink protocol is NETLINK_GENERIC.
Since generic netlink has no notifier chain of its own, we can't fix the
problem more generically.

Fixes: 026331c4d9b5 ("cfg80211/mac80211: allow registering for and sending action frames")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Ivanov <dima@ubnt.com>
[rewrite commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 90a0e55..dd3dbed 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10685,7 +10685,7 @@ static int nl80211_netlink_notify(struct notifier_block * nb,
 	struct wireless_dev *wdev;
 	struct cfg80211_beacon_registration *reg, *tmp;
 
-	if (state != NETLINK_URELEASE)
+	if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC)
 		return NOTIFY_DONE;
 
 	rcu_read_lock();
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 087/143] Input: gtco - fix crash on detecting device without endpoints
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (85 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 086/143] nl80211: check netlink protocol in socket release notification Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 088/143] i2c: cpm: Fix build break due to incompatible pointer types Willy Tarreau
                   ` (56 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Vladis Dronov, Dmitry Torokhov, Willy Tarreau

From: Vladis Dronov <vdronov@redhat.com>

commit 162f98dea487206d9ab79fc12ed64700667a894d upstream.

The gtco driver expects at least one valid endpoint. If given malicious
descriptors that specify 0 for the number of endpoints, it will crash in
the probe function. Ensure there is at least one endpoint on the interface
before using it.

Also let's fix a minor coding style issue.

The full correct report of this issue can be found in the public
Red Hat Bugzilla:

https://bugzilla.redhat.com/show_bug.cgi?id=1283385

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/input/tablet/gtco.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index 29e01ab..a9f8f92 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -869,6 +869,14 @@ static int gtco_probe(struct usb_interface *usbinterface,
 		goto err_free_buf;
 	}
 
+	/* Sanity check that a device has an endpoint */
+	if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) {
+		dev_err(&usbinterface->dev,
+			"Invalid number of endpoints\n");
+		error = -EINVAL;
+		goto err_free_urb;
+	}
+
 	/*
 	 * The endpoint is always altsetting 0, we know this since we know
 	 * this device only has one interrupt endpoint
@@ -890,7 +898,7 @@ static int gtco_probe(struct usb_interface *usbinterface,
 	 * HID report descriptor
 	 */
 	if (usb_get_extra_descriptor(usbinterface->cur_altsetting,
-				     HID_DEVICE_TYPE, &hid_desc) != 0){
+				     HID_DEVICE_TYPE, &hid_desc) != 0) {
 		dev_err(&usbinterface->dev,
 			"Can't retrieve exta USB descriptor to get hid report descriptor length\n");
 		error = -EIO;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 088/143] i2c: cpm: Fix build break due to incompatible pointer types
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (86 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 087/143] Input: gtco - fix crash on detecting device without endpoints Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 089/143] EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder callback Willy Tarreau
                   ` (55 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Michael Ellerman, Wolfram Sang, stable, Willy Tarreau

From: Michael Ellerman <mpe@ellerman.id.au>

commit 609d5a1b2b35bb62b4b3750396e55453160c2a17 upstream.

Since commit ea8daa7b9784 ("kbuild: Add option to turn incompatible
pointer check into error"), assignments from an incompatible pointer
types have become a hard error, eg:

  drivers/i2c/busses/i2c-cpm.c:545:91: error: passing argument 3 of
  'dma_alloc_coherent' from incompatible pointer type

Fix the build break by converting txdma & rxdma to dma_addr_t.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
Fixes: ea8daa7b9784
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/i2c/busses/i2c-cpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 3823623..693e4ce 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -120,8 +120,8 @@ struct cpm_i2c {
 	cbd_t __iomem *rbase;
 	u_char *txbuf[CPM_MAXBD];
 	u_char *rxbuf[CPM_MAXBD];
-	u32 txdma[CPM_MAXBD];
-	u32 rxdma[CPM_MAXBD];
+	dma_addr_t txdma[CPM_MAXBD];
+	dma_addr_t rxdma[CPM_MAXBD];
 };
 
 static irqreturn_t cpm_i2c_interrupt(int irq, void *dev_id)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 089/143] EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder callback
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (87 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 088/143] i2c: cpm: Fix build break due to incompatible pointer types Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 090/143] ASoC: s3c24xx: use const snd_soc_component_driver pointer Willy Tarreau
                   ` (54 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tony Luck, linux-edac, Borislav Petkov, Willy Tarreau

From: Tony Luck <tony.luck@intel.com>

commit c4fc1956fa31003bfbe4f597e359d751568e2954 upstream.

Both of these drivers can return NOTIFY_BAD, but this terminates
processing other callbacks that were registered later on the chain.
Since the driver did nothing to log the error it seems wrong to prevent
other interested parties from seeing it. E.g. neither of them had even
bothered to check the type of the error to see if it was a memory error
before the return NOTIFY_BAD.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Acked-by: Aristeu Rozanski <aris@redhat.com>
Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/72937355dd92318d2630979666063f8a2853495b.1461864507.git.tony.luck@intel.com
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/edac/i7core_edac.c | 2 +-
 drivers/edac/sb_edac.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 271818a..c4131a7 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1878,7 +1878,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val,
 
 	i7_dev = get_i7core_dev(mce->socketid);
 	if (!i7_dev)
-		return NOTIFY_BAD;
+		return NOTIFY_DONE;
 
 	mci = i7_dev->mci;
 	pvt = mci->pvt_info;
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 3bdefbf..0d40f7f 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -1538,7 +1538,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val,
 
 	mci = get_mci_for_node_id(mce->socketid);
 	if (!mci)
-		return NOTIFY_BAD;
+		return NOTIFY_DONE;
 	pvt = mci->pvt_info;
 
 	/*
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 090/143] ASoC: s3c24xx: use const snd_soc_component_driver pointer
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (88 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 089/143] EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder callback Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 091/143] efi: Fix out-of-bounds read in variable_matches() Willy Tarreau
                   ` (53 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, Mark Brown, Greg Kroah-Hartman, Willy Tarreau

From: Arnd Bergmann <arnd@arndb.de>

commit ba4bc32eaa39ba7687f0958ae90eec94da613b46 upstream.

An older patch to convert the API in the s3c i2s driver
ended up passing a const pointer into a function that takes
a non-const pointer, so we now get a warning:

sound/soc/samsung/s3c2412-i2s.c: In function 's3c2412_iis_dev_probe':
sound/soc/samsung/s3c2412-i2s.c:172:9: error: passing argument 3 of 's3c_i2sv2_register_component' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

However, the s3c_i2sv2_register_component() function again
passes the pointer into another function taking a const, so
we just need to change its prototype.

Fixes: eca3b01d0885 ("ASoC: switch over to use snd_soc_register_component() on s3c i2s")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 sound/soc/samsung/s3c-i2s-v2.c | 2 +-
 sound/soc/samsung/s3c-i2s-v2.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c
index 20e98d1..38c36cd 100644
--- a/sound/soc/samsung/s3c-i2s-v2.c
+++ b/sound/soc/samsung/s3c-i2s-v2.c
@@ -732,7 +732,7 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
 #endif
 
 int s3c_i2sv2_register_component(struct device *dev, int id,
-			   struct snd_soc_component_driver *cmp_drv,
+			   const struct snd_soc_component_driver *cmp_drv,
 			   struct snd_soc_dai_driver *dai_drv)
 {
 	struct snd_soc_dai_ops *ops = drv->ops;
diff --git a/sound/soc/samsung/s3c-i2s-v2.h b/sound/soc/samsung/s3c-i2s-v2.h
index 90abab3..d068414 100644
--- a/sound/soc/samsung/s3c-i2s-v2.h
+++ b/sound/soc/samsung/s3c-i2s-v2.h
@@ -101,7 +101,7 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai,
  * soc core.
  */
 extern int s3c_i2sv2_register_component(struct device *dev, int id,
-					struct snd_soc_component_driver *cmp_drv,
+					const struct snd_soc_component_driver *cmp_drv,
 					struct snd_soc_dai_driver *dai_drv);
 
 #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 091/143] efi: Fix out-of-bounds read in variable_matches()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (89 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 090/143] ASoC: s3c24xx: use const snd_soc_component_driver pointer Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 092/143] workqueue: fix ghost PENDING flag while doing MQ IO Willy Tarreau
                   ` (52 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Laszlo Ersek, Peter Jones, Matthew Garrett, Jason Andryuk,
	Jani Nikula, stable, Matt Fleming, Willy Tarreau

From: Laszlo Ersek <lersek@redhat.com>

commit 630ba0cc7a6dbafbdee43795617c872b35cde1b4 upstream.

The variable_matches() function can currently read "var_name[len]", for
example when:

 - var_name[0] == 'a',
 - len == 1
 - match_name points to the NUL-terminated string "ab".

This function is supposed to accept "var_name" inputs that are not
NUL-terminated (hence the "len" parameter"). Document the function, and
access "var_name[*match]" only if "*match" is smaller than "len".

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Matthew Garrett <mjg59@coreos.com>
Cc: Jason Andryuk <jandryuk@gmail.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: <stable@vger.kernel.org> # v3.10+
Link: http://thread.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/86906
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/firmware/efi/vars.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 9f82b55..61e7ec5 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -202,29 +202,44 @@ static const struct variable_validate variable_validate[] = {
 	{ NULL_GUID, "", NULL },
 };
 
+/*
+ * Check if @var_name matches the pattern given in @match_name.
+ *
+ * @var_name: an array of @len non-NUL characters.
+ * @match_name: a NUL-terminated pattern string, optionally ending in "*". A
+ *              final "*" character matches any trailing characters @var_name,
+ *              including the case when there are none left in @var_name.
+ * @match: on output, the number of non-wildcard characters in @match_name
+ *         that @var_name matches, regardless of the return value.
+ * @return: whether @var_name fully matches @match_name.
+ */
 static bool
 variable_matches(const char *var_name, size_t len, const char *match_name,
 		 int *match)
 {
 	for (*match = 0; ; (*match)++) {
 		char c = match_name[*match];
-		char u = var_name[*match];
 
-		/* Wildcard in the matching name means we've matched */
-		if (c == '*')
+		switch (c) {
+		case '*':
+			/* Wildcard in @match_name means we've matched. */
 			return true;
 
-		/* Case sensitive match */
-		if (!c && *match == len)
-			return true;
+		case '\0':
+			/* @match_name has ended. Has @var_name too? */
+			return (*match == len);
 
-		if (c != u)
+		default:
+			/*
+			 * We've reached a non-wildcard char in @match_name.
+			 * Continue only if there's an identical character in
+			 * @var_name.
+			 */
+			if (*match < len && c == var_name[*match])
+				continue;
 			return false;
-
-		if (!c)
-			return true;
+		}
 	}
-	return true;
 }
 
 bool
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 092/143] workqueue: fix ghost PENDING flag while doing MQ IO
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (90 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 091/143] efi: Fix out-of-bounds read in variable_matches() Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 093/143] USB: usbip: fix potential out-of-bounds write Willy Tarreau
                   ` (51 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Roman Pen, Gioh Kim, Michael Wang, Tejun Heo, Jens Axboe,
	linux-block, Willy Tarreau

From: Roman Pen <roman.penyaev@profitbricks.com>

commit 346c09f80459a3ad97df1816d6d606169a51001a upstream.

The bug in a workqueue leads to a stalled IO request in MQ ctx->rq_list
with the following backtrace:

[  601.347452] INFO: task kworker/u129:5:1636 blocked for more than 120 seconds.
[  601.347574]       Tainted: G           O    4.4.5-1-storage+ #6
[  601.347651] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  601.348142] kworker/u129:5  D ffff880803077988     0  1636      2 0x00000000
[  601.348519] Workqueue: ibnbd_server_fileio_wq ibnbd_dev_file_submit_io_worker [ibnbd_server]
[  601.348999]  ffff880803077988 ffff88080466b900 ffff8808033f9c80 ffff880803078000
[  601.349662]  ffff880807c95000 7fffffffffffffff ffffffff815b0920 ffff880803077ad0
[  601.350333]  ffff8808030779a0 ffffffff815b01d5 0000000000000000 ffff880803077a38
[  601.350965] Call Trace:
[  601.351203]  [<ffffffff815b0920>] ? bit_wait+0x60/0x60
[  601.351444]  [<ffffffff815b01d5>] schedule+0x35/0x80
[  601.351709]  [<ffffffff815b2dd2>] schedule_timeout+0x192/0x230
[  601.351958]  [<ffffffff812d43f7>] ? blk_flush_plug_list+0xc7/0x220
[  601.352208]  [<ffffffff810bd737>] ? ktime_get+0x37/0xa0
[  601.352446]  [<ffffffff815b0920>] ? bit_wait+0x60/0x60
[  601.352688]  [<ffffffff815af784>] io_schedule_timeout+0xa4/0x110
[  601.352951]  [<ffffffff815b3a4e>] ? _raw_spin_unlock_irqrestore+0xe/0x10
[  601.353196]  [<ffffffff815b093b>] bit_wait_io+0x1b/0x70
[  601.353440]  [<ffffffff815b056d>] __wait_on_bit+0x5d/0x90
[  601.353689]  [<ffffffff81127bd0>] wait_on_page_bit+0xc0/0xd0
[  601.353958]  [<ffffffff81096db0>] ? autoremove_wake_function+0x40/0x40
[  601.354200]  [<ffffffff81127cc4>] __filemap_fdatawait_range+0xe4/0x140
[  601.354441]  [<ffffffff81127d34>] filemap_fdatawait_range+0x14/0x30
[  601.354688]  [<ffffffff81129a9f>] filemap_write_and_wait_range+0x3f/0x70
[  601.354932]  [<ffffffff811ced3b>] blkdev_fsync+0x1b/0x50
[  601.355193]  [<ffffffff811c82d9>] vfs_fsync_range+0x49/0xa0
[  601.355432]  [<ffffffff811cf45a>] blkdev_write_iter+0xca/0x100
[  601.355679]  [<ffffffff81197b1a>] __vfs_write+0xaa/0xe0
[  601.355925]  [<ffffffff81198379>] vfs_write+0xa9/0x1a0
[  601.356164]  [<ffffffff811c59d8>] kernel_write+0x38/0x50

The underlying device is a null_blk, with default parameters:

  queue_mode    = MQ
  submit_queues = 1

Verification that nullb0 has something inflight:

root@pserver8:~# cat /sys/block/nullb0/inflight
       0        1
root@pserver8:~# find /sys/block/nullb0/mq/0/cpu* -name rq_list -print -exec cat {} \;
...
/sys/block/nullb0/mq/0/cpu2/rq_list
CTX pending:
        ffff8838038e2400
...

During debug it became clear that stalled request is always inserted in
the rq_list from the following path:

   save_stack_trace_tsk + 34
   blk_mq_insert_requests + 231
   blk_mq_flush_plug_list + 281
   blk_flush_plug_list + 199
   wait_on_page_bit + 192
   __filemap_fdatawait_range + 228
   filemap_fdatawait_range + 20
   filemap_write_and_wait_range + 63
   blkdev_fsync + 27
   vfs_fsync_range + 73
   blkdev_write_iter + 202
   __vfs_write + 170
   vfs_write + 169
   kernel_write + 56

So blk_flush_plug_list() was called with from_schedule == true.

If from_schedule is true, that means that finally blk_mq_insert_requests()
offloads execution of __blk_mq_run_hw_queue() and uses kblockd workqueue,
i.e. it calls kblockd_schedule_delayed_work_on().

That means, that we race with another CPU, which is about to execute
__blk_mq_run_hw_queue() work.

Further debugging shows the following traces from different CPUs:

  CPU#0                                  CPU#1
  ----------------------------------     -------------------------------
  reqeust A inserted
  STORE hctx->ctx_map[0] bit marked
  kblockd_schedule...() returns 1
  <schedule to kblockd workqueue>
                                         request B inserted
                                         STORE hctx->ctx_map[1] bit marked
                                         kblockd_schedule...() returns 0
  *** WORK PENDING bit is cleared ***
  flush_busy_ctxs() is executed, but
  bit 1, set by CPU#1, is not observed

As a result request B pended forever.

This behaviour can be explained by speculative LOAD of hctx->ctx_map on
CPU#0, which is reordered with clear of PENDING bit and executed _before_
actual STORE of bit 1 on CPU#1.

The proper fix is an explicit full barrier <mfence>, which guarantees
that clear of PENDING bit is to be executed before all possible
speculative LOADS or STORES inside actual work function.

Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
Cc: Gioh Kim <gi-oh.kim@profitbricks.com>
Cc: Michael Wang <yun.wang@profitbricks.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 kernel/workqueue.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index fe7c4b91..66972ac 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -606,6 +606,35 @@ static void set_work_pool_and_clear_pending(struct work_struct *work,
 	 */
 	smp_wmb();
 	set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT, 0);
+	/*
+	 * The following mb guarantees that previous clear of a PENDING bit
+	 * will not be reordered with any speculative LOADS or STORES from
+	 * work->current_func, which is executed afterwards.  This possible
+	 * reordering can lead to a missed execution on attempt to qeueue
+	 * the same @work.  E.g. consider this case:
+	 *
+	 *   CPU#0                         CPU#1
+	 *   ----------------------------  --------------------------------
+	 *
+	 * 1  STORE event_indicated
+	 * 2  queue_work_on() {
+	 * 3    test_and_set_bit(PENDING)
+	 * 4 }                             set_..._and_clear_pending() {
+	 * 5                                 set_work_data() # clear bit
+	 * 6                                 smp_mb()
+	 * 7                               work->current_func() {
+	 * 8				      LOAD event_indicated
+	 *				   }
+	 *
+	 * Without an explicit full barrier speculative LOAD on line 8 can
+	 * be executed before CPU#0 does STORE on line 1.  If that happens,
+	 * CPU#0 observes the PENDING bit is still set and new execution of
+	 * a @work is not queued in a hope, that CPU#1 will eventually
+	 * finish the queued @work.  Meanwhile CPU#1 does not see
+	 * event_indicated is set, because speculative LOAD was executed
+	 * before actual STORE.
+	 */
+	smp_mb();
 }
 
 static void clear_work_data(struct work_struct *work)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 093/143] USB: usbip: fix potential out-of-bounds write
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (91 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 092/143] workqueue: fix ghost PENDING flag while doing MQ IO Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 094/143] paride: make 'verbose' parameter an 'int' again Willy Tarreau
                   ` (50 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ignat Korchagin, Sasha Levin, Paul Gortmaker, Greg Kroah-Hartman,
	Willy Tarreau

From: Ignat Korchagin <ignat.korchagin@gmail.com>

commit b348d7dddb6c4fbfc810b7a0626e8ec9e29f7cbb upstream.

Fix potential out-of-bounds write to urb->transfer_buffer
usbip handles network communication directly in the kernel. When receiving a
packet from its peer, usbip code parses headers according to protocol. As
part of this parsing urb->actual_length is filled. Since the input for
urb->actual_length comes from the network, it should be treated as untrusted.
Any entity controlling the network may put any value in the input and the
preallocated urb->transfer_buffer may not be large enough to hold the data.
Thus, the malicious entity is able to write arbitrary data to kernel memory.

Signed-off-by: Ignat Korchagin <ignat.korchagin@gmail.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/staging/usbip/usbip_common.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 7b97df6..b4f237e 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -784,6 +784,17 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)
 	if (!(size > 0))
 		return 0;
 
+	if (size > urb->transfer_buffer_length) {
+		/* should not happen, probably malicious packet */
+		if (ud->side == USBIP_STUB) {
+			usbip_event_add(ud, SDEV_EVENT_ERROR_TCP);
+			return 0;
+		} else {
+			usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
+			return -EPIPE;
+		}
+	}
+
 	ret = usbip_recv(ud->tcp_socket, urb->transfer_buffer, size);
 	if (ret != size) {
 		dev_err(&urb->dev->dev, "recv xbuf, %d\n", ret);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 094/143] paride: make 'verbose' parameter an 'int' again
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (92 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 093/143] USB: usbip: fix potential out-of-bounds write Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 095/143] fbdev: da8xx-fb: fix videomodes of lcd panels Willy Tarreau
                   ` (49 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, Tim Waugh, Sudip Mukherjee, Jens Axboe,
	Greg Kroah-Hartman, Andrew Morton, Linus Torvalds, Willy Tarreau

From: Arnd Bergmann <arnd@arndb.de>

commit dec63a4dec2d6d01346fd5d96062e67c0636852b upstream.

gcc-6.0 found an ancient bug in the paride driver, which had a
"module_param(verbose, bool, 0);" since before 2.6.12, but actually uses
it to accept '0', '1' or '2' as arguments:

  drivers/block/paride/pd.c: In function 'pd_init_dev_parms':
  drivers/block/paride/pd.c:298:29: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
   #define DBMSG(msg) ((verbose>1)?(msg):NULL)

In 2012, Rusty did a cleanup patch that also changed the type of the
variable to 'bool', which introduced what is now a gcc warning.

This changes the type back to 'int' and adapts the module_param() line
instead, so it should work as documented in case anyone ever cares about
running the ancient driver with debugging.

Fixes: 90ab5ee94171 ("module_param: make bool parameters really bool (drivers & misc)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Rusty Russell <rusty@rustcorp.com.au>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/block/paride/pd.c | 4 ++--
 drivers/block/paride/pt.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 19ad8f0..897b6b9 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -126,7 +126,7 @@
 */
 #include <linux/types.h>
 
-static bool verbose = 0;
+static int verbose = 0;
 static int major = PD_MAJOR;
 static char *name = PD_NAME;
 static int cluster = 64;
@@ -161,7 +161,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
 static DEFINE_MUTEX(pd_mutex);
 static DEFINE_SPINLOCK(pd_lock);
 
-module_param(verbose, bool, 0);
+module_param(verbose, int, 0);
 module_param(major, int, 0);
 module_param(name, charp, 0);
 module_param(cluster, int, 0);
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 2596042..ada4505 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -117,7 +117,7 @@
 
 */
 
-static bool verbose = 0;
+static int verbose = 0;
 static int major = PT_MAJOR;
 static char *name = PT_NAME;
 static int disable = 0;
@@ -152,7 +152,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
 
 #include <asm/uaccess.h>
 
-module_param(verbose, bool, 0);
+module_param(verbose, int, 0);
 module_param(major, int, 0);
 module_param(name, charp, 0);
 module_param_array(drive0, int, NULL, 0);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 095/143] fbdev: da8xx-fb: fix videomodes of lcd panels
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (93 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 094/143] paride: make 'verbose' parameter an 'int' again Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:19 ` [PATCH 3.10 096/143] misc/bmp085: Enable building as a module Willy Tarreau
                   ` (48 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sushaanth Srirangapathi, Tomi Valkeinen, Greg Kroah-Hartman,
	Willy Tarreau

From: Sushaanth Srirangapathi <sushaanth.s@ti.com>

commit 713fced8d10fa1c759c8fb6bf9aaa681bae68cad upstream.

Commit 028cd86b794f4a ("video: da8xx-fb: fix the polarities of the
hsync/vsync pulse") fixes polarities of HSYNC/VSYNC pulse but
forgot to update known_lcd_panels[] which had sync values
according to old logic. This breaks LCD at least on DA850 EVM.

This patch fixes this issue and I have tested this for panel
"Sharp_LK043T1DG01" using DA850 EVM board.

Fixes: 028cd86b794f4a ("video: da8xx-fb: fix the polarities of the hsync/vsync pulse")
Signed-off-by: Sushaanth Srirangapathi <sushaanth.s@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/video/da8xx-fb.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 0810939..b13bfb2 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -226,8 +226,7 @@ static struct fb_videomode known_lcd_panels[] = {
 		.lower_margin   = 2,
 		.hsync_len      = 0,
 		.vsync_len      = 0,
-		.sync           = FB_SYNC_CLK_INVERT |
-			FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.sync           = FB_SYNC_CLK_INVERT,
 	},
 	/* Sharp LK043T1DG01 */
 	[1] = {
@@ -241,7 +240,7 @@ static struct fb_videomode known_lcd_panels[] = {
 		.lower_margin   = 2,
 		.hsync_len      = 41,
 		.vsync_len      = 10,
-		.sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.sync           = 0,
 		.flag           = 0,
 	},
 	[2] = {
@@ -256,7 +255,7 @@ static struct fb_videomode known_lcd_panels[] = {
 		.lower_margin   = 10,
 		.hsync_len      = 10,
 		.vsync_len      = 10,
-		.sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.sync           = 0,
 		.flag           = 0,
 	},
 };
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 096/143] misc/bmp085: Enable building as a module
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (94 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 095/143] fbdev: da8xx-fb: fix videomodes of lcd panels Willy Tarreau
@ 2016-06-05 10:19 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 097/143] rtc: vr41xx: Wire up alarm_irq_enable Willy Tarreau
                   ` (47 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:19 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ben Hutchings, Eric Andersson, Greg Kroah-Hartman, Willy Tarreau

From: Ben Hutchings <ben@decadent.org.uk>

commit 50e6315dba721cbc24ccd6d7b299f1782f210a98 upstream.

Commit 985087dbcb02 'misc: add support for bmp18x chips to the bmp085
driver' changed the BMP085 config symbol to a boolean.  I see no
reason why the shared code cannot be built as a module, so change it
back to tristate.

Fixes: 985087dbcb02 ("misc: add support for bmp18x chips to the bmp085 driver")
Cc: Eric Andersson <eric.andersson@unixphere.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/misc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index c002d86..7a68184 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -451,7 +451,7 @@ config ARM_CHARLCD
 	  still useful.
 
 config BMP085
-	bool
+	tristate
 	depends on SYSFS
 
 config BMP085_I2C
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 097/143] rtc: vr41xx: Wire up alarm_irq_enable
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (95 preceding siblings ...)
  2016-06-05 10:19 ` [PATCH 3.10 096/143] misc/bmp085: Enable building as a module Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 098/143] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Willy Tarreau
                   ` (46 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Geert Uytterhoeven, Alexandre Belloni, Willy Tarreau

From: Geert Uytterhoeven <geert@linux-m68k.org>

commit a25f4a95ec3cded34c1250364eba704c5e4fdac4 upstream.

drivers/rtc/rtc-vr41xx.c:229: warning: ‘vr41xx_rtc_alarm_irq_enable’ defined but not used

Apparently the conversion to alarm_irq_enable forgot to wire up the
callback.

Fixes: 16380c153a69c378 ("RTC: Convert rtc drivers to use the alarm_irq_enable method")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/rtc/rtc-vr41xx.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index f91be04..ca0f213 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -272,12 +272,13 @@ static irqreturn_t rtclong1_interrupt(int irq, void *dev_id)
 }
 
 static const struct rtc_class_ops vr41xx_rtc_ops = {
-	.release	= vr41xx_rtc_release,
-	.ioctl		= vr41xx_rtc_ioctl,
-	.read_time	= vr41xx_rtc_read_time,
-	.set_time	= vr41xx_rtc_set_time,
-	.read_alarm	= vr41xx_rtc_read_alarm,
-	.set_alarm	= vr41xx_rtc_set_alarm,
+	.release		= vr41xx_rtc_release,
+	.ioctl			= vr41xx_rtc_ioctl,
+	.read_time		= vr41xx_rtc_read_time,
+	.set_time		= vr41xx_rtc_set_time,
+	.read_alarm		= vr41xx_rtc_read_alarm,
+	.set_alarm		= vr41xx_rtc_set_alarm,
+	.alarm_irq_enable	= vr41xx_rtc_alarm_irq_enable,
 };
 
 static int rtc_probe(struct platform_device *pdev)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 098/143] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (96 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 097/143] rtc: vr41xx: Wire up alarm_irq_enable Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 099/143] include/linux/poison.h: fix LIST_POISON{1,2} offset Willy Tarreau
                   ` (45 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Michael Hennerich, Greg Kroah-Hartman, Willy Tarreau

From: Michael Hennerich <michael.hennerich@analog.com>

commit f3df53e4d70b5736368a8fe8aa1bb70c1cb1f577 upstream.

Fix RDAC read back errors caused by a typo. Value must shift by 2.

Fixes: a4bd394956f2 ("drivers/misc/ad525x_dpot.c: new features")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/misc/ad525x_dpot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 8f99e8e..beb7422 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -216,7 +216,7 @@ static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg)
 			 */
 			value = swab16(value);
 
-			if (dpot->uid == DPOT_UID(AD5271_ID))
+			if (dpot->uid == DPOT_UID(AD5274_ID))
 				value = value >> 2;
 		return value;
 	default:
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 099/143] include/linux/poison.h: fix LIST_POISON{1,2} offset
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (97 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 098/143] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 100/143] Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors Willy Tarreau
                   ` (44 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vasily Kulikov, Solar Designer, Thomas Gleixner,
	Kirill A. Shutemov, Andrew Morton, Linus Torvalds, Willy Tarreau

From: Vasily Kulikov <segoon@openwall.com>

commit 8a5e5e02fc83aaf67053ab53b359af08c6c49aaf upstream.

Poison pointer values should be small enough to find a room in
non-mmap'able/hardly-mmap'able space.  E.g.  on x86 "poison pointer space"
is located starting from 0x0.  Given unprivileged users cannot mmap
anything below mmap_min_addr, it should be safe to use poison pointers
lower than mmap_min_addr.

The current poison pointer values of LIST_POISON{1,2} might be too big for
mmap_min_addr values equal or less than 1 MB (common case, e.g.  Ubuntu
uses only 0x10000).  There is little point to use such a big value given
the "poison pointer space" below 1 MB is not yet exhausted.  Changing it
to a smaller value solves the problem for small mmap_min_addr setups.

The values are suggested by Solar Designer:
http://www.openwall.com/lists/oss-security/2015/05/02/6

Signed-off-by: Vasily Kulikov <segoon@openwall.com>
Cc: Solar Designer <solar@openwall.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 include/linux/poison.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/poison.h b/include/linux/poison.h
index 2110a81..253c9b4 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -19,8 +19,8 @@
  * under normal circumstances, used to verify that nobody uses
  * non-initialized list entries.
  */
-#define LIST_POISON1  ((void *) 0x00100100 + POISON_POINTER_DELTA)
-#define LIST_POISON2  ((void *) 0x00200200 + POISON_POINTER_DELTA)
+#define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
+#define LIST_POISON2  ((void *) 0x200 + POISON_POINTER_DELTA)
 
 /********** include/linux/timer.h **********/
 /*
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 100/143] Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (98 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 099/143] include/linux/poison.h: fix LIST_POISON{1,2} offset Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 101/143] perf stat: Document --detailed option Willy Tarreau
                   ` (43 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vitaly Kuznetsov, K . Y . Srinivasan, Chas Williams,
	Greg Kroah-Hartman, Willy Tarreau

From: Vitaly Kuznetsov <vkuznets@redhat.com>

commit e513229b4c386e6c9f66298c13fde92f73e6e1ac upstream.

When an SMP Hyper-V guest is running on top of 2012R2 Server and secondary
cpus are sent offline (with echo 0 > /sys/devices/system/cpu/cpu$cpu/online)
the system freeze is observed. This happens due to the fact that on newer
hypervisors (Win8, WS2012R2, ...) vmbus channel handlers are distributed
across all cpus (see init_vp_index() function in drivers/hv/channel_mgmt.c)
and on cpu offlining nobody reassigns them to CPU0. Prevent cpu offlining
when vmbus is loaded until the issue is fixed host-side.

This patch also disables hibernation but it is OK as it is also broken (MCE
error is hit on resume). Suspend still works.

Tested with WS2008R2 and WS2012R2.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
[ 3chas3@gmail.com: rebase to 3.14-stable ]
Signed-off-by: Chas Williams <3chas3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/hv/vmbus_drv.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index f445b08..80754e2 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -32,6 +32,7 @@
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <linux/completion.h>
+#include <linux/cpu.h>
 #include <linux/hyperv.h>
 #include <linux/kernel_stat.h>
 #include <asm/hyperv.h>
@@ -517,6 +518,39 @@ static void vmbus_flow_handler(unsigned int irq, struct irq_desc *desc)
 	desc->action->handler(irq, desc->action->dev_id);
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static int hyperv_cpu_disable(void)
+{
+	return -ENOSYS;
+}
+
+static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
+{
+	static void *previous_cpu_disable;
+
+	/*
+	 * Offlining a CPU when running on newer hypervisors (WS2012R2, Win8,
+	 * ...) is not supported at this moment as channel interrupts are
+	 * distributed across all of them.
+	 */
+
+	if ((vmbus_proto_version == VERSION_WS2008) ||
+	    (vmbus_proto_version == VERSION_WIN7))
+		return;
+
+	if (vmbus_loaded) {
+		previous_cpu_disable = smp_ops.cpu_disable;
+		smp_ops.cpu_disable = hyperv_cpu_disable;
+		pr_notice("CPU offlining is not supported by hypervisor\n");
+	} else if (previous_cpu_disable)
+		smp_ops.cpu_disable = previous_cpu_disable;
+}
+#else
+static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
+{
+}
+#endif
+
 /*
  * vmbus_bus_init -Main vmbus driver initialization routine.
  *
@@ -572,6 +606,7 @@ static int vmbus_bus_init(int irq)
 	if (ret)
 		goto err_irq;
 
+	hv_cpu_hotplug_quirk(true);
 	vmbus_request_offers();
 
 	return 0;
@@ -808,6 +843,7 @@ static void __exit vmbus_exit(void)
 	bus_unregister(&hv_bus);
 	hv_cleanup();
 	acpi_bus_unregister_driver(&vmbus_acpi_driver);
+	hv_cpu_hotplug_quirk(false);
 }
 
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 101/143] perf stat: Document --detailed option
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (99 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 100/143] Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 102/143] ARM: OMAP3: Add cpuidle parameters table for omap3430 Willy Tarreau
                   ` (42 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Alexander Shishkin,
	David Ahern, Davidlohr Bueso, Jiri Olsa, Mel Gorman,
	Namhyung Kim, Peter Zijlstra, Peter Zijlstra, Steven Rostedt,
	Thomas Gleixner, Ingo Molnar, Willy Tarreau

From: Borislav Petkov <bp@suse.de>

commit f594bae08183fb6b57db55387794ece3e1edf6f6 upstream.

I'm surprised this remained undocumented since at least 2011. And it is
actually a very useful switch, as Steve and I came to realize recently.

Add the text from

  2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")

which added the incrementing aspect to -d.

Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Davidlohr Bueso <dbueso@suse.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mel Gorman <mgorman@suse.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")
Link: http://lkml.kernel.org/r/1457347294-32546-1-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 tools/perf/Documentation/perf-stat.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
index 2fe87fb..8c96047 100644
--- a/tools/perf/Documentation/perf-stat.txt
+++ b/tools/perf/Documentation/perf-stat.txt
@@ -50,6 +50,14 @@ OPTIONS
 --scale::
 	scale/normalize counter values
 
+-d::
+--detailed::
+	print more detailed statistics, can be specified up to 3 times
+
+	   -d:          detailed events, L1 and LLC data cache
+        -d -d:     more detailed events, dTLB and iTLB events
+     -d -d -d:     very detailed events, adding prefetch events
+
 -r::
 --repeat=<n>::
 	repeat command and print average + stddev (max: 100). 0 means forever.
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 102/143] ARM: OMAP3: Add cpuidle parameters table for omap3430
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (100 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 101/143] perf stat: Document --detailed option Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 103/143] compiler-gcc: disable -ftracer for __noclone functions Willy Tarreau
                   ` (41 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Pali Rohár, Tony Lindgren, Willy Tarreau

From: Pali Rohár <pali.rohar@gmail.com>

commit 98f42221501353067251fbf11e732707dbb68ce3 upstream.

Based on CPU type choose generic omap3 or omap3430 specific cpuidle
parameters. Parameters for omap3430 were measured on Nokia N900 device and
added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
remove rx51 cpuidle parameters table") due to huge code complexity.

This patch brings cpuidle parameters for omap3430 devices again, but uses
simple condition based on CPU type.

Fixes: 231900afba52 ("ARM: OMAP3: cpuidle - remove rx51 cpuidle
parameters table")
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/arm/mach-omap2/cpuidle34xx.c | 69 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index e18709d..38e1bdc 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -34,6 +34,7 @@
 #include "pm.h"
 #include "control.h"
 #include "common.h"
+#include "soc.h"
 
 /* Mach specific information to be recorded in the C-state driver_data */
 struct omap3_idle_statedata {
@@ -322,6 +323,69 @@ static struct cpuidle_driver omap3_idle_driver = {
 	.safe_state_index = 0,
 };
 
+/*
+ * Numbers based on measurements made in October 2009 for PM optimized kernel
+ * with CPU freq enabled on device Nokia N900. Assumes OPP2 (main idle OPP,
+ * and worst case latencies).
+ */
+static struct cpuidle_driver omap3430_idle_driver = {
+	.name             = "omap3430_idle",
+	.owner            = THIS_MODULE,
+	.states = {
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 110 + 162,
+			.target_residency = 5,
+			.name		  = "C1",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 106 + 180,
+			.target_residency = 309,
+			.name		  = "C2",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 107 + 410,
+			.target_residency = 46057,
+			.name		  = "C3",
+			.desc		  = "MPU RET + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 121 + 3374,
+			.target_residency = 46057,
+			.name		  = "C4",
+			.desc		  = "MPU OFF + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 855 + 1146,
+			.target_residency = 46057,
+			.name		  = "C5",
+			.desc		  = "MPU RET + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 7580 + 4134,
+			.target_residency = 484329,
+			.name		  = "C6",
+			.desc		  = "MPU OFF + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 7505 + 15274,
+			.target_residency = 484329,
+			.name		  = "C7",
+			.desc		  = "MPU OFF + CORE OFF",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap3_idle_data),
+	.safe_state_index = 0,
+};
+
 /* Public functions */
 
 /**
@@ -340,5 +404,8 @@ int __init omap3_idle_init(void)
 	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
 		return -ENODEV;
 
-	return cpuidle_register(&omap3_idle_driver, NULL);
+	if (cpu_is_omap3430())
+		return cpuidle_register(&omap3430_idle_driver, NULL);
+	else
+		return cpuidle_register(&omap3_idle_driver, NULL);
 }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 103/143] compiler-gcc: disable -ftracer for __noclone functions
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (101 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 102/143] ARM: OMAP3: Add cpuidle parameters table for omap3430 Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 104/143] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Willy Tarreau
                   ` (40 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Paolo Bonzini, Andrew Morton, Michal Marek, kvm, Willy Tarreau

From: Paolo Bonzini <pbonzini@redhat.com>

commit 95272c29378ee7dc15f43fa2758cb28a5913a06d upstream.

-ftracer can duplicate asm blocks causing compilation to fail in
noclone functions.  For example, KVM declares a global variable
in an asm like

    asm("2: ... \n
         .pushsection data \n
         .global vmx_return \n
         vmx_return: .long 2b");

and -ftracer causes a double declaration.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: stable@vger.kernel.org
Cc: kvm@vger.kernel.org
Reported-by: Linda Walsh <lkml@tlinx.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 include/linux/compiler-gcc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 65856c3..953cd121 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -177,7 +177,7 @@
 #define unreachable() __builtin_unreachable()
 
 /* Mark a function definition as prohibited from being cloned. */
-#define __noclone	__attribute__((__noclone__))
+#define __noclone	__attribute__((__noclone__, __optimize__("no-tracer")))
 
 #endif /* GCC_VERSION >= 40500 */
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 104/143] ipvs: correct initial offset of Call-ID header search in SIP persistence engine
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (102 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 103/143] compiler-gcc: disable -ftracer for __noclone functions Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 105/143] nbd: ratelimit error msgs after socket close Willy Tarreau
                   ` (39 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Marco Angaroni, Simon Horman, Willy Tarreau

From: Marco Angaroni <marcoangaroni@gmail.com>

commit 7617a24f83b5d67f4dab1844956be1cebc44aec8 upstream.

The IPVS SIP persistence engine is not able to parse the SIP header
"Call-ID" when such header is inserted in the first positions of
the SIP message.

When IPVS is configured with "--pe sip" option, like for example:
ipvsadm -A -u 1.2.3.4:5060 -s rr --pe sip -p 120 -o
some particular messages (see below for details) do not create entries
in the connection template table, which can be listed with:
ipvsadm -Lcn --persistent-conn

Problematic SIP messages are SIP responses having "Call-ID" header
positioned just after message first line:
SIP/2.0 200 OK
[Call-ID header here]
[rest of the headers]

When "Call-ID" header is positioned down (after a few other headers)
it is correctly recognized.

This is due to the data offset used in get_callid function call inside
ip_vs_pe_sip.c file: since dptr already points to the start of the
SIP message, the value of dataoff should be initially 0.
Otherwise the header is searched starting from some bytes after the
first character of the SIP message.

Fixes: 758ff0338722 ("IPVS: sip persistence engine")
Signed-off-by: Marco Angaroni <marcoangaroni@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/netfilter/ipvs/ip_vs_pe_sip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c
index bed5f70..bb318e4 100644
--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb)
 	dptr = skb->data + dataoff;
 	datalen = skb->len - dataoff;
 
-	if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen))
+	if (get_callid(dptr, 0, datalen, &matchoff, &matchlen))
 		return -EINVAL;
 
 	/* N.B: pe_data is only set on success,
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 105/143] nbd: ratelimit error msgs after socket close
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (103 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 104/143] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 106/143] clk: versatile: sp810: support reentrance Willy Tarreau
                   ` (38 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dan Streetman, Markus Pargmann, Greg Kroah-Hartman, Willy Tarreau

From: Dan Streetman <dan.streetman@canonical.com>

commit da6ccaaa79caca4f38b540b651238f87215217a2 upstream.

Make the "Attempted send on closed socket" error messages generated in
nbd_request_handler() ratelimited.

When the nbd socket is shutdown, the nbd_request_handler() function emits
an error message for every request remaining in its queue.  If the queue
is large, this will spam a large amount of messages to the log.  There's
no need for a separate error message for each request, so this patch
ratelimits it.

In the specific case this was found, the system was virtual and the error
messages were logged to the serial port, which overwhelmed it.

Fixes: 4d48a542b427 ("nbd: fix I/O hang on disconnected nbds")
Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/block/nbd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a5c987a..d593fa5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -581,8 +581,8 @@ static void do_nbd_request(struct request_queue *q)
 		BUG_ON(nbd->magic != NBD_MAGIC);
 
 		if (unlikely(!nbd->sock)) {
-			dev_err(disk_to_dev(nbd->disk),
-				"Attempted send on closed socket\n");
+			dev_err_ratelimited(disk_to_dev(nbd->disk),
+					    "Attempted send on closed socket\n");
 			req->errors++;
 			nbd_end_request(req);
 			spin_lock_irq(q->queue_lock);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 106/143] clk: versatile: sp810: support reentrance
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (104 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 105/143] nbd: ratelimit error msgs after socket close Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 107/143] lpfc: fix misleading indentation Willy Tarreau
                   ` (37 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Linus Walleij, Michael Turquette, Pawel Moll, Stephen Boyd,
	Greg Kroah-Hartman, Willy Tarreau

From: Linus Walleij <linus.walleij@linaro.org>

commit ec7957a6aa0aaf981fb8356dc47a2cdd01cde03c upstream.

Despite care take to allocate clocks state containers the
SP810 driver actually just supports creating one instance:
all clocks registered for every instance will end up with the
exact same name and __clk_init() will fail.

Rename the timclken<0> .. timclken<n> to sp810_<instance>_<n>
so every clock on every instance gets a unique name.

This is necessary for the RealView PBA8 which has two SP810
blocks: the second block will not register its clocks unless
every clock on every instance is unique and results in boot
logs like this:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at ../drivers/clk/versatile/clk-sp810.c:137
  clk_sp810_of_setup+0x110/0x154()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.5.0-rc2-00030-g352718fc39f6-dirty #225
Hardware name: ARM RealView Machine (Device Tree Support)
[<c00167f8>] (unwind_backtrace) from [<c0013204>]
             (show_stack+0x10/0x14)
[<c0013204>] (show_stack) from [<c01a049c>]
             (dump_stack+0x84/0x9c)
[<c01a049c>] (dump_stack) from [<c0024990>]
             (warn_slowpath_common+0x74/0xb0)
[<c0024990>] (warn_slowpath_common) from [<c0024a68>]
             (warn_slowpath_null+0x1c/0x24)
[<c0024a68>] (warn_slowpath_null) from [<c051eb44>]
             (clk_sp810_of_setup+0x110/0x154)
[<c051eb44>] (clk_sp810_of_setup) from [<c051e3a4>]
             (of_clk_init+0x12c/0x1c8)
[<c051e3a4>] (of_clk_init) from [<c0504714>]
             (time_init+0x20/0x2c)
[<c0504714>] (time_init) from [<c0501b18>]
             (start_kernel+0x244/0x3c4)
[<c0501b18>] (start_kernel) from [<7000807c>] (0x7000807c)
---[ end trace cb88537fdc8fa200 ]---

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Fixes: 6e973d2c4385 "clk: vexpress: Add separate SP810 driver"
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/clk/versatile/clk-sp810.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index b9e05bd..a21e2fa 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -141,6 +141,7 @@ void __init clk_sp810_of_setup(struct device_node *node)
 	const char *parent_names[2];
 	char name[12];
 	struct clk_init_data init;
+	static int instance;
 	int i;
 
 	if (!sp810) {
@@ -172,7 +173,7 @@ void __init clk_sp810_of_setup(struct device_node *node)
 	init.num_parents = ARRAY_SIZE(parent_names);
 
 	for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) {
-		snprintf(name, ARRAY_SIZE(name), "timerclken%d", i);
+		snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);
 
 		sp810->timerclken[i].sp810 = sp810;
 		sp810->timerclken[i].channel = i;
@@ -184,5 +185,6 @@ void __init clk_sp810_of_setup(struct device_node *node)
 	}
 
 	of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810);
+	instance++;
 }
 CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 107/143] lpfc: fix misleading indentation
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (105 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 106/143] clk: versatile: sp810: support reentrance Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 108/143] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel Willy Tarreau
                   ` (36 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Arnd Bergmann, Martin K . Petersen, Willy Tarreau

From: Arnd Bergmann <arnd@arndb.de>

commit aeb6641f8ebdd61939f462a8255b316f9bfab707 upstream.

gcc-6 complains about the indentation of the lpfc_destroy_vport_work_array()
call in lpfc_online(), which clearly doesn't look right:

drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_online':
drivers/scsi/lpfc/lpfc_init.c:2880:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
   lpfc_destroy_vport_work_array(phba, vports);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_init.c:2863:2: note: ...this 'if' clause, but it is not
  if (vports != NULL)
  ^~

Looking at the patch that introduced this code, it's clear that the
behavior is correct and the indentation is wrong.

This fixes the indentation and adds curly braces around the previous
if() block for clarity, as that is most likely what caused the code
to be misindented in the first place.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 549e55cd2a1b ("[SCSI] lpfc 8.2.2 : Fix locking around HBA's port_list")
Reviewed-by: Sebastian Herbszt <herbszt@gmx.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/scsi/lpfc/lpfc_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index cb465b2..e6e0679 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2684,7 +2684,7 @@ lpfc_online(struct lpfc_hba *phba)
 	}
 
 	vports = lpfc_create_vport_work_array(phba);
-	if (vports != NULL)
+	if (vports != NULL) {
 		for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
 			struct Scsi_Host *shost;
 			shost = lpfc_shost_from_vport(vports[i]);
@@ -2701,7 +2701,8 @@ lpfc_online(struct lpfc_hba *phba)
 			}
 			spin_unlock_irq(shost->host_lock);
 		}
-		lpfc_destroy_vport_work_array(phba, vports);
+	}
+	lpfc_destroy_vport_work_array(phba, vports);
 
 	lpfc_unblock_mgmt_io(phba);
 	return 0;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 108/143] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (106 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 107/143] lpfc: fix misleading indentation Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 109/143] proc: prevent accessing /proc/<PID>/environ until it's ready Willy Tarreau
                   ` (35 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sascha Hauer, Dinh Nguyen, Kevin Hilman, Greg Kroah-Hartman,
	Willy Tarreau

From: Sascha Hauer <s.hauer@pengutronix.de>

commit 5616f36713ea77f57ae908bf2fef641364403c9f upstream.

The secondary CPU starts up in ARM mode. When the kernel is compiled in
thumb2 mode we have to explicitly compile the secondary startup
trampoline in ARM mode, otherwise the CPU will go to Nirvana.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/arm/mach-socfpga/headsmp.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S
index 9004bfb..a6f5519 100644
--- a/arch/arm/mach-socfpga/headsmp.S
+++ b/arch/arm/mach-socfpga/headsmp.S
@@ -12,6 +12,7 @@
 
 	__CPUINIT
 	.arch	armv7-a
+	.arm
 
 ENTRY(secondary_trampoline)
 	movw	r2, #:lower16:cpu1start_addr
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 109/143] proc: prevent accessing /proc/<PID>/environ until it's ready
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (107 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 108/143] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 110/143] batman-adv: Fix broadcast/ogm queue limit on a removed interface Willy Tarreau
                   ` (34 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Mathias Krause, Emese Revfy, Pax Team, Al Viro, Mateusz Guzik,
	Alexey Dobriyan, Cyrill Gorcunov, Jarod Wilson, Andrew Morton,
	Linus Torvalds, Greg Kroah-Hartman, Willy Tarreau

From: Mathias Krause <minipli@googlemail.com>

commit 8148a73c9901a8794a50f950083c00ccf97d43b3 upstream.

If /proc/<PID>/environ gets read before the envp[] array is fully set up
in create_{aout,elf,elf_fdpic,flat}_tables(), we might end up trying to
read more bytes than are actually written, as env_start will already be
set but env_end will still be zero, making the range calculation
underflow, allowing to read beyond the end of what has been written.

Fix this as it is done for /proc/<PID>/cmdline by testing env_end for
zero.  It is, apparently, intentionally set last in create_*_tables().

This bug was found by the PaX size_overflow plugin that detected the
arithmetic underflow of 'this_len = env_end - (env_start + src)' when
env_end is still zero.

The expected consequence is that userland trying to access
/proc/<PID>/environ of a not yet fully set up process may get
inconsistent data as we're in the middle of copying in the environment
variables.

Fixes: https://forums.grsecurity.net/viewtopic.php?f=3&t=4363
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=116461
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Emese Revfy <re.emese@gmail.com>
Cc: Pax Team <pageexec@freemail.hu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Mateusz Guzik <mguzik@redhat.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/proc/base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7b5d453..e5160b7 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -844,7 +844,8 @@ static ssize_t environ_read(struct file *file, char __user *buf,
 	int ret = 0;
 	struct mm_struct *mm = file->private_data;
 
-	if (!mm)
+	/* Ensure the process spawned far enough to have an environment. */
+	if (!mm || !mm->env_end)
 		return 0;
 
 	page = (char *)__get_free_page(GFP_TEMPORARY);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 110/143] batman-adv: Fix broadcast/ogm queue limit on a removed interface
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (108 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 109/143] proc: prevent accessing /proc/<PID>/environ until it's ready Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 111/143] MAINTAINERS: Remove asterisk from EFI directory names Willy Tarreau
                   ` (33 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Linus Lüssing, Sven Eckelmann, Marek Lindner,
	Antonio Quartulli, Willy Tarreau

From: Linus Lüssing <linus.luessing@c0d3.blue>

commit c4fdb6cff2aa0ae740c5f19b6f745cbbe786d42f upstream.

When removing a single interface while a broadcast or ogm packet is
still pending then we will free the forward packet without releasing the
queue slots again.

This patch is supposed to fix this issue.

Fixes: 6d5808d4ae1b ("batman-adv: Add missing hardif_free_ref in forw_packet_free")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/batman-adv/send.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 263cfd1..cf5b766 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -353,6 +353,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
 		if (pending) {
 			hlist_del(&forw_packet->list);
+			if (!forw_packet->own)
+				atomic_inc(&bat_priv->batman_queue_left);
+
 			batadv_forw_packet_free(forw_packet);
 		}
 	}
@@ -379,6 +382,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
 		if (pending) {
 			hlist_del(&forw_packet->list);
+			if (!forw_packet->own)
+				atomic_inc(&bat_priv->bcast_queue_left);
+
 			batadv_forw_packet_free(forw_packet);
 		}
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 111/143] MAINTAINERS: Remove asterisk from EFI directory names
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (109 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 110/143] batman-adv: Fix broadcast/ogm queue limit on a removed interface Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 112/143] ACPICA: Dispatcher: Update thread ID for recursive method calls Willy Tarreau
                   ` (32 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Matt Fleming, Ard Biesheuvel, Catalin Marinas, Linus Torvalds,
	Peter Zijlstra, Thomas Gleixner, linux-efi, Ingo Molnar,
	Willy Tarreau

From: Matt Fleming <matt@codeblueprint.co.uk>

commit e8dfe6d8f6762d515fcd4f30577f7bfcf7659887 upstream.

Mark reported that having asterisks on the end of directory names
confuses get_maintainer.pl when it encounters subdirectories, and that
my name does not appear when run on drivers/firmware/efi/libstub.

Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: <stable@vger.kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1462303781-8686-2-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 48c7480..29d7d74 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3032,8 +3032,8 @@ F:	Documentation/x86/efi-stub.txt
 F:	arch/ia64/kernel/efi.c
 F:	arch/x86/boot/compressed/eboot.[ch]
 F:	arch/x86/include/asm/efi.h
-F:	arch/x86/platform/efi/*
-F:	drivers/firmware/efi/*
+F:	arch/x86/platform/efi/
+F:	drivers/firmware/efi/
 F:	include/linux/efi*.h
 
 EFI VARIABLE FILESYSTEM
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 112/143] ACPICA: Dispatcher: Update thread ID for recursive method calls
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (110 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 111/143] MAINTAINERS: Remove asterisk from EFI directory names Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 113/143] USB: serial: cp210x: add ID for Link ECU Willy Tarreau
                   ` (31 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Prarit Bhargava, Bob Moore, Lv Zheng, Rafael J . Wysocki, Willy Tarreau

From: Prarit Bhargava <prarit@redhat.com>

commit 93d68841a23a5779cef6fb9aa0ef32e7c5bd00da upstream.

ACPICA commit 7a3bd2d962f221809f25ddb826c9e551b916eb25

Set the mutex owner thread ID.
Original patch from: Prarit Bhargava <prarit@redhat.com>

Link: https://bugzilla.kernel.org/show_bug.cgi?id=115121
Link: https://github.com/acpica/acpica/commit/7a3bd2d9
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Tested-by: Andy Lutomirski <luto@kernel.org> # On a Dell XPS 13 9350
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/acpi/acpica/dsmethod.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index a9ffd44..2184259 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -267,6 +267,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
 				obj_desc->method.mutex->mutex.
 				    original_sync_level =
 				    obj_desc->method.mutex->mutex.sync_level;
+
+				obj_desc->method.mutex->mutex.thread_id =
+				    acpi_os_get_thread_id();
 			}
 		}
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 113/143] USB: serial: cp210x: add ID for Link ECU
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (111 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 112/143] ACPICA: Dispatcher: Update thread ID for recursive method calls Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 114/143] USB: serial: cp210x: add Straizona Focusers device ids Willy Tarreau
                   ` (30 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mike Manning, Johan Hovold, Willy Tarreau

From: Mike Manning <michael@bsch.com.au>

commit 1d377f4d690637a0121eac8701f84a0aa1e69a69 upstream.

The Link ECU is an aftermarket ECU computer for vehicles that provides
full tuning abilities as well as datalogging and displaying capabilities
via the USB to Serial adapter built into the device.

Signed-off-by: Mike Manning <michael@bsch.com.au>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/cp210x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index a4003d4..40e2d58 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -140,6 +140,8 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */
 	{ USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */
 	{ USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */
+	{ USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */
+	{ USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */
 	{ USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
 	{ USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
 	{ USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 114/143] USB: serial: cp210x: add Straizona Focusers device ids
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (112 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 113/143] USB: serial: cp210x: add ID for Link ECU Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 115/143] Input: ads7846 - correct the value got from SPI Willy Tarreau
                   ` (29 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jasem Mutlaq, Johan Hovold, Willy Tarreau

From: Jasem Mutlaq <mutlaqja@ikarustech.com>

commit 613ac23a46e10d4d4339febdd534fafadd68e059 upstream.

Adding VID:PID for Straizona Focusers to cp210x driver.

Signed-off-by: Jasem Mutlaq <mutlaqja@ikarustech.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/cp210x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 40e2d58..0093261 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -108,6 +108,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */
 	{ USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */
 	{ USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */
+	{ USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */
 	{ USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
 	{ USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
 	{ USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
@@ -117,6 +118,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
 	{ USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
 	{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
+	{ USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
 	{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
 	{ USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
 	{ USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 115/143] Input: ads7846 - correct the value got from SPI
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (113 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 114/143] USB: serial: cp210x: add Straizona Focusers device ids Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 116/143] powerpc: scan_features() updates incorrect bits for REAL_LE Willy Tarreau
                   ` (28 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Andrey Gelman, Haibo Chen, Igor Grinberg, Dmitry Torokhov, Willy Tarreau

From: Andrey Gelman <andrey.gelman@compulab.co.il>

commit 879f2fea8a5a748bcbf98d2cdce9139c045505d3 upstream.

According to the touch controller spec, SPI return a 16 bit value, only 12
bits are valid, they are bit[14-3].

The value of MISO and MOSI can be configured when SPI is in idle mode.
Currently this touch driver assumes the SPI bus sets the MOSI and MISO in
low level when SPI bus is in idle mode. So the bit[15] of the value got
from SPI bus is always 0. But when SPI bus congfigures the MOSI and MISO in
high level during the SPI idle mode, the bit[15] of the value get from SPI
is always 1. If bit[15] is not masked, we may get the wrong value.

Mask the invalid bit to make sure the correct value gets returned.
Regardless of the SPI bus idle configuration.

Signed-off-by: Andrey Gelman <andrey.gelman@compulab.co.il>
Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/input/touchscreen/ads7846.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 84ccf14..9332e46 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -697,18 +697,22 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val)
 
 static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m)
 {
+	int value;
 	struct spi_transfer *t =
 		list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
 
 	if (ts->model == 7845) {
-		return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3;
+		value = be16_to_cpup((__be16 *)&(((char *)t->rx_buf)[1]));
 	} else {
 		/*
 		 * adjust:  on-wire is a must-ignore bit, a BE12 value, then
 		 * padding; built from two 8 bit values written msb-first.
 		 */
-		return be16_to_cpup((__be16 *)t->rx_buf) >> 3;
+		value = be16_to_cpup((__be16 *)t->rx_buf);
 	}
+
+	/* enforce ADC output is 12 bits width */
+	return (value >> 3) & 0xfff;
 }
 
 static void ads7846_update_value(struct spi_message *m, int val)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 116/143] powerpc: scan_features() updates incorrect bits for REAL_LE
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (114 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 115/143] Input: ads7846 - correct the value got from SPI Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 117/143] crypto: hash - Fix page length clamping in hash walk Willy Tarreau
                   ` (27 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Anton Blanchard, Michael Ellerman, Greg Kroah-Hartman, Willy Tarreau

From: Anton Blanchard <anton@samba.org>

commit 6997e57d693b07289694239e52a10d2f02c3a46f upstream.

The REAL_LE feature entry in the ibm_pa_feature struct is missing an MMU
feature value, meaning all the remaining elements initialise the wrong
values.

This means instead of checking for byte 5, bit 0, we check for byte 0,
bit 0, and then we incorrectly set the CPU feature bit as well as MMU
feature bit 1 and CPU user feature bits 0 and 2 (5).

Checking byte 0 bit 0 (IBM numbering), means we're looking at the
"Memory Management Unit (MMU)" feature - ie. does the CPU have an MMU.
In practice that bit is set on all platforms which have the property.

This means we set CPU_FTR_REAL_LE always. In practice that seems not to
matter because all the modern cpus which have this property also
implement REAL_LE, and we've never needed to disable it.

We're also incorrectly setting MMU feature bit 1, which is:

  #define MMU_FTR_TYPE_8xx		0x00000002

Luckily the only place that looks for MMU_FTR_TYPE_8xx is in Book3E
code, which can't run on the same cpus as scan_features(). So this also
doesn't matter in practice.

Finally in the CPU user feature mask, we're setting bits 0 and 2. Bit 2
is not currently used, and bit 0 is:

  #define PPC_FEATURE_PPC_LE		0x00000001

Which says the CPU supports the old style "PPC Little Endian" mode.
Again this should be harmless in practice as no 64-bit CPUs implement
that mode.

Fix the code by adding the missing initialisation of the MMU feature.

Also add a comment marking CPU user feature bit 2 (0x4) as reserved. It
would be unsafe to start using it as old kernels incorrectly set it.

Fixes: 44ae3ab3358e ("powerpc: Free up some CPU feature bits by moving out MMU-related features")
Signed-off-by: Anton Blanchard <anton@samba.org>
[mpe: Flesh out changelog, add comment reserving 0x4]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/powerpc/include/uapi/asm/cputable.h | 1 +
 arch/powerpc/kernel/prom.c               | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
index de2c0e4..67de80a 100644
--- a/arch/powerpc/include/uapi/asm/cputable.h
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -31,6 +31,7 @@
 #define PPC_FEATURE_PSERIES_PERFMON_COMPAT \
 					0x00000040
 
+/* Reserved - do not use		0x00000004 */
 #define PPC_FEATURE_TRUE_LE		0x00000002
 #define PPC_FEATURE_PPC_LE		0x00000001
 
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8b6f7a9..e8c45b7 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -159,7 +159,7 @@ static struct ibm_pa_feature {
 	{CPU_FTR_NOEXECUTE, 0, 0,	0, 6, 0},
 	{CPU_FTR_NODSISRALIGN, 0, 0,	1, 1, 1},
 	{0, MMU_FTR_CI_LARGE_PAGE, 0,	1, 2, 0},
-	{CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
+	{CPU_FTR_REAL_LE, 0, PPC_FEATURE_TRUE_LE, 5, 0, 0},
 };
 
 static void __init scan_features(unsigned long node, unsigned char *ftrs,
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 117/143] crypto: hash - Fix page length clamping in hash walk
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (115 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 116/143] powerpc: scan_features() updates incorrect bits for REAL_LE Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 118/143] get_rock_ridge_filename(): handle malformed NM entries Willy Tarreau
                   ` (26 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Herbert Xu, Willy Tarreau

From: Herbert Xu <herbert@gondor.apana.org.au>

commit 13f4bb78cf6a312bbdec367ba3da044b09bf0e29 upstream.

The crypto hash walk code is broken when supplied with an offset
greater than or equal to PAGE_SIZE.  This patch fixes it by adjusting
walk->pg and walk->offset when this happens.

Cc: <stable@vger.kernel.org>
Reported-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 crypto/ahash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/ahash.c b/crypto/ahash.c
index 857ae2b..bcd5efc 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -64,8 +64,9 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)
 	struct scatterlist *sg;
 
 	sg = walk->sg;
-	walk->pg = sg_page(sg);
 	walk->offset = sg->offset;
+	walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
+	walk->offset = offset_in_page(walk->offset);
 	walk->entrylen = sg->length;
 
 	if (walk->entrylen > walk->total)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 118/143] get_rock_ridge_filename(): handle malformed NM entries
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (116 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 117/143] crypto: hash - Fix page length clamping in hash walk Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 119/143] Input: max8997-haptic - fix NULL pointer dereference Willy Tarreau
                   ` (25 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Al Viro, yes, really, Willy Tarreau

From: Al Viro <viro@zeniv.linux.org.uk>

commit 99d825822eade8d827a1817357cbf3f889a552d6 upstream.

Payloads of NM entries are not supposed to contain NUL.  When we run
into such, only the part prior to the first NUL goes into the
concatenation (i.e. the directory entry name being encoded by a bunch
of NM entries).  We do stop when the amount collected so far + the
claimed amount in the current NM entry exceed 254.  So far, so good,
but what we return as the total length is the sum of *claimed*
sizes, not the actual amount collected.  And that can grow pretty
large - not unlimited, since you'd need to put CE entries in
between to be able to get more than the maximum that could be
contained in one isofs directory entry / continuation chunk and
we are stop once we'd encountered 32 CEs, but you can get about 8Kb
easily.  And that's what will be passed to readdir callback as the
name length.  8Kb __copy_to_user() from a buffer allocated by
__get_free_page()

Cc: stable@vger.kernel.org # 0.98pl6+ (yes, really)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/isofs/rock.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 735d752..204659a 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -203,6 +203,8 @@ int get_rock_ridge_filename(struct iso_directory_record *de,
 	int retnamlen = 0;
 	int truncate = 0;
 	int ret = 0;
+	char *p;
+	int len;
 
 	if (!ISOFS_SB(inode->i_sb)->s_rock)
 		return 0;
@@ -267,12 +269,17 @@ repeat:
 					rr->u.NM.flags);
 				break;
 			}
-			if ((strlen(retname) + rr->len - 5) >= 254) {
+			len = rr->len - 5;
+			if (retnamlen + len >= 254) {
 				truncate = 1;
 				break;
 			}
-			strncat(retname, rr->u.NM.name, rr->len - 5);
-			retnamlen += rr->len - 5;
+			p = memchr(rr->u.NM.name, '\0', len);
+			if (unlikely(p))
+				len = p - rr->u.NM.name;
+			memcpy(retname + retnamlen, rr->u.NM.name, len);
+			retnamlen += len;
+			retname[retnamlen] = '\0';
 			break;
 		case SIG('R', 'E'):
 			kfree(rs.buffer);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 119/143] Input: max8997-haptic - fix NULL pointer dereference
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (117 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 118/143] get_rock_ridge_filename(): handle malformed NM entries Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 120/143] asmlinkage, pnp: Make variables used from assembler code visible Willy Tarreau
                   ` (24 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Marek Szyprowski, Krzysztof Kozlowski, Dmitry Torokhov, Willy Tarreau

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit 6ae645d5fa385f3787bf1723639cd907fe5865e7 upstream.

NULL pointer derefence happens when booting with DTB because the
platform data for haptic device is not set in supplied data from parent
MFD device.

The MFD device creates only platform data (from Device Tree) for itself,
not for haptic child.

Unable to handle kernel NULL pointer dereference at virtual address 0000009c
pgd = c0004000
	[0000009c] *pgd=00000000
	Internal error: Oops: 5 [#1] PREEMPT SMP ARM
	(max8997_haptic_probe) from [<c03f9cec>] (platform_drv_probe+0x4c/0xb0)
	(platform_drv_probe) from [<c03f8440>] (driver_probe_device+0x214/0x2c0)
	(driver_probe_device) from [<c03f8598>] (__driver_attach+0xac/0xb0)
	(__driver_attach) from [<c03f67ac>] (bus_for_each_dev+0x68/0x9c)
	(bus_for_each_dev) from [<c03f7a38>] (bus_add_driver+0x1a0/0x218)
	(bus_add_driver) from [<c03f8db0>] (driver_register+0x78/0xf8)
	(driver_register) from [<c0101774>] (do_one_initcall+0x90/0x1d8)
	(do_one_initcall) from [<c0a00dbc>] (kernel_init_freeable+0x15c/0x1fc)
	(kernel_init_freeable) from [<c06bb5b4>] (kernel_init+0x8/0x114)
	(kernel_init) from [<c0107938>] (ret_from_fork+0x14/0x3c)

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 104594b01ce7 ("Input: add driver support for MAX8997-haptic")
[k.kozlowski: Write commit message, add CC-stable]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/input/misc/max8997_haptic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c
index e973133..a8c9122 100644
--- a/drivers/input/misc/max8997_haptic.c
+++ b/drivers/input/misc/max8997_haptic.c
@@ -246,12 +246,14 @@ static int max8997_haptic_probe(struct platform_device *pdev)
 	struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	const struct max8997_platform_data *pdata =
 					dev_get_platdata(iodev->dev);
-	const struct max8997_haptic_platform_data *haptic_pdata =
-					pdata->haptic_pdata;
+	const struct max8997_haptic_platform_data *haptic_pdata = NULL;
 	struct max8997_haptic *chip;
 	struct input_dev *input_dev;
 	int error;
 
+	if (pdata)
+		haptic_pdata = pdata->haptic_pdata;
+
 	if (!haptic_pdata) {
 		dev_err(&pdev->dev, "no haptic platform data\n");
 		return -EINVAL;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 120/143] asmlinkage, pnp: Make variables used from assembler code visible
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (118 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 119/143] Input: max8997-haptic - fix NULL pointer dereference Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 121/143] ARM: OMAP3: Fix booting with thumb2 kernel Willy Tarreau
                   ` (23 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Andi Kleen, Jaroslav Kysela, H . Peter Anvin, Willy Tarreau

From: Andi Kleen <ak@linux.intel.com>

commit a99aa42d0253f033cbb85096d3f2bd82201321e6 upstream.

Mark variables referenced from assembler files visible.

This fixes compile problems with LTO.

Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1391845930-28580-4-git-send-email-ak@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/pnp/pnpbios/bioscalls.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index 769d265..deb7f4b 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
+++ b/drivers/pnp/pnpbios/bioscalls.c
@@ -21,7 +21,7 @@
 
 #include "pnpbios.h"
 
-static struct {
+__visible struct {
 	u16 offset;
 	u16 segment;
 } pnp_bios_callpoint;
@@ -41,6 +41,7 @@ asmlinkage void pnp_bios_callfunc(void);
 
 __asm__(".text			\n"
 	__ALIGN_STR "\n"
+	".globl pnp_bios_callfunc\n"
 	"pnp_bios_callfunc:\n"
 	"	pushl %edx	\n"
 	"	pushl %ecx	\n"
@@ -66,9 +67,9 @@ static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092,
  * after PnP BIOS oopses.
  */
 
-u32 pnp_bios_fault_esp;
-u32 pnp_bios_fault_eip;
-u32 pnp_bios_is_utter_crap = 0;
+__visible u32 pnp_bios_fault_esp;
+__visible u32 pnp_bios_fault_eip;
+__visible u32 pnp_bios_is_utter_crap = 0;
 
 static spinlock_t pnp_bios_lock;
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 121/143] ARM: OMAP3: Fix booting with thumb2 kernel
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (119 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 120/143] asmlinkage, pnp: Make variables used from assembler code visible Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 122/143] decnet: Do not build routes to devices without decnet private data Willy Tarreau
                   ` (22 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tony Lindgren, Willy Tarreau

From: Tony Lindgren <tony@atomide.com>

commit d8a50941c91a68da202aaa96a3dacd471ea9c693 upstream.

We get a NULL pointer dereference on omap3 for thumb2 compiled kernels:

Internal error: Oops: 80000005 [#1] SMP THUMB2
...
[<c046497b>] (_raw_spin_unlock_irqrestore) from [<c0024375>]
(omap3_enter_idle_bm+0xc5/0x178)
[<c0024375>] (omap3_enter_idle_bm) from [<c0374e63>]
(cpuidle_enter_state+0x77/0x27c)
[<c0374e63>] (cpuidle_enter_state) from [<c00627f1>]
(cpu_startup_entry+0x155/0x23c)
[<c00627f1>] (cpu_startup_entry) from [<c06b9a47>]
(start_kernel+0x32f/0x338)
[<c06b9a47>] (start_kernel) from [<8000807f>] (0x8000807f)

The power management related assembly on omaps needs to interact with
ARM mode bootrom code, so we need to keep most of the related assembly
in ARM mode.

Turns out this error is because of missing ENDPROC for assembly code
as suggested by Stephen Boyd <sboyd@codeaurora.org>. Let's fix the
problem by adding ENDPROC in two places to sleep34xx.S.

Let's also remove the now duplicate custom code for mode switching.
This has been unnecessary since commit 6ebbf2ce437b ("ARM: convert
all "mov.* pc, reg" to "bx reg" for ARMv6+").

And let's also remove the comments about local variables, they are
now just confusing after the ENDPROC.

The reason why ENDPROC makes a difference is it sets .type and then
the compiler knows what to do with the thumb bit as explained at:

https://wiki.ubuntu.com/ARM/Thumb2PortingHowto

Reported-by: Kevin Hilman <khilman@kernel.org>
Tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 arch/arm/mach-omap2/sleep34xx.S | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index d1dedc8..eafd120 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -203,23 +203,8 @@ save_context_wfi:
 	 */
 	ldr	r1, kernel_flush
 	blx	r1
-	/*
-	 * The kernel doesn't interwork: v7_flush_dcache_all in particluar will
-	 * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled.
-	 * This sequence switches back to ARM.  Note that .align may insert a
-	 * nop: bx pc needs to be word-aligned in order to work.
-	 */
- THUMB(	.thumb		)
- THUMB(	.align		)
- THUMB(	bx	pc	)
- THUMB(	nop		)
-	.arm
-
 	b	omap3_do_wfi
-
-/*
- * Local variables
- */
+ENDPROC(omap34xx_cpu_suspend)
 omap3_do_wfi_sram_addr:
 	.word omap3_do_wfi_sram
 kernel_flush:
@@ -364,10 +349,7 @@ exit_nonoff_modes:
  * ===================================
  */
 	ldmfd	sp!, {r4 - r11, pc}	@ restore regs and return
-
-/*
- * Local variables
- */
+ENDPROC(omap3_do_wfi)
 sdrc_power:
 	.word	SDRC_POWER_V
 cm_idlest1_core:
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 122/143] decnet: Do not build routes to devices without decnet private data.
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (120 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 121/143] ARM: OMAP3: Fix booting with thumb2 kernel Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 123/143] route: do not cache fib route info on local routes with oif Willy Tarreau
                   ` (21 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: David S. Miller, Willy Tarreau

From: "David S. Miller" <davem@davemloft.net>

commit a36a0d4008488fa545c74445d69eaf56377d5d4e upstream.

In particular, make sure we check for decnet private presence
for loopback devices.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/decnet/dn_route.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index fe32388..b961005 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1030,10 +1030,13 @@ source_ok:
 	if (!fld.daddr) {
 		fld.daddr = fld.saddr;
 
-		err = -EADDRNOTAVAIL;
 		if (dev_out)
 			dev_put(dev_out);
+		err = -EINVAL;
 		dev_out = init_net.loopback_dev;
+		if (!dev_out->dn_ptr)
+			goto out;
+		err = -EADDRNOTAVAIL;
 		dev_hold(dev_out);
 		if (!fld.daddr) {
 			fld.daddr =
@@ -1106,6 +1109,8 @@ source_ok:
 		if (dev_out == NULL)
 			goto out;
 		dn_db = rcu_dereference_raw(dev_out->dn_ptr);
+		if (!dn_db)
+			goto e_inval;
 		/* Possible improvement - check all devices for local addr */
 		if (dn_dev_islocal(dev_out, fld.daddr)) {
 			dev_put(dev_out);
@@ -1147,6 +1152,8 @@ select_source:
 			dev_put(dev_out);
 		dev_out = init_net.loopback_dev;
 		dev_hold(dev_out);
+		if (!dev_out->dn_ptr)
+			goto e_inval;
 		fld.flowidn_oif = dev_out->ifindex;
 		if (res.fi)
 			dn_fib_info_put(res.fi);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 123/143] route: do not cache fib route info on local routes with oif
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (121 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 122/143] decnet: Do not build routes to devices without decnet private data Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 124/143] packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface Willy Tarreau
                   ` (20 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Chris Friesen, Allain Legacy, David S . Miller, Willy Tarreau

From: Chris Friesen <chris.friesen@windriver.com>

commit d6d5e999e5df67f8ec20b6be45e2229455ee3699 upstream.

For local routes that require a particular output interface we do not want
to cache the result.  Caching the result causes incorrect behaviour when
there are multiple source addresses on the interface.  The end result
being that if the intended recipient is waiting on that interface for the
packet he won't receive it because it will be delivered on the loopback
interface and the IP_PKTINFO ipi_ifindex will be set to the loopback
interface as well.

This can be tested by running a program such as "dhcp_release" which
attempts to inject a packet on a particular interface so that it is
received by another program on the same board.  The receiving process
should see an IP_PKTINFO ipi_ifndex value of the source interface
(e.g., eth1) instead of the loopback interface (e.g., lo).  The packet
will still appear on the loopback interface in tcpdump but the important
aspect is that the CMSG info is correct.

Sample dhcp_release command line:

   dhcp_release eth1 192.168.204.222 02:11:33:22:44:66

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Signed off-by: Chris Friesen <chris.friesen@windriver.com>
Reviewed-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/ipv4/route.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 222e1b6..624ca8e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1876,6 +1876,18 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 		 */
 		if (fi && res->prefixlen < 4)
 			fi = NULL;
+	} else if ((type == RTN_LOCAL) && (orig_oif != 0) &&
+		   (orig_oif != dev_out->ifindex)) {
+		/* For local routes that require a particular output interface
+		 * we do not want to cache the result.  Caching the result
+		 * causes incorrect behaviour when there are multiple source
+		 * addresses on the interface, the end result being that if the
+		 * intended recipient is waiting on that interface for the
+		 * packet he won't receive it because it will be delivered on
+		 * the loopback interface and the IP_PKTINFO ipi_ifindex will
+		 * be set to the loopback interface as well.
+		 */
+		fi = NULL;
 	}
 
 	fnhe = NULL;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 124/143] packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (122 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 123/143] route: do not cache fib route info on local routes with oif Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 125/143] atl2: Disable unimplemented scatter/gather feature Willy Tarreau
                   ` (19 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Mathias Krause, Eric W . Biederman, Pavel Emelyanov,
	David S . Miller, Willy Tarreau

From: Mathias Krause <minipli@googlemail.com>

commit 309cf37fe2a781279b7675d4bb7173198e532867 upstream.

Because we miss to wipe the remainder of i->addr[] in packet_mc_add(),
pdiag_put_mclist() leaks uninitialized heap bytes via the
PACKET_DIAG_MCLIST netlink attribute.

Fix this by explicitly memset(0)ing the remaining bytes in i->addr[].

Fixes: eea68e2f1a00 ("packet: Report socket mclist info via diag module")
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/packet/af_packet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 39fa339..2d454a2 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2997,6 +2997,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq)
 	i->ifindex = mreq->mr_ifindex;
 	i->alen = mreq->mr_alen;
 	memcpy(i->addr, mreq->mr_address, i->alen);
+	memset(i->addr + i->alen, 0, sizeof(i->addr) - i->alen);
 	i->count = 1;
 	i->next = po->mclist;
 	po->mclist = i;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 125/143] atl2: Disable unimplemented scatter/gather feature
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (123 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 124/143] packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 126/143] net: fix infoleak in llc Willy Tarreau
                   ` (18 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Ben Hutchings, David S . Miller, Willy Tarreau

From: Ben Hutchings <ben@decadent.org.uk>

commit f43bfaeddc79effbf3d0fcb53ca477cca66f3db8 upstream.

atl2 includes NETIF_F_SG in hw_features even though it has no support
for non-linear skbs.  This bug was originally harmless since the
driver does not claim to implement checksum offload and that used to
be a requirement for SG.

Now that SG and checksum offload are independent features, if you
explicitly enable SG *and* use one of the rare protocols that can use
SG without checkusm offload, this potentially leaks sensitive
information (before you notice that it just isn't working).  Therefore
this obscure bug has been designated CVE-2016-2117.

Reported-by: Justin Yackoski <jyackoski@crypto-nite.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Fixes: ec5f06156423 ("net: Kill link between CSUM and SG features.")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/ethernet/atheros/atlx/atl2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index 265ce1b..96fe542 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -1413,7 +1413,7 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	err = -EIO;
 
-	netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX;
+	netdev->hw_features = NETIF_F_HW_VLAN_CTAG_RX;
 	netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);
 
 	/* Init PHY as early as possible due to power saving issue  */
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 126/143] net: fix infoleak in llc
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (124 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 125/143] atl2: Disable unimplemented scatter/gather feature Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 127/143] net: fix infoleak in rtnetlink Willy Tarreau
                   ` (17 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kangjie Lu, Kangjie Lu, David S . Miller, Willy Tarreau

From: Kangjie Lu <kangjielu@gmail.com>

commit b8670c09f37bdf2847cc44f36511a53afc6161fd upstream.

The stack object “info” has a total size of 12 bytes. Its last byte
is padding which is not initialized and leaked via “put_cmsg”.

Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/llc/af_llc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index c3ee805..9d14059 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -626,6 +626,7 @@ static void llc_cmsg_rcv(struct msghdr *msg, struct sk_buff *skb)
 	if (llc->cmsg_flags & LLC_CMSG_PKTINFO) {
 		struct llc_pktinfo info;
 
+		memset(&info, 0, sizeof(info));
 		info.lpi_ifindex = llc_sk(skb->sk)->dev->ifindex;
 		llc_pdu_decode_dsap(skb, &info.lpi_sap);
 		llc_pdu_decode_da(skb, info.lpi_mac);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 127/143] net: fix infoleak in rtnetlink
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (125 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 126/143] net: fix infoleak in llc Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 128/143] VSOCK: do not disconnect socket when peer has shutdown SEND only Willy Tarreau
                   ` (16 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kangjie Lu, Kangjie Lu, David S . Miller, Greg Kroah-Hartman,
	Willy Tarreau

From: Kangjie Lu <kangjielu@gmail.com>

commit 5f8e44741f9f216e33736ea4ec65ca9ac03036e6 upstream.

The stack object “map” has a total size of 32 bytes. Its last 4
bytes are padding generated by compiler. These padding bytes are
not initialized and sent out via “nla_put”.

Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/core/rtnetlink.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a67310e..602c6d0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -899,14 +899,16 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
 		goto nla_put_failure;
 
 	if (1) {
-		struct rtnl_link_ifmap map = {
-			.mem_start   = dev->mem_start,
-			.mem_end     = dev->mem_end,
-			.base_addr   = dev->base_addr,
-			.irq         = dev->irq,
-			.dma         = dev->dma,
-			.port        = dev->if_port,
-		};
+		struct rtnl_link_ifmap map;
+
+		memset(&map, 0, sizeof(map));
+		map.mem_start   = dev->mem_start;
+		map.mem_end     = dev->mem_end;
+		map.base_addr   = dev->base_addr;
+		map.irq         = dev->irq;
+		map.dma         = dev->dma;
+		map.port        = dev->if_port;
+
 		if (nla_put(skb, IFLA_MAP, sizeof(map), &map))
 			goto nla_put_failure;
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 128/143] VSOCK: do not disconnect socket when peer has shutdown SEND only
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (126 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 127/143] net: fix infoleak in rtnetlink Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 129/143] net: bridge: fix old ioctl unlocked net device walk Willy Tarreau
                   ` (15 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ian Campbell, David S. Miller, Stefan Hajnoczi, Claudio Imbrenda,
	Andy King, Dmitry Torokhov, Jorgen Hansen, Adit Ranadive, netdev,
	Greg Kroah-Hartman, Willy Tarreau

From: Ian Campbell <ian.campbell@docker.com>

commit dedc58e067d8c379a15a8a183c5db318201295bb upstream.

The peer may be expecting a reply having sent a request and then done a
shutdown(SHUT_WR), so tearing down the whole socket at this point seems
wrong and breaks for me with a client which does a SHUT_WR.

Looking at other socket family's stream_recvmsg callbacks doing a shutdown
here does not seem to be the norm and removing it does not seem to have
had any adverse effects that I can see.

I'm using Stefan's RFC virtio transport patches, I'm unsure of the impact
on the vmci transport.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Cc: Andy King <acking@vmware.com>
Cc: Dmitry Torokhov <dtor@vmware.com>
Cc: Jorgen Hansen <jhansen@vmware.com>
Cc: Adit Ranadive <aditr@vmware.com>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/vmw_vsock/af_vsock.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 9b88693..66a9bf5 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1804,27 +1804,8 @@ vsock_stream_recvmsg(struct kiocb *kiocb,
 	else if (sk->sk_shutdown & RCV_SHUTDOWN)
 		err = 0;
 
-	if (copied > 0) {
-		/* We only do these additional bookkeeping/notification steps
-		 * if we actually copied something out of the queue pair
-		 * instead of just peeking ahead.
-		 */
-
-		if (!(flags & MSG_PEEK)) {
-			/* If the other side has shutdown for sending and there
-			 * is nothing more to read, then modify the socket
-			 * state.
-			 */
-			if (vsk->peer_shutdown & SEND_SHUTDOWN) {
-				if (vsock_stream_has_data(vsk) <= 0) {
-					sk->sk_state = SS_UNCONNECTED;
-					sock_set_flag(sk, SOCK_DONE);
-					sk->sk_state_change(sk);
-				}
-			}
-		}
+	if (copied > 0)
 		err = copied;
-	}
 
 out_wait:
 	finish_wait(sk_sleep(sk), &wait);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 129/143] net: bridge: fix old ioctl unlocked net device walk
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (127 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 128/143] VSOCK: do not disconnect socket when peer has shutdown SEND only Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 130/143] net: fix a kernel infoleak in x25 module Willy Tarreau
                   ` (14 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Nikolay Aleksandrov, David S . Miller, Willy Tarreau

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

commit 31ca0458a61a502adb7ed192bf9716c6d05791a5 upstream.

get_bridge_ifindices() is used from the old "deviceless" bridge ioctl
calls which aren't called with rtnl held. The comment above says that it is
called with rtnl but that is not really the case.
Here's a sample output from a test ASSERT_RTNL() which I put in
get_bridge_ifindices and executed "brctl show":
[  957.422726] RTNL: assertion failed at net/bridge//br_ioctl.c (30)
[  957.422925] CPU: 0 PID: 1862 Comm: brctl Tainted: G        W  O
4.6.0-rc4+ #157
[  957.423009] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS 1.8.1-20150318_183358- 04/01/2014
[  957.423009]  0000000000000000 ffff880058adfdf0 ffffffff8138dec5
0000000000000400
[  957.423009]  ffffffff81ce8380 ffff880058adfe58 ffffffffa05ead32
0000000000000001
[  957.423009]  00007ffec1a444b0 0000000000000400 ffff880053c19130
0000000000008940
[  957.423009] Call Trace:
[  957.423009]  [<ffffffff8138dec5>] dump_stack+0x85/0xc0
[  957.423009]  [<ffffffffa05ead32>]
br_ioctl_deviceless_stub+0x212/0x2e0 [bridge]
[  957.423009]  [<ffffffff81515beb>] sock_ioctl+0x22b/0x290
[  957.423009]  [<ffffffff8126ba75>] do_vfs_ioctl+0x95/0x700
[  957.423009]  [<ffffffff8126c159>] SyS_ioctl+0x79/0x90
[  957.423009]  [<ffffffff8163a4c0>] entry_SYSCALL_64_fastpath+0x23/0xc1

Since it only reads bridge ifindices, we can use rcu to safely walk the net
device list. Also remove the wrong rtnl comment above.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/bridge/br_ioctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index b73eaba..a882db4 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -21,18 +21,19 @@
 #include <asm/uaccess.h>
 #include "br_private.h"
 
-/* called with RTNL */
 static int get_bridge_ifindices(struct net *net, int *indices, int num)
 {
 	struct net_device *dev;
 	int i = 0;
 
-	for_each_netdev(net, dev) {
+	rcu_read_lock();
+	for_each_netdev_rcu(net, dev) {
 		if (i >= num)
 			break;
 		if (dev->priv_flags & IFF_EBRIDGE)
 			indices[i++] = dev->ifindex;
 	}
+	rcu_read_unlock();
 
 	return i;
 }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 130/143] net: fix a kernel infoleak in x25 module
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (128 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 129/143] net: bridge: fix old ioctl unlocked net device walk Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 131/143] fs/cifs: correctly to anonymous authentication via NTLMSSP Willy Tarreau
                   ` (13 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kangjie Lu, Kangjie Lu, David S . Miller, Willy Tarreau

From: Kangjie Lu <kangjielu@gmail.com>

commit 79e48650320e6fba48369fccf13fd045315b19b8 upstream.

Stack object "dte_facilities" is allocated in x25_rx_call_request(),
which is supposed to be initialized in x25_negotiate_facilities.
However, 5 fields (8 bytes in total) are not initialized. This
object is then copied to userland via copy_to_user, thus infoleak
occurs.

Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 net/x25/x25_facilities.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index 66c63873..de7552d 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -271,6 +271,7 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
 
 	memset(&theirs, 0, sizeof(theirs));
 	memcpy(new, ours, sizeof(*new));
+	memset(dte, 0, sizeof(*dte));
 
 	len = x25_parse_facilities(skb, &theirs, dte, &x25->vc_facil_mask);
 	if (len < 0)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 131/143] fs/cifs: correctly to anonymous authentication via NTLMSSP
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (129 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 130/143] net: fix a kernel infoleak in x25 module Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 132/143] ring-buffer: Use long for nr_pages to avoid overflow failures Willy Tarreau
                   ` (12 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Stefan Metzmacher, Steve French, Willy Tarreau

From: Stefan Metzmacher <metze@samba.org>

commit cfda35d98298131bf38fbad3ce4cd5ecb3cf18db upstream.

See [MS-NLMP] 3.2.5.1.2 Server Receives an AUTHENTICATE_MESSAGE from the Client:

   ...
   Set NullSession to FALSE
   If (AUTHENTICATE_MESSAGE.UserNameLen == 0 AND
      AUTHENTICATE_MESSAGE.NtChallengeResponse.Length == 0 AND
      (AUTHENTICATE_MESSAGE.LmChallengeResponse == Z(1)
       OR
       AUTHENTICATE_MESSAGE.LmChallengeResponse.Length == 0))
       -- Special case: client requested anonymous authentication
       Set NullSession to TRUE
   ...

Only server which map unknown users to guest will allow
access using a non-null NTChallengeResponse.

For Samba it's the "map to guest = bad user" option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913

CC: Stable <stable@vger.kernel.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 fs/cifs/sess.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 8edc9eb..d65e16e 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -487,19 +487,27 @@ int build_ntlmssp_auth_blob(unsigned char *pbuffer,
 	sec_blob->LmChallengeResponse.MaximumLength = 0;
 
 	sec_blob->NtChallengeResponse.BufferOffset = cpu_to_le32(tmp - pbuffer);
-	rc = setup_ntlmv2_rsp(ses, nls_cp);
-	if (rc) {
-		cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc);
-		goto setup_ntlmv2_ret;
-	}
-	memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
-			ses->auth_key.len - CIFS_SESS_KEY_SIZE);
-	tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE;
+	if (ses->user_name != NULL) {
+		rc = setup_ntlmv2_rsp(ses, nls_cp);
+		if (rc) {
+			cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc);
+			goto setup_ntlmv2_ret;
+		}
+		memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
+				ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+		tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE;
 
-	sec_blob->NtChallengeResponse.Length =
-			cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
-	sec_blob->NtChallengeResponse.MaximumLength =
-			cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+		sec_blob->NtChallengeResponse.Length =
+				cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+		sec_blob->NtChallengeResponse.MaximumLength =
+				cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+	} else {
+		/*
+		 * don't send an NT Response for anonymous access
+		 */
+		sec_blob->NtChallengeResponse.Length = 0;
+		sec_blob->NtChallengeResponse.MaximumLength = 0;
+	}
 
 	if (ses->domainName == NULL) {
 		sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 132/143] ring-buffer: Use long for nr_pages to avoid overflow failures
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (130 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 131/143] fs/cifs: correctly to anonymous authentication via NTLMSSP Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 133/143] ring-buffer: Prevent overflow of size in ring_buffer_resize() Willy Tarreau
                   ` (11 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Steven Rostedt (Red Hat), Greg Kroah-Hartman, Willy Tarreau

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 9b94a8fba501f38368aef6ac1b30e7335252a220 upstream.

The size variable to change the ring buffer in ftrace is a long. The
nr_pages used to update the ring buffer based on the size is int. On 64 bit
machines this can cause an overflow problem.

For example, the following will cause the ring buffer to crash:

 # cd /sys/kernel/debug/tracing
 # echo 10 > buffer_size_kb
 # echo 8556384240 > buffer_size_kb

Then you get the warning of:

 WARNING: CPU: 1 PID: 318 at kernel/trace/ring_buffer.c:1527 rb_update_pages+0x22f/0x260

Which is:

  RB_WARN_ON(cpu_buffer, nr_removed);

Note each ring buffer page holds 4080 bytes.

This is because:

 1) 10 causes the ring buffer to have 3 pages.
    (10kb requires 3 * 4080 pages to hold)

 2) (2^31 / 2^10  + 1) * 4080 = 8556384240
    The value written into buffer_size_kb is shifted by 10 and then passed
    to ring_buffer_resize(). 8556384240 * 2^10 = 8761737461760

 3) The size passed to ring_buffer_resize() is then divided by BUF_PAGE_SIZE
    which is 4080. 8761737461760 / 4080 = 2147484672

 4) nr_pages is subtracted from the current nr_pages (3) and we get:
    2147484669. This value is saved in a signed integer nr_pages_to_update

 5) 2147484669 is greater than 2^31 but smaller than 2^32, a signed int
    turns into the value of -2147482627

 6) As the value is a negative number, in update_pages_handler() it is
    negated and passed to rb_remove_pages() and 2147482627 pages will
    be removed, which is much larger than 3 and it causes the warning
    because not all the pages asked to be removed were removed.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=118001

Fixes: 7a8e76a3829f1 ("tracing: unified trace buffer")
Reported-by: Hao Qin <QEver.cn@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 kernel/trace/ring_buffer.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index cb73c4e..6f70235 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -463,7 +463,7 @@ struct ring_buffer_per_cpu {
 	raw_spinlock_t			reader_lock;	/* serialize readers */
 	arch_spinlock_t			lock;
 	struct lock_class_key		lock_key;
-	unsigned int			nr_pages;
+	unsigned long			nr_pages;
 	struct list_head		*pages;
 	struct buffer_page		*head_page;	/* read from head */
 	struct buffer_page		*tail_page;	/* write to tail */
@@ -483,7 +483,7 @@ struct ring_buffer_per_cpu {
 	u64				write_stamp;
 	u64				read_stamp;
 	/* ring buffer pages to update, > 0 to add, < 0 to remove */
-	int				nr_pages_to_update;
+	long				nr_pages_to_update;
 	struct list_head		new_pages; /* new pages to add */
 	struct work_struct		update_pages_work;
 	struct completion		update_done;
@@ -1120,10 +1120,10 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer)
 	return 0;
 }
 
-static int __rb_allocate_pages(int nr_pages, struct list_head *pages, int cpu)
+static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)
 {
-	int i;
 	struct buffer_page *bpage, *tmp;
+	long i;
 
 	for (i = 0; i < nr_pages; i++) {
 		struct page *page;
@@ -1160,7 +1160,7 @@ free_pages:
 }
 
 static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
-			     unsigned nr_pages)
+			     unsigned long nr_pages)
 {
 	LIST_HEAD(pages);
 
@@ -1185,7 +1185,7 @@ static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
 }
 
 static struct ring_buffer_per_cpu *
-rb_allocate_cpu_buffer(struct ring_buffer *buffer, int nr_pages, int cpu)
+rb_allocate_cpu_buffer(struct ring_buffer *buffer, long nr_pages, int cpu)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
 	struct buffer_page *bpage;
@@ -1284,8 +1284,9 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,
 					struct lock_class_key *key)
 {
 	struct ring_buffer *buffer;
+	long nr_pages;
 	int bsize;
-	int cpu, nr_pages;
+	int cpu;
 
 	/* keep it in its own cache line */
 	buffer = kzalloc(ALIGN(sizeof(*buffer), cache_line_size()),
@@ -1408,12 +1409,12 @@ static inline unsigned long rb_page_write(struct buffer_page *bpage)
 }
 
 static int
-rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned int nr_pages)
+rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
 {
 	struct list_head *tail_page, *to_remove, *next_page;
 	struct buffer_page *to_remove_page, *tmp_iter_page;
 	struct buffer_page *last_page, *first_page;
-	unsigned int nr_removed;
+	unsigned long nr_removed;
 	unsigned long head_bit;
 	int page_entries;
 
@@ -1629,7 +1630,7 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
 			int cpu_id)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
-	unsigned nr_pages;
+	unsigned long nr_pages;
 	int cpu, err = 0;
 
 	/*
@@ -4607,8 +4608,9 @@ static int rb_cpu_notify(struct notifier_block *self,
 	struct ring_buffer *buffer =
 		container_of(self, struct ring_buffer, cpu_notify);
 	long cpu = (long)hcpu;
-	int cpu_i, nr_pages_same;
-	unsigned int nr_pages;
+	long nr_pages_same;
+	int cpu_i;
+	unsigned long nr_pages;
 
 	switch (action) {
 	case CPU_UP_PREPARE:
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 133/143] ring-buffer: Prevent overflow of size in ring_buffer_resize()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (131 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 132/143] ring-buffer: Use long for nr_pages to avoid overflow failures Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 134/143] mfd: omap-usb-tll: Fix scheduling while atomic BUG Willy Tarreau
                   ` (10 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Steven Rostedt (Red Hat), stable, Willy Tarreau

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 59643d1535eb220668692a5359de22545af579f6 upstream.

If the size passed to ring_buffer_resize() is greater than MAX_LONG - BUF_PAGE_SIZE
then the DIV_ROUND_UP() will return zero.

Here's the details:

  # echo 18014398509481980 > /sys/kernel/debug/tracing/buffer_size_kb

tracing_entries_write() processes this and converts kb to bytes.

 18014398509481980 << 10 = 18446744073709547520

and this is passed to ring_buffer_resize() as unsigned long size.

 size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);

Where DIV_ROUND_UP(a, b) is (a + b - 1)/b

BUF_PAGE_SIZE is 4080 and here

 18446744073709547520 + 4080 - 1 = 18446744073709551599

where 18446744073709551599 is still smaller than 2^64

 2^64 - 18446744073709551599 = 17

But now 18446744073709551599 / 4080 = 4521260802379792

and size = size * 4080 = 18446744073709551360

This is checked to make sure its still greater than 2 * 4080,
which it is.

Then we convert to the number of buffer pages needed.

 nr_page = DIV_ROUND_UP(size, BUF_PAGE_SIZE)

but this time size is 18446744073709551360 and

 2^64 - (18446744073709551360 + 4080 - 1) = -3823

Thus it overflows and the resulting number is less than 4080, which makes

  3823 / 4080 = 0

an nr_pages is set to this. As we already checked against the minimum that
nr_pages may be, this causes the logic to fail as well, and we crash the
kernel.

There's no reason to have the two DIV_ROUND_UP() (that's just result of
historical code changes), clean up the code and fix this bug.

Cc: stable@vger.kernel.org # 3.5+
Fixes: 83f40318dab00 ("ring-buffer: Make removal of ring buffer pages atomic")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 kernel/trace/ring_buffer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 6f70235..c4ce3a9 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1644,14 +1644,13 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
 	    !cpumask_test_cpu(cpu_id, buffer->cpumask))
 		return size;
 
-	size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
-	size *= BUF_PAGE_SIZE;
+	nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
 
 	/* we need a minimum of two pages */
-	if (size < BUF_PAGE_SIZE * 2)
-		size = BUF_PAGE_SIZE * 2;
+	if (nr_pages < 2)
+		nr_pages = 2;
 
-	nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
+	size = nr_pages * BUF_PAGE_SIZE;
 
 	/*
 	 * Don't succeed if resizing is disabled, as a reader might be
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 134/143] mfd: omap-usb-tll: Fix scheduling while atomic BUG
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (132 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 133/143] ring-buffer: Prevent overflow of size in ring_buffer_resize() Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 135/143] mmc: mmc: Fix partition switch timeout for some eMMCs Willy Tarreau
                   ` (9 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Roger Quadros, Lee Jones, Greg Kroah-Hartman, Willy Tarreau

From: Roger Quadros <rogerq@ti.com>

commit b49b927f16acee626c56a1af4ab4cb062f75b5df upstream.

We shouldn't be calling clk_prepare_enable()/clk_prepare_disable()
in an atomic context.

Fixes the following issue:

[    5.830970] ehci-omap: OMAP-EHCI Host Controller driver
[    5.830974] driver_register 'ehci-omap'
[    5.895849] driver_register 'wl1271_sdio'
[    5.896870] BUG: scheduling while atomic: udevd/994/0x00000002
[    5.896876] 4 locks held by udevd/994:
[    5.896904]  #0:  (&dev->mutex){......}, at: [<c049597c>] __driver_attach+0x60/0xac
[    5.896923]  #1:  (&dev->mutex){......}, at: [<c049598c>] __driver_attach+0x70/0xac
[    5.896946]  #2:  (tll_lock){+.+...}, at: [<c04c2630>] omap_tll_enable+0x2c/0xd0
[    5.896966]  #3:  (prepare_lock){+.+...}, at: [<c05ce9c8>] clk_prepare_lock+0x48/0xe0
[    5.897042] Modules linked in: wlcore_sdio(+) ehci_omap(+) dwc3_omap snd_soc_ts3a225e leds_is31fl319x bq27xxx_battery_i2c tsc2007 bq27xxx_battery bq2429x_charger ina2xx tca8418_keypad as5013 leds_tca6507 twl6040_vibra gpio_twl6040 bmp085_i2c(+) palmas_gpadc usb3503 palmas_pwrbutton bmg160_i2c(+) bmp085 bma150(+) bmg160_core bmp280 input_polldev snd_soc_omap_mcbsp snd_soc_omap_mcpdm snd_soc_omap snd_pcm_dmaengine
[    5.897048] Preemption disabled at:[<  (null)>]   (null)
[    5.897051]
[    5.897059] CPU: 0 PID: 994 Comm: udevd Not tainted 4.6.0-rc5-letux+ #233
[    5.897062] Hardware name: Generic OMAP5 (Flattened Device Tree)
[    5.897076] [<c010e714>] (unwind_backtrace) from [<c010af34>] (show_stack+0x10/0x14)
[    5.897087] [<c010af34>] (show_stack) from [<c040aa7c>] (dump_stack+0x88/0xc0)
[    5.897099] [<c040aa7c>] (dump_stack) from [<c020c558>] (__schedule_bug+0xac/0xd0)
[    5.897111] [<c020c558>] (__schedule_bug) from [<c06f3d44>] (__schedule+0x88/0x7e4)
[    5.897120] [<c06f3d44>] (__schedule) from [<c06f46d8>] (schedule+0x9c/0xc0)
[    5.897129] [<c06f46d8>] (schedule) from [<c06f4904>] (schedule_preempt_disabled+0x14/0x20)
[    5.897140] [<c06f4904>] (schedule_preempt_disabled) from [<c06f64e4>] (mutex_lock_nested+0x258/0x43c)
[    5.897150] [<c06f64e4>] (mutex_lock_nested) from [<c05ce9c8>] (clk_prepare_lock+0x48/0xe0)
[    5.897160] [<c05ce9c8>] (clk_prepare_lock) from [<c05d0e7c>] (clk_prepare+0x10/0x28)
[    5.897169] [<c05d0e7c>] (clk_prepare) from [<c04c2668>] (omap_tll_enable+0x64/0xd0)
[    5.897180] [<c04c2668>] (omap_tll_enable) from [<c04c1728>] (usbhs_runtime_resume+0x18/0x17c)
[    5.897192] [<c04c1728>] (usbhs_runtime_resume) from [<c049d404>] (pm_generic_runtime_resume+0x2c/0x40)
[    5.897202] [<c049d404>] (pm_generic_runtime_resume) from [<c049f180>] (__rpm_callback+0x38/0x68)
[    5.897210] [<c049f180>] (__rpm_callback) from [<c049f220>] (rpm_callback+0x70/0x88)
[    5.897218] [<c049f220>] (rpm_callback) from [<c04a0a00>] (rpm_resume+0x4ec/0x7ec)
[    5.897227] [<c04a0a00>] (rpm_resume) from [<c04a0f48>] (__pm_runtime_resume+0x4c/0x64)
[    5.897236] [<c04a0f48>] (__pm_runtime_resume) from [<c04958dc>] (driver_probe_device+0x30/0x70)
[    5.897246] [<c04958dc>] (driver_probe_device) from [<c04959a4>] (__driver_attach+0x88/0xac)
[    5.897256] [<c04959a4>] (__driver_attach) from [<c04940f8>] (bus_for_each_dev+0x50/0x84)
[    5.897267] [<c04940f8>] (bus_for_each_dev) from [<c0494e40>] (bus_add_driver+0xcc/0x1e4)
[    5.897276] [<c0494e40>] (bus_add_driver) from [<c0496914>] (driver_register+0xac/0xf4)
[    5.897286] [<c0496914>] (driver_register) from [<c01018e0>] (do_one_initcall+0x100/0x1b8)
[    5.897296] [<c01018e0>] (do_one_initcall) from [<c01c7a54>] (do_init_module+0x58/0x1c0)
[    5.897304] [<c01c7a54>] (do_init_module) from [<c01c8a3c>] (SyS_finit_module+0x88/0x90)
[    5.897313] [<c01c8a3c>] (SyS_finit_module) from [<c0107120>] (ret_fast_syscall+0x0/0x1c)
[    5.912697] ------------[ cut here ]------------
[    5.912711] WARNING: CPU: 0 PID: 994 at kernel/sched/core.c:2996 _raw_spin_unlock+0x28/0x58
[    5.912717] DEBUG_LOCKS_WARN_ON(val > preempt_count())

Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
Tested-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/mfd/omap-usb-tll.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index e59ac4c..c7576a5 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -269,6 +269,8 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 
 		if (IS_ERR(tll->ch_clk[i]))
 			dev_dbg(dev, "can't get clock : %s\n", clkname);
+		else
+			clk_prepare(tll->ch_clk[i]);
 	}
 
 	pm_runtime_put_sync(dev);
@@ -301,9 +303,12 @@ static int usbtll_omap_remove(struct platform_device *pdev)
 	tll_dev = NULL;
 	spin_unlock(&tll_lock);
 
-	for (i = 0; i < tll->nch; i++)
-		if (!IS_ERR(tll->ch_clk[i]))
+	for (i = 0; i < tll->nch; i++) {
+		if (!IS_ERR(tll->ch_clk[i])) {
+			clk_unprepare(tll->ch_clk[i]);
 			clk_put(tll->ch_clk[i]);
+		}
+	}
 
 	pm_runtime_disable(&pdev->dev);
 	return 0;
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 135/143] mmc: mmc: Fix partition switch timeout for some eMMCs
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (133 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 134/143] mfd: omap-usb-tll: Fix scheduling while atomic BUG Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 136/143] mmc: longer timeout for long read time quirk Willy Tarreau
                   ` (8 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Adrian Hunter, Ulf Hansson, Greg Kroah-Hartman, Willy Tarreau

From: Adrian Hunter <adrian.hunter@intel.com>

commit 1c447116d017a98c90f8f71c8c5a611e0aa42178 upstream.

Some eMMCs set the partition switch timeout too low.

Now typically eMMCs are considered a critical component (e.g. because
they store the root file system) and consequently are expected to be
reliable.  Thus we can neglect the use case where eMMCs can't switch
reliably and we might want a lower timeout to facilitate speedy
recovery.

Although we could employ a quirk for the cards that are affected (if
we could identify them all), as described above, there is little
benefit to having a low timeout, so instead simply set a minimum
timeout.

The minimum is set to 300ms somewhat arbitrarily - the examples that
have been seen had a timeout of 10ms but were sometimes taking 60-70ms.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/mmc/core/mmc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 0cbd1ef..dda1a42 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -266,6 +266,9 @@ static void mmc_select_card_type(struct mmc_card *card)
 	card->ext_csd.card_type = card_type;
 }
 
+/* Minimum partition switch timeout in milliseconds */
+#define MMC_MIN_PART_SWITCH_TIME	300
+
 /*
  * Decode extended CSD.
  */
@@ -330,6 +333,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 
 		/* EXT_CSD value is in units of 10ms, but we store in ms */
 		card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
+		/* Some eMMC set the value too low so set a minimum */
+		if (card->ext_csd.part_time &&
+		    card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
+			card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
 
 		/* Sleep / awake timeout in 100ns units */
 		if (sa_shift > 0 && sa_shift <= 0x17)
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 136/143] mmc: longer timeout for long read time quirk
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (134 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 135/143] mmc: mmc: Fix partition switch timeout for some eMMCs Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 137/143] Bluetooth: vhci: purge unhandled skbs Willy Tarreau
                   ` (7 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Matt Gumbel, Adrian Hunter, Ulf Hansson, Willy Tarreau

From: Matt Gumbel <matthew.k.gumbel@intel.com>

commit 32ecd320db39bcb007679ed42f283740641b81ea upstream.

008GE0 Toshiba mmc in some Intel Baytrail tablets responds to
MMC_SEND_EXT_CSD in 450-600ms.

This patch will...

() Increase the long read time quirk timeout from 300ms to 600ms. Original
   author of that quirk says 300ms was only a guess and that the number
   may need to be raised in the future.

() Add this specific MMC to the quirk

Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/mmc/card/block.c | 5 +++--
 drivers/mmc/core/core.c  | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index ebb40a2..c6bf235 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2322,11 +2322,12 @@ static const struct mmc_fixup blk_fixups[] =
 		  MMC_QUIRK_BLK_NO_CMD23),
 
 	/*
-	 * Some Micron MMC cards needs longer data read timeout than
-	 * indicated in CSD.
+	 * Some MMC cards need longer data read timeout than indicated in CSD.
 	 */
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
 		  MMC_QUIRK_LONG_READ_TIME),
+	MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_LONG_READ_TIME),
 
 	/*
 	 * On these Samsung MoviNAND parts, performing secure erase or
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 68ab263..3ae6f13 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -801,11 +801,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
 	/*
 	 * Some cards require longer data read timeout than indicated in CSD.
 	 * Address this by setting the read timeout to a "reasonably high"
-	 * value. For the cards tested, 300ms has proven enough. If necessary,
+	 * value. For the cards tested, 600ms has proven enough. If necessary,
 	 * this value can be increased if other problematic cards require this.
 	 */
 	if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) {
-		data->timeout_ns = 300000000;
+		data->timeout_ns = 600000000;
 		data->timeout_clks = 0;
 	}
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 137/143] Bluetooth: vhci: purge unhandled skbs
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (135 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 136/143] mmc: longer timeout for long read time quirk Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 138/143] USB: serial: keyspan: fix use-after-free in probe error path Willy Tarreau
                   ` (6 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jiri Slaby, Marcel Holtmann, Greg Kroah-Hartman, Willy Tarreau

From: Jiri Slaby <jslaby@suse.cz>

commit 13407376b255325fa817798800117a839f3aa055 upstream.

The write handler allocates skbs and queues them into data->readq.
Read side should read them, if there is any. If there is none, skbs
should be dropped by hdev->flush. But this happens only if the device
is HCI_UP, i.e. hdev->power_on work was triggered already. When it was
not, skbs stay allocated in the queue when /dev/vhci is closed. So
purge the queue in ->release.

Program to reproduce:
	#include <err.h>
	#include <fcntl.h>
	#include <stdio.h>
	#include <unistd.h>

	#include <sys/stat.h>
	#include <sys/types.h>
	#include <sys/uio.h>

	int main()
	{
		char buf[] = { 0xff, 0 };
		struct iovec iov = {
			.iov_base = buf,
			.iov_len = sizeof(buf),
		};
		int fd;

		while (1) {
			fd = open("/dev/vhci", O_RDWR);
			if (fd < 0)
				err(1, "open");

			usleep(50);

			if (writev(fd, &iov, 1) < 0)
				err(1, "writev");

			usleep(50);

			close(fd);
		}

		return 0;
	}

Result:
kmemleak: 4609 new suspected memory leaks
unreferenced object 0xffff88059f4d5440 (size 232):
  comm "vhci", pid 1084, jiffies 4294912542 (age 37569.296s)
  hex dump (first 32 bytes):
    20 f0 23 87 05 88 ff ff 20 f0 23 87 05 88 ff ff   .#..... .#.....
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
...
    [<ffffffff81ece010>] __alloc_skb+0x0/0x5a0
    [<ffffffffa021886c>] vhci_create_device+0x5c/0x580 [hci_vhci]
    [<ffffffffa0219436>] vhci_write+0x306/0x4c8 [hci_vhci]

Fixes: 23424c0d31 (Bluetooth: Add support creating virtual AMP controllers)
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/bluetooth/hci_vhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index d8b7aed..f3ce1c4 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -265,6 +265,7 @@ static int vhci_release(struct inode *inode, struct file *file)
 	hci_unregister_dev(hdev);
 	hci_free_dev(hdev);
 
+	skb_queue_purge(&data->readq);
 	file->private_data = NULL;
 	kfree(data);
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 138/143] USB: serial: keyspan: fix use-after-free in probe error path
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (136 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 137/143] Bluetooth: vhci: purge unhandled skbs Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 139/143] USB: serial: quatech2: " Willy Tarreau
                   ` (5 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Johan Hovold, stable, Willy Tarreau

From: Johan Hovold <johan@kernel.org>

commit 35be1a71d70775e7bd7e45fa6d2897342ff4c9d2 upstream.

The interface instat and indat URBs were submitted in attach, but never
unlinked in release before deallocating the corresponding transfer
buffers.

In the case of a late probe error (e.g. due to failed minor allocation),
disconnect would not have been called before release, causing the
buffers to be freed while the URBs are still in use. We'd also end up
with active URBs for an unbound interface.

Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
release")
Cc: stable <stable@vger.kernel.org>	# v2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/keyspan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index cec377b..32a67c6 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -2392,6 +2392,10 @@ static void keyspan_release(struct usb_serial *serial)
 
 	s_priv = usb_get_serial_data(serial);
 
+	/* Make sure to unlink the URBs submitted in attach. */
+	usb_kill_urb(s_priv->instat_urb);
+	usb_kill_urb(s_priv->indat_urb);
+
 	usb_free_urb(s_priv->instat_urb);
 	usb_free_urb(s_priv->indat_urb);
 	usb_free_urb(s_priv->glocont_urb);
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 139/143] USB: serial: quatech2: fix use-after-free in probe error path
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (137 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 138/143] USB: serial: keyspan: fix use-after-free in probe error path Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 140/143] USB: serial: io_edgeport: fix memory leaks " Willy Tarreau
                   ` (4 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Johan Hovold, Greg Kroah-Hartman, Willy Tarreau

From: Johan Hovold <johan@kernel.org>

commit 028c49f5e02a257c94129cd815f7c8485f51d4ef upstream.

The interface read URB is submitted in attach, but was only unlinked by
the driver at disconnect.

In case of a late probe error (e.g. due to failed minor allocation),
disconnect is never called and we would end up with active URBs for an
unbound interface. This in turn could lead to deallocated memory being
dereferenced in the completion callback.

Fixes: f7a33e608d9a ("USB: serial: add quatech2 usb to serial driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/quatech2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 02b0803..13824b5 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -141,6 +141,7 @@ static void qt2_release(struct usb_serial *serial)
 
 	serial_priv = usb_get_serial_data(serial);
 
+	usb_kill_urb(serial_priv->read_urb);
 	usb_free_urb(serial_priv->read_urb);
 	kfree(serial_priv);
 }
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 140/143] USB: serial: io_edgeport: fix memory leaks in probe error path
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (138 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 139/143] USB: serial: quatech2: " Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 141/143] USB: serial: option: add support for Cinterion PH8 and AHxx Willy Tarreau
                   ` (3 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Johan Hovold, stable, Willy Tarreau

From: Johan Hovold <johan@kernel.org>

commit c8d62957d450cc1a22ce3242908709fe367ddc8e upstream.

URBs and buffers allocated in attach for Epic devices would never be
deallocated in case of a later probe error (e.g. failure to allocate
minor numbers) as disconnect is then never called.

Fix by moving deallocation to release and making sure that the
URBs are first unlinked.

Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
release")
Cc: stable <stable@vger.kernel.org>	# v2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/io_edgeport.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 1477e85..c574d312 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2988,16 +2988,9 @@ static void edge_disconnect(struct usb_serial *serial)
 {
 	struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
 
-	/* stop reads and writes on all ports */
-	/* free up our endpoint stuff */
 	if (edge_serial->is_epic) {
 		usb_kill_urb(edge_serial->interrupt_read_urb);
-		usb_free_urb(edge_serial->interrupt_read_urb);
-		kfree(edge_serial->interrupt_in_buffer);
-
 		usb_kill_urb(edge_serial->read_urb);
-		usb_free_urb(edge_serial->read_urb);
-		kfree(edge_serial->bulk_in_buffer);
 	}
 }
 
@@ -3010,6 +3003,16 @@ static void edge_release(struct usb_serial *serial)
 {
 	struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
 
+	if (edge_serial->is_epic) {
+		usb_kill_urb(edge_serial->interrupt_read_urb);
+		usb_free_urb(edge_serial->interrupt_read_urb);
+		kfree(edge_serial->interrupt_in_buffer);
+
+		usb_kill_urb(edge_serial->read_urb);
+		usb_free_urb(edge_serial->read_urb);
+		kfree(edge_serial->bulk_in_buffer);
+	}
+
 	kfree(edge_serial);
 }
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 141/143] USB: serial: option: add support for Cinterion PH8 and AHxx
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (139 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 140/143] USB: serial: io_edgeport: fix memory leaks " Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 142/143] tty: vt, return error when con_startup fails Willy Tarreau
                   ` (2 subsequent siblings)
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Schemmel Hans-Christoph, Hans-Christoph Schemmel, Johan Hovold,
	Willy Tarreau

From: Schemmel Hans-Christoph <Hans-Christoph.Schemmel@gemalto.com>

commit 444f94e9e625f6ec6bbe2cb232a6451c637f35a3 upstream.

Added support for Gemalto's Cinterion PH8 and AHxx products
with 2 RmNet Interfaces and products with 1 RmNet + 1 USB Audio interface.

In addition some minor renaming and formatting.

Signed-off-by: Hans-Christoph Schemmel <hans-christoph.schemmel@gemalto.com>
[johan: sort current entries and trim trailing whitespace ]
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/usb/serial/option.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 99c89d7..bcb6f5c 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -375,18 +375,22 @@ static void option_instat_callback(struct urb *urb);
 #define HAIER_PRODUCT_CE81B			0x10f8
 #define HAIER_PRODUCT_CE100			0x2009
 
-/* Cinterion (formerly Siemens) products */
-#define SIEMENS_VENDOR_ID				0x0681
-#define CINTERION_VENDOR_ID				0x1e2d
+/* Gemalto's Cinterion products (formerly Siemens) */
+#define SIEMENS_VENDOR_ID			0x0681
+#define CINTERION_VENDOR_ID			0x1e2d
+#define CINTERION_PRODUCT_HC25_MDMNET		0x0040
 #define CINTERION_PRODUCT_HC25_MDM		0x0047
-#define CINTERION_PRODUCT_HC25_MDMNET	0x0040
+#define CINTERION_PRODUCT_HC28_MDMNET		0x004A /* same for HC28J */
 #define CINTERION_PRODUCT_HC28_MDM		0x004C
-#define CINTERION_PRODUCT_HC28_MDMNET	0x004A /* same for HC28J */
 #define CINTERION_PRODUCT_EU3_E			0x0051
 #define CINTERION_PRODUCT_EU3_P			0x0052
 #define CINTERION_PRODUCT_PH8			0x0053
 #define CINTERION_PRODUCT_AHXX			0x0055
 #define CINTERION_PRODUCT_PLXX			0x0060
+#define CINTERION_PRODUCT_PH8_2RMNET		0x0082
+#define CINTERION_PRODUCT_PH8_AUDIO		0x0083
+#define CINTERION_PRODUCT_AHXX_2RMNET		0x0084
+#define CINTERION_PRODUCT_AHXX_AUDIO		0x0085
 
 /* Olivetti products */
 #define OLIVETTI_VENDOR_ID			0x0b3c
@@ -641,6 +645,10 @@ static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = {
 	.reserved = BIT(1) | BIT(2) | BIT(3),
 };
 
+static const struct option_blacklist_info cinterion_rmnet2_blacklist = {
+	.reserved = BIT(4) | BIT(5),
+};
+
 static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -1712,7 +1720,13 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
 		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_2RMNET, 0xff),
+		.driver_info = (kernel_ulong_t)&cinterion_rmnet2_blacklist },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_AUDIO, 0xff),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_2RMNET, 0xff) },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) },
+	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 142/143] tty: vt, return error when con_startup fails
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (140 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 141/143] USB: serial: option: add support for Cinterion PH8 and AHxx Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-05 10:20 ` [PATCH 3.10 143/143] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Willy Tarreau
  2016-06-07  3:46 ` [PATCH 3.10 000/143] 3.10.102-stable review Guenter Roeck
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jiri Slaby, Greg Kroah-Hartman, Willy Tarreau

From: Jiri Slaby <jslaby@suse.cz>

commit 6798df4c5fe0a7e6d2065cf79649a794e5ba7114 upstream.

When csw->con_startup() fails in do_register_con_driver, we return no
error (i.e. 0). This was changed back in 2006 by commit 3e795de763.
Before that we used to return -ENODEV.

So fix the return value to be -ENODEV in that case again.

Fixes: 3e795de763 ("VT binding: Add binding/unbinding support for the VT console")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: "Dan Carpenter" <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/tty/vt/vt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index db9d69f..6dff194 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3534,9 +3534,10 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
 		goto err;
 
 	desc = csw->con_startup();
-
-	if (!desc)
+	if (!desc) {
+		retval = -ENODEV;
 		goto err;
+	}
 
 	retval = -EINVAL;
 
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* [PATCH 3.10 143/143] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (141 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 142/143] tty: vt, return error when con_startup fails Willy Tarreau
@ 2016-06-05 10:20 ` Willy Tarreau
  2016-06-07  3:46 ` [PATCH 3.10 000/143] 3.10.102-stable review Guenter Roeck
  143 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-05 10:20 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Chanwoo Choi, Greg Kroah-Hartman, Willy Tarreau

From: Chanwoo Choi <cw00.choi@samsung.com>

commit b8995f527aac143e83d3900ff39357651ea4e0f6 upstream.

This patch fixes the broken serial log when changing the clock source
of uart device. Before disabling the original clock source, this patch
enables the new clock source to protect the clock off state for a split second.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/tty/serial/samsung.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index b8366b1..921bf90 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -724,6 +724,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	/* check to see if we need  to change clock source */
 
 	if (ourport->baudclk != clk) {
+		clk_prepare_enable(clk);
+
 		s3c24xx_serial_setsource(port, clk_sel);
 
 		if (!IS_ERR(ourport->baudclk)) {
@@ -731,8 +733,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 			ourport->baudclk = ERR_PTR(-EINVAL);
 		}
 
-		clk_prepare_enable(clk);
-
 		ourport->baudclk = clk;
 		ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
 	}
-- 
2.8.0.rc2.1.gbe9624a

^ permalink raw reply related	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
                   ` (142 preceding siblings ...)
  2016-06-05 10:20 ` [PATCH 3.10 143/143] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Willy Tarreau
@ 2016-06-07  3:46 ` Guenter Roeck
  2016-06-07  4:09   ` Willy Tarreau
  143 siblings, 1 reply; 154+ messages in thread
From: Guenter Roeck @ 2016-06-07  3:46 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux-kernel, stable

On Sun, Jun 05, 2016 at 12:18:23PM +0200, Willy Tarreau wrote:
> This is the start of the stable review cycle for the 3.10.102 release.
> All patches will be posted as a response to this one. If anyone has any
> issue with these being applied, please let me know. If anyone thinks some
> important patches are missing and should be added prior to the release,
> please report them quickly with their respective mainline commit IDs.
> 
> Responses should be made by Sat Jun 11 11:48:43 CEST 2016.
> Anything received after that time might be too late. If someone
> wants a bit more time for a deeper review, please let me know.
> 
> The whole patch series can be found in one patch at :
>    https://kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.10.102-rc1.gz
> 

Hi Willy,

my auto-builder can not pick up a stable release candidate from a
tarball like this. Do you have a repository, either with the patch
series or with the to-be-tested branch, where the builder could
pick it up ?

Also, it would be helpful if you can copy me (linux@roeck-us.net)
on release annoucements like this.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07  3:46 ` [PATCH 3.10 000/143] 3.10.102-stable review Guenter Roeck
@ 2016-06-07  4:09   ` Willy Tarreau
  2016-06-07  4:30     ` Guenter Roeck
  0 siblings, 1 reply; 154+ messages in thread
From: Willy Tarreau @ 2016-06-07  4:09 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable

Hi Guenter,

On Mon, Jun 06, 2016 at 08:46:57PM -0700, Guenter Roeck wrote:
> On Sun, Jun 05, 2016 at 12:18:23PM +0200, Willy Tarreau wrote:
> > The whole patch series can be found in one patch at :
> >    https://kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.10.102-rc1.gz
> > 
> 
> Hi Willy,
> 
> my auto-builder can not pick up a stable release candidate from a
> tarball like this.

I guess you mean from a patch, since it's a patch and not a tarball :-)

> Do you have a repository, either with the patch
> series or with the to-be-tested branch, where the builder could
> pick it up ?

I don't but I can set something up for you. Would you be OK with a
branch in my account (eg: "3.10-for-guenter") which I "git push -f"
from my local branch ? That way you always pull from the same branch
and we don't care if patches are removed during the process. Just let
me know. Otherwise let me know if a different form is desired.

> Also, it would be helpful if you can copy me (linux@roeck-us.net)
> on release annoucements like this.

OK, noted.

Thanks,
Willy

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07  4:09   ` Willy Tarreau
@ 2016-06-07  4:30     ` Guenter Roeck
  2016-06-07  5:17       ` Willy Tarreau
  0 siblings, 1 reply; 154+ messages in thread
From: Guenter Roeck @ 2016-06-07  4:30 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux-kernel, stable

Hi Willy,

On 06/06/2016 09:09 PM, Willy Tarreau wrote:
> Hi Guenter,
>
> On Mon, Jun 06, 2016 at 08:46:57PM -0700, Guenter Roeck wrote:
>> On Sun, Jun 05, 2016 at 12:18:23PM +0200, Willy Tarreau wrote:
>>> The whole patch series can be found in one patch at :
>>>     https://kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.10.102-rc1.gz
>>>
>>
>> Hi Willy,
>>
>> my auto-builder can not pick up a stable release candidate from a
>> tarball like this.
>
> I guess you mean from a patch, since it's a patch and not a tarball :-)
>

Whatever it is :-)

>> Do you have a repository, either with the patch
>> series or with the to-be-tested branch, where the builder could
>> pick it up ?
>
> I don't but I can set something up for you. Would you be OK with a
> branch in my account (eg: "3.10-for-guenter") which I "git push -f"
> from my local branch ? That way you always pull from the same branch
> and we don't care if patches are removed during the process. Just let
> me know. Otherwise let me know if a different form is desired.
>

Yes, that would be excellent. I would suggest to name it something like
stable-3.10-queue, though, to be a bit more generic. After all, other
testers will want to pick it up as well.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07  4:30     ` Guenter Roeck
@ 2016-06-07  5:17       ` Willy Tarreau
  2016-06-07  5:59         ` Guenter Roeck
  0 siblings, 1 reply; 154+ messages in thread
From: Willy Tarreau @ 2016-06-07  5:17 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable

On Mon, Jun 06, 2016 at 09:30:11PM -0700, Guenter Roeck wrote:
> > > Do you have a repository, either with the patch
> > > series or with the to-be-tested branch, where the builder could
> > > pick it up ?
> > 
> > I don't but I can set something up for you. Would you be OK with a
> > branch in my account (eg: "3.10-for-guenter") which I "git push -f"
> > from my local branch ? That way you always pull from the same branch
> > and we don't care if patches are removed during the process. Just let
> > me know. Otherwise let me know if a different form is desired.
> > 
> 
> Yes, that would be excellent. I would suggest to name it something like
> stable-3.10-queue, though, to be a bit more generic. After all, other
> testers will want to pick it up as well.

Well, for me it would not be a "queue" in the sense of how Greg maintains
it but more a release candidate derived from the last 3.10 tag. Basically
if nothing changes between the review and the release, it will just get
an extra commit which is the release tag. If I produce it just for your
use case and you're fine with a force-pushed branch, I'd rather avoid to
confuse other people who probably have no business using it.

Thanks,
Willy

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07  5:17       ` Willy Tarreau
@ 2016-06-07  5:59         ` Guenter Roeck
  2016-06-07  6:54           ` Willy Tarreau
  0 siblings, 1 reply; 154+ messages in thread
From: Guenter Roeck @ 2016-06-07  5:59 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux-kernel, stable

On 06/06/2016 10:17 PM, Willy Tarreau wrote:
> On Mon, Jun 06, 2016 at 09:30:11PM -0700, Guenter Roeck wrote:
>>>> Do you have a repository, either with the patch
>>>> series or with the to-be-tested branch, where the builder could
>>>> pick it up ?
>>>
>>> I don't but I can set something up for you. Would you be OK with a
>>> branch in my account (eg: "3.10-for-guenter") which I "git push -f"
>>> from my local branch ? That way you always pull from the same branch
>>> and we don't care if patches are removed during the process. Just let
>>> me know. Otherwise let me know if a different form is desired.
>>>
>>
>> Yes, that would be excellent. I would suggest to name it something like
>> stable-3.10-queue, though, to be a bit more generic. After all, other
>> testers will want to pick it up as well.
>
> Well, for me it would not be a "queue" in the sense of how Greg maintains
> it but more a release candidate derived from the last 3.10 tag. Basically
> if nothing changes between the review and the release, it will just get
> an extra commit which is the release tag. If I produce it just for your
> use case and you're fine with a force-pushed branch, I'd rather avoid to
> confuse other people who probably have no business using it.
>

Jiri provides a branch for 3.12, exactly as you suggested. In his case it is
named stable-3.12-queue. Sasha does the same, with linux-3.18.y-queue and
linux-4.1.y-queue. Both force-push as needed. I don't see a problem with it.
Other testers such as kernelci.org pick it up from there (or from my repository
after I pull it in). In my repository, all branches are named linux-<release>.y.queue;
for example, the 3.10 branch in my repository is named linux-3.10.y.queue.
Those branches are also force-pushed when updated.

Having said that, as long as you make it available, please feel free to name
the branch as you like.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07  5:59         ` Guenter Roeck
@ 2016-06-07  6:54           ` Willy Tarreau
  2016-06-07 17:49             ` Willy Tarreau
  0 siblings, 1 reply; 154+ messages in thread
From: Willy Tarreau @ 2016-06-07  6:54 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable

On Mon, Jun 06, 2016 at 10:59:27PM -0700, Guenter Roeck wrote:
> On 06/06/2016 10:17 PM, Willy Tarreau wrote:
> > On Mon, Jun 06, 2016 at 09:30:11PM -0700, Guenter Roeck wrote:
> > > > > Do you have a repository, either with the patch
> > > > > series or with the to-be-tested branch, where the builder could
> > > > > pick it up ?
> > > > 
> > > > I don't but I can set something up for you. Would you be OK with a
> > > > branch in my account (eg: "3.10-for-guenter") which I "git push -f"
> > > > from my local branch ? That way you always pull from the same branch
> > > > and we don't care if patches are removed during the process. Just let
> > > > me know. Otherwise let me know if a different form is desired.
> > > > 
> > > 
> > > Yes, that would be excellent. I would suggest to name it something like
> > > stable-3.10-queue, though, to be a bit more generic. After all, other
> > > testers will want to pick it up as well.
> > 
> > Well, for me it would not be a "queue" in the sense of how Greg maintains
> > it but more a release candidate derived from the last 3.10 tag. Basically
> > if nothing changes between the review and the release, it will just get
> > an extra commit which is the release tag. If I produce it just for your
> > use case and you're fine with a force-pushed branch, I'd rather avoid to
> > confuse other people who probably have no business using it.
> > 
> 
> Jiri provides a branch for 3.12, exactly as you suggested. In his case it is
> named stable-3.12-queue. Sasha does the same, with linux-3.18.y-queue and
> linux-4.1.y-queue. Both force-push as needed. I don't see a problem with it.
> Other testers such as kernelci.org pick it up from there (or from my repository
> after I pull it in). In my repository, all branches are named linux-<release>.y.queue;
> for example, the 3.10 branch in my repository is named linux-3.10.y.queue.
> Those branches are also force-pushed when updated.

OK then that's perfect, I'll do the same ASAP, probably today as time permits.

Cheers,
Willy

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07  6:54           ` Willy Tarreau
@ 2016-06-07 17:49             ` Willy Tarreau
  2016-06-07 18:21               ` Guenter Roeck
  2016-06-08  0:52               ` Guenter Roeck
  0 siblings, 2 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-07 17:49 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable

Hi Guenter,

On Tue, Jun 07, 2016 at 08:54:53AM +0200, Willy Tarreau wrote:
> > Jiri provides a branch for 3.12, exactly as you suggested. In his case it is
> > named stable-3.12-queue. Sasha does the same, with linux-3.18.y-queue and
> > linux-4.1.y-queue. Both force-push as needed. I don't see a problem with it.
> > Other testers such as kernelci.org pick it up from there (or from my repository
> > after I pull it in). In my repository, all branches are named linux-<release>.y.queue;
> > for example, the 3.10 branch in my repository is named linux-3.10.y.queue.
> > Those branches are also force-pushed when updated.
> 
> OK then that's perfect, I'll do the same ASAP, probably today as time permits.

Now done. Please find it here :

  git://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/linux-stable.git linux-3.10.y-queue

It's a fork of Greg's linux-stable. I cleaned it up from irrelevant
tags and branches. If you have any issue, please let me know.

Thanks,
Willy

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07 17:49             ` Willy Tarreau
@ 2016-06-07 18:21               ` Guenter Roeck
  2016-06-08  0:52               ` Guenter Roeck
  1 sibling, 0 replies; 154+ messages in thread
From: Guenter Roeck @ 2016-06-07 18:21 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux-kernel, stable

On Tue, Jun 07, 2016 at 07:49:53PM +0200, Willy Tarreau wrote:
> 
> Now done. Please find it here :
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/linux-stable.git linux-3.10.y-queue
> 
> It's a fork of Greg's linux-stable. I cleaned it up from irrelevant
> tags and branches. If you have any issue, please let me know.
> 
Excellent - picked up and building. I'll let you know once I have results;
should be in a couple of hours.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-07 17:49             ` Willy Tarreau
  2016-06-07 18:21               ` Guenter Roeck
@ 2016-06-08  0:52               ` Guenter Roeck
  2016-06-08  5:19                 ` Willy Tarreau
  1 sibling, 1 reply; 154+ messages in thread
From: Guenter Roeck @ 2016-06-08  0:52 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux-kernel, stable

On 06/07/2016 10:49 AM, Willy Tarreau wrote:
> Hi Guenter,
>
> On Tue, Jun 07, 2016 at 08:54:53AM +0200, Willy Tarreau wrote:
>>> Jiri provides a branch for 3.12, exactly as you suggested. In his case it is
>>> named stable-3.12-queue. Sasha does the same, with linux-3.18.y-queue and
>>> linux-4.1.y-queue. Both force-push as needed. I don't see a problem with it.
>>> Other testers such as kernelci.org pick it up from there (or from my repository
>>> after I pull it in). In my repository, all branches are named linux-<release>.y.queue;
>>> for example, the 3.10 branch in my repository is named linux-3.10.y.queue.
>>> Those branches are also force-pushed when updated.
>>
>> OK then that's perfect, I'll do the same ASAP, probably today as time permits.
>
> Now done. Please find it here :
>
>    git://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/linux-stable.git linux-3.10.y-queue
>
> It's a fork of Greg's linux-stable. I cleaned it up from irrelevant
> tags and branches. If you have any issue, please let me know.
>

Here we are;

Build results:
	total: 123 pass: 123 fail: 0
Qemu test results:
	total: 75 pass: 75 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

^ permalink raw reply	[flat|nested] 154+ messages in thread

* Re: [PATCH 3.10 000/143] 3.10.102-stable review
  2016-06-08  0:52               ` Guenter Roeck
@ 2016-06-08  5:19                 ` Willy Tarreau
  0 siblings, 0 replies; 154+ messages in thread
From: Willy Tarreau @ 2016-06-08  5:19 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable

On Tue, Jun 07, 2016 at 05:52:52PM -0700, Guenter Roeck wrote:
> Here we are;
> 
> Build results:
> 	total: 123 pass: 123 fail: 0
> Qemu test results:
> 	total: 75 pass: 75 fail: 0
> 
> Details are available at http://kerneltests.org/builders.

Excellent, thank you Guenter!

Willy

^ permalink raw reply	[flat|nested] 154+ messages in thread

end of thread, other threads:[~2016-06-08  5:20 UTC | newest]

Thread overview: 154+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-05 10:18 [PATCH 3.10 000/143] 3.10.102-stable review Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 001/143] pipe: Fix buffer offset after partially failed read Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 002/143] x86/iopl/64: Properly context-switch IOPL on Xen PV Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 003/143] ext4: fix NULL pointer dereference in ext4_mark_inode_dirty() Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 004/143] compiler-gcc: integrate the various compiler-gcc[345].h files Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 005/143] x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id" Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 006/143] KVM: i8254: change PIT discard tick policy Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 007/143] KVM: fix spin_lock_init order on x86 Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 008/143] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 009/143] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 010/143] linux/const.h: Add _BITUL() and _BITULL() Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 011/143] x86: Rename X86_CR4_RDWRGSFS to X86_CR4_FSGSBASE Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 012/143] x86, processor-flags: Fix the datatypes and add bit number defines Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 013/143] x86/iopl: Fix iopl capability check on Xen PV Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 014/143] sg: fix dxferp in from_to case Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 015/143] aacraid: Fix memory leak in aac_fib_map_free Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 016/143] be2iscsi: set the boot_kset pointer to NULL in case of failure Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 017/143] usb: retry reset if a device times out Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 018/143] USB: cdc-acm: more sanity checking Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 019/143] USB: iowarrior: fix oops with malicious USB descriptors Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 020/143] USB: usb_driver_claim_interface: add sanity checking Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 021/143] USB: mct_u232: add sanity checking in probe Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 022/143] USB: digi_acceleport: do sanity checking for the number of ports Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 023/143] USB: cypress_m8: add endpoint sanity check Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 024/143] USB: serial: cp210x: Adding GE Healthcare Device ID Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 025/143] USB: option: add "D-Link DWM-221 B1" device id Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 026/143] pwc: Add USB id for Philips Spc880nc webcam Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 027/143] Input: powermate - fix oops with malicious USB descriptors Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 028/143] net: irda: Fix use-after-free in irtty_open() Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 029/143] 8250: use callbacks to access UART_DLL/UART_DLM Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 030/143] bttv: Width must be a multiple of 16 when capturing planar formats Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 031/143] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 032/143] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 033/143] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 034/143] bcache: fix cache_set_flush() NULL pointer dereference on OOM Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 035/143] watchdog: rc32434_wdt: fix ioctl error handling Willy Tarreau
2016-06-05 10:18 ` [PATCH 3.10 036/143] splice: handle zero nr_pages in splice_to_pipe() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 037/143] xtensa: ISS: don't hang if stdin EOF is reached Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 038/143] xtensa: clear all DBREAKC registers on start Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 039/143] md/raid5: Compare apples to apples (or sectors to sectors) Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 040/143] rapidio/rionet: fix deadlock on SMP Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 041/143] ipr: Fix out-of-bounds null overwrite Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 042/143] ipr: Fix regression when loading firmware Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 043/143] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 044/143] tracing: Have preempt(irqs)off trace preempt disabled functions Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 045/143] tracing: Fix crash from reading trace_pipe with sendfile Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 046/143] tracing: Fix trace_printk() to print when not using bprintk() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 047/143] scripts/coccinelle: modernize & Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 048/143] Input: ims-pcu - sanity check against missing interfaces Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 049/143] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 050/143] ocfs2/dlm: fix race between convert and recovery Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 051/143] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 052/143] mtd: onenand: fix deadlock in onenand_block_markbad Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 053/143] sched/cputime: Fix steal time accounting vs. CPU hotplug Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 054/143] perf/x86/intel: Fix PEBS data source interpretation on Nehalem/Westmere Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 055/143] hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 056/143] parisc: Avoid function pointers for kernel exception routines Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 057/143] parisc: Fix kernel crash with reversed copy_from_user() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 058/143] ALSA: timer: Use mod_timer() for rearming the system timer Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 059/143] net: jme: fix suspend/resume on JMC260 Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 060/143] sctp: lack the check for ports in sctp_v6_cmp_addr Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 061/143] ipv6: re-enable fragment header matching in ipv6_find_hdr Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 062/143] cdc_ncm: toggle altsetting to force reset before setup Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 063/143] usbnet: cleanup after bind() in probe() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 064/143] udp6: fix UDP/IPv6 encap resubmit path Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 065/143] sh_eth: fix NULL pointer dereference in sh_eth_ring_format() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 066/143] net: Fix use after free in the recvmmsg exit path Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 067/143] farsync: fix off-by-one bug in fst_add_one Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 068/143] ath9k: fix buffer overrun for ar9287 Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 069/143] qlge: Fix receive packets drop Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 070/143] ppp: take reference on channels netns Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 071/143] qmi_wwan: add "D-Link DWM-221 B1" device id Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 072/143] ipv4: l2tp: fix a potential issue in l2tp_ip_recv Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 073/143] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 074/143] ip6_tunnel: set rtnl_link_ops before calling register_netdevice Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 075/143] usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 076/143] usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 077/143] ext4: add lockdep annotations for i_data_sem Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 078/143] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 079/143] drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and older) Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 080/143] [media] usbvision-video: fix memory leak of alt_max_pkt_size Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 081/143] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 082/143] usbvision: fix crash on detecting device with invalid configuration Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 083/143] usb: xhci: fix wild pointers in xhci_mem_cleanup Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 084/143] usb: hcd: out of bounds access in for_each_companion Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 085/143] crypto: gcm - Fix rfc4543 decryption crash Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 086/143] nl80211: check netlink protocol in socket release notification Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 087/143] Input: gtco - fix crash on detecting device without endpoints Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 088/143] i2c: cpm: Fix build break due to incompatible pointer types Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 089/143] EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder callback Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 090/143] ASoC: s3c24xx: use const snd_soc_component_driver pointer Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 091/143] efi: Fix out-of-bounds read in variable_matches() Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 092/143] workqueue: fix ghost PENDING flag while doing MQ IO Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 093/143] USB: usbip: fix potential out-of-bounds write Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 094/143] paride: make 'verbose' parameter an 'int' again Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 095/143] fbdev: da8xx-fb: fix videomodes of lcd panels Willy Tarreau
2016-06-05 10:19 ` [PATCH 3.10 096/143] misc/bmp085: Enable building as a module Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 097/143] rtc: vr41xx: Wire up alarm_irq_enable Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 098/143] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 099/143] include/linux/poison.h: fix LIST_POISON{1,2} offset Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 100/143] Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 101/143] perf stat: Document --detailed option Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 102/143] ARM: OMAP3: Add cpuidle parameters table for omap3430 Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 103/143] compiler-gcc: disable -ftracer for __noclone functions Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 104/143] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 105/143] nbd: ratelimit error msgs after socket close Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 106/143] clk: versatile: sp810: support reentrance Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 107/143] lpfc: fix misleading indentation Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 108/143] ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 109/143] proc: prevent accessing /proc/<PID>/environ until it's ready Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 110/143] batman-adv: Fix broadcast/ogm queue limit on a removed interface Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 111/143] MAINTAINERS: Remove asterisk from EFI directory names Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 112/143] ACPICA: Dispatcher: Update thread ID for recursive method calls Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 113/143] USB: serial: cp210x: add ID for Link ECU Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 114/143] USB: serial: cp210x: add Straizona Focusers device ids Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 115/143] Input: ads7846 - correct the value got from SPI Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 116/143] powerpc: scan_features() updates incorrect bits for REAL_LE Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 117/143] crypto: hash - Fix page length clamping in hash walk Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 118/143] get_rock_ridge_filename(): handle malformed NM entries Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 119/143] Input: max8997-haptic - fix NULL pointer dereference Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 120/143] asmlinkage, pnp: Make variables used from assembler code visible Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 121/143] ARM: OMAP3: Fix booting with thumb2 kernel Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 122/143] decnet: Do not build routes to devices without decnet private data Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 123/143] route: do not cache fib route info on local routes with oif Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 124/143] packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 125/143] atl2: Disable unimplemented scatter/gather feature Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 126/143] net: fix infoleak in llc Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 127/143] net: fix infoleak in rtnetlink Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 128/143] VSOCK: do not disconnect socket when peer has shutdown SEND only Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 129/143] net: bridge: fix old ioctl unlocked net device walk Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 130/143] net: fix a kernel infoleak in x25 module Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 131/143] fs/cifs: correctly to anonymous authentication via NTLMSSP Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 132/143] ring-buffer: Use long for nr_pages to avoid overflow failures Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 133/143] ring-buffer: Prevent overflow of size in ring_buffer_resize() Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 134/143] mfd: omap-usb-tll: Fix scheduling while atomic BUG Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 135/143] mmc: mmc: Fix partition switch timeout for some eMMCs Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 136/143] mmc: longer timeout for long read time quirk Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 137/143] Bluetooth: vhci: purge unhandled skbs Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 138/143] USB: serial: keyspan: fix use-after-free in probe error path Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 139/143] USB: serial: quatech2: " Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 140/143] USB: serial: io_edgeport: fix memory leaks " Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 141/143] USB: serial: option: add support for Cinterion PH8 and AHxx Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 142/143] tty: vt, return error when con_startup fails Willy Tarreau
2016-06-05 10:20 ` [PATCH 3.10 143/143] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Willy Tarreau
2016-06-07  3:46 ` [PATCH 3.10 000/143] 3.10.102-stable review Guenter Roeck
2016-06-07  4:09   ` Willy Tarreau
2016-06-07  4:30     ` Guenter Roeck
2016-06-07  5:17       ` Willy Tarreau
2016-06-07  5:59         ` Guenter Roeck
2016-06-07  6:54           ` Willy Tarreau
2016-06-07 17:49             ` Willy Tarreau
2016-06-07 18:21               ` Guenter Roeck
2016-06-08  0:52               ` Guenter Roeck
2016-06-08  5:19                 ` Willy Tarreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).