All of lore.kernel.org
 help / color / mirror / Atom feed
* [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review
@ 2015-03-25 13:59 Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 001/165] netfilter: nf_tables: disable preemption when restoring chain counters Luis Henriques
                   ` (164 more replies)
  0 siblings, 165 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Luis Henriques

This is the start of the review cycle for the Linux 3.16.7-ckt9 stable kernel.

This version contains 165 new patches, summarized below.  The new patches are
posted as replies to this message and also available in this git branch:

http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.16.y-review;a=shortlog

git://kernel.ubuntu.com/ubuntu/linux.git  linux-3.16.y-review

The review period for version 3.16.7-ckt9 will be open for the next three days.
To report a problem, please reply to the relevant follow-up patch message.

For more information about the Linux 3.16.y-ckt extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Luis

--
 arch/arc/include/asm/processor.h                 |   9 +-
 arch/arc/kernel/stacktrace.c                     |   6 +-
 arch/arm/boot/dts/am33xx-clocks.dtsi             |   6 +-
 arch/arm/boot/dts/am43xx-clocks.dtsi             |  12 +-
 arch/arm/boot/dts/dra7xx-clocks.dtsi             |  90 +++++++++-
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi           |   2 +
 arch/arm/boot/dts/imx6sl-evk.dts                 |   2 +
 arch/arm/mach-at91/pm.h                          |   2 +-
 arch/arm64/kernel/signal32.c                     |   5 +-
 arch/metag/include/asm/processor.h               |   4 +-
 arch/mips/kvm/trace.h                            |   6 +-
 arch/sparc/kernel/perf_event.c                   |  15 +-
 arch/sparc/kernel/process_64.c                   |   4 +
 arch/sparc/kernel/sys_sparc_64.c                 |   2 +-
 arch/sparc/lib/memmove.S                         |  35 +++-
 arch/sparc/mm/srmmu.c                            |  11 +-
 arch/x86/kernel/entry_64.S                       |  13 +-
 arch/x86/kvm/emulate.c                           |   3 +-
 drivers/acpi/video.c                             |  11 ++
 drivers/char/tpm/tpm_ibmvtpm.c                   |  10 +-
 drivers/char/tpm/tpm_ibmvtpm.h                   |   6 +-
 drivers/clk/clk-divider.c                        |  14 +-
 drivers/firmware/efi/efi-stub-helper.c           |   8 +-
 drivers/gpio/gpio-tps65912.c                     |  14 +-
 drivers/gpio/gpiolib-of.c                        |   9 +-
 drivers/gpu/drm/i915/i915_gem_tiling.c           |   7 +-
 drivers/gpu/drm/i915/intel_display.c             |   3 +
 drivers/gpu/drm/radeon/atombios_crtc.c           |   3 +
 drivers/gpu/drm/radeon/cik.c                     |   3 +
 drivers/gpu/drm/radeon/evergreen.c               |   3 +
 drivers/gpu/drm/radeon/ni.c                      |   8 +-
 drivers/gpu/drm/radeon/r100.c                    |   4 +
 drivers/gpu/drm/radeon/r600.c                    |   3 +
 drivers/gpu/drm/radeon/r600_dpm.c                |   2 +-
 drivers/gpu/drm/radeon/radeon_cs.c               |   4 +-
 drivers/gpu/drm/radeon/rs600.c                   |   4 +
 drivers/gpu/drm/radeon/si.c                      |   9 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              |  77 +++++----
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c          |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c              |  14 +-
 drivers/hid/hid-core.c                           |   9 +
 drivers/hid/hid-ids.h                            |   3 +
 drivers/hid/hid-input.c                          |   9 +-
 drivers/hid/hid-microsoft.c                      |   6 +
 drivers/hid/usbhid/hid-pidff.c                   |   6 +
 drivers/hid/usbhid/hid-quirks.c                  |   2 +
 drivers/i2c/i2c-core.c                           |   3 -
 drivers/iio/adc/mcp3422.c                        |  17 +-
 drivers/iio/dac/ad5686.c                         |   2 +-
 drivers/iio/imu/adis16400_core.c                 |   3 +-
 drivers/irqchip/irq-armada-370-xp.c              |  21 ++-
 drivers/md/raid1.c                               |   5 +-
 drivers/misc/mei/init.c                          |   2 +
 drivers/mtd/nand/pxa3xx_nand.c                   |  48 +++++-
 drivers/net/can/dev.c                            |   8 +
 drivers/net/can/usb/kvaser_usb.c                 |  48 ++++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   3 +
 drivers/net/ethernet/qlogic/qlge/qlge_main.c     |  26 +--
 drivers/net/macvtap.c                            |   7 +-
 drivers/net/phy/phy.c                            |  23 ++-
 drivers/net/team/team.c                          |  10 +-
 drivers/net/usb/cx82310_eth.c                    |  11 +-
 drivers/net/usb/plusb.c                          |   5 +
 drivers/net/wireless/ath/ath5k/reset.c           |   2 +-
 drivers/pci/pci-sysfs.c                          |   5 +-
 drivers/scsi/libsas/sas_discover.c               |   6 +-
 drivers/spi/spi-atmel.c                          |  12 +-
 drivers/spi/spi-dw.c                             |   4 +-
 drivers/spi/spi-pl022.c                          |   2 +-
 drivers/staging/comedi/drivers/adv_pci1710.c     |   3 +-
 drivers/staging/iio/adc/mxs-lradc.c              | 207 ++++++++++++-----------
 drivers/tty/serial/8250/8250_pci.c               |   2 +-
 drivers/tty/tty_io.c                             |   4 +-
 drivers/tty/tty_ioctl.c                          |  12 +-
 drivers/usb/class/cdc-acm.c                      |   2 +
 drivers/usb/core/devio.c                         |   2 +
 drivers/usb/dwc3/dwc3-omap.c                     |  30 +++-
 drivers/usb/gadget/configfs.c                    |   2 -
 drivers/usb/gadget/f_phonet.c                    |   5 +-
 drivers/usb/host/xhci-pci.c                      |  30 ++++
 drivers/usb/host/xhci-plat.c                     |  18 +-
 drivers/usb/host/xhci-ring.c                     |  10 +-
 drivers/usb/host/xhci.h                          |   9 +-
 drivers/usb/musb/musb_core.c                     |  10 +-
 drivers/usb/serial/Kconfig                       |   1 +
 drivers/usb/serial/bus.c                         |  13 +-
 drivers/usb/serial/cp210x.c                      |   2 +
 drivers/usb/serial/ftdi_sio.c                    |  19 +++
 drivers/usb/serial/ftdi_sio_ids.h                |  23 +++
 drivers/usb/serial/generic.c                     |   5 +-
 drivers/usb/serial/mxuport.c                     |   3 +-
 drivers/usb/serial/usb-serial-simple.c           |  10 ++
 drivers/usb/serial/usb-serial.c                  |   5 +-
 drivers/usb/storage/unusual_uas.h                |   7 +
 drivers/xen/events/events_base.c                 |  18 +-
 drivers/xen/xen-pciback/conf_space.c             |   2 +-
 drivers/xen/xen-pciback/conf_space.h             |   2 +
 drivers/xen/xen-pciback/conf_space_header.c      |  61 +++++--
 fs/btrfs/file.c                                  |  56 +++---
 fs/btrfs/inode.c                                 |   1 -
 fs/btrfs/tree-log.c                              |   2 +-
 fs/ecryptfs/file.c                               |  34 +++-
 fs/nfs/delegation.c                              |   2 +-
 fs/nilfs2/btree.c                                |  47 ++++-
 fs/nilfs2/segment.c                              |   7 +-
 fs/xfs/xfs_qm.c                                  |   5 +
 include/linux/usb/serial.h                       |   3 +-
 include/linux/workqueue.h                        |   3 +-
 kernel/cpuset.c                                  |   3 -
 kernel/printk/console_cmdline.h                  |   2 +-
 kernel/printk/printk.c                           |   1 +
 kernel/trace/ftrace.c                            |  32 +++-
 kernel/workqueue.c                               |  56 +++++-
 net/caif/caif_socket.c                           |   2 +-
 net/can/af_can.c                                 |   3 +
 net/compat.c                                     |  16 +-
 net/core/dev.c                                   |   2 +-
 net/core/flow.c                                  |   2 +-
 net/core/gen_stats.c                             |  15 +-
 net/core/pktgen.c                                |  16 +-
 net/core/rtnetlink.c                             |  30 ++--
 net/core/sysctl_net_core.c                       |  10 +-
 net/ipv4/inet_diag.c                             |  18 +-
 net/ipv4/ip_fragment.c                           |  11 +-
 net/ipv4/ip_output.c                             |   3 +-
 net/ipv4/ping.c                                  |  14 +-
 net/ipv4/tcp_fastopen.c                          |  32 +++-
 net/ipv4/tcp_output.c                            |  74 ++++----
 net/ipv6/fib6_rules.c                            |   1 +
 net/ipv6/ip6_gre.c                               |   4 +-
 net/ipv6/ip6_output.c                            |   3 +-
 net/ipv6/ping.c                                  |   5 +-
 net/ipv6/route.c                                 |   2 +-
 net/irda/ircomm/ircomm_tty.c                     |   4 +-
 net/mac80211/tx.c                                |   1 +
 net/netfilter/ipvs/ip_vs_core.c                  |  33 ++--
 net/netfilter/ipvs/ip_vs_sync.c                  |   3 +
 net/netfilter/nf_tables_api.c                    |  10 +-
 net/netfilter/nft_compat.c                       |  12 +-
 net/netfilter/xt_socket.c                        |  21 ++-
 net/openvswitch/datapath.c                       |  45 ++++-
 net/openvswitch/vport.h                          |   2 +
 net/rds/iw_rdma.c                                |  40 +++--
 net/rxrpc/ar-recvmsg.c                           |   2 +-
 net/sched/cls_bpf.c                              |  15 +-
 net/sched/ematch.c                               |   1 +
 net/sunrpc/auth_gss/gss_rpc_upcall.c             |   2 +
 net/sunrpc/backchannel_rqst.c                    |   5 +-
 net/sunrpc/cache.c                               |   2 +-
 sound/core/control.c                             |   4 +
 sound/core/pcm_native.c                          |   2 +
 sound/pci/hda/hda_controller.c                   |   7 +-
 sound/pci/hda/hda_generic.c                      |  30 +++-
 sound/pci/hda/hda_intel.c                        |   2 +-
 sound/pci/hda/patch_cirrus.c                     |   2 +
 sound/pci/hda/patch_conexant.c                   |  11 ++
 sound/pci/hda/patch_sigmatel.c                   |  17 +-
 sound/soc/omap/omap-pcm.c                        |   2 +-
 sound/usb/quirks-table.h                         |  30 ++++
 159 files changed, 1467 insertions(+), 631 deletions(-)

Ahmed S. Darwish (2):
      can: kvaser_usb: Avoid double free on URB submission failures
      can: kvaser_usb: Read all messages in a bulk-in URB buffer

Al Viro (4):
      ecryptfs: ->f_op is never NULL
      sunrpc: fix braino in ->poll()
      caif: fix MSG_OOB test in caif_seqpkt_recvmsg()
      rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg()

Alan Stern (1):
      USB: usbfs: don't leak kernel data in siginfo

Alan Wu (2):
      HID: add support for MS Surface Pro 3 Type Cover
      HID: microsoft: add support for Japanese Surface Type Cover 3

Aleksander Morgado (1):
      xhci: fix reporting of 0-sized URBs in control endpoint

Alex Deucher (9):
      drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
      drm/radeon: fix 1 RB harvest config setup for TN/RL
      drm/radeon: do a posting read in r100_set_irq
      drm/radeon: do a posting read in rs600_set_irq
      drm/radeon: do a posting read in r600_set_irq
      drm/radeon: do a posting read in evergreen_set_irq
      drm/radeon: do a posting read in si_set_irq
      drm/radeon: do a posting read in cik_set_irq
      drm/radeon: fix interlaced modes on DCE8

Alexander Drozdov (2):
      ipv4: ip_check_defrag should correctly check return value of skb_copy_bits
      ipv4: ip_check_defrag should not assume that skb_network_offset is zero

Alexander Sverdlin (1):
      spi: pl022: Fix race in giveback() leading to driver lock-up

Alexander Usyskin (1):
      mei: make device disabled on stop unconditionally

Alexandre Belloni (1):
      ARM: at91: pm: fix at91rm9200 standby

Alexey Kodanev (1):
      net: sysctl_net_core: check SNDBUF and RCVBUF for min length

Andreas Larsson (1):
      sparc32: destroy_context() and switch_mm() needs to disable interrupts.

Andrzej Pietrasiewicz (1):
      usb: gadget: configfs: don't NUL-terminate (sub)compatible ids

Andy Lutomirski (1):
      x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization

Andy Shevchenko (1):
      spi: dw: revisit FIFO size detection again

Angelo Compagnucci (1):
      iio:adc:mcp3422 Fix incorrect scales table

Anton Staaf (1):
      USB: serial: add Google simple serial SubClass support

Arnd Bergmann (1):
      rds: avoid potential stack overflow

Ben Shelton (1):
      usb: plusb: Add support for National Instruments host-to-host cable

Björn Gerhart (1):
      cdc-acm: Add support for Denso cradle CU-321

Brian King (1):
      bnx2x: Force fundamental reset for EEH recovery

Catalin Marinas (3):
      net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg
      arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
      net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour

Chris Wilson (2):
      drm/i915: Check obj->vma_list under the struct_mutex
      ACPI / video: Load the module even if ACPI is disabled

Christian König (1):
      drm/radeon: drop setting UPLL to sleep mode

Chuck Lever (1):
      SUNRPC: Always manipulate rpc_rqst::rq_bc_pa_list under xprt->bc_pa_lock

Daniel Borkmann (3):
      rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY
      net: cls_bpf: fix size mismatch on filter preparation
      net: cls_bpf: fix auto generation of per list handles

Daniel Mack (1):
      ALSA: snd-usb: add quirks for Roland UA-22

David Ahern (3):
      sparc: perf: Remove redundant perf_pmu_{en|dis}able calls
      sparc: perf: Make counting mode actually work
      sparc: Touch NMI watchdog when walking cpus and calling printk

David Ramos (1):
      svcrpc: fix memory leak in gssp_accept_sec_context_upcall

David S. Miller (1):
      sparc64: Fix several bugs in memmove().

David Sterba (1):
      btrfs: fix lost return value due to variable shadowing

Eric Dumazet (5):
      netfilter: xt_socket: fix a stack corruption bug
      tcp: make sure skb is not shared before using skb_get()
      macvtap: make sure neighbour code can push ethernet header
      inet_diag: fix possible overflow in inet_diag_dump_one_icsk()
      tcp: make connect() mem charging friendly

Felipe Balbi (2):
      usb: gadget: function: phonet: balance usb_ep_disable calls
      usb: musb: core: add pm_runtime_irq_safe()

Filipe Manana (1):
      Btrfs: fix data loss in the fast fsync path

George Cherian (1):
      usb: dwc3: dwc3-omap: Fix disable IRQ

Guenter Roeck (1):
      net: phy: Fix verification of EEE support in phy_init_eee

Hans Holmberg (1):
      gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node

Hans de Goede (1):
      uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539

Ian Abbott (1):
      staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel

Ignacy Gawędzki (2):
      gen_stats.c: Duplicate xstats buffer for later use
      ematch: Fix auto-loading of ematch modules.

Jakub Kicinski (1):
      Revert "i2c: core: Dispose OF IRQ mapping at client removal time"

Jakub Sitnicki (1):
      HID: microsoft: Add ID for NE7K wireless keyboard

James Bottomley (1):
      libsas: Fix Kernel Crash in smp_execute_task

James Hogan (2):
      metag: Fix KSTK_EIP() and KSTK_ESP() macros
      KVM: MIPS: Fix trace event to save PC directly

Jan Beulich (1):
      xen-pciback: limit guest control of command register

Jan Kara (1):
      xfs: Fix quota type in quota structures when reusing quota file

Jani Nikula (1):
      drm/i915: Dell Chromebook 11 has PWM backlight

Jaroslav Kysela (1):
      ALSA: hda: controller code - do not export static functions

Jason Low (1):
      cpuset: Fix cpuset sched_relax_domain_level

Jim Keir (1):
      HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2

Jiri Pirko (2):
      team: fix possible null pointer dereference in team_handle_frame
      team: don't traverse port list using rcu in team_set_mac_address

Jiri Slaby (1):
      tty: fix up atime/mtime mess, take four

Johan Hovold (7):
      Revert "USB: serial: make bulk_out_size a lower limit"
      USB: serial: fix potential use-after-free after failed probe
      USB: serial: fix tty-device error handling at probe
      USB: mxuport: fix null deref when used as a console
      net: irda: fix wait_until_sent poll timeout
      USB: serial: fix infinite wait_until_sent timeout
      TTY: fix tty_wait_until_sent on 64-bit machines

Josh Hunt (1):
      tcp: fix tcp fin memory accounting

Jouni Malinen (1):
      mac80211: Send EAPOL frames at lowest rate

Juergen Gross (1):
      xen/events: avoid NULL pointer dereference in dom0 on large machines

Julian Anastasov (2):
      ipvs: rerouting to local clients is not needed anymore
      ipvs: add missing ip_vs_pe_put in sync code

Kristina Martšenko (4):
      iio: mxs-lradc: separate touchscreen and buffer virtual channels
      iio: mxs-lradc: make ADC reads not disable touchscreen interrupts
      iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions
      iio: mxs-lradc: only update the buffer when its conversions have finished

Lorenzo Colitti (1):
      net: ping: Return EAFNOSUPPORT when appropriate.

Marcelo Leitner (1):
      qlge: Fix qlge_update_hw_vlan_features to handle if interface is down

Mark Glover (1):
      USB: ftdi_sio: add PIDs for Actisense USB devices

Martin KaFai Lau (1):
      ipv6: fix ipv6_cow_metrics for non DST_HOST case

Mathias Nyman (2):
      xhci: Allocate correct amount of scratchpad buffers
      xhci: Workaround for PME stuck issues in Intel xhci

Matthew Thode (1):
      net: reject creation of netdev names with colons

Max Mansfield (1):
      usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards

Maxime Ripard (3):
      usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks
      mtd: nand: pxa3xx: Fix PIO FIFO draining
      irqchip: armada-370-xp: Fix chained per-cpu interrupts

Michal Kubeček (1):
      udp: only allow UFO for packets from SOCK_DGRAM sockets

Michiel vd Garde (1):
      USB: serial: cp210x: Adding Seletek device id's

Miroslav Urbanek (1):
      flowcache: Fix kernel panic in flow_cache_flush_task

Nicolas Saenz Julienne (1):
      gpio: tps65912: fix wrong container_of arguments

Oliver Hartkopp (1):
      can: add missing initialisations in CAN related skbuffs

Ondrej Zary (1):
      Revert "net: cx82310_eth: use common match macro"

Pablo Neira Ayuso (3):
      netfilter: nf_tables: disable preemption when restoring chain counters
      netfilter: nf_tables: fix leaks in error path of nf_tables_newchain()
      netfilter: nft_compat: fix module refcount underflow

Paolo Bonzini (1):
      KVM: emulate: fix CMPXCHG8B on 32-bit hosts

Peter Chen (2):
      ARM: imx6qdl-sabresd: set swbst_reg as vbus's parent reg
      ARM: imx6sl-evk: set swbst_reg as vbus's parent reg

Peter Hurley (1):
      console: Fix console name size mismatch

Peter Ujfalusi (1):
      ASoC: omap-pcm: Correct dma mask

Pratyush Anand (1):
      ftrace: Fix en(dis)able graph caller when en(dis)abling record via sysctl

Pravin B Shelar (1):
      openvswitch: Fix net exit.

Quentin Casasnovas (1):
      Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref.

Rasmus Villemoes (1):
      iio: imu: adis16400: Fix sign extension

Ravikumar Kattekola (1):
      ARM: dts: DRA7x: Fix the bypass clock source for dpll_iva and others

Rob Gardner (1):
      sparc: semtimedop() unreachable due to comparison error

Ross Skaliotis (1):
      HID: apple: fix battery support for the 2009 ANSI wireless keyboard

Russell King (1):
      Change email address for 8250_pci

Ryusuke Konishi (2):
      nilfs2: fix potential memory overrun on inode
      nilfs2: fix deadlock of segment constructor during recovery

Sabrina Dubroca (2):
      pktgen: fix UDP checksum computation
      ip6_gre: fix endianness errors in ip6gre_err

Sasha Levin (1):
      PCI: Don't read past the end of sysfs "driver_override" buffer

Sergey Ryazanov (1):
      ath5k: fix spontaneus AR5312 freezes

Stefan Wahren (1):
      iio: mxs-lradc: fix iio channel map regression

Steven Barth (1):
      ipv6: fix backtracking for throw routes

Steven Rostedt (Red Hat) (1):
      ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled

Takashi Iwai (9):
      ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec
      ALSA: pcm: Don't leave PREPARED state after draining
      ALSA: hda - Disable runtime PM for Panther Point again
      ALSA: hda - Fix regression of HD-audio controller fallback modes
      ALSA: hda - Fix built-in mic on Compaq Presario CQ60
      ALSA: control: Add sanity checks for user ctl id name string
      ALSA: hda - Set single_adc_amp flag for CS420x codecs
      ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic
      ALSA: hda - Don't access stereo amps for mono channel widgets

Tejun Heo (1):
      workqueue: fix hang involving racing cancel[_delayed]_work_sync()'s for PREEMPT_NONE

Thomas Hellstrom (2):
      drm/vmwgfx: Fix a couple of lock dependency violations
      drm/vmwgfx: Reorder device takedown somewhat

Tommi Rantala (1):
      drm/radeon: fix DRM_IOCTL_RADEON_CS oops

Tomáš Hodek (1):
      md/raid1: fix read balance when a drive is write-mostly.

Torsten Fleischer (1):
      spi: atmel: Fix interrupt setup for PDC transfers

Trond Myklebust (1):
      NFSv4: Don't call put_rpccred() under the rcu_read_lock()

Tyler Hicks (1):
      eCryptfs: don't pass fs-specific ioctl commands through

Urs Fässler (1):
      iio: ad5686: fix optional reference voltage declaration

Uwe Kleine-König (2):
      clk: divider: fix calculation of maximal parent rate for a given divider
      clk: divider: fix selection of divider when rounding to closest

Vignesh R (2):
      ARM: dts: am33xx-clocks: Fix ehrpwm tbclk data on am33xx
      ARM: dts: am43xx-clocks: Fix ehrpwm tbclk data on am43xx

Vineet Gupta (1):
      ARC: Fix KSTK_ESP()

WANG Cong (1):
      rtnetlink: call ->dellink on failure when ->newlink exists

Yinghai Lu (1):
      efi/libstub: Fix boundary checking in efi_high_alloc()

jmlatten@linux.vnet.ibm.com (1):
      tpm/ibmvtpm: Additional LE support for tpm_ibmvtpm_send

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

* [PATCH 3.16.y-ckt 001/165] netfilter: nf_tables: disable preemption when restoring chain counters
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 002/165] netfilter: nf_tables: fix leaks in error path of nf_tables_newchain() Luis Henriques
                   ` (163 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pablo Neira Ayuso <pablo@netfilter.org>

commit e8781f70a5b210a1b08cff8ce05895ebcec18d83 upstream.

With CONFIG_DEBUG_PREEMPT=y

[22144.496057] BUG: using smp_processor_id() in preemptible [00000000] code: iptables-compat/10406
[22144.496061] caller is debug_smp_processor_id+0x17/0x1b
[22144.496065] CPU: 2 PID: 10406 Comm: iptables-compat Not tainted 3.19.0-rc4+ #
[...]
[22144.496092] Call Trace:
[22144.496098]  [<ffffffff8145b9fa>] dump_stack+0x4f/0x7b
[22144.496104]  [<ffffffff81244f52>] check_preemption_disabled+0xd6/0xe8
[22144.496110]  [<ffffffff81244f90>] debug_smp_processor_id+0x17/0x1b
[22144.496120]  [<ffffffffa07c557e>] nft_stats_alloc+0x94/0xc7 [nf_tables]
[22144.496130]  [<ffffffffa07c73d2>] nf_tables_newchain+0x471/0x6d8 [nf_tables]
[22144.496140]  [<ffffffffa07c5ef6>] ? nft_trans_alloc+0x18/0x34 [nf_tables]
[22144.496154]  [<ffffffffa063c8da>] nfnetlink_rcv_batch+0x2b4/0x457 [nfnetlink]

Reported-by: Andreas Schultz <aschultz@tpip.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nf_tables_api.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 594afb3e7c40..fe551ca01a98 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -889,9 +889,11 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
 	/* Restore old counters on this cpu, no problem. Per-cpu statistics
 	 * are not exposed to userspace.
 	 */
+	preempt_disable();
 	stats = this_cpu_ptr(newstats);
 	stats->bytes = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_BYTES]));
 	stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS]));
+	preempt_enable();
 
 	return newstats;
 }

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

* [PATCH 3.16.y-ckt 002/165] netfilter: nf_tables: fix leaks in error path of nf_tables_newchain()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 001/165] netfilter: nf_tables: disable preemption when restoring chain counters Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 003/165] ipvs: rerouting to local clients is not needed anymore Luis Henriques
                   ` (162 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pablo Neira Ayuso <pablo@netfilter.org>

commit f5553c19ff9058136e7082c0b1f4268e705ea538 upstream.

Release statistics and module refcount on memory allocation problems.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nf_tables_api.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index fe551ca01a98..e1cf0f89748d 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1034,8 +1034,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
 		nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla);
 		trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN,
 					sizeof(struct nft_trans_chain));
-		if (trans == NULL)
+		if (trans == NULL) {
+			free_percpu(stats);
 			return -ENOMEM;
+		}
 
 		nft_trans_chain_stats(trans) = stats;
 		nft_trans_chain_update(trans) = true;
@@ -1091,8 +1093,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb,
 		hookfn = type->hooks[hooknum];
 
 		basechain = kzalloc(sizeof(*basechain), GFP_KERNEL);
-		if (basechain == NULL)
+		if (basechain == NULL) {
+			module_put(type->owner);
 			return -ENOMEM;
+		}
 
 		if (nla[NFTA_CHAIN_COUNTERS]) {
 			stats = nft_stats_alloc(nla[NFTA_CHAIN_COUNTERS]);

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

* [PATCH 3.16.y-ckt 003/165] ipvs: rerouting to local clients is not needed anymore
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 001/165] netfilter: nf_tables: disable preemption when restoring chain counters Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 002/165] netfilter: nf_tables: fix leaks in error path of nf_tables_newchain() Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 004/165] netfilter: nft_compat: fix module refcount underflow Luis Henriques
                   ` (161 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Julian Anastasov, Simon Horman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Julian Anastasov <ja@ssi.bg>

commit 579eb62ac35845686a7c4286c0a820b4eb1f96aa upstream.

commit f5a41847acc5 ("ipvs: move ip_route_me_harder for ICMP")
from 2.6.37 introduced ip_route_me_harder() call for responses to
local clients, so that we can provide valid rt_src after SNAT.
It was used by TCP to provide valid daddr for ip_send_reply().
After commit 0a5ebb8000c5 ("ipv4: Pass explicit daddr arg to
ip_send_reply()." from 3.0 this rerouting is not needed anymore
and should be avoided, especially in LOCAL_IN.

Fixes 3.12.33 crash in xfrm reported by Florian Wiessner:
"3.12.33 - BUG xfrm_selector_match+0x25/0x2f6"

Reported-by: Smart Weblications GmbH - Florian Wiessner <f.wiessner@smart-weblications.de>
Tested-by: Smart Weblications GmbH - Florian Wiessner <f.wiessner@smart-weblications.de>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/ipvs/ip_vs_core.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 5c34e8d42e01..74de7655faf8 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -658,16 +658,24 @@ static inline int ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
 	return err;
 }
 
-static int ip_vs_route_me_harder(int af, struct sk_buff *skb)
+static int ip_vs_route_me_harder(int af, struct sk_buff *skb,
+				 unsigned int hooknum)
 {
+	if (!sysctl_snat_reroute(skb))
+		return 0;
+	/* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */
+	if (NF_INET_LOCAL_IN == hooknum)
+		return 0;
 #ifdef CONFIG_IP_VS_IPV6
 	if (af == AF_INET6) {
-		if (sysctl_snat_reroute(skb) && ip6_route_me_harder(skb) != 0)
+		struct dst_entry *dst = skb_dst(skb);
+
+		if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) &&
+		    ip6_route_me_harder(skb) != 0)
 			return 1;
 	} else
 #endif
-		if ((sysctl_snat_reroute(skb) ||
-		     skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
+		if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
 		    ip_route_me_harder(skb, RTN_LOCAL) != 0)
 			return 1;
 
@@ -790,7 +798,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
 				union nf_inet_addr *snet,
 				__u8 protocol, struct ip_vs_conn *cp,
 				struct ip_vs_protocol *pp,
-				unsigned int offset, unsigned int ihl)
+				unsigned int offset, unsigned int ihl,
+				unsigned int hooknum)
 {
 	unsigned int verdict = NF_DROP;
 
@@ -820,7 +829,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
 #endif
 		ip_vs_nat_icmp(skb, pp, cp, 1);
 
-	if (ip_vs_route_me_harder(af, skb))
+	if (ip_vs_route_me_harder(af, skb, hooknum))
 		goto out;
 
 	/* do the statistics and put it back */
@@ -915,7 +924,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related,
 
 	snet.ip = iph->saddr;
 	return handle_response_icmp(AF_INET, skb, &snet, cih->protocol, cp,
-				    pp, ciph.len, ihl);
+				    pp, ciph.len, ihl, hooknum);
 }
 
 #ifdef CONFIG_IP_VS_IPV6
@@ -980,7 +989,8 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related,
 	snet.in6 = ciph.saddr.in6;
 	writable = ciph.len;
 	return handle_response_icmp(AF_INET6, skb, &snet, ciph.protocol, cp,
-				    pp, writable, sizeof(struct ipv6hdr));
+				    pp, writable, sizeof(struct ipv6hdr),
+				    hooknum);
 }
 #endif
 
@@ -1039,7 +1049,8 @@ static inline bool is_new_conn(const struct sk_buff *skb,
  */
 static unsigned int
 handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
-		struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
+		struct ip_vs_conn *cp, struct ip_vs_iphdr *iph,
+		unsigned int hooknum)
 {
 	struct ip_vs_protocol *pp = pd->pp;
 
@@ -1077,7 +1088,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
 	 * if it came from this machine itself.  So re-compute
 	 * the routing information.
 	 */
-	if (ip_vs_route_me_harder(af, skb))
+	if (ip_vs_route_me_harder(af, skb, hooknum))
 		goto drop;
 
 	IP_VS_DBG_PKT(10, af, pp, skb, 0, "After SNAT");
@@ -1180,7 +1191,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
 	cp = pp->conn_out_get(af, skb, &iph, 0);
 
 	if (likely(cp))
-		return handle_response(af, skb, pd, cp, &iph);
+		return handle_response(af, skb, pd, cp, &iph, hooknum);
 	if (sysctl_nat_icmp_send(net) &&
 	    (pp->protocol == IPPROTO_TCP ||
 	     pp->protocol == IPPROTO_UDP ||

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

* [PATCH 3.16.y-ckt 004/165] netfilter: nft_compat: fix module refcount underflow
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (2 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 003/165] ipvs: rerouting to local clients is not needed anymore Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 005/165] netfilter: xt_socket: fix a stack corruption bug Luis Henriques
                   ` (160 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pablo Neira Ayuso <pablo@netfilter.org>

commit 520aa7414bb590f39d0d1591b06018e60cbc7cf4 upstream.

Feb 12 18:20:42 nfdev kernel: ------------[ cut here ]------------
Feb 12 18:20:42 nfdev kernel: WARNING: CPU: 4 PID: 4359 at kernel/module.c:963 module_put+0x9b/0xba()
Feb 12 18:20:42 nfdev kernel: CPU: 4 PID: 4359 Comm: ebtables-compat Tainted: G        W      3.19.0-rc6+ #43
[...]
Feb 12 18:20:42 nfdev kernel: Call Trace:
Feb 12 18:20:42 nfdev kernel: [<ffffffff815fd911>] dump_stack+0x4c/0x65
Feb 12 18:20:42 nfdev kernel: [<ffffffff8103e6f7>] warn_slowpath_common+0x9c/0xb6
Feb 12 18:20:42 nfdev kernel: [<ffffffff8109919f>] ? module_put+0x9b/0xba
Feb 12 18:20:42 nfdev kernel: [<ffffffff8103e726>] warn_slowpath_null+0x15/0x17
Feb 12 18:20:42 nfdev kernel: [<ffffffff8109919f>] module_put+0x9b/0xba
Feb 12 18:20:42 nfdev kernel: [<ffffffff813ecf7c>] nft_match_destroy+0x45/0x4c
Feb 12 18:20:42 nfdev kernel: [<ffffffff813e683f>] nf_tables_rule_destroy+0x28/0x70

Reported-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nft_compat.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 5b5ab9ec1a90..318e1f1b0e4c 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -629,8 +629,12 @@ nft_match_select_ops(const struct nft_ctx *ctx,
 		struct xt_match *match = nft_match->ops.data;
 
 		if (strcmp(match->name, mt_name) == 0 &&
-		    match->revision == rev && match->family == family)
+		    match->revision == rev && match->family == family) {
+			if (!try_module_get(match->me))
+				return ERR_PTR(-ENOENT);
+
 			return &nft_match->ops;
+		}
 	}
 
 	match = xt_request_find_match(family, mt_name, rev);
@@ -700,8 +704,12 @@ nft_target_select_ops(const struct nft_ctx *ctx,
 		struct xt_target *target = nft_target->ops.data;
 
 		if (strcmp(target->name, tg_name) == 0 &&
-		    target->revision == rev && target->family == family)
+		    target->revision == rev && target->family == family) {
+			if (!try_module_get(target->me))
+				return ERR_PTR(-ENOENT);
+
 			return &nft_target->ops;
+		}
 	}
 
 	target = xt_request_find_target(family, tg_name, rev);

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

* [PATCH 3.16.y-ckt 005/165] netfilter: xt_socket: fix a stack corruption bug
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (3 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 004/165] netfilter: nft_compat: fix module refcount underflow Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 006/165] ipvs: add missing ip_vs_pe_put in sync code Luis Henriques
                   ` (159 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Pablo Neira Ayuso, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 78296c97ca1fd3b104f12e1f1fbc06c46635990b upstream.

As soon as extract_icmp6_fields() returns, its local storage (automatic
variables) is deallocated and can be overwritten.

Lets add an additional parameter to make sure storage is valid long
enough.

While we are at it, adds some const qualifiers.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: b64c9256a9b76 ("tproxy: added IPv6 support to the socket match")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_socket.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c
index 1ba67931eb1b..13332dbf291d 100644
--- a/net/netfilter/xt_socket.c
+++ b/net/netfilter/xt_socket.c
@@ -243,12 +243,13 @@ static int
 extract_icmp6_fields(const struct sk_buff *skb,
 		     unsigned int outside_hdrlen,
 		     int *protocol,
-		     struct in6_addr **raddr,
-		     struct in6_addr **laddr,
+		     const struct in6_addr **raddr,
+		     const struct in6_addr **laddr,
 		     __be16 *rport,
-		     __be16 *lport)
+		     __be16 *lport,
+		     struct ipv6hdr *ipv6_var)
 {
-	struct ipv6hdr *inside_iph, _inside_iph;
+	const struct ipv6hdr *inside_iph;
 	struct icmp6hdr *icmph, _icmph;
 	__be16 *ports, _ports[2];
 	u8 inside_nexthdr;
@@ -263,12 +264,14 @@ extract_icmp6_fields(const struct sk_buff *skb,
 	if (icmph->icmp6_type & ICMPV6_INFOMSG_MASK)
 		return 1;
 
-	inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), sizeof(_inside_iph), &_inside_iph);
+	inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph),
+					sizeof(*ipv6_var), ipv6_var);
 	if (inside_iph == NULL)
 		return 1;
 	inside_nexthdr = inside_iph->nexthdr;
 
-	inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph),
+	inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) +
+					      sizeof(*ipv6_var),
 					 &inside_nexthdr, &inside_fragoff);
 	if (inside_hdrlen < 0)
 		return 1; /* hjm: Packet has no/incomplete transport layer headers. */
@@ -315,10 +318,10 @@ xt_socket_get_sock_v6(struct net *net, const u8 protocol,
 static bool
 socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par)
 {
-	struct ipv6hdr *iph = ipv6_hdr(skb);
+	struct ipv6hdr ipv6_var, *iph = ipv6_hdr(skb);
 	struct udphdr _hdr, *hp = NULL;
 	struct sock *sk = skb->sk;
-	struct in6_addr *daddr = NULL, *saddr = NULL;
+	const struct in6_addr *daddr = NULL, *saddr = NULL;
 	__be16 uninitialized_var(dport), uninitialized_var(sport);
 	int thoff = 0, uninitialized_var(tproto);
 	const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo;
@@ -342,7 +345,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par)
 
 	} else if (tproto == IPPROTO_ICMPV6) {
 		if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr,
-					 &sport, &dport))
+					 &sport, &dport, &ipv6_var))
 			return false;
 	} else {
 		return false;

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

* [PATCH 3.16.y-ckt 006/165] ipvs: add missing ip_vs_pe_put in sync code
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (4 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 005/165] netfilter: xt_socket: fix a stack corruption bug Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 007/165] flowcache: Fix kernel panic in flow_cache_flush_task Luis Henriques
                   ` (158 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Julian Anastasov, Simon Horman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Julian Anastasov <ja@ssi.bg>

commit 528c943f3bb919aef75ab2fff4f00176f09a4019 upstream.

ip_vs_conn_fill_param_sync() gets in param.pe a module
reference for persistence engine from __ip_vs_pe_getbyname()
but forgets to put it. Problem occurs in backup for
sync protocol v1 (2.6.39).

Also, pe_data usually comes in sync messages for
connection templates and ip_vs_conn_new() copies
the pointer only in this case. Make sure pe_data
is not leaked if it comes unexpectedly for normal
connections. Leak can happen only if bogus messages
are sent to backup server.

Fixes: fe5e7a1efb66 ("IPVS: Backup, Adding Version 1 receive capability")
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/ipvs/ip_vs_sync.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index db801263ee9f..a8027e73b6a2 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -891,6 +891,8 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param,
 			IP_VS_DBG(2, "BACKUP, add new conn. failed\n");
 			return;
 		}
+		if (!(flags & IP_VS_CONN_F_TEMPLATE))
+			kfree(param->pe_data);
 	}
 
 	if (opt)
@@ -1164,6 +1166,7 @@ static inline int ip_vs_proc_sync_conn(struct net *net, __u8 *p, __u8 *msg_end)
 				(opt_flags & IPVS_OPT_F_SEQ_DATA ? &opt : NULL)
 				);
 #endif
+	ip_vs_pe_put(param.pe);
 	return 0;
 	/* Error exit */
 out:

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

* [PATCH 3.16.y-ckt 007/165] flowcache: Fix kernel panic in flow_cache_flush_task
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (5 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 006/165] ipvs: add missing ip_vs_pe_put in sync code Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 008/165] pktgen: fix UDP checksum computation Luis Henriques
                   ` (157 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Miroslav Urbanek, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Miroslav Urbanek <mu@miroslavurbanek.com>

commit 233c96fc077d310772375d47522fb444ff546905 upstream.

flow_cache_flush_task references a structure member flow_cache_gc_work
where it should reference flow_cache_flush_task instead.

Kernel panic occurs on kernels using IPsec during XFRM garbage
collection. The garbage collection interval can be shortened using the
following sysctl settings:

net.ipv4.xfrm4_gc_thresh=4
net.ipv6.xfrm6_gc_thresh=4

With the default settings, our productions servers crash approximately
once a week. With the settings above, they crash immediately.

Fixes: ca925cf1534e ("flowcache: Make flow cache name space aware")
Reported-by: Tomáš Charvát <tc@excello.cz>
Tested-by: Jan Hejl <jh@excello.cz>
Signed-off-by: Miroslav Urbanek <mu@miroslavurbanek.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/flow.c b/net/core/flow.c
index a0348fde1fdf..1033725be40b 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -379,7 +379,7 @@ done:
 static void flow_cache_flush_task(struct work_struct *work)
 {
 	struct netns_xfrm *xfrm = container_of(work, struct netns_xfrm,
-						flow_cache_gc_work);
+						flow_cache_flush_work);
 	struct net *net = container_of(xfrm, struct net, xfrm);
 
 	flow_cache_flush(net);

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

* [PATCH 3.16.y-ckt 008/165] pktgen: fix UDP checksum computation
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (6 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 007/165] flowcache: Fix kernel panic in flow_cache_flush_task Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 009/165] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Luis Henriques
                   ` (156 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sabrina Dubroca, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sabrina Dubroca <sd@queasysnail.net>

commit 7744b5f3693cc06695cb9d6667671c790282730f upstream.

This patch fixes two issues in UDP checksum computation in pktgen.

First, the pseudo-header uses the source and destination IP
addresses. Currently, the ports are used for IPv4.

Second, the UDP checksum covers both header and data.  So we need to
generate the data earlier (move pktgen_finalize_skb up), and compute
the checksum for UDP header + data.

Fixes: c26bf4a51308c ("pktgen: Add UDPCSUM flag to support UDP checksums")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/pktgen.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fc17a9d309ac..5901a1187cd2 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2814,25 +2814,25 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
 	skb->dev = odev;
 	skb->pkt_type = PACKET_HOST;
 
+	pktgen_finalize_skb(pkt_dev, skb, datalen);
+
 	if (!(pkt_dev->flags & F_UDPCSUM)) {
 		skb->ip_summed = CHECKSUM_NONE;
 	} else if (odev->features & NETIF_F_V4_CSUM) {
 		skb->ip_summed = CHECKSUM_PARTIAL;
 		skb->csum = 0;
-		udp4_hwcsum(skb, udph->source, udph->dest);
+		udp4_hwcsum(skb, iph->saddr, iph->daddr);
 	} else {
-		__wsum csum = udp_csum(skb);
+		__wsum csum = skb_checksum(skb, skb_transport_offset(skb), datalen + 8, 0);
 
 		/* add protocol-dependent pseudo-header */
-		udph->check = csum_tcpudp_magic(udph->source, udph->dest,
+		udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
 						datalen + 8, IPPROTO_UDP, csum);
 
 		if (udph->check == 0)
 			udph->check = CSUM_MANGLED_0;
 	}
 
-	pktgen_finalize_skb(pkt_dev, skb, datalen);
-
 #ifdef CONFIG_XFRM
 	if (!process_ipsec(pkt_dev, skb, protocol))
 		return NULL;
@@ -2948,6 +2948,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 	skb->dev = odev;
 	skb->pkt_type = PACKET_HOST;
 
+	pktgen_finalize_skb(pkt_dev, skb, datalen);
+
 	if (!(pkt_dev->flags & F_UDPCSUM)) {
 		skb->ip_summed = CHECKSUM_NONE;
 	} else if (odev->features & NETIF_F_V6_CSUM) {
@@ -2956,7 +2958,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 		skb->csum_offset = offsetof(struct udphdr, check);
 		udph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, 0);
 	} else {
-		__wsum csum = udp_csum(skb);
+		__wsum csum = skb_checksum(skb, skb_transport_offset(skb), udplen, 0);
 
 		/* add protocol-dependent pseudo-header */
 		udph->check = csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, csum);
@@ -2965,8 +2967,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 			udph->check = CSUM_MANGLED_0;
 	}
 
-	pktgen_finalize_skb(pkt_dev, skb, datalen);
-
 	return skb;
 }
 

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

* [PATCH 3.16.y-ckt 009/165] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (7 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 008/165] pktgen: fix UDP checksum computation Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 010/165] tcp: make sure skb is not shared before using skb_get() Luis Henriques
                   ` (155 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mitch Williams, Jeff Kirsher, Daniel Borkmann, David S. Miller,
	Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit 364d5716a7adb91b731a35765d369602d68d2881 upstream.

ifla_vf_policy[] is wrong in advertising its individual member types as
NLA_BINARY since .type = NLA_BINARY in combination with .len declares the
len member as *max* attribute length [0, len].

The issue is that when do_setvfinfo() is being called to set up a VF
through ndo handler, we could set corrupted data if the attribute length
is less than the size of the related structure itself.

The intent is exactly the opposite, namely to make sure to pass at least
data of minimum size of len.

Fixes: ebc08a6f47ee ("rtnetlink: Add VF config code to rtnetlink")
Cc: Mitch Williams <mitch.a.williams@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/rtnetlink.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 2128423f8a7c..888136a75454 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1207,18 +1207,12 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = {
 };
 
 static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
-	[IFLA_VF_MAC]		= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_mac) },
-	[IFLA_VF_VLAN]		= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_vlan) },
-	[IFLA_VF_TX_RATE]	= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_tx_rate) },
-	[IFLA_VF_SPOOFCHK]	= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_spoofchk) },
-	[IFLA_VF_RATE]		= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_rate) },
-	[IFLA_VF_LINK_STATE]	= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_link_state) },
+	[IFLA_VF_MAC]		= { .len = sizeof(struct ifla_vf_mac) },
+	[IFLA_VF_VLAN]		= { .len = sizeof(struct ifla_vf_vlan) },
+	[IFLA_VF_TX_RATE]	= { .len = sizeof(struct ifla_vf_tx_rate) },
+	[IFLA_VF_SPOOFCHK]	= { .len = sizeof(struct ifla_vf_spoofchk) },
+	[IFLA_VF_RATE]		= { .len = sizeof(struct ifla_vf_rate) },
+	[IFLA_VF_LINK_STATE]	= { .len = sizeof(struct ifla_vf_link_state) },
 };
 
 static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = {

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

* [PATCH 3.16.y-ckt 010/165] tcp: make sure skb is not shared before using skb_get()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (8 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 009/165] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 011/165] ipv6: fix ipv6_cow_metrics for non DST_HOST case Luis Henriques
                   ` (154 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Yuchung Cheng, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit ba34e6d9d346fe4e05d7e417b9edf5140772d34c upstream.

IPv6 can keep a copy of SYN message using skb_get() in
tcp_v6_conn_request() so that caller wont free the skb when calling
kfree_skb() later.

Therefore TCP fast open has to clone the skb it is queuing in
child->sk_receive_queue, as all skbs consumed from receive_queue are
freed using __kfree_skb() (ie assuming skb->users == 1)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Fixes: 5b7ed0892f2af ("tcp: move fastopen functions to tcp_fastopen.c")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_fastopen.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 9771563ab564..2d925f65c2cc 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -134,6 +134,7 @@ static bool tcp_fastopen_create_child(struct sock *sk,
 	struct tcp_sock *tp;
 	struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue;
 	struct sock *child;
+	u32 end_seq;
 
 	req->num_retrans = 0;
 	req->num_timeout = 0;
@@ -185,20 +186,35 @@ static bool tcp_fastopen_create_child(struct sock *sk,
 
 	/* Queue the data carried in the SYN packet. We need to first
 	 * bump skb's refcnt because the caller will attempt to free it.
+	 * Note that IPv6 might also have used skb_get() trick
+	 * in tcp_v6_conn_request() to keep this SYN around (treq->pktopts)
+	 * So we need to eventually get a clone of the packet,
+	 * before inserting it in sk_receive_queue.
 	 *
 	 * XXX (TFO) - we honor a zero-payload TFO request for now,
 	 * (any reason not to?) but no need to queue the skb since
 	 * there is no data. How about SYN+FIN?
 	 */
-	if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq + 1) {
-		skb = skb_get(skb);
-		skb_dst_drop(skb);
-		__skb_pull(skb, tcp_hdr(skb)->doff * 4);
-		skb_set_owner_r(skb, child);
-		__skb_queue_tail(&child->sk_receive_queue, skb);
-		tp->syn_data_acked = 1;
+	end_seq = TCP_SKB_CB(skb)->end_seq;
+	if (end_seq != TCP_SKB_CB(skb)->seq + 1) {
+		struct sk_buff *skb2;
+
+		if (unlikely(skb_shared(skb)))
+			skb2 = skb_clone(skb, GFP_ATOMIC);
+		else
+			skb2 = skb_get(skb);
+
+		if (likely(skb2)) {
+			skb_dst_drop(skb2);
+			__skb_pull(skb2, tcp_hdrlen(skb));
+			skb_set_owner_r(skb2, child);
+			__skb_queue_tail(&child->sk_receive_queue, skb2);
+			tp->syn_data_acked = 1;
+		} else {
+			end_seq = TCP_SKB_CB(skb)->seq + 1;
+		}
 	}
-	tcp_rsk(req)->rcv_nxt = tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
+	tcp_rsk(req)->rcv_nxt = tp->rcv_nxt = end_seq;
 	sk->sk_data_ready(sk);
 	bh_unlock_sock(child);
 	sock_put(child);

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

* [PATCH 3.16.y-ckt 011/165] ipv6: fix ipv6_cow_metrics for non DST_HOST case
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (9 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 010/165] tcp: make sure skb is not shared before using skb_get() Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 012/165] rtnetlink: call ->dellink on failure when ->newlink exists Luis Henriques
                   ` (153 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin KaFai Lau, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Martin KaFai Lau <kafai@fb.com>

commit 3b4711757d7903ab6fa88a9e7ab8901b8227da60 upstream.

ipv6_cow_metrics() currently assumes only DST_HOST routes require
dynamic metrics allocation from inetpeer.  The assumption breaks
when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
is called after the route is created.

This patch creates the metrics array (by calling dst_cow_metrics_generic) in
ipv6_cow_metrics().

Test:
radvd.conf:
interface qemubr0
{
	AdvLinkMTU 1300;
	AdvCurHopLimit 30;

	prefix fd00:face:face:face::/64
	{
		AdvOnLink on;
		AdvAutonomous on;
		AdvRouterAddr off;
	};
};

Before:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0  proto kernel  metric 256  expires 27sec
fe80::/64 dev eth0  proto kernel  metric 256
default via fe80::74df:d0ff:fe23:8ef2 dev eth0  proto ra  metric 1024  expires 27sec

After:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0  proto kernel  metric 256  expires 27sec mtu 1300
fe80::/64 dev eth0  proto kernel  metric 256  mtu 1300
default via fe80::74df:d0ff:fe23:8ef2 dev eth0  proto ra  metric 1024  expires 27sec mtu 1300 hoplimit 30

Fixes: 8e2ec639173f325 (ipv6: don't use inetpeer to store metrics for routes.)
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 920616d05758..07b1eee067b1 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
 	u32 *p = NULL;
 
 	if (!(rt->dst.flags & DST_HOST))
-		return NULL;
+		return dst_cow_metrics_generic(dst, old);
 
 	peer = rt6_get_peer_create(rt);
 	if (peer) {

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

* [PATCH 3.16.y-ckt 012/165] rtnetlink: call ->dellink on failure when ->newlink exists
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (10 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 011/165] ipv6: fix ipv6_cow_metrics for non DST_HOST case Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 013/165] gen_stats.c: Duplicate xstats buffer for later use Luis Henriques
                   ` (152 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cong Wang, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: WANG Cong <xiyou.wangcong@gmail.com>

commit 7afb8886a05be68e376655539a064ec672de8a8e upstream.

Ignacy reported that when eth0 is down and add a vlan device
on top of it like:

  ip link add link eth0 name eth0.1 up type vlan id 1

We will get a refcount leak:

  unregister_netdevice: waiting for eth0.1 to become free. Usage count = 2

The problem is when rtnl_configure_link() fails in rtnl_newlink(),
we simply call unregister_device(), but for stacked device like vlan,
we almost do nothing when we unregister the upper device, more work
is done when we unregister the lower device, so call its ->dellink().

Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: based on davem's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/rtnetlink.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 888136a75454..b1e79ca03fa0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2069,8 +2069,16 @@ replay:
 			}
 		}
 		err = rtnl_configure_link(dev, ifm);
-		if (err < 0)
-			unregister_netdevice(dev);
+		if (err < 0) {
+			if (ops->newlink) {
+				LIST_HEAD(list_kill);
+
+				ops->dellink(dev, &list_kill);
+				unregister_netdevice_many(&list_kill);
+			} else {
+				unregister_netdevice(dev);
+			}
+		}
 out:
 		put_net(dest_net);
 		return err;

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

* [PATCH 3.16.y-ckt 013/165] gen_stats.c: Duplicate xstats buffer for later use
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (11 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 012/165] rtnetlink: call ->dellink on failure when ->newlink exists Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 014/165] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Luis Henriques
                   ` (151 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ignacy Gawędzki, Cong Wang, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Ignacy=20Gaw=C4=99dzki?=

commit 1c4cff0cf55011792125b6041bc4e9713e46240f upstream.

The gnet_stats_copy_app() function gets called, more often than not, with its
second argument a pointer to an automatic variable in the caller's stack.
Therefore, to avoid copying garbage afterwards when calling
gnet_stats_finish_copy(), this data is better copied to a dynamically allocated
memory that gets freed after use.

[xiyou.wangcong@gmail.com: remove a useless kfree()]

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/gen_stats.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 9d3d9e78397b..372ac662adf9 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size)
 	return 0;
 
 nla_put_failure:
+	kfree(d->xstats);
+	d->xstats = NULL;
+	d->xstats_len = 0;
 	spin_unlock_bh(d->lock);
 	return -1;
 }
@@ -217,7 +220,9 @@ int
 gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
 {
 	if (d->compat_xstats) {
-		d->xstats = st;
+		d->xstats = kmemdup(st, len, GFP_ATOMIC);
+		if (!d->xstats)
+			goto err_out;
 		d->xstats_len = len;
 	}
 
@@ -225,6 +230,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
 		return gnet_stats_copy(d, TCA_STATS_APP, st, len);
 
 	return 0;
+
+err_out:
+	d->xstats_len = 0;
+	spin_unlock_bh(d->lock);
+	return -1;
 }
 EXPORT_SYMBOL(gnet_stats_copy_app);
 
@@ -257,6 +267,9 @@ gnet_stats_finish_copy(struct gnet_dump *d)
 			return -1;
 	}
 
+	kfree(d->xstats);
+	d->xstats = NULL;
+	d->xstats_len = 0;
 	spin_unlock_bh(d->lock);
 	return 0;
 }

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

* [PATCH 3.16.y-ckt 014/165] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (12 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 013/165] gen_stats.c: Duplicate xstats buffer for later use Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 015/165] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Luis Henriques
                   ` (150 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Drozdov, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Drozdov <al.drozdov@gmail.com>

commit fba04a9e0c869498889b6445fd06cbe7da9bb834 upstream.

skb_copy_bits() returns zero on success and negative value on error,
so it is needed to invert the condition in ip_check_defrag().

Fixes: 1bf3751ec90c ("ipv4: ip_check_defrag must not modify skb before unsharing")
Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ip_fragment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index ed32313e307c..022b5f49aab7 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -685,7 +685,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
 	if (skb->protocol != htons(ETH_P_IP))
 		return skb;
 
-	if (!skb_copy_bits(skb, 0, &iph, sizeof(iph)))
+	if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0)
 		return skb;
 
 	if (iph.ihl < 5 || iph.version != 4)

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

* [PATCH 3.16.y-ckt 015/165] ipv4: ip_check_defrag should not assume that skb_network_offset is zero
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (13 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 014/165] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 016/165] net: phy: Fix verification of EEE support in phy_init_eee Luis Henriques
                   ` (149 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Drozdov, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Drozdov <al.drozdov@gmail.com>

commit 3e32e733d1bbb3f227259dc782ef01d5706bdae0 upstream.

ip_check_defrag() may be used by af_packet to defragment outgoing packets.
skb_network_offset() of af_packet's outgoing packets is not zero.

Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ip_fragment.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 022b5f49aab7..8ff962d15c99 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -680,27 +680,30 @@ EXPORT_SYMBOL(ip_defrag);
 struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
 {
 	struct iphdr iph;
+	int netoff;
 	u32 len;
 
 	if (skb->protocol != htons(ETH_P_IP))
 		return skb;
 
-	if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0)
+	netoff = skb_network_offset(skb);
+
+	if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0)
 		return skb;
 
 	if (iph.ihl < 5 || iph.version != 4)
 		return skb;
 
 	len = ntohs(iph.tot_len);
-	if (skb->len < len || len < (iph.ihl * 4))
+	if (skb->len < netoff + len || len < (iph.ihl * 4))
 		return skb;
 
 	if (ip_is_fragment(&iph)) {
 		skb = skb_share_check(skb, GFP_ATOMIC);
 		if (skb) {
-			if (!pskb_may_pull(skb, iph.ihl*4))
+			if (!pskb_may_pull(skb, netoff + iph.ihl * 4))
 				return skb;
-			if (pskb_trim_rcsum(skb, len))
+			if (pskb_trim_rcsum(skb, netoff + len))
 				return skb;
 			memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
 			if (ip_defrag(skb, user))

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

* [PATCH 3.16.y-ckt 016/165] net: phy: Fix verification of EEE support in phy_init_eee
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (14 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 015/165] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 017/165] ematch: Fix auto-loading of ematch modules Luis Henriques
                   ` (148 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Giuseppe Cavallaro, Guenter Roeck, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

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

commit 54da5a8be3c1e924c35480eb44c6e9b275f6444e upstream.

phy_init_eee uses phy_find_setting(phydev->speed, phydev->duplex)
to find a valid entry in the settings array for the given speed
and duplex value. For full duplex 1000baseT, this will return
the first matching entry, which is the entry for 1000baseKX_Full.

If the phy eee does not support 1000baseKX_Full, this entry will not
match, causing phy_init_eee to fail for no good reason.

Fixes: 9a9c56cb34e6 ("net: phy: fix a bug when verify the EEE support")
Fixes: 3e7077067e80c ("phy: Expand phy speed/duplex settings array")
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/phy/phy.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f7c61812ea4a..d792574b0db6 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -216,6 +216,25 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features)
 }
 
 /**
+ * phy_check_valid - check if there is a valid PHY setting which matches
+ *		     speed, duplex, and feature mask
+ * @speed: speed to match
+ * @duplex: duplex to match
+ * @features: A mask of the valid settings
+ *
+ * Description: Returns true if there is a valid setting, false otherwise.
+ */
+static inline bool phy_check_valid(int speed, int duplex, u32 features)
+{
+	unsigned int idx;
+
+	idx = phy_find_valid(phy_find_setting(speed, duplex), features);
+
+	return settings[idx].speed == speed && settings[idx].duplex == duplex &&
+		(settings[idx].setting & features);
+}
+
+/**
  * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex
  * @phydev: the target phy_device struct
  *
@@ -992,7 +1011,6 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 		int eee_lp, eee_cap, eee_adv;
 		u32 lp, cap, adv;
 		int status;
-		unsigned int idx;
 
 		/* Read phy status to properly get the right settings */
 		status = phy_read_status(phydev);
@@ -1024,8 +1042,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 
 		adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
 		lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
-		idx = phy_find_setting(phydev->speed, phydev->duplex);
-		if (!(lp & adv & settings[idx].setting))
+		if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv))
 			return -EPROTONOSUPPORT;
 
 		if (clk_stop_enable) {

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

* [PATCH 3.16.y-ckt 017/165] ematch: Fix auto-loading of ematch modules.
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (15 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 016/165] net: phy: Fix verification of EEE support in phy_init_eee Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 018/165] openvswitch: Fix net exit Luis Henriques
                   ` (147 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ignacy Gawędzki, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Ignacy=20Gaw=C4=99dzki?=

commit 34eea79e2664b314cab6a30fc582fdfa7a1bb1df upstream.

In tcf_em_validate(), after calling request_module() to load the
kind-specific module, set em->ops to NULL before returning -EAGAIN, so
that module_put() is not called again by tcf_em_tree_destroy().

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Acked-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sched/ematch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index 3a633debb6df..a2abc449ce8f 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
 				 * to replay the request.
 				 */
 				module_put(em->ops->owner);
+				em->ops = NULL;
 				err = -EAGAIN;
 			}
 #endif

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

* [PATCH 3.16.y-ckt 018/165] openvswitch: Fix net exit.
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (16 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 017/165] ematch: Fix auto-loading of ematch modules Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 019/165] net: reject creation of netdev names with colons Luis Henriques
                   ` (146 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pravin B Shelar, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pravin B Shelar <pshelar@nicira.com>

commit 7b4577a9da3702049650f7095506e9afd9f68849 upstream.

Open vSwitch allows moving internal vport to different namespace
while still connected to the bridge. But when namespace deleted
OVS does not detach these vports, that results in dangling
pointer to netdevice which causes kernel panic as follows.
This issue is fixed by detaching all ovs ports from the deleted
namespace at net-exit.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
IP: [<ffffffffa0aadaa5>] ovs_vport_locate+0x35/0x80 [openvswitch]
Oops: 0000 [#1] SMP
Call Trace:
 [<ffffffffa0aa6391>] lookup_vport+0x21/0xd0 [openvswitch]
 [<ffffffffa0aa65f9>] ovs_vport_cmd_get+0x59/0xf0 [openvswitch]
 [<ffffffff8167e07c>] genl_family_rcv_msg+0x1bc/0x3e0
 [<ffffffff8167e319>] genl_rcv_msg+0x79/0xc0
 [<ffffffff8167d919>] netlink_rcv_skb+0xb9/0xe0
 [<ffffffff8167deac>] genl_rcv+0x2c/0x40
 [<ffffffff8167cffd>] netlink_unicast+0x12d/0x1c0
 [<ffffffff8167d3da>] netlink_sendmsg+0x34a/0x6b0
 [<ffffffff8162e140>] sock_sendmsg+0xa0/0xe0
 [<ffffffff8162e5e8>] ___sys_sendmsg+0x408/0x420
 [<ffffffff8162f541>] __sys_sendmsg+0x51/0x90
 [<ffffffff8162f592>] SyS_sendmsg+0x12/0x20
 [<ffffffff81764ee9>] system_call_fastpath+0x12/0x17

Reported-by: Assaf Muller <amuller@redhat.com>
Fixes: 46df7b81454("openvswitch: Add support for network namespaces.")
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Reviewed-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/openvswitch/datapath.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
 net/openvswitch/vport.h    |  2 ++
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 9db4bf6740d1..1e71adeca318 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -2025,14 +2025,55 @@ static int __net_init ovs_init_net(struct net *net)
 	return 0;
 }
 
-static void __net_exit ovs_exit_net(struct net *net)
+static void __net_exit list_vports_from_net(struct net *net, struct net *dnet,
+					    struct list_head *head)
 {
-	struct datapath *dp, *dp_next;
 	struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
+	struct datapath *dp;
+
+	list_for_each_entry(dp, &ovs_net->dps, list_node) {
+		int i;
+
+		for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) {
+			struct vport *vport;
+
+			hlist_for_each_entry(vport, &dp->ports[i], dp_hash_node) {
+				struct netdev_vport *netdev_vport;
+
+				if (vport->ops->type != OVS_VPORT_TYPE_INTERNAL)
+					continue;
+
+				netdev_vport = netdev_vport_priv(vport);
+				if (dev_net(netdev_vport->dev) == dnet)
+					list_add(&vport->detach_list, head);
+			}
+		}
+	}
+}
+
+static void __net_exit ovs_exit_net(struct net *dnet)
+{
+	struct datapath *dp, *dp_next;
+	struct ovs_net *ovs_net = net_generic(dnet, ovs_net_id);
+	struct vport *vport, *vport_next;
+	struct net *net;
+	LIST_HEAD(head);
 
 	ovs_lock();
 	list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node)
 		__dp_destroy(dp);
+
+	rtnl_lock();
+	for_each_net(net)
+		list_vports_from_net(net, dnet, &head);
+	rtnl_unlock();
+
+	/* Detach all vports from given namespace. */
+	list_for_each_entry_safe(vport, vport_next, &head, detach_list) {
+		list_del(&vport->detach_list);
+		ovs_dp_detach_port(vport);
+	}
+
 	ovs_unlock();
 
 	cancel_work_sync(&ovs_net->dp_notify_work);
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 8d721e62f388..6114d38cc141 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -76,6 +76,7 @@ struct vport_err_stats {
  * @percpu_stats: Points to per-CPU statistics used and maintained by vport
  * @stats_lock: Protects @err_stats;
  * @err_stats: Points to error statistics used and maintained by vport
+ * @detach_list: list used for detaching vport in net-exit call.
  */
 struct vport {
 	struct rcu_head rcu;
@@ -91,6 +92,7 @@ struct vport {
 
 	spinlock_t stats_lock;
 	struct vport_err_stats err_stats;
+	struct list_head detach_list;
 };
 
 /**

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

* [PATCH 3.16.y-ckt 019/165] net: reject creation of netdev names with colons
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (17 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 018/165] openvswitch: Fix net exit Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 020/165] team: fix possible null pointer dereference in team_handle_frame Luis Henriques
                   ` (145 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Matthew Thode, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Matthew Thode <mthode@mthode.org>

commit a4176a9391868bfa87705bcd2e3b49e9b9dd2996 upstream.

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <mthode@mthode.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index efcc7f4b4fc7..58bf1016a521 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -940,7 +940,7 @@ bool dev_valid_name(const char *name)
 		return false;
 
 	while (*name) {
-		if (*name == '/' || isspace(*name))
+		if (*name == '/' || *name == ':' || isspace(*name))
 			return false;
 		name++;
 	}

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

* [PATCH 3.16.y-ckt 020/165] team: fix possible null pointer dereference in team_handle_frame
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (18 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 019/165] net: reject creation of netdev names with colons Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 021/165] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Luis Henriques
                   ` (144 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Pirko, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Pirko <jiri@resnulli.us>

commit 57e595631904c827cfa1a0f7bbd7cc9a49da5745 upstream.

Currently following race is possible in team:

CPU0                                        CPU1
                                            team_port_del
                                              team_upper_dev_unlink
                                                priv_flags &= ~IFF_TEAM_PORT
team_handle_frame
  team_port_get_rcu
    team_port_exists
      priv_flags & IFF_TEAM_PORT == 0
    return NULL (instead of port got
                 from rx_handler_data)
                                              netdev_rx_handler_unregister

The thing is that the flag is removed before rx_handler is unregistered.
If team_handle_frame is called in between, team_port_exists returns 0
and team_port_get_rcu will return NULL.
So do not check the flag here. It is guaranteed by netdev_rx_handler_unregister
that team_handle_frame will always see valid rx_handler_data pointer.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/team/team.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 3dd334a29fcf..fa977f9c2e5f 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -42,9 +42,7 @@
 
 static struct team_port *team_port_get_rcu(const struct net_device *dev)
 {
-	struct team_port *port = rcu_dereference(dev->rx_handler_data);
-
-	return team_port_exists(dev) ? port : NULL;
+	return rcu_dereference(dev->rx_handler_data);
 }
 
 static struct team_port *team_port_get_rtnl(const struct net_device *dev)

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

* [PATCH 3.16.y-ckt 021/165] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (19 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 020/165] team: fix possible null pointer dereference in team_handle_frame Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 022/165] macvtap: make sure neighbour code can push ethernet header Luis Henriques
                   ` (143 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Lutomirski, David S. Miller, Catalin Marinas, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Catalin Marinas <catalin.marinas@arm.com>

commit d720d8cec563ce4e4fa44a613d4f2dcb1caf2998 upstream.

With commit a7526eb5d06b (net: Unbreak compat_sys_{send,recv}msg), the
MSG_CMSG_COMPAT flag is blocked at the compat syscall entry points,
changing the kernel compat behaviour from the one before the commit it
was trying to fix (1be374a0518a, net: Block MSG_CMSG_COMPAT in
send(m)msg and recv(m)msg).

On 32-bit kernels (!CONFIG_COMPAT), MSG_CMSG_COMPAT is 0 and the native
32-bit sys_sendmsg() allows flag 0x80000000 to be set (it is ignored by
the kernel). However, on a 64-bit kernel, the compat ABI is different
with commit a7526eb5d06b.

This patch changes the compat_sys_{send,recv}msg behaviour to the one
prior to commit 1be374a0518a.

The problem was found running 32-bit LTP (sendmsg01) binary on an arm64
kernel. Arguably, LTP should not pass 0xffffffff as flags to sendmsg()
but the general rule is not to break user ABI (even when the user
behaviour is not entirely sane).

Fixes: a7526eb5d06b (net: Unbreak compat_sys_{send,recv}msg)
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/compat.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/net/compat.c b/net/compat.c
index bc8aeefddf3f..c48930373e65 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -738,24 +738,18 @@ static unsigned char nas[21] = {
 
 COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
 {
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
 	return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
 COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
 		       unsigned int, vlen, unsigned int, flags)
 {
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
 	return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
 			      flags | MSG_CMSG_COMPAT);
 }
 
 COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
 {
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
 	return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
@@ -778,9 +772,6 @@ COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
 	int datagrams;
 	struct timespec ktspec;
 
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
-
 	if (timeout == NULL)
 		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
 				      flags | MSG_CMSG_COMPAT, NULL);

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

* [PATCH 3.16.y-ckt 022/165] macvtap: make sure neighbour code can push ethernet header
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (20 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 021/165] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 023/165] usb: plusb: Add support for National Instruments host-to-host cable Luis Henriques
                   ` (142 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 2f1d8b9e8afa5a833d96afcd23abcb8cdf8d83ab upstream.

Brian reported crashes using IPv6 traffic with macvtap/veth combo.

I tracked the crashes in neigh_hh_output()

-> memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);

Neighbour code assumes headroom to push Ethernet header is
at least 16 bytes.

It appears macvtap has only 14 bytes available on arches
where NET_IP_ALIGN is 0 (like x86)

Effect is a corruption of 2 bytes right before skb->head,
and possible crashes if accessing non existing memory.

This fix should also increase IPv4 performance, as paranoid code
in ip_finish_output2() wont have to call skb_realloc_headroom()

Reported-by: Brian Rak <brak@vultr.com>
Tested-by: Brian Rak <brak@vultr.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/macvtap.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 07c942b6ae01..e8c21f911b6f 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -637,12 +637,15 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
 	} /* else everything is zero */
 }
 
+/* Neighbour code has some assumptions on HH_DATA_MOD alignment */
+#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN)
+
 /* Get packet from user space buffer */
 static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
 				const struct iovec *iv, unsigned long total_len,
 				size_t count, int noblock)
 {
-	int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN);
+	int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE);
 	struct sk_buff *skb;
 	struct macvlan_dev *vlan;
 	unsigned long len = total_len;
@@ -701,7 +704,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
 			linear = vnet_hdr.hdr_len;
 	}
 
-	skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen,
+	skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen,
 				linear, noblock, &err);
 	if (!skb)
 		goto err;

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

* [PATCH 3.16.y-ckt 023/165] usb: plusb: Add support for National Instruments host-to-host cable
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (21 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 022/165] macvtap: make sure neighbour code can push ethernet header Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 024/165] udp: only allow UFO for packets from SOCK_DGRAM sockets Luis Henriques
                   ` (141 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Shelton, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ben Shelton <ben.shelton@ni.com>

commit 42c972a1f390e3bc51ca1e434b7e28764992067f upstream.

The National Instruments USB Host-to-Host Cable is based on the Prolific
PL-25A1 chipset.  Add its VID/PID so the plusb driver will recognize it.

Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/plusb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 3d18bb0eee85..1bfe0fcaccf5 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -134,6 +134,11 @@ static const struct usb_device_id	products [] = {
 }, {
 	USB_DEVICE(0x050d, 0x258a),     /* Belkin F5U258/F5U279 (PL-25A1) */
 	.driver_info =  (unsigned long) &prolific_info,
+}, {
+	USB_DEVICE(0x3923, 0x7825),     /* National Instruments USB
+					 * Host-to-Host Cable
+					 */
+	.driver_info =  (unsigned long) &prolific_info,
 },
 
 	{ },		// END

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

* [PATCH 3.16.y-ckt 024/165] udp: only allow UFO for packets from SOCK_DGRAM sockets
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (22 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 023/165] usb: plusb: Add support for National Instruments host-to-host cable Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 025/165] net: ping: Return EAFNOSUPPORT when appropriate Luis Henriques
                   ` (140 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= <mkubecek@suse.cz>

commit acf8dd0a9d0b9e4cdb597c2f74802f79c699e802 upstream.

If an over-MTU UDP datagram is sent through a SOCK_RAW socket to a
UFO-capable device, ip_ufo_append_data() sets skb->ip_summed to
CHECKSUM_PARTIAL unconditionally as all GSO code assumes transport layer
checksum is to be computed on segmentation. However, in this case,
skb->csum_start and skb->csum_offset are never set as raw socket
transmit path bypasses udp_send_skb() where they are usually set. As a
result, driver may access invalid memory when trying to calculate the
checksum and store the result (as observed in virtio_net driver).

Moreover, the very idea of modifying the userspace provided UDP header
is IMHO against raw socket semantics (I wasn't able to find a document
clearly stating this or the opposite, though). And while allowing
CHECKSUM_NONE in the UFO case would be more efficient, it would be a bit
too intrusive change just to handle a corner case like this. Therefore
disallowing UFO for packets from SOCK_DGRAM seems to be the best option.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ip_output.c  | 3 ++-
 net/ipv6/ip6_output.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 4aca72f52636..0f3e713c5e75 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -886,7 +886,8 @@ static int __ip_append_data(struct sock *sk,
 	cork->length += length;
 	if (((length > mtu) || (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
-	    (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) {
+	    (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
+	    (sk->sk_type == SOCK_DGRAM)) {
 		err = ip_ufo_append_data(sk, queue, getfrag, from, length,
 					 hh_len, fragheaderlen, transhdrlen,
 					 maxfraglen, flags);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 59345af6d3a7..f709462b1a77 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1296,7 +1296,8 @@ emsgsize:
 	if (((length > mtu) ||
 	     (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
-	    (rt->dst.dev->features & NETIF_F_UFO)) {
+	    (rt->dst.dev->features & NETIF_F_UFO) &&
+	    (sk->sk_type == SOCK_DGRAM)) {
 		err = ip6_ufo_append_data(sk, getfrag, from, length,
 					  hh_len, fragheaderlen,
 					  transhdrlen, mtu, flags, rt);

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

* [PATCH 3.16.y-ckt 025/165] net: ping: Return EAFNOSUPPORT when appropriate.
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (23 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 024/165] udp: only allow UFO for packets from SOCK_DGRAM sockets Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 026/165] team: don't traverse port list using rcu in team_set_mac_address Luis Henriques
                   ` (139 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lorenzo Colitti, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lorenzo Colitti <lorenzo@google.com>

commit 9145736d4862145684009d6a72a6e61324a9439e upstream.

1. For an IPv4 ping socket, ping_check_bind_addr does not check
   the family of the socket address that's passed in. Instead,
   make it behave like inet_bind, which enforces either that the
   address family is AF_INET, or that the family is AF_UNSPEC and
   the address is 0.0.0.0.
2. For an IPv6 ping socket, ping_check_bind_addr returns EINVAL
   if the socket family is not AF_INET6. Return EAFNOSUPPORT
   instead, for consistency with inet6_bind.
3. Make ping_v4_sendmsg and ping_v6_sendmsg return EAFNOSUPPORT
   instead of EINVAL if an incorrect socket address structure is
   passed in.
4. Make IPv6 ping sockets be IPv6-only. The code does not support
   IPv4, and it cannot easily be made to support IPv4 because
   the protocol numbers for ICMP and ICMPv6 are different. This
   makes connect(::ffff:192.0.2.1) fail with EAFNOSUPPORT instead
   of making the socket unusable.

Among other things, this fixes an oops that can be triggered by:

    int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
    struct sockaddr_in6 sin6 = {
        .sin6_family = AF_INET6,
        .sin6_addr = in6addr_any,
    };
    bind(s, (struct sockaddr *) &sin6, sizeof(sin6));

Change-Id: If06ca86d9f1e4593c0d6df174caca3487c57a241
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: based on davem's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ping.c | 14 ++++++++++++--
 net/ipv6/ping.c |  5 +++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 7dec0787b4a2..45d5bc0ad86c 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -259,6 +259,11 @@ int ping_init_sock(struct sock *sk)
 	kgid_t low, high;
 	int ret = 0;
 
+#if IS_ENABLED(CONFIG_IPV6)
+	if (sk->sk_family == AF_INET6)
+		inet6_sk(sk)->ipv6only = 1;
+#endif
+
 	inet_get_ping_group_range_net(net, &low, &high);
 	if (gid_lte(low, group) && gid_lte(group, high))
 		return 0;
@@ -305,6 +310,11 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk,
 		if (addr_len < sizeof(*addr))
 			return -EINVAL;
 
+		if (addr->sin_family != AF_INET &&
+		    !(addr->sin_family == AF_UNSPEC &&
+		      addr->sin_addr.s_addr == htonl(INADDR_ANY)))
+			return -EAFNOSUPPORT;
+
 		pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n",
 			 sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port));
 
@@ -330,7 +340,7 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk,
 			return -EINVAL;
 
 		if (addr->sin6_family != AF_INET6)
-			return -EINVAL;
+			return -EAFNOSUPPORT;
 
 		pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n",
 			 sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port));
@@ -716,7 +726,7 @@ static int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
 		if (msg->msg_namelen < sizeof(*usin))
 			return -EINVAL;
 		if (usin->sin_family != AF_INET)
-			return -EINVAL;
+			return -EAFNOSUPPORT;
 		daddr = usin->sin_addr.s_addr;
 		/* no remote port */
 	} else {
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 5b7a1ed2aba9..2d452a382128 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -102,9 +102,10 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 
 	if (msg->msg_name) {
 		DECLARE_SOCKADDR(struct sockaddr_in6 *, u, msg->msg_name);
-		if (msg->msg_namelen < sizeof(struct sockaddr_in6) ||
-		    u->sin6_family != AF_INET6) {
+		if (msg->msg_namelen < sizeof(*u))
 			return -EINVAL;
+		if (u->sin6_family != AF_INET6) {
+			return -EAFNOSUPPORT;
 		}
 		if (sk->sk_bound_dev_if &&
 		    sk->sk_bound_dev_if != u->sin6_scope_id) {

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

* [PATCH 3.16.y-ckt 026/165] team: don't traverse port list using rcu in team_set_mac_address
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (24 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 025/165] net: ping: Return EAFNOSUPPORT when appropriate Luis Henriques
@ 2015-03-25 13:59 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 027/165] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Luis Henriques
                   ` (138 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 13:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Pirko, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Pirko <jiri@resnulli.us>

commit 9215f437b85da339a7dfe3db6e288637406f88b2 upstream.

Currently the list is traversed using rcu variant. That is not correct
since dev_set_mac_address can be called which eventually calls
rtmsg_ifinfo_build_skb and there, skb allocation can sleep. So fix this
by remove the rcu usage here.

Fixes: 3d249d4ca7 "net: introduce ethernet teaming device"
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/team/team.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index fa977f9c2e5f..82fcb2df455b 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1715,11 +1715,11 @@ static int team_set_mac_address(struct net_device *dev, void *p)
 	if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-	rcu_read_lock();
-	list_for_each_entry_rcu(port, &team->port_list, list)
+	mutex_lock(&team->lock);
+	list_for_each_entry(port, &team->port_list, list)
 		if (team->ops.port_change_dev_addr)
 			team->ops.port_change_dev_addr(team, port);
-	rcu_read_unlock();
+	mutex_unlock(&team->lock);
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 027/165] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (25 preceding siblings ...)
  2015-03-25 13:59 ` [PATCH 3.16.y-ckt 026/165] team: don't traverse port list using rcu in team_set_mac_address Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 028/165] xfs: Fix quota type in quota structures when reusing quota file Luis Henriques
                   ` (137 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 6426460e5d87810e042962281fe3c1e8fc256162 upstream.

BIOS doesn't seem to set up pins for 5.1 and the SPDIF out, so we need
to give explicitly here.

Reported-and-tested-by: Misan Thropos <misanthropos@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_sigmatel.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index fbb51d9331b0..8c478464c21d 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -85,6 +85,7 @@ enum {
 	STAC_ALIENWARE_M17X,
 	STAC_92HD89XX_HP_FRONT_JACK,
 	STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
+	STAC_92HD73XX_ASUS_MOBO,
 	STAC_92HD73XX_MODELS
 };
 
@@ -1943,7 +1944,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = {
 	[STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
-	}
+	},
+	[STAC_92HD73XX_ASUS_MOBO] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			/* enable 5.1 and SPDIF out */
+			{ 0x0c, 0x01014411 },
+			{ 0x0d, 0x01014410 },
+			{ 0x0e, 0x01014412 },
+			{ 0x22, 0x014b1180 },
+			{ }
+		}
+	},
 };
 
 static const struct hda_model_fixup stac92hd73xx_models[] = {
@@ -1955,6 +1967,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = {
 	{ .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
 	{ .id = STAC_DELL_EQ, .name = "dell-eq" },
 	{ .id = STAC_ALIENWARE_M17X, .name = "alienware" },
+	{ .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" },
 	{}
 };
 
@@ -2007,6 +2020,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
 				"HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
 				"unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
+	SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10",
+		      STAC_92HD73XX_ASUS_MOBO),
 	{} /* terminator */
 };
 

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

* [PATCH 3.16.y-ckt 028/165] xfs: Fix quota type in quota structures when reusing quota file
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (26 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 027/165] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 029/165] drm/i915: Dell Chromebook 11 has PWM backlight Luis Henriques
                   ` (136 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jan Kara, Dave Chinner, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

commit dfcc70a8c868fe03276fa59864149708fb41930b upstream.

For filesystems without separate project quota inode field in the
superblock we just reuse project quota file for group quotas (and vice
versa) if project quota file is allocated and we need group quota file.
When we reuse the file, quota structures on disk suddenly have wrong
type stored in d_flags though. Nobody really cares about this (although
structure type reported to userspace was wrong as well) except
that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
->set_dqblk() to use bytes as space units) assertion in
xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
was testing without XFS_DEBUG so I didn't notice when submitting the
above commit).

Fix the problem by properly resetting ddq->d_flags when running quotacheck
for a quota file.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/xfs/xfs_qm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 6c51e2f97c0a..7347df393225 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -937,6 +937,11 @@ xfs_qm_reset_dqcounts(
 		 */
 		xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
 			    "xfs_quotacheck");
+		/*
+		 * Reset type in case we are reusing group quota file for
+		 * project quotas or vice versa
+		 */
+		ddq->d_flags = type;
 		ddq->d_bcount = 0;
 		ddq->d_icount = 0;
 		ddq->d_rtbcount = 0;

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

* [PATCH 3.16.y-ckt 029/165] drm/i915: Dell Chromebook 11 has PWM backlight
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (27 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 028/165] xfs: Fix quota type in quota structures when reusing quota file Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 030/165] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Luis Henriques
                   ` (135 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jani Nikula, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jani Nikula <jani.nikula@intel.com>

commit cf6f0af9fbdd90b81af14fa6375387131cd8adf1 upstream.

Add quirk for Dell Chromebook 11 backlight.

Reported-and-tested-by: Owen Garland <garland.owen@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=93451
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 00ca8c9a314f..c7d7dbec4965 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11703,6 +11703,9 @@ static struct intel_quirk intel_quirks[] = {
 
 	/* HP Chromebook 14 (Celeron 2955U) */
 	{ 0x0a06, 0x103c, 0x21ed, quirk_backlight_present },
+
+	/* Dell Chromebook 11 */
+	{ 0x0a06, 0x1028, 0x0a35, quirk_backlight_present },
 };
 
 static void intel_init_quirks(struct drm_device *dev)

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

* [PATCH 3.16.y-ckt 030/165] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (28 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 029/165] drm/i915: Dell Chromebook 11 has PWM backlight Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 031/165] gpio: tps65912: fix wrong container_of arguments Luis Henriques
                   ` (134 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans Holmberg, Linus Walleij, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans Holmberg <hans.holmberg@intel.com>

commit 9cf75e9e4ddd587ac12e88e8751c358b7b27e95f upstream.

The change:

7b8792bbdffdff3abda704f89c6a45ea97afdc62
gpiolib: of: Correct error handling in of_get_named_gpiod_flags

assumed that only one gpio-chip is registred per of-node.
Some drivers register more than one chip per of-node, so
adjust the matching function of_gpiochip_find_and_xlate to
not stop looking for chips if a node-match is found and
the translation fails.

Fixes: 7b8792bbdffd ("gpiolib: of: Correct error handling in of_get_named_gpiod_flags")
Signed-off-by: Hans Holmberg <hans.holmberg@intel.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Tyler Hall <tylerwhall@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpio/gpiolib-of.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 8f9f0ad91445..621e1b50a092 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -46,12 +46,13 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)
 
 	ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags);
 	if (ret < 0) {
-		/* We've found the gpio chip, but the translation failed.
-		 * Return true to stop looking and return the translation
-		 * error via out_gpio
+		/* We've found a gpio chip, but the translation failed.
+		 * Store translation error in out_gpio.
+		 * Return false to keep looking, as more than one gpio chip
+		 * could be registered per of-node.
 		 */
 		gg_data->out_gpio = ERR_PTR(ret);
-		return true;
+		return false;
 	 }
 
 	gg_data->out_gpio = gpiochip_get_desc(gc, ret);

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

* [PATCH 3.16.y-ckt 031/165] gpio: tps65912: fix wrong container_of arguments
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (29 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 030/165] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 032/165] ALSA: pcm: Don't leave PREPARED state after draining Luis Henriques
                   ` (133 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Saenz Julienne, Linus Walleij, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>

commit 2f97c20e5f7c3582c7310f65a04465bfb0fd0e85 upstream.

The gpio_chip operations receive a pointer the gpio_chip struct which is
contained in the driver's private struct, yet the container_of call in those
functions point to the mfd struct defined in include/linux/mfd/tps65912.h.

Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpio/gpio-tps65912.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c
index 59ee486cb8b9..6005d260457d 100644
--- a/drivers/gpio/gpio-tps65912.c
+++ b/drivers/gpio/gpio-tps65912.c
@@ -26,9 +26,12 @@ struct tps65912_gpio_data {
 	struct gpio_chip gpio_chip;
 };
 
+#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip)
+
 static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 	int val;
 
 	val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset);
@@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
 static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
 			      int value)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 
 	if (value)
 		tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
@@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
 static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
 				int value)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 
 	/* Set the initial value */
 	tps65912_gpio_set(gc, offset, value);
@@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
 
 static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 
 	return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
 								GPIO_CFG_MASK);

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

* [PATCH 3.16.y-ckt 032/165] ALSA: pcm: Don't leave PREPARED state after draining
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (30 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 031/165] gpio: tps65912: fix wrong container_of arguments Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 033/165] metag: Fix KSTK_EIP() and KSTK_ESP() macros Luis Henriques
                   ` (132 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 70372a7566b5e552dbe48abdac08c275081d8558 upstream.

When a PCM draining is performed to an empty stream that has been
already in PREPARED state, the current code just ignores and leaves as
it is, although the drain is supposed to set all such streams to SETUP
state.  This patch covers that overlooked case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/core/pcm_native.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 39c572806d0d..35148fa49ccc 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1404,6 +1404,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
 			if (! snd_pcm_playback_empty(substream)) {
 				snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING);
 				snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING);
+			} else {
+				runtime->status->state = SNDRV_PCM_STATE_SETUP;
 			}
 			break;
 		case SNDRV_PCM_STATE_RUNNING:

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

* [PATCH 3.16.y-ckt 033/165] metag: Fix KSTK_EIP() and KSTK_ESP() macros
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (31 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 032/165] ALSA: pcm: Don't leave PREPARED state after draining Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 034/165] ALSA: hda: controller code - do not export static functions Luis Henriques
                   ` (131 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, linux-metag, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit c2996cb29bfb73927a79dc96e598a718e843f01a upstream.

The KSTK_EIP() and KSTK_ESP() macros should return the user program
counter (PC) and stack pointer (A0StP) of the given task. These are used
to determine which VMA corresponds to the user stack in
/proc/<pid>/maps, and for the user PC & A0StP in /proc/<pid>/stat.

However for Meta the PC & A0StP from the task's kernel context are used,
resulting in broken output. For example in following /proc/<pid>/maps
output, the 3afff000-3b021000 VMA should be described as the stack:

  # cat /proc/self/maps
  ...
  100b0000-100b1000 rwxp 00000000 00:00 0          [heap]
  3afff000-3b021000 rwxp 00000000 00:00 0

And in the following /proc/<pid>/stat output, the PC is in kernel code
(1074234964 = 0x40078654) and the A0StP is in the kernel heap
(1335981392 = 0x4fa17550):

  # cat /proc/self/stat
  51 (cat) R ... 1335981392 1074234964 ...

Fix the definitions of KSTK_EIP() and KSTK_ESP() to use
task_pt_regs(tsk)->ctx rather than (tsk)->thread.kernel_context. This
gets the registers from the user context stored after the thread info at
the base of the kernel stack, which is from the last entry into the
kernel from userland, regardless of where in the kernel the task may
have been interrupted, which results in the following more correct
/proc/<pid>/maps output:

  # cat /proc/self/maps
  ...
  0800b000-08070000 r-xp 00000000 00:02 207        /lib/libuClibc-0.9.34-git.so
  ...
  100b0000-100b1000 rwxp 00000000 00:00 0          [heap]
  3afff000-3b021000 rwxp 00000000 00:00 0          [stack]

And /proc/<pid>/stat now correctly reports the PC in libuClibc
(134320308 = 0x80190b4) and the A0StP in the [stack] region (989864576 =
0x3b002280):

  # cat /proc/self/stat
  51 (cat) R ... 989864576 134320308 ...

Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Reported-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/metag/include/asm/processor.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h
index a8a37477c66e..eb2005bd3c79 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -149,8 +149,8 @@ extern void exit_thread(void);
 
 unsigned long get_wchan(struct task_struct *p);
 
-#define	KSTK_EIP(tsk)	((tsk)->thread.kernel_context->CurrPC)
-#define	KSTK_ESP(tsk)	((tsk)->thread.kernel_context->AX[0].U0)
+#define	KSTK_EIP(tsk)	(task_pt_regs(tsk)->ctx.CurrPC)
+#define	KSTK_ESP(tsk)	(task_pt_regs(tsk)->ctx.AX[0].U0)
 
 #define user_stack_pointer(regs)        ((regs)->ctx.AX[0].U0)
 

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

* [PATCH 3.16.y-ckt 034/165] ALSA: hda: controller code - do not export static functions
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (32 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 033/165] metag: Fix KSTK_EIP() and KSTK_ESP() macros Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 035/165] drm/i915: Check obj->vma_list under the struct_mutex Luis Henriques
                   ` (130 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jaroslav Kysela, Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jaroslav Kysela <perex@perex.cz>

commit 37ed398839fa3e0d2de77925097db7a370abb096 upstream.

It is a bad idea to export static functions. GCC for some platforms
shows errors like:

  error: __ksymtab_azx_get_response causes a section type conflict

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_controller.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 6df04d91c93c..e476a198c15f 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1040,7 +1040,6 @@ static int azx_alloc_cmd_io(struct azx *chip)
 		dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n");
 	return err;
 }
-EXPORT_SYMBOL_GPL(azx_alloc_cmd_io);
 
 static void azx_init_cmd_io(struct azx *chip)
 {
@@ -1105,7 +1104,6 @@ static void azx_init_cmd_io(struct azx *chip)
 	azx_writeb(chip, RIRBCTL, ICH6_RBCTL_DMA_EN | ICH6_RBCTL_IRQ_EN);
 	spin_unlock_irq(&chip->reg_lock);
 }
-EXPORT_SYMBOL_GPL(azx_init_cmd_io);
 
 static void azx_free_cmd_io(struct azx *chip)
 {
@@ -1115,7 +1113,6 @@ static void azx_free_cmd_io(struct azx *chip)
 	azx_writeb(chip, CORBCTL, 0);
 	spin_unlock_irq(&chip->reg_lock);
 }
-EXPORT_SYMBOL_GPL(azx_free_cmd_io);
 
 static unsigned int azx_command_addr(u32 cmd)
 {
@@ -1396,7 +1393,6 @@ static int azx_send_cmd(struct hda_bus *bus, unsigned int val)
 	else
 		return azx_corb_send_cmd(bus, val);
 }
-EXPORT_SYMBOL_GPL(azx_send_cmd);
 
 /* get a response */
 static unsigned int azx_get_response(struct hda_bus *bus,
@@ -1410,7 +1406,6 @@ static unsigned int azx_get_response(struct hda_bus *bus,
 	else
 		return azx_rirb_get_response(bus, addr);
 }
-EXPORT_SYMBOL_GPL(azx_get_response);
 
 #ifdef CONFIG_SND_HDA_DSP_LOADER
 /*

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

* [PATCH 3.16.y-ckt 035/165] drm/i915: Check obj->vma_list under the struct_mutex
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (33 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 034/165] ALSA: hda: controller code - do not export static functions Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 036/165] md/raid1: fix read balance when a drive is write-mostly Luis Henriques
                   ` (129 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Wilson, Jani Nikula, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Wilson <chris@chris-wilson.co.uk>

commit 6c31a614c43ae274546f736b2a33363e149c3dc2 upstream.

When we walk the list of vma, or even for protecting against concurrent
framebuffer creation, we must hold the struct_mutex or else a second
thread can corrupt the list as we walk it.

Fixes regression from
commit d7f46fc4e7323887494db13f063a8e59861fefb0
Author: Ben Widawsky <benjamin.widawsky@intel.com>
Date:   Fri Dec 6 14:10:55 2013 -0800

    drm/i915: Make pin count per VMA

References: https://bugs.freedesktop.org/show_bug.cgi?id=89085
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem_tiling.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index cb150e8b4336..9de497537074 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -308,9 +308,10 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
+	mutex_lock(&dev->struct_mutex);
 	if (i915_gem_obj_is_pinned(obj) || obj->framebuffer_references) {
-		drm_gem_object_unreference_unlocked(&obj->base);
-		return -EBUSY;
+		ret = -EBUSY;
+		goto err;
 	}
 
 	if (args->tiling_mode == I915_TILING_NONE) {
@@ -342,7 +343,6 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
 		}
 	}
 
-	mutex_lock(&dev->struct_mutex);
 	if (args->tiling_mode != obj->tiling_mode ||
 	    args->stride != obj->stride) {
 		/* We need to rebind the object if its current allocation
@@ -401,6 +401,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
 		obj->bit_17 = NULL;
 	}
 
+err:
 	drm_gem_object_unreference(&obj->base);
 	mutex_unlock(&dev->struct_mutex);
 

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

* [PATCH 3.16.y-ckt 036/165] md/raid1: fix read balance when a drive is write-mostly.
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (34 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 035/165] drm/i915: Check obj->vma_list under the struct_mutex Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 037/165] ALSA: hda - Disable runtime PM for Panther Point again Luis Henriques
                   ` (128 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hodek?= <tomas.hodek@volny.cz>

commit d1901ef099c38afd11add4cfb3312c02ef21ec4a upstream.

When a drive is marked write-mostly it should only be the
target of reads if there is no other option.

This behaviour was broken by

commit 9dedf60313fa4dddfd5b9b226a0ef12a512bf9dc
    md/raid1: read balance chooses idlest disk for SSD

which causes a write-mostly device to be *preferred* is some cases.

Restore correct behaviour by checking and setting
best_dist_disk and best_pending_disk rather than best_disk.

We only need to test one of these as they are both changed
from -1 or >=0 at the same time.

As we leave min_pending and best_dist unchanged, any non-write-mostly
device will appear better than the write-mostly device.

Reported-by: Tomáš Hodek <tomas.hodek@volny.cz>
Reported-by: Dark Penguin <darkpenguin@yandex.ru>
Signed-off-by: NeilBrown <neilb@suse.de>
Link: http://marc.info/?l=linux-raid&m=135982797322422
Fixes: 9dedf60313fa4dddfd5b9b226a0ef12a512bf9dc
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/raid1.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 55de4f6f7eaf..b96ee9d78aa3 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -561,7 +561,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
 		if (test_bit(WriteMostly, &rdev->flags)) {
 			/* Don't balance among write-mostly, just
 			 * use the first as a last resort */
-			if (best_disk < 0) {
+			if (best_dist_disk < 0) {
 				if (is_badblock(rdev, this_sector, sectors,
 						&first_bad, &bad_sectors)) {
 					if (first_bad < this_sector)
@@ -570,7 +570,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
 					best_good_sectors = first_bad - this_sector;
 				} else
 					best_good_sectors = sectors;
-				best_disk = disk;
+				best_dist_disk = disk;
+				best_pending_disk = disk;
 			}
 			continue;
 		}

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

* [PATCH 3.16.y-ckt 037/165] ALSA: hda - Disable runtime PM for Panther Point again
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (35 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 036/165] md/raid1: fix read balance when a drive is write-mostly Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 038/165] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Luis Henriques
                   ` (127 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit de5d0ad506cb10ab143e2ffb9def7607e3671f83 upstream.

This is essentially a partial revert of the commit [b1920c21102a:
'ALSA: hda - Enable runtime PM on Panther Point'].  There was a bug
report showing the HD-audio bus hang during runtime PM on HP Spectre
XT.

Reported-by: Dang Sananikone <dang.sananikone@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 6383971dcd15..89dfe344ee75 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1779,7 +1779,7 @@ static const struct pci_device_id azx_ids[] = {
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
 	/* Panther Point */
 	{ PCI_DEVICE(0x8086, 0x1e20),
-	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
+	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
 	/* Lynx Point */
 	{ PCI_DEVICE(0x8086, 0x8c20),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },

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

* [PATCH 3.16.y-ckt 038/165] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (36 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 037/165] ALSA: hda - Disable runtime PM for Panther Point again Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 039/165] drm/radeon: fix 1 RB harvest config setup for TN/RL Luis Henriques
                   ` (126 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 3d2d98ee1af0cf6eebfbd6bff4c17d3601ac1284 upstream.

Just in case it hasn't been calculated for the mode.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/r600_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index e961be55348a..8eab0d20edad 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -187,7 +187,7 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev)
 		list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 			radeon_crtc = to_radeon_crtc(crtc);
 			if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) {
-				vrefresh = radeon_crtc->hw_mode.vrefresh;
+				vrefresh = drm_mode_vrefresh(&radeon_crtc->hw_mode);
 				break;
 			}
 		}

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

* [PATCH 3.16.y-ckt 039/165] drm/radeon: fix 1 RB harvest config setup for TN/RL
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (37 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 038/165] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 040/165] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Luis Henriques
                   ` (125 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit dbfb00c3e7e18439f2ebf67fe99bf7a50b5bae1e upstream.

The logic was reversed from what the hw actually exposed.
Fixes graphics corruption in certain harvest configurations.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/ni.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 699bd1083e1f..1d0c08de1731 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1085,12 +1085,12 @@ static void cayman_gpu_init(struct radeon_device *rdev)
 
 	if ((rdev->config.cayman.max_backends_per_se == 1) &&
 	    (rdev->flags & RADEON_IS_IGP)) {
-		if ((disabled_rb_mask & 3) == 1) {
-			/* RB0 disabled, RB1 enabled */
-			tmp = 0x11111111;
-		} else {
+		if ((disabled_rb_mask & 3) == 2) {
 			/* RB1 disabled, RB0 enabled */
 			tmp = 0x00000000;
+		} else {
+			/* RB0 disabled, RB1 enabled */
+			tmp = 0x11111111;
 		}
 	} else {
 		tmp = gb_addr_config & NUM_PIPES_MASK;

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

* [PATCH 3.16.y-ckt 040/165] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (38 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 039/165] drm/radeon: fix 1 RB harvest config setup for TN/RL Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 041/165] nilfs2: fix potential memory overrun on inode Luis Henriques
                   ` (124 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Catalin Marinas, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Catalin Marinas <catalin.marinas@arm.com>

commit 9d42d48a342aee208c1154696196497fdc556bbf upstream.

The native (64-bit) sigval_t union contains sival_int (32-bit) and
sival_ptr (64-bit). When a compat application invokes a syscall that
takes a sigval_t value (as part of a larger structure, e.g.
compat_sys_mq_notify, compat_sys_timer_create), the compat_sigval_t
union is converted to the native sigval_t with sival_int overlapping
with either the least or the most significant half of sival_ptr,
depending on endianness. When the corresponding signal is delivered to a
compat application, on big endian the current (compat_uptr_t)sival_ptr
cast always returns 0 since sival_int corresponds to the top part of
sival_ptr. This patch fixes copy_siginfo_to_user32() so that sival_int
is copied to the compat_siginfo_t structure.

Reported-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Tested-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/kernel/signal32.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index 3491c638f172..070de43fb3b5 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -154,8 +154,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
 	case __SI_TIMER:
 		 err |= __put_user(from->si_tid, &to->si_tid);
 		 err |= __put_user(from->si_overrun, &to->si_overrun);
-		 err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr,
-				   &to->si_ptr);
+		 err |= __put_user(from->si_int, &to->si_int);
 		break;
 	case __SI_POLL:
 		err |= __put_user(from->si_band, &to->si_band);
@@ -184,7 +183,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
 	case __SI_MESGQ: /* But this is */
 		err |= __put_user(from->si_pid, &to->si_pid);
 		err |= __put_user(from->si_uid, &to->si_uid);
-		err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr);
+		err |= __put_user(from->si_int, &to->si_int);
 		break;
 	default: /* this is just in case for now ... */
 		err |= __put_user(from->si_pid, &to->si_pid);

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

* [PATCH 3.16.y-ckt 041/165] nilfs2: fix potential memory overrun on inode
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (39 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 040/165] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 042/165] iio: mxs-lradc: separate touchscreen and buffer virtual channels Luis Henriques
                   ` (123 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ryusuke Konishi, Andrew Morton, Linus Torvalds, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

commit 957ed60b53b519064a54988c4e31e0087e47d091 upstream.

Each inode of nilfs2 stores a root node of a b-tree, and it turned out to
have a memory overrun issue:

Each b-tree node of nilfs2 stores a set of key-value pairs and the number
of them (in "bn_nchildren" member of nilfs_btree_node struct), as well as
a few other "bn_*" members.

Since the value of "bn_nchildren" is used for operations on the key-values
within the b-tree node, it can cause memory access overrun if a large
number is incorrectly set to "bn_nchildren".

For instance, nilfs_btree_node_lookup() function determines the range of
binary search with it, and too large "bn_nchildren" leads
nilfs_btree_node_get_key() in that function to overrun.

As for intermediate b-tree nodes, this is prevented by a sanity check
performed when each node is read from a drive, however, no sanity check
has been done for root nodes stored in inodes.

This patch fixes the issue by adding missing sanity check against b-tree
root nodes so that it's called when on-memory inodes are read from ifile,
inode metadata file.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nilfs2/btree.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index b2e3ff347620..ecdbae19a766 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -31,6 +31,8 @@
 #include "alloc.h"
 #include "dat.h"
 
+static void __nilfs_btree_init(struct nilfs_bmap *bmap);
+
 static struct nilfs_btree_path *nilfs_btree_alloc_path(void)
 {
 	struct nilfs_btree_path *path;
@@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
 	return ret;
 }
 
+/**
+ * nilfs_btree_root_broken - verify consistency of btree root node
+ * @node: btree root node to be examined
+ * @ino: inode number
+ *
+ * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned.
+ */
+static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
+				   unsigned long ino)
+{
+	int level, flags, nchildren;
+	int ret = 0;
+
+	level = nilfs_btree_node_get_level(node);
+	flags = nilfs_btree_node_get_flags(node);
+	nchildren = nilfs_btree_node_get_nchildren(node);
+
+	if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN ||
+		     level > NILFS_BTREE_LEVEL_MAX ||
+		     nchildren < 0 ||
+		     nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) {
+		pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n",
+			ino, level, flags, nchildren);
+		ret = 1;
+	}
+	return ret;
+}
+
 int nilfs_btree_broken_node_block(struct buffer_head *bh)
 {
 	int ret;
@@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree,
 
 	/* convert and insert */
 	dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL;
-	nilfs_btree_init(btree);
+	__nilfs_btree_init(btree);
 	if (nreq != NULL) {
 		nilfs_bmap_commit_alloc_ptr(btree, dreq, dat);
 		nilfs_bmap_commit_alloc_ptr(btree, nreq, dat);
@@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = {
 	.bop_gather_data	=	NULL,
 };
 
-int nilfs_btree_init(struct nilfs_bmap *bmap)
+static void __nilfs_btree_init(struct nilfs_bmap *bmap)
 {
 	bmap->b_ops = &nilfs_btree_ops;
 	bmap->b_nchildren_per_block =
 		NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap));
-	return 0;
+}
+
+int nilfs_btree_init(struct nilfs_bmap *bmap)
+{
+	int ret = 0;
+
+	__nilfs_btree_init(bmap);
+
+	if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap),
+				    bmap->b_inode->i_ino))
+		ret = -EIO;
+	return ret;
 }
 
 void nilfs_btree_init_gc(struct nilfs_bmap *bmap)

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

* [PATCH 3.16.y-ckt 042/165] iio: mxs-lradc: separate touchscreen and buffer virtual channels
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (40 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 041/165] nilfs2: fix potential memory overrun on inode Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 043/165] iio: mxs-lradc: make ADC reads not disable touchscreen interrupts Luis Henriques
                   ` (122 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kristina Martšenko, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= <kristina.martsenko@gmail.com>

commit f81197b8a31b8fb287ae57f597b5b6841e1ece92 upstream.

The touchscreen was initially designed [1] to map all of its physical
channels to one virtual channel, leaving buffered capture to use the
remaining 7 virtual channels. When the touchscreen was reimplemented
[2], it was made to use four virtual channels, which overlap and
conflict with the channels the buffer uses.

As a result, when the buffer is enabled, the touchscreen's virtual
channels are remapped to whichever physical channels the buffer was
configured with, causing the touchscreen to read those instead of the
touch measurement channels. Effectively the touchscreen stops working.

So here we separate the channels again, giving the touchscreen 2 virtual
channels and the buffer 6. We can't give the touchscreen just 1 channel
as before, as the current pressure calculation requires 2 channels to be
read at the same time.

This makes the touchscreen continue to work during buffered capture. It
has been tested on i.MX28, but not on i.MX23.

[1] 06ddd353f5c8 ("iio: mxs: Implement support for touchscreen")
[2] dee05308f602 ("Staging/iio/adc/touchscreen/MXS: add interrupt driven
touch detection")

Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/iio/adc/mxs-lradc.c | 166 ++++++++++++++++--------------------
 1 file changed, 75 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 6d500c21cc58..0704291ec1e9 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -214,11 +214,14 @@ struct mxs_lradc {
 	unsigned long		is_divided;
 
 	/*
-	 * Touchscreen LRADC channels receives a private slot in the CTRL4
-	 * register, the slot #7. Therefore only 7 slots instead of 8 in the
-	 * CTRL4 register can be mapped to LRADC channels when using the
-	 * touchscreen.
-	 *
+	 * When the touchscreen is enabled, we give it two private virtual
+	 * channels: #6 and #7. This means that only 6 virtual channels (instead
+	 * of 8) will be available for buffered capture.
+	 */
+#define TOUCHSCREEN_VCHANNEL1		7
+#define TOUCHSCREEN_VCHANNEL2		6
+
+	/*
 	 * Furthermore, certain LRADC channels are shared between touchscreen
 	 * and/or touch-buttons and generic LRADC block. Therefore when using
 	 * either of these, these channels are not available for the regular
@@ -342,6 +345,9 @@ struct mxs_lradc {
 #define	LRADC_CTRL4				0x140
 #define	LRADC_CTRL4_LRADCSELECT_MASK(n)		(0xf << ((n) * 4))
 #define	LRADC_CTRL4_LRADCSELECT_OFFSET(n)	((n) * 4)
+#define	LRADC_CTRL4_LRADCSELECT(n, x) \
+				(((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \
+				LRADC_CTRL4_LRADCSELECT_MASK(n))
 
 #define LRADC_RESOLUTION			12
 #define LRADC_SINGLE_SAMPLE_MASK		((1 << LRADC_RESOLUTION) - 1)
@@ -423,6 +429,14 @@ static bool mxs_lradc_check_touch_event(struct mxs_lradc *lradc)
 					LRADC_STATUS_TOUCH_DETECT_RAW);
 }
 
+static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch,
+				  unsigned ch)
+{
+	mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch),
+				LRADC_CTRL4);
+	mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4);
+}
+
 static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch)
 {
 	/*
@@ -450,12 +464,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch)
 		LRADC_DELAY_DELAY(lradc->over_sample_delay - 1),
 			LRADC_DELAY(3));
 
-	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) |
-			LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) |
-			LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
+	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1);
 
-	/* wake us again, when the complete conversion is done */
-	mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1);
 	/*
 	 * after changing the touchscreen plates setting
 	 * the signals need some initial time to settle. Start the
@@ -508,12 +518,8 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1,
 		LRADC_DELAY_DELAY(lradc->over_sample_delay - 1),
 					LRADC_DELAY(3));
 
-	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) |
-			LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) |
-			LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
+	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1);
 
-	/* wake us again, when the conversions are done */
-	mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1);
 	/*
 	 * after changing the touchscreen plates setting
 	 * the signals need some initial time to settle. Start the
@@ -578,36 +584,6 @@ static unsigned mxs_lradc_read_ts_pressure(struct mxs_lradc *lradc,
 #define TS_CH_XM 4
 #define TS_CH_YM 5
 
-static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc)
-{
-	u32 reg;
-	int val;
-
-	reg = readl(lradc->base + LRADC_CTRL1);
-
-	/* only channels 3 to 5 are of interest here */
-	if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) {
-		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) |
-			LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1);
-		val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP);
-	} else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) {
-		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) |
-			LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1);
-		val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM);
-	} else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) {
-		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) |
-			LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1);
-		val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM);
-	} else {
-		return -EIO;
-	}
-
-	mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
-	mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
-
-	return val;
-}
-
 /*
  * YP(open)--+-------------+
  *           |             |--+
@@ -651,7 +627,8 @@ static void mxs_lradc_prepare_x_pos(struct mxs_lradc *lradc)
 	mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0);
 
 	lradc->cur_plate = LRADC_SAMPLE_X;
-	mxs_lradc_setup_ts_channel(lradc, TS_CH_YP);
+	mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP);
+	mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1);
 }
 
 /*
@@ -672,7 +649,8 @@ static void mxs_lradc_prepare_y_pos(struct mxs_lradc *lradc)
 	mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0);
 
 	lradc->cur_plate = LRADC_SAMPLE_Y;
-	mxs_lradc_setup_ts_channel(lradc, TS_CH_XM);
+	mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM);
+	mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1);
 }
 
 /*
@@ -693,7 +671,10 @@ static void mxs_lradc_prepare_pressure(struct mxs_lradc *lradc)
 	mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0);
 
 	lradc->cur_plate = LRADC_SAMPLE_PRESSURE;
-	mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM);
+	mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM);
+	mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP);
+	mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2,
+						TOUCHSCREEN_VCHANNEL1);
 }
 
 static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc)
@@ -706,6 +687,19 @@ static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc)
 	mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
 }
 
+static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc)
+{
+	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
+				LRADC_CTRL1);
+	mxs_lradc_reg_set(lradc,
+		LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1);
+	/*
+	 * start with the Y-pos, because it uses nearly the same plate
+	 * settings like the touch detection
+	 */
+	mxs_lradc_prepare_y_pos(lradc);
+}
+
 static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc)
 {
 	input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos);
@@ -723,10 +717,12 @@ static void mxs_lradc_complete_touch_event(struct mxs_lradc *lradc)
 	 * start a dummy conversion to burn time to settle the signals
 	 * note: we are not interested in the conversion's value
 	 */
-	mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5));
-	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1);
-	mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1);
-	mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) |
+	mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1));
+	mxs_lradc_reg_clear(lradc,
+		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
+		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1);
+	mxs_lradc_reg_wrt(lradc,
+		LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) |
 		LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */
 			LRADC_DELAY(2));
 }
@@ -758,59 +754,45 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid)
 
 	/* if it is released, wait for the next touch via IRQ */
 	lradc->cur_plate = LRADC_TOUCH;
-	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1);
+	mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2));
+	mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3));
+	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ |
+		LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) |
+		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1);
 	mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1);
 }
 
 /* touchscreen's state machine */
 static void mxs_lradc_handle_touch(struct mxs_lradc *lradc)
 {
-	int val;
-
 	switch (lradc->cur_plate) {
 	case LRADC_TOUCH:
-		/*
-		 * start with the Y-pos, because it uses nearly the same plate
-		 * settings like the touch detection
-		 */
-		if (mxs_lradc_check_touch_event(lradc)) {
-			mxs_lradc_reg_clear(lradc,
-					LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
-					LRADC_CTRL1);
-			mxs_lradc_prepare_y_pos(lradc);
-		}
+		if (mxs_lradc_check_touch_event(lradc))
+			mxs_lradc_start_touch_event(lradc);
 		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ,
 					LRADC_CTRL1);
 		return;
 
 	case LRADC_SAMPLE_Y:
-		val = mxs_lradc_read_ts_channel(lradc);
-		if (val < 0) {
-			mxs_lradc_enable_touch_detection(lradc); /* re-start */
-			return;
-		}
-		lradc->ts_y_pos = val;
+		lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc,
+							TOUCHSCREEN_VCHANNEL1);
 		mxs_lradc_prepare_x_pos(lradc);
 		return;
 
 	case LRADC_SAMPLE_X:
-		val = mxs_lradc_read_ts_channel(lradc);
-		if (val < 0) {
-			mxs_lradc_enable_touch_detection(lradc); /* re-start */
-			return;
-		}
-		lradc->ts_x_pos = val;
+		lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc,
+							TOUCHSCREEN_VCHANNEL1);
 		mxs_lradc_prepare_pressure(lradc);
 		return;
 
 	case LRADC_SAMPLE_PRESSURE:
-		lradc->ts_pressure =
-			mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM);
+		lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc,
+							TOUCHSCREEN_VCHANNEL2,
+							TOUCHSCREEN_VCHANNEL1);
 		mxs_lradc_complete_touch_event(lradc);
 		return;
 
 	case LRADC_SAMPLE_VALID:
-		val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */
 		mxs_lradc_finish_touch_event(lradc, 1);
 		break;
 	}
@@ -1088,9 +1070,8 @@ static void mxs_lradc_disable_ts(struct mxs_lradc *lradc)
 {
 	/* stop all interrupts from firing */
 	mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN |
-		LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) |
-		LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5),
-		LRADC_CTRL1);
+		LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) |
+		LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1);
 
 	/* Power-down touchscreen touch-detect circuitry. */
 	mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0);
@@ -1156,26 +1137,29 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
 	struct iio_dev *iio = data;
 	struct mxs_lradc *lradc = iio_priv(iio);
 	unsigned long reg = readl(lradc->base + LRADC_CTRL1);
+	uint32_t clr_irq = mxs_lradc_irq_mask(lradc);
 	const uint32_t ts_irq_mask =
 		LRADC_CTRL1_TOUCH_DETECT_IRQ |
-		LRADC_CTRL1_LRADC_IRQ(2) |
-		LRADC_CTRL1_LRADC_IRQ(3) |
-		LRADC_CTRL1_LRADC_IRQ(4) |
-		LRADC_CTRL1_LRADC_IRQ(5);
+		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
+		LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2);
 
 	if (!(reg & mxs_lradc_irq_mask(lradc)))
 		return IRQ_NONE;
 
-	if (lradc->use_touchscreen && (reg & ts_irq_mask))
+	if (lradc->use_touchscreen && (reg & ts_irq_mask)) {
 		mxs_lradc_handle_touch(lradc);
 
+		/* Make sure we don't clear the next conversion's interrupt. */
+		clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) |
+				LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2));
+	}
+
 	if (iio_buffer_enabled(iio))
 		iio_trigger_poll(iio->trig, iio_get_time_ns());
 	else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
 		complete(&lradc->completion);
 
-	mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc),
-			LRADC_CTRL1);
+	mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);
 
 	return IRQ_HANDLED;
 }
@@ -1351,7 +1335,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio,
 	if (lradc->use_touchbutton)
 		rsvd_chans++;
 	if (lradc->use_touchscreen)
-		rsvd_chans++;
+		rsvd_chans += 2;
 
 	/* Test for attempts to map channels with special mode of operation. */
 	if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS))

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

* [PATCH 3.16.y-ckt 043/165] iio: mxs-lradc: make ADC reads not disable touchscreen interrupts
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (41 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 042/165] iio: mxs-lradc: separate touchscreen and buffer virtual channels Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 044/165] iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions Luis Henriques
                   ` (121 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kristina Martšenko, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= <kristina.martsenko@gmail.com>

commit 86bf7f3ef7e961e91e16dceb31ae0f583483b204 upstream.

Reading a channel through sysfs, or starting a buffered capture, will
currently turn off the touchscreen. This is because the read_raw() and
buffer preenable()/postdisable() callbacks disable interrupts for all
LRADC channels, including those the touchscreen uses.

So make the callbacks only disable interrupts for the channels they use.
This means channel 0 for read_raw() and channels 0-5 for the buffer (if
the touchscreen is enabled). Since the touchscreen uses different
channels (6 and 7), it no longer gets turned off.

Note that only i.MX28 is affected by this issue, i.MX23 should be fine.

Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/iio/adc/mxs-lradc.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 0704291ec1e9..74c4a2d057af 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -220,6 +220,9 @@ struct mxs_lradc {
 	 */
 #define TOUCHSCREEN_VCHANNEL1		7
 #define TOUCHSCREEN_VCHANNEL2		6
+#define BUFFER_VCHANS_LIMITED		0x3f
+#define BUFFER_VCHANS_ALL		0xff
+	u8			buffer_vchans;
 
 	/*
 	 * Furthermore, certain LRADC channels are shared between touchscreen
@@ -824,7 +827,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val)
 	 * used if doing raw sampling.
 	 */
 	if (lradc->soc == IMX28_LRADC)
-		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
+		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0),
 			LRADC_CTRL1);
 	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
 
@@ -1271,8 +1274,9 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
 	}
 
 	if (lradc->soc == IMX28_LRADC)
-		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
-							LRADC_CTRL1);
+		mxs_lradc_reg_clear(lradc,
+			lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
+			LRADC_CTRL1);
 	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
 
 	for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
@@ -1308,8 +1312,9 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
 
 	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
 	if (lradc->soc == IMX28_LRADC)
-		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK,
-					LRADC_CTRL1);
+		mxs_lradc_reg_clear(lradc,
+			lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
+			LRADC_CTRL1);
 
 	kfree(lradc->buffer);
 	mutex_unlock(&lradc->lock);
@@ -1546,6 +1551,11 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 
 	touch_ret = mxs_lradc_probe_touchscreen(lradc, node);
 
+	if (touch_ret == 0)
+		lradc->buffer_vchans = BUFFER_VCHANS_LIMITED;
+	else
+		lradc->buffer_vchans = BUFFER_VCHANS_ALL;
+
 	/* Grab all IRQ sources */
 	for (i = 0; i < of_cfg->irq_count; i++) {
 		lradc->irq[i] = platform_get_irq(pdev, i);

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

* [PATCH 3.16.y-ckt 044/165] iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (42 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 043/165] iio: mxs-lradc: make ADC reads not disable touchscreen interrupts Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 045/165] iio: mxs-lradc: only update the buffer when its conversions have finished Luis Henriques
                   ` (120 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kristina Martšenko, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= <kristina.martsenko@gmail.com>

commit 6abe0300a1d5242f4ff89257197f284679af1a06 upstream.

Reading a channel through sysfs, or starting a buffered capture, can
occasionally turn off the touchscreen.

This is because the read_raw() and buffer preenable()/postdisable()
callbacks unschedule current conversions on all channels. If a delay
channel happens to schedule a touchscreen conversion at the same time,
the conversion gets cancelled and the touchscreen sequence stops.

This is probably related to this note from the reference manual:

	"If a delay group schedules channels to be sampled and a manual
	write to the schedule field in CTRL0 occurs while the block is
	discarding samples, the LRADC will switch to the new schedule
	and will not sample the channels that were previously scheduled.
	The time window for this to happen is very small and lasts only
	while the LRADC is discarding samples."

So make the callbacks only unschedule conversions for the channels they
use. This means channel 0 for read_raw() and channels 0-5 for the buffer
(if the touchscreen is enabled). Since the touchscreen uses different
channels (6 and 7), it no longer gets turned off.

This is tested and fixes the issue on i.MX28, but hasn't been tested on
i.MX23.

Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/iio/adc/mxs-lradc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 74c4a2d057af..565366fcfe3e 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -829,7 +829,7 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val)
 	if (lradc->soc == IMX28_LRADC)
 		mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0),
 			LRADC_CTRL1);
-	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
+	mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0);
 
 	/* Enable / disable the divider per requirement */
 	if (test_bit(chan, &lradc->is_divided))
@@ -1277,7 +1277,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio)
 		mxs_lradc_reg_clear(lradc,
 			lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,
 			LRADC_CTRL1);
-	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
+	mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0);
 
 	for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
 		ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs);
@@ -1310,7 +1310,7 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio)
 	mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK |
 					LRADC_DELAY_KICK, LRADC_DELAY(0));
 
-	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
+	mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0);
 	if (lradc->soc == IMX28_LRADC)
 		mxs_lradc_reg_clear(lradc,
 			lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET,

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

* [PATCH 3.16.y-ckt 045/165] iio: mxs-lradc: only update the buffer when its conversions have finished
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (43 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 044/165] iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 046/165] iio: imu: adis16400: Fix sign extension Luis Henriques
                   ` (119 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kristina Martšenko, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= <kristina.martsenko@gmail.com>

commit 89bb35e200bee745c539a96666e0792301ca40f1 upstream.

Using the touchscreen while running buffered capture results in the
buffer reporting lots of wrong values, often just zeros. This is because
we push readings to the buffer every time a touchscreen interrupt
arrives, including when the buffer's own conversions have not yet
finished. So let's only push to the buffer when its conversions are
ready.

Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/iio/adc/mxs-lradc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 565366fcfe3e..4907efaf5e3d 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1157,10 +1157,12 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
 				LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2));
 	}
 
-	if (iio_buffer_enabled(iio))
-		iio_trigger_poll(iio->trig, iio_get_time_ns());
-	else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
+	if (iio_buffer_enabled(iio)) {
+		if (reg & lradc->buffer_vchans)
+			iio_trigger_poll(iio->trig, iio_get_time_ns());
+	} else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) {
 		complete(&lradc->completion);
+	}
 
 	mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);
 

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

* [PATCH 3.16.y-ckt 046/165] iio: imu: adis16400: Fix sign extension
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (44 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 045/165] iio: mxs-lradc: only update the buffer when its conversions have finished Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 047/165] iio: mxs-lradc: fix iio channel map regression Luis Henriques
                   ` (118 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rasmus Villemoes, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rasmus Villemoes <linux@rasmusvillemoes.dk>

commit 19e353f2b344ad86cea6ebbc0002e5f903480a90 upstream.

The intention is obviously to sign-extend a 12 bit quantity. But
because of C's promotion rules, the assignment is equivalent to "val16
&= 0xfff;". Use the proper API for this.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/imu/adis16400_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
index 433583b6f800..8ca469c17a91 100644
--- a/drivers/iio/imu/adis16400_core.c
+++ b/drivers/iio/imu/adis16400_core.c
@@ -26,6 +26,7 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/debugfs.h>
+#include <linux/bitops.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -447,7 +448,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
 		mutex_unlock(&indio_dev->mlock);
 		if (ret)
 			return ret;
-		val16 = ((val16 & 0xFFF) << 4) >> 4;
+		val16 = sign_extend32(val16, 11);
 		*val = val16;
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_OFFSET:

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

* [PATCH 3.16.y-ckt 047/165] iio: mxs-lradc: fix iio channel map regression
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (45 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 046/165] iio: imu: adis16400: Fix sign extension Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 048/165] iio:adc:mcp3422 Fix incorrect scales table Luis Henriques
                   ` (117 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Wahren, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Stefan Wahren <stefan.wahren@i2se.com>

commit 03305e535cd5cdc1079b32909bf4b2dd67d46f7f upstream.

Since commit c8231a9af8147f8a ("iio: mxs-lradc: compute temperature
from channel 8 and 9") with the removal of adc channel 9 there is
no 1-1 mapping in the channel spec.

All hwmon channel values above 9 are accessible via there index minus
one. So add a hidden iio channel 9 to fix this issue.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/iio/adc/mxs-lradc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 4907efaf5e3d..37a1192f1637 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1402,6 +1402,13 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = {
 		.channel = 8,
 		.scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,},
 	},
+	/* Hidden channel to keep indexes */
+	{
+		.type = IIO_TEMP,
+		.indexed = 1,
+		.scan_index = -1,
+		.channel = 9,
+	},
 	MXS_ADC_CHAN(10, IIO_VOLTAGE),	/* VDDIO */
 	MXS_ADC_CHAN(11, IIO_VOLTAGE),	/* VTH */
 	MXS_ADC_CHAN(12, IIO_VOLTAGE),	/* VDDA */

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

* [PATCH 3.16.y-ckt 048/165] iio:adc:mcp3422 Fix incorrect scales table
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (46 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 047/165] iio: mxs-lradc: fix iio channel map regression Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 049/165] iio: ad5686: fix optional reference voltage declaration Luis Henriques
                   ` (116 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Angelo Compagnucci, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Angelo Compagnucci <angelo.compagnucci@gmail.com>

commit 9e128ced3851d2802b6db870f6b2e93f449ce013 upstream.

This patch fixes uncorrect order of mcp3422_scales table, the values
was erroneously transposed.
It removes also an unused array and a wrong comment.

Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/adc/mcp3422.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
index 51672256072b..b96c636470ef 100644
--- a/drivers/iio/adc/mcp3422.c
+++ b/drivers/iio/adc/mcp3422.c
@@ -58,20 +58,11 @@
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
 	}
 
-/* LSB is in nV to eliminate floating point */
-static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625};
-
-/*
- *  scales calculated as:
- *  rates_to_lsb[sample_rate] / (1 << pga);
- *  pga is 1 for 0, 2
- */
-
 static const int mcp3422_scales[4][4] = {
-	{ 1000000, 250000, 62500, 15625 },
-	{ 500000 , 125000, 31250, 7812 },
-	{ 250000 , 62500 , 15625, 3906 },
-	{ 125000 , 31250 , 7812 , 1953 } };
+	{ 1000000, 500000, 250000, 125000 },
+	{ 250000 , 125000, 62500 , 31250  },
+	{ 62500  , 31250 , 15625 , 7812   },
+	{ 15625  , 7812  , 3906  , 1953   } };
 
 /* Constant msleep times for data acquisitions */
 static const int mcp3422_read_times[4] = {

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

* [PATCH 3.16.y-ckt 049/165] iio: ad5686: fix optional reference voltage declaration
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (47 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 048/165] iio:adc:mcp3422 Fix incorrect scales table Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 050/165] usb: dwc3: dwc3-omap: Fix disable IRQ Luis Henriques
                   ` (115 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Urs Fässler, Jonathan Cameron, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Urs=20F=C3=A4ssler?= <urs.fassler@bytesatwork.ch>

commit da019f59cb16570e78feaf10380ac65a3a06861e upstream.

When not using the "_optional" function, a dummy regulator is returned
and the driver fails to initialize.

Signed-off-by: Urs Fässler <urs.fassler@bytesatwork.ch>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iio/dac/ad5686.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 17aca4d9bd06..861ba3d60163 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -322,7 +322,7 @@ static int ad5686_probe(struct spi_device *spi)
 	st = iio_priv(indio_dev);
 	spi_set_drvdata(spi, indio_dev);
 
-	st->reg = devm_regulator_get(&spi->dev, "vcc");
+	st->reg = devm_regulator_get_optional(&spi->dev, "vcc");
 	if (!IS_ERR(st->reg)) {
 		ret = regulator_enable(st->reg);
 		if (ret)

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

* [PATCH 3.16.y-ckt 050/165] usb: dwc3: dwc3-omap: Fix disable IRQ
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (48 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 049/165] iio: ad5686: fix optional reference voltage declaration Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 051/165] usb: gadget: configfs: don't NUL-terminate (sub)compatible ids Luis Henriques
                   ` (114 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: George Cherian, Felipe Balbi, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: George Cherian <george.cherian@ti.com>

commit 96e5d31244c5542f5b2ea81d76f14ba4b8a7d440 upstream.

In the wrapper the IRQ disable should be done by writing 1's to the
IRQ*_CLR register. Existing code is broken because it instead writes
zeros to IRQ*_SET register.

Fix this by adding functions dwc3_omap_write_irqmisc_clr() and
dwc3_omap_write_irq0_clr() which do the right thing.

Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/dwc3/dwc3-omap.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 0aa49e0fb4e0..e19a669d60bd 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -210,6 +210,18 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value)
 						omap->irq0_offset, value);
 }
 
+static void dwc3_omap_write_irqmisc_clr(struct dwc3_omap *omap, u32 value)
+{
+	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_MISC +
+						omap->irqmisc_offset, value);
+}
+
+static void dwc3_omap_write_irq0_clr(struct dwc3_omap *omap, u32 value)
+{
+	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_0 -
+						omap->irq0_offset, value);
+}
+
 static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
 	enum omap_dwc3_vbus_id_status status)
 {
@@ -350,9 +362,23 @@ static void dwc3_omap_enable_irqs(struct dwc3_omap *omap)
 
 static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 {
+	u32			reg;
+
 	/* disable all IRQs */
-	dwc3_omap_write_irqmisc_set(omap, 0x00);
-	dwc3_omap_write_irq0_set(omap, 0x00);
+	reg = USBOTGSS_IRQO_COREIRQ_ST;
+	dwc3_omap_write_irq0_clr(omap, reg);
+
+	reg = (USBOTGSS_IRQMISC_OEVT |
+			USBOTGSS_IRQMISC_DRVVBUS_RISE |
+			USBOTGSS_IRQMISC_CHRGVBUS_RISE |
+			USBOTGSS_IRQMISC_DISCHRGVBUS_RISE |
+			USBOTGSS_IRQMISC_IDPULLUP_RISE |
+			USBOTGSS_IRQMISC_DRVVBUS_FALL |
+			USBOTGSS_IRQMISC_CHRGVBUS_FALL |
+			USBOTGSS_IRQMISC_DISCHRGVBUS_FALL |
+			USBOTGSS_IRQMISC_IDPULLUP_FALL);
+
+	dwc3_omap_write_irqmisc_clr(omap, reg);
 }
 
 static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);

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

* [PATCH 3.16.y-ckt 051/165] usb: gadget: configfs: don't NUL-terminate (sub)compatible ids
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (49 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 050/165] usb: dwc3: dwc3-omap: Fix disable IRQ Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 052/165] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Luis Henriques
                   ` (113 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrzej Pietrasiewicz, Felipe Balbi, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>

commit a0456399fb07155637a2b597b91cc1c63bc25141 upstream.

The "Extended Compat ID OS Feature Descriptor Specification" does not
require the (sub)compatible ids to be NUL-terminated, because they
are placed in a fixed-size buffer and only unused parts of it should
contain NULs. If the buffer is fully utilized, there is no place for NULs.

Consequently, the code which uses desc->ext_compat_id never expects the
data contained to be NUL terminated.

If the compatible id is stored after sub-compatible id, and the compatible
id is full length (8 bytes), the (useless) NUL terminator overwrites the
first byte of the sub-compatible id.

If the sub-compatible id is full length (8 bytes), the (useless) NUL
terminator ends up out of the buffer. The situation can happen in the RNDIS
function, where the buffer is a part of struct f_rndis_opts. The next
member of struct f_rndis_opts is a mutex, so its first byte gets
overwritten. The said byte is a part of a mutex'es member which contains
the information on whether the muext is locked or not. This can lead to a
deadlock, because, in a configfs-composed gadget when a function is linked
into a configuration with config_usb_cfg_link(), usb_get_function()
is called, which then calls rndis_alloc(), which tries locking the same
mutex and (wrongly) finds it already locked.

This patch eliminates NUL terminating of the (sub)compatible id.

Fixes: da4243145fb1: "usb: gadget: configfs: OS Extended Compatibility descriptors support"
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/gadget/configfs.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 97142146eead..45a94a77d986 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1163,7 +1163,6 @@ static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc,
 	if (desc->opts_mutex)
 		mutex_lock(desc->opts_mutex);
 	memcpy(desc->ext_compat_id, page, l);
-	desc->ext_compat_id[l] = '\0';
 
 	if (desc->opts_mutex)
 		mutex_unlock(desc->opts_mutex);
@@ -1194,7 +1193,6 @@ static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc,
 	if (desc->opts_mutex)
 		mutex_lock(desc->opts_mutex);
 	memcpy(desc->ext_compat_id + 8, page, l);
-	desc->ext_compat_id[l + 8] = '\0';
 
 	if (desc->opts_mutex)
 		mutex_unlock(desc->opts_mutex);

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

* [PATCH 3.16.y-ckt 052/165] KVM: emulate: fix CMPXCHG8B on 32-bit hosts
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (50 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 051/165] usb: gadget: configfs: don't NUL-terminate (sub)compatible ids Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 053/165] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks Luis Henriques
                   ` (112 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Paolo Bonzini <pbonzini@redhat.com>

commit 4ff6f8e61eb7f96d3ca535c6d240f863ccd6fb7d upstream.

This has been broken for a long time: it broke first in 2.6.35, then was
almost fixed in 2.6.36 but this one-liner slipped through the cracks.
The bug shows up as an infinite loop in Windows 7 (and newer) boot on
32-bit hosts without EPT.

Windows uses CMPXCHG8B to write to page tables, which causes a
page fault if running without EPT; the emulator is then called from
kvm_mmu_page_fault.  The loop then happens if the higher 4 bytes are
not 0; the common case for this is that the NX bit (bit 63) is 1.

Fixes: 6550e1f165f384f3a46b60a1be9aba4bc3c2adad
Fixes: 16518d5ada690643453eb0aef3cc7841d3623c2d
Reported-by: Erik Rull <erik.rull@rdsoftware.de>
Tested-by: Erik Rull <erik.rull@rdsoftware.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/emulate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8c9f719453da..57604c0e5a53 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4720,7 +4720,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
 		if (rc != X86EMUL_CONTINUE)
 			goto done;
 	}
-	ctxt->dst.orig_val = ctxt->dst.val;
+	/* Copy full 64-bit value for CMPXCHG8B.  */
+	ctxt->dst.orig_val64 = ctxt->dst.val64;
 
 special_insn:
 

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

* [PATCH 3.16.y-ckt 053/165] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (51 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 052/165] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 054/165] xhci: Allocate correct amount of scratchpad buffers Luis Henriques
                   ` (111 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxime Ripard, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maxime Ripard <maxime.ripard@free-electrons.com>

commit 1e7e4fb66489cc84366656ca5318f1cb61afd4ba upstream.

The commit 973747928514 ("usb: host: xhci-plat: add support for the Armada
375/38x XHCI controllers") extended the xhci-plat driver to support the Armada
375/38x SoCs, mostly by adding a quirk configuring the MBUS window.

However, that quirk was run before the clock the controllers needs has been
enabled. This usually worked because the clock was first enabled by the
bootloader, and left as such until the driver is probe, where it tries to
access the MBUS configuration registers before enabling the clock.

Things get messy when EPROBE_DEFER is involved during the probe, since as part
of its error path, the driver will rightfully disable the clock. When the
driver will be reprobed, it will retry to access the MBUS registers, but this
time with the clock disabled, which hangs forever.

Fix this by running the quirks after the clock has been enabled by the driver.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-plat.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 271690de8de1..bbf86db713ce 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -115,15 +115,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	if (of_device_is_compatible(pdev->dev.of_node,
-				    "marvell,armada-375-xhci") ||
-	    of_device_is_compatible(pdev->dev.of_node,
-				    "marvell,armada-380-xhci")) {
-		ret = xhci_mvebu_mbus_init_quirk(pdev);
-		if (ret)
-			return ret;
-	}
-
 	/* Initialize dma_mask and coherent_dma_mask to 32-bits */
 	ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 	if (ret)
@@ -165,6 +156,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
 			goto unmap_registers;
 	}
 
+	if (of_device_is_compatible(pdev->dev.of_node,
+				    "marvell,armada-375-xhci") ||
+	    of_device_is_compatible(pdev->dev.of_node,
+				    "marvell,armada-380-xhci")) {
+		ret = xhci_mvebu_mbus_init_quirk(pdev);
+		if (ret)
+			goto disable_clk;
+	}
+
 	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (ret)
 		goto disable_clk;

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

* [PATCH 3.16.y-ckt 054/165] xhci: Allocate correct amount of scratchpad buffers
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (52 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 053/165] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 055/165] USB: usbfs: don't leak kernel data in siginfo Luis Henriques
                   ` (110 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit 6596a926b0b6c80b730a1dd2fa91908e0a539c37 upstream.

Include the high order bit fields for Max scratchpad buffers when
calculating how many scratchpad buffers are needed.

I'm suprised this hasn't caused more issues, we never allocated more than
32 buffers even if xhci needed more. Either we got lucky and xhci never
really used past that area, or then we got enough zeroed dma memory anyway.

Should be backported as far back as possible

Reported-by: Tim Chen <tim.c.chen@linux.intel.com>
Tested-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 00ed780c0563..c57261affada 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -88,9 +88,10 @@ struct xhci_cap_regs {
 #define HCS_IST(p)		(((p) >> 0) & 0xf)
 /* bits 4:7, max number of Event Ring segments */
 #define HCS_ERST_MAX(p)		(((p) >> 4) & 0xf)
+/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */
 /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */
-/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */
-#define HCS_MAX_SCRATCHPAD(p)   (((p) >> 27) & 0x1f)
+/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */
+#define HCS_MAX_SCRATCHPAD(p)   ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f))
 
 /* HCSPARAMS3 - hcs_params3 - bitmasks */
 /* bits 0:7, Max U1 to U0 latency for the roothub ports */

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

* [PATCH 3.16.y-ckt 055/165] USB: usbfs: don't leak kernel data in siginfo
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (53 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 054/165] xhci: Allocate correct amount of scratchpad buffers Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 056/165] uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539 Luis Henriques
                   ` (109 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alan Stern, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

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

commit f0c2b68198589249afd2b1f2c4e8de8c03e19c16 upstream.

When a signal is delivered, the information in the siginfo structure
is copied to userspace.  Good security practice dicatates that the
unused fields in this structure should be initialized to 0 so that
random kernel stack data isn't exposed to the user.  This patch adds
such an initialization to the two places where usbfs raises signals.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Dave Mielke <dave@mielke.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/core/devio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 0b59731c3021..e500243803d8 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb)
 	as->status = urb->status;
 	signr = as->signr;
 	if (signr) {
+		memset(&sinfo, 0, sizeof(sinfo));
 		sinfo.si_signo = as->signr;
 		sinfo.si_errno = as->status;
 		sinfo.si_code = SI_ASYNCIO;
@@ -2371,6 +2372,7 @@ static void usbdev_remove(struct usb_device *udev)
 		wake_up_all(&ps->wait);
 		list_del_init(&ps->list);
 		if (ps->discsignr) {
+			memset(&sinfo, 0, sizeof(sinfo));
 			sinfo.si_signo = ps->discsignr;
 			sinfo.si_errno = EPIPE;
 			sinfo.si_code = SI_ASYNCIO;

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

* [PATCH 3.16.y-ckt 056/165] uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (54 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 055/165] USB: usbfs: don't leak kernel data in siginfo Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 057/165] efi/libstub: Fix boundary checking in efi_high_alloc() Luis Henriques
                   ` (108 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

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

commit 59e980efafd27df83a5c85c054f906d82bcbf752 upstream.

Like the JMicron JMS567 enclosures with the JMS539 choke on report-opcodes,
so avoid it.

Tested-and-reported-by: Tom Arild Naess <tanaess@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/storage/unusual_uas.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
index 2706a434fdbb..cd047d0cc7a6 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -103,6 +103,13 @@ UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x9999,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_NO_ATA_1X),
 
+/* Reported-by: Tom Arild Naess <tanaess@gmail.com> */
+UNUSUAL_DEV(0x152d, 0x0539, 0x0000, 0x9999,
+		"JMicron",
+		"JMS539",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_REPORT_OPCODES),
+
 /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */
 UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999,
 		"JMicron",

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

* [PATCH 3.16.y-ckt 057/165] efi/libstub: Fix boundary checking in efi_high_alloc()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (55 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 056/165] uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539 Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 058/165] Revert "USB: serial: make bulk_out_size a lower limit" Luis Henriques
                   ` (107 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yinghai Lu, Matt Fleming, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yinghai Lu <yinghai@kernel.org>

commit 7ed620bb343f434f8a85f830020c04988df2a140 upstream.

While adding support loading kernel and initrd above 4G to grub2 in legacy
mode, I was referring to efi_high_alloc().
That will allocate buffer for kernel and then initrd, and initrd will
use kernel buffer start as limit.

During testing found two buffers will be overlapped when initrd size is
very big like 400M.

It turns out efi_high_alloc() boundary checking is not right.
end - size will be the new start, and should not compare new
start with max, we need to make sure end is smaller than max.

[ Basically, with the current efi_high_alloc() code it's possible to
  allocate memory above 'max', because efi_high_alloc() doesn't check
  that the tail of the allocation is below 'max'.

  If you have an EFI memory map with a single entry that looks like so,

   [0xc0000000-0xc0004000]

  And want to allocate 0x3000 bytes below 0xc0003000 the current code
  will allocate [0xc0001000-0xc0004000], not [0xc0000000-0xc0003000]
  like you would expect. - Matt ]

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ luis: backported to 3.16:
  - file rename: drivers/firmware/efi/libstub/efi-stub-helper.c ->
    drivers/firmware/efi/efi-stub-helper.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/firmware/efi/efi-stub-helper.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index eb6d4be9e722..2fb3a0aab56c 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -157,12 +157,12 @@ again:
 		start = desc->phys_addr;
 		end = start + desc->num_pages * (1UL << EFI_PAGE_SHIFT);
 
-		if ((start + size) > end || (start + size) > max)
-			continue;
-
-		if (end - size > max)
+		if (end > max)
 			end = max;
 
+		if ((start + size) > end)
+			continue;
+
 		if (round_down(end - size, align) < start)
 			continue;
 

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

* [PATCH 3.16.y-ckt 058/165] Revert "USB: serial: make bulk_out_size a lower limit"
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (56 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 057/165] efi/libstub: Fix boundary checking in efi_high_alloc() Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 059/165] USB: ftdi_sio: add PIDs for Actisense USB devices Luis Henriques
                   ` (106 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit bc4b1f486fe69b86769e07c8edce472327a8462b upstream.

This reverts commit 5083fd7bdfe6760577235a724cf6dccae13652c2.

A bulk-out size smaller than the end-point size is indeed valid. The
offending commit broke the usb-debug driver for EHCI debug devices,
which use 8-byte buffers.

Fixes: 5083fd7bdfe6 ("USB: serial: make bulk_out_size a lower limit")
Reported-by: "Li, Elvin" <elvin.li@intel.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/usb-serial.c | 5 +++--
 include/linux/usb/serial.h      | 3 +--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 475723c006f9..19842370a07f 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -940,8 +940,9 @@ static int usb_serial_probe(struct usb_interface *interface,
 		port = serial->port[i];
 		if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL))
 			goto probe_error;
-		buffer_size = max_t(int, serial->type->bulk_out_size,
-						usb_endpoint_maxp(endpoint));
+		buffer_size = serial->type->bulk_out_size;
+		if (!buffer_size)
+			buffer_size = usb_endpoint_maxp(endpoint);
 		port->bulk_out_size = buffer_size;
 		port->bulk_out_endpointAddress = endpoint->bEndpointAddress;
 
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 9bb547c7bce7..704a1ab8240c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -190,8 +190,7 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
  * @num_ports: the number of different ports this device will have.
  * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
  *	(0 = end-point size)
- * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer
- *	(0 = end-point size)
+ * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
  * @calc_num_ports: pointer to a function to determine how many ports this
  *	device has dynamically.  It will be called after the probe()
  *	callback is called, but before attach()

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

* [PATCH 3.16.y-ckt 059/165] USB: ftdi_sio: add PIDs for Actisense USB devices
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (57 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 058/165] Revert "USB: serial: make bulk_out_size a lower limit" Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 060/165] USB: serial: fix potential use-after-free after failed probe Luis Henriques
                   ` (105 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Glover, Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Glover <mark@actisense.com>

commit f6950344d3cf4a1e231b5828b50c4ac168db3886 upstream.

These product identifiers (PID) all deal with marine NMEA format data
used on motor boats and yachts. We supply the programmed devices to
Chetco, for use inside their equipment. The PIDs are a direct copy of
our Windows device drivers (FTDI drivers with altered PIDs).

Signed-off-by: Mark Glover <mark@actisense.com>
[johan: edit commit message slightly ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 17 +++++++++++++++++
 drivers/usb/serial/ftdi_sio_ids.h | 20 ++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index debcdef4cbf0..cf4c0702ff50 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -991,6 +991,23 @@ static const struct usb_device_id id_table_combined[] = {
 	{ USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
 	/* GE Healthcare devices */
 	{ USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) },
+	/* Active Research (Actisense) devices */
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) },
 	{ }					/* Terminating entry */
 };
 
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index e52409c9be99..4d3da89cd8dd 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1438,3 +1438,23 @@
  */
 #define GE_HEALTHCARE_VID		0x1901
 #define GE_HEALTHCARE_NEMO_TRACKER_PID	0x0015
+
+/*
+ * Active Research (Actisense) devices
+ */
+#define ACTISENSE_NDC_PID		0xD9A8 /* NDC USB Serial Adapter */
+#define ACTISENSE_USG_PID		0xD9A9 /* USG USB Serial Adapter */
+#define ACTISENSE_NGT_PID		0xD9AA /* NGT NMEA2000 Interface */
+#define ACTISENSE_NGW_PID		0xD9AB /* NGW NMEA2000 Gateway */
+#define ACTISENSE_D9AC_PID		0xD9AC /* Actisense Reserved */
+#define ACTISENSE_D9AD_PID		0xD9AD /* Actisense Reserved */
+#define ACTISENSE_D9AE_PID		0xD9AE /* Actisense Reserved */
+#define ACTISENSE_D9AF_PID		0xD9AF /* Actisense Reserved */
+#define CHETCO_SEAGAUGE_PID		0xA548 /* SeaGauge USB Adapter */
+#define CHETCO_SEASWITCH_PID		0xA549 /* SeaSwitch USB Adapter */
+#define CHETCO_SEASMART_NMEA2000_PID	0xA54A /* SeaSmart NMEA2000 Gateway */
+#define CHETCO_SEASMART_ETHERNET_PID	0xA54B /* SeaSmart Ethernet Gateway */
+#define CHETCO_SEASMART_WIFI_PID	0xA5AC /* SeaSmart Wifi Gateway */
+#define CHETCO_SEASMART_DISPLAY_PID	0xA5AD /* SeaSmart NMEA2000 Display */
+#define CHETCO_SEASMART_LITE_PID	0xA5AE /* SeaSmart Lite USB Adapter */
+#define CHETCO_SEASMART_ANALOG_PID	0xA5AF /* SeaSmart Analog Adapter */

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

* [PATCH 3.16.y-ckt 060/165] USB: serial: fix potential use-after-free after failed probe
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (58 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 059/165] USB: ftdi_sio: add PIDs for Actisense USB devices Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 061/165] USB: serial: fix tty-device error handling at probe Luis Henriques
                   ` (104 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 07fdfc5e9f1c966be8722e8fa927e5ea140df5ce upstream.

Fix return value in probe error path, which could end up returning
success (0) on errors. This could in turn lead to use-after-free or
double free (e.g. in port_remove) when the port device is removed.

Fixes: c706ebdfc895 ("USB: usb-serial: call port_probe and port_remove
at the right times")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 9374bd2aba20..5d8d86666b90 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -75,7 +75,7 @@ static int usb_serial_device_probe(struct device *dev)
 	retval = device_create_file(dev, &dev_attr_port_number);
 	if (retval) {
 		if (driver->port_remove)
-			retval = driver->port_remove(port);
+			driver->port_remove(port);
 		goto exit_with_autopm;
 	}
 

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

* [PATCH 3.16.y-ckt 061/165] USB: serial: fix tty-device error handling at probe
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (59 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 060/165] USB: serial: fix potential use-after-free after failed probe Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 062/165] USB: mxuport: fix null deref when used as a console Luis Henriques
                   ` (103 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit ca4383a3947a83286bc9b9c598a1f55e867871d7 upstream.

Add missing error handling when registering the tty device at port
probe. This avoids trying to remove an uninitialised character device
when the port device is removed.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/bus.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 5d8d86666b90..6f91eb9ae81a 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -51,6 +51,7 @@ static int usb_serial_device_probe(struct device *dev)
 {
 	struct usb_serial_driver *driver;
 	struct usb_serial_port *port;
+	struct device *tty_dev;
 	int retval = 0;
 	int minor;
 
@@ -80,7 +81,15 @@ static int usb_serial_device_probe(struct device *dev)
 	}
 
 	minor = port->minor;
-	tty_register_device(usb_serial_tty_driver, minor, dev);
+	tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev);
+	if (IS_ERR(tty_dev)) {
+		retval = PTR_ERR(tty_dev);
+		device_remove_file(dev, &dev_attr_port_number);
+		if (driver->port_remove)
+			driver->port_remove(port);
+		goto exit_with_autopm;
+	}
+
 	dev_info(&port->serial->dev->dev,
 		 "%s converter now attached to ttyUSB%d\n",
 		 driver->description, minor);

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

* [PATCH 3.16.y-ckt 062/165] USB: mxuport: fix null deref when used as a console
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (60 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 061/165] USB: serial: fix tty-device error handling at probe Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 063/165] mac80211: Send EAPOL frames at lowest rate Luis Henriques
                   ` (102 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit db81de767e375743ebb0ad2bcad3326962c2b67e upstream.

Fix null-pointer dereference at probe when the device is used as a
console, in which case the tty argument to open will be NULL.

Fixes: ee467a1f2066 ("USB: serial: add Moxa UPORT 12XX/14XX/16XX
driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/mxuport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c
index ab1d690274ae..460a40669967 100644
--- a/drivers/usb/serial/mxuport.c
+++ b/drivers/usb/serial/mxuport.c
@@ -1284,7 +1284,8 @@ static int mxuport_open(struct tty_struct *tty, struct usb_serial_port *port)
 	}
 
 	/* Initial port termios */
-	mxuport_set_termios(tty, port, NULL);
+	if (tty)
+		mxuport_set_termios(tty, port, NULL);
 
 	/*
 	 * TODO: use RQ_VENDOR_GET_MSR, once we know what it

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

* [PATCH 3.16.y-ckt 063/165] mac80211: Send EAPOL frames at lowest rate
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (61 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 062/165] USB: mxuport: fix null deref when used as a console Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 064/165] ARC: Fix KSTK_ESP() Luis Henriques
                   ` (101 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jouni Malinen, Johannes Berg, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jouni Malinen <jouni@qca.qualcomm.com>

commit 9c1c98a3bb7b7593b60264b9a07e001e68b46697 upstream.

The current minstrel_ht rate control behavior is somewhat optimistic in
trying to find optimum TX rate. While this is usually fine for normal
Data frames, there are cases where a more conservative set of retry
parameters would be beneficial to make the connection more robust.

EAPOL frames are critical to the authentication and especially the
EAPOL-Key message 4/4 (the last message in the 4-way handshake) is
important to get through to the AP. If that message is lost, the only
recovery mechanism in many cases is to reassociate with the AP and start
from scratch. This can often be avoided by trying to send the frame with
more conservative rate and/or with more link layer retries.

In most cases, minstrel_ht is currently using the initial EAPOL-Key
frames for probing higher rates and this results in only five link layer
transmission attempts (one at high(ish) MCS and four at MCS0). While
this works with most APs, it looks like there are some deployed APs that
may have issues with the EAPOL frames using HT MCS immediately after
association. Similarly, there may be issues in cases where the signal
strength or radio environment is not good enough to be able to get
frames through even at couple of MCS 0 tries.

The best approach for this would likely to be to reduce the TX rate for
the last rate (3rd rate parameter in the set) to a low basic rate (say,
6 Mbps on 5 GHz and 2 or 5.5 Mbps on 2.4 GHz), but doing that cleanly
requires some more effort. For now, we can start with a simple one-liner
that forces the minimum rate to be used for EAPOL frames similarly how
the TX rate is selected for the IEEE 802.11 Management frames. This does
result in a small extra latency added to the cases where the AP would be
able to receive the higher rate, but taken into account how small number
of EAPOL frames are used, this is likely to be insignificant. A future
optimization in the minstrel_ht design can also allow this patch to be
reverted to get back to the more optimized initial TX rate.

It should also be noted that many drivers that do not use minstrel as
the rate control algorithm are already doing similar workarounds by
forcing the lowest TX rate to be used for EAPOL frames.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/tx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1a252c606ad0..f0fda4e1dc0d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -559,6 +559,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx)
 		if (tx->sdata->control_port_no_encrypt)
 			info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 		info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
+		info->flags |= IEEE80211_TX_CTL_USE_MINRATE;
 	}
 
 	return TX_CONTINUE;

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

* [PATCH 3.16.y-ckt 064/165] ARC: Fix KSTK_ESP()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (62 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 063/165] mac80211: Send EAPOL frames at lowest rate Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 065/165] USB: serial: cp210x: Adding Seletek device id's Luis Henriques
                   ` (100 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vineet Gupta <vgupta@synopsys.com>

commit 13648b0118a24f4fc76c34e6c7b6ccf447e46a2a upstream.

/proc/<pid>/maps currently don't annotate stack vma with "[stack]"
This is because KSTK_ESP ie expected to return usermode SP of tsk while
currently it returns the kernel mode SP of a sleeping tsk.

While the fix is trivial, we also need to adjust the ARC kernel stack
unwinder to not use KSTK_SP and friends any more.

Reported-and-suggested-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arc/include/asm/processor.h | 9 +++++----
 arch/arc/kernel/stacktrace.c     | 6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
index c6468fe847e3..c7f41d68d6eb 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -75,18 +75,19 @@ unsigned long thread_saved_pc(struct task_struct *t);
 #define release_segments(mm)        do { } while (0)
 
 #define KSTK_EIP(tsk)   (task_pt_regs(tsk)->ret)
+#define KSTK_ESP(tsk)   (task_pt_regs(tsk)->sp)
 
 /*
  * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode.
  * Look in process.c for details of kernel stack layout
  */
-#define KSTK_ESP(tsk)   (tsk->thread.ksp)
+#define TSK_K_ESP(tsk)		(tsk->thread.ksp)
 
-#define KSTK_REG(tsk, off)	(*((unsigned int *)(KSTK_ESP(tsk) + \
+#define TSK_K_REG(tsk, off)	(*((unsigned int *)(TSK_K_ESP(tsk) + \
 					sizeof(struct callee_regs) + off)))
 
-#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4)
-#define KSTK_FP(tsk)    KSTK_REG(tsk, 0)
+#define TSK_K_BLINK(tsk)	TSK_K_REG(tsk, 4)
+#define TSK_K_FP(tsk)		TSK_K_REG(tsk, 0)
 
 extern void start_thread(struct pt_regs * regs, unsigned long pc,
 			 unsigned long usp);
diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
index 9ce47cfe2303..fb98769b6a98 100644
--- a/arch/arc/kernel/stacktrace.c
+++ b/arch/arc/kernel/stacktrace.c
@@ -64,9 +64,9 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
 
 		frame_info->task = tsk;
 
-		frame_info->regs.r27 = KSTK_FP(tsk);
-		frame_info->regs.r28 = KSTK_ESP(tsk);
-		frame_info->regs.r31 = KSTK_BLINK(tsk);
+		frame_info->regs.r27 = TSK_K_FP(tsk);
+		frame_info->regs.r28 = TSK_K_ESP(tsk);
+		frame_info->regs.r31 = TSK_K_BLINK(tsk);
 		frame_info->regs.r63 = (unsigned int)__switch_to;
 
 		/* In the prologue of __switch_to, first FP is saved on stack

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

* [PATCH 3.16.y-ckt 065/165] USB: serial: cp210x: Adding Seletek device id's
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (63 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 064/165] ARC: Fix KSTK_ESP() Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 066/165] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel Luis Henriques
                   ` (99 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michiel van de Garde, Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Michiel vd Garde <mgparser@gmail.com>

commit 675af70856d7cc026be8b6ea7a8b9db10b8b38a1 upstream.

These device ID's are not associated with the cp210x module currently,
but should be. This patch allows the devices to operate upon connecting
them to the usb bus as intended.

Signed-off-by: Michiel van de Garde <mgparser@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 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 a2d040971afe..8d114b9733ed 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */
 	{ USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */
 	{ USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */
+	{ USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */
+	{ USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */
 	{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
 	{ USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */
 	{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */

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

* [PATCH 3.16.y-ckt 066/165] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (64 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 065/165] USB: serial: cp210x: Adding Seletek device id's Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 067/165] mei: make device disabled on stop unconditionally Luis Henriques
                   ` (98 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ian Abbott, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ian Abbott <abbotti@mev.co.uk>

commit abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 upstream.

Reading of analog input channels by the `INSN_READ` comedi instruction
is broken for all except channel 0.  `pci171x_ai_insn_read()` calls
`pci171x_ai_read_sample()` with the wrong value for the third parameter.
It is supposed to be the current index in a channel list (which is
always of length 1 in this case, so the index should be 0), but instead
it is passing the actual channel number.  `pci171x_ai_read_sample()`
checks the channel number encoded in the raw sample value read from the
hardware matches the channel number stored in the specified index of the
previously set up channel list and returns `-ENODATA` if it doesn't
match.  Since the index should always be 0 in this case, the match will
fail unless the channel number is also 0.  Fix it by passing 0 as the
channel index.

Note that when the bug first appeared, it was `pci171x_ai_dropout()`
that was called with the wrong parameter value.  `pci171x_ai_dropout()`
got replaced with `pci171x_ai_read_sample()` in commit 7fd2dae2500d
("staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()").

Fixes: 16c7eb6047bb ("staging: comedi: adv_pci1710: always enable PCI171x_PARANOIDCHECK code")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: used Ian's backport ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 602b7a1e40e6..89de43ffc110 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -456,7 +456,6 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,
 				struct comedi_insn *insn, unsigned int *data)
 {
 	struct pci1710_private *devpriv = dev->private;
-	unsigned int chan = CR_CHAN(insn->chanspec);
 	int ret = 0;
 	int i;
 
@@ -478,7 +477,7 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,
 			break;
 
 		val = inw(dev->iobase + PCI171x_AD_DATA);
-		ret = pci171x_ai_dropout(dev, s, chan, val);
+		ret = pci171x_ai_dropout(dev, s, 0, val);
 		if (ret)
 			break;
 

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

* [PATCH 3.16.y-ckt 067/165] mei: make device disabled on stop unconditionally
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (65 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 066/165] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 068/165] NFSv4: Don't call put_rpccred() under the rcu_read_lock() Luis Henriques
                   ` (97 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Usyskin, Tomas Winkler, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Usyskin <alexander.usyskin@intel.com>

commit 6c15a8516b8118eb19a59fd0bd22df41b9101c32 upstream.

Set the internal device state to to disabled after hardware reset in stop flow.
This will cover cases when driver was not brought to disabled state because of
an error and in stop flow we wish not to retry the reset.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/misc/mei/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 006929222481..cf83ce10bcee 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -300,6 +300,8 @@ void mei_stop(struct mei_device *dev)
 
 	dev->dev_state = MEI_DEV_POWER_DOWN;
 	mei_reset(dev);
+	/* move device to disabled state unconditionally */
+	dev->dev_state = MEI_DEV_DISABLED;
 
 	mutex_unlock(&dev->device_lock);
 

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

* [PATCH 3.16.y-ckt 068/165] NFSv4: Don't call put_rpccred() under the rcu_read_lock()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (66 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 067/165] mei: make device disabled on stop unconditionally Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 069/165] btrfs: fix lost return value due to variable shadowing Luis Henriques
                   ` (96 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Trond Myklebust, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit 7c0af9ffb7bb4e5355470fa60b3eb711ddf226fa upstream.

put_rpccred() can sleep.

Fixes: 8f649c3762547 ("NFSv4: Fix the locking in nfs_inode_reclaim_delegation()")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfs/delegation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 3ed1be9aade3..2ea3537b8bde 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -161,8 +161,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
 				  &delegation->flags);
 			NFS_I(inode)->delegation_state = delegation->type;
 			spin_unlock(&delegation->lock);
-			put_rpccred(oldcred);
 			rcu_read_unlock();
+			put_rpccred(oldcred);
 			trace_nfs4_reclaim_delegation(inode, res->delegation_type);
 		} else {
 			/* We appear to have raced with a delegation return. */

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

* [PATCH 3.16.y-ckt 069/165] btrfs: fix lost return value due to variable shadowing
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (67 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 068/165] NFSv4: Don't call put_rpccred() under the rcu_read_lock() Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 070/165] KVM: MIPS: Fix trace event to save PC directly Luis Henriques
                   ` (95 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Sterba, Chris Mason, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Sterba <dsterba@suse.cz>

commit 1932b7be973b554ffe20a5bba6ffaed6fa995cdc upstream.

A block-local variable stores error code but btrfs_get_blocks_direct may
not return it in the end as there's a ret defined in the function scope.

Fixes: d187663ef24c ("Btrfs: lock extents as we map them in DIO")
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/inode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a3a8dee8030f..670f942e2235 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7000,7 +7000,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
 	    ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) &&
 	     em->block_start != EXTENT_MAP_HOLE)) {
 		int type;
-		int ret;
 		u64 block_start, orig_start, orig_block_len, ram_bytes;
 
 		if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags))

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

* [PATCH 3.16.y-ckt 070/165] KVM: MIPS: Fix trace event to save PC directly
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (68 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 069/165] btrfs: fix lost return value due to variable shadowing Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 071/165] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Luis Henriques
                   ` (94 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Paolo Bonzini, Ralf Baechle, Marcelo Tosatti,
	Gleb Natapov, Steven Rostedt, Ingo Molnar, linux-mips, kvm,
	Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hogan <james.hogan@imgtec.com>

commit b3cffac04eca9af46e1e23560a8ee22b1bd36d43 upstream.

Currently the guest exit trace event saves the VCPU pointer to the
structure, and the guest PC is retrieved by dereferencing it when the
event is printed rather than directly from the trace record. This isn't
safe as the printing may occur long afterwards, after the PC has changed
and potentially after the VCPU has been freed. Usually this results in
the same (wrong) PC being printed for multiple trace events. It also
isn't portable as userland has no way to access the VCPU data structure
when interpreting the trace record itself.

Lets save the actual PC in the structure so that the correct value is
accessible later.

Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/kvm/trace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h
index bc9e0f406c08..e51621e36152 100644
--- a/arch/mips/kvm/trace.h
+++ b/arch/mips/kvm/trace.h
@@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit,
 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
 	    TP_ARGS(vcpu, reason),
 	    TP_STRUCT__entry(
-			__field(struct kvm_vcpu *, vcpu)
+			__field(unsigned long, pc)
 			__field(unsigned int, reason)
 	    ),
 
 	    TP_fast_assign(
-			__entry->vcpu = vcpu;
+			__entry->pc = vcpu->arch.pc;
 			__entry->reason = reason;
 	    ),
 
 	    TP_printk("[%s]PC: 0x%08lx",
 		      kvm_mips_exit_types_str[__entry->reason],
-		      __entry->vcpu->arch.pc)
+		      __entry->pc)
 );
 
 #endif /* _TRACE_KVM_H */

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

* [PATCH 3.16.y-ckt 071/165] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (69 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 070/165] KVM: MIPS: Fix trace event to save PC directly Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 072/165] ecryptfs: ->f_op is never NULL Luis Henriques
                   ` (93 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Max Mansfield, Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Max Mansfield <max.m.mansfield@gmail.com>

commit c7d373c3f0da2b2b78c4b1ce5ae41485b3ef848c upstream.

This patch integrates Cyber Cortex AV boards with the existing
ftdi_jtag_quirk in order to use serial port 0 with JTAG which is
required by the manufacturers' software.

Steps: 2

[ftdi_sio_ids.h]
1. Defined the device PID

[ftdi_sio.c]
2. Added a macro declaration to the ids array, in order to enable the
jtag quirk for the device.

Signed-off-by: Max Mansfield <max.m.mansfield@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 2 ++
 drivers/usb/serial/ftdi_sio_ids.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index cf4c0702ff50..923500595357 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -812,6 +812,8 @@ static const struct usb_device_id id_table_combined[] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) },
+	{ USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID),
+		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID),
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 4d3da89cd8dd..56b1b55c4751 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -38,6 +38,9 @@
 
 #define FTDI_LUMEL_PD12_PID	0x6002
 
+/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */
+#define CYBER_CORTEX_AV_PID	0x8698
+
 /*
  * Marvell OpenRD Base, Client
  * http://www.open-rd.org

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

* [PATCH 3.16.y-ckt 072/165] ecryptfs: ->f_op is never NULL
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (70 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 071/165] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 073/165] eCryptfs: don't pass fs-specific ioctl commands through Luis Henriques
                   ` (92 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@zeniv.linux.org.uk>

commit c2e3f5d5f4620bb6568bc559f712ce80222e20cb upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[ luis: 3.16-stable, just to make 6d65261a09ad ("eCryptfs: don't pass
  fs-specific ioctl commands through") a clean cherry-pick ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ecryptfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index a06ad2f7ed80..de1111457b5e 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -315,7 +315,7 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	struct file *lower_file = ecryptfs_file_to_lower(file);
 	long rc = -ENOIOCTLCMD;
 
-	if (lower_file->f_op && lower_file->f_op->compat_ioctl)
+	if (lower_file->f_op->compat_ioctl)
 		rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
 	return rc;
 }

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

* [PATCH 3.16.y-ckt 073/165] eCryptfs: don't pass fs-specific ioctl commands through
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (71 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 072/165] ecryptfs: ->f_op is never NULL Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 074/165] drm/radeon: do a posting read in r100_set_irq Luis Henriques
                   ` (91 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tyler Hicks, Rocko, Colin Ian King, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tyler Hicks <tyhicks@canonical.com>

commit 6d65261a09adaa374c05de807f73a144d783669e upstream.

eCryptfs can't be aware of what to expect when after passing an
arbitrary ioctl command through to the lower filesystem. The ioctl
command may trigger an action in the lower filesystem that is
incompatible with eCryptfs.

One specific example is when one attempts to use the Btrfs clone
ioctl command when the source file is in the Btrfs filesystem that
eCryptfs is mounted on top of and the destination fd is from a new file
created in the eCryptfs mount. The ioctl syscall incorrectly returns
success because the command is passed down to Btrfs which thinks that it
was able to do the clone operation. However, the result is an empty
eCryptfs file.

This patch allows the trim, {g,s}etflags, and {g,s}etversion ioctl
commands through and then copies up the inode metadata from the lower
inode to the eCryptfs inode to catch any changes made to the lower
inode's metadata. Those five ioctl commands are mostly common across all
filesystems but the whitelist may need to be further pruned in the
future.

https://bugzilla.kernel.org/show_bug.cgi?id=93691
https://launchpad.net/bugs/1305335

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: Rocko <rockorequin@hotmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ecryptfs/file.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index de1111457b5e..0682699519af 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -303,9 +303,22 @@ ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	struct file *lower_file = ecryptfs_file_to_lower(file);
 	long rc = -ENOTTY;
 
-	if (lower_file->f_op->unlocked_ioctl)
+	if (!lower_file->f_op->unlocked_ioctl)
+		return rc;
+
+	switch (cmd) {
+	case FITRIM:
+	case FS_IOC_GETFLAGS:
+	case FS_IOC_SETFLAGS:
+	case FS_IOC_GETVERSION:
+	case FS_IOC_SETVERSION:
 		rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
-	return rc;
+		fsstack_copy_attr_all(file_inode(file), file_inode(lower_file));
+
+		return rc;
+	default:
+		return rc;
+	}
 }
 
 #ifdef CONFIG_COMPAT
@@ -315,9 +328,22 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	struct file *lower_file = ecryptfs_file_to_lower(file);
 	long rc = -ENOIOCTLCMD;
 
-	if (lower_file->f_op->compat_ioctl)
+	if (!lower_file->f_op->compat_ioctl)
+		return rc;
+
+	switch (cmd) {
+	case FITRIM:
+	case FS_IOC32_GETFLAGS:
+	case FS_IOC32_SETFLAGS:
+	case FS_IOC32_GETVERSION:
+	case FS_IOC32_SETVERSION:
 		rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
-	return rc;
+		fsstack_copy_attr_all(file_inode(file), file_inode(lower_file));
+
+		return rc;
+	default:
+		return rc;
+	}
 }
 #endif
 

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

* [PATCH 3.16.y-ckt 074/165] drm/radeon: do a posting read in r100_set_irq
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (72 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 073/165] eCryptfs: don't pass fs-specific ioctl commands through Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 075/165] drm/radeon: do a posting read in rs600_set_irq Luis Henriques
                   ` (90 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit f957063fee6392bb9365370db6db74dc0b2dce0a upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/r100.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 7f64a30b50cd..0da2837bd099 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -723,6 +723,10 @@ int r100_irq_set(struct radeon_device *rdev)
 		tmp |= RADEON_FP2_DETECT_MASK;
 	}
 	WREG32(RADEON_GEN_INT_CNTL, tmp);
+
+	/* read back to post the write */
+	RREG32(RADEON_GEN_INT_CNTL);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 075/165] drm/radeon: do a posting read in rs600_set_irq
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (73 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 074/165] drm/radeon: do a posting read in r100_set_irq Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 076/165] drm/radeon: do a posting read in r600_set_irq Luis Henriques
                   ` (89 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 54acf107e4e66d1f4a697e08a7f60dba9fcf07c3 upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/rs600.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index d6e64b93d8b1..1016f53f755c 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -684,6 +684,10 @@ int rs600_irq_set(struct radeon_device *rdev)
 	WREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL, hpd2);
 	if (ASIC_IS_DCE2(rdev))
 		WREG32(R_007408_HDMI0_AUDIO_PACKET_CONTROL, hdmi0);
+
+	/* posting read */
+	RREG32(R_000040_GEN_INT_CNTL);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 076/165] drm/radeon: do a posting read in r600_set_irq
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (74 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 075/165] drm/radeon: do a posting read in rs600_set_irq Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 077/165] drm/radeon: do a posting read in evergreen_set_irq Luis Henriques
                   ` (88 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 9d1393f23d5656cdd5f368efd60694d4aeed81d3 upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/r600.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 44b046b4056f..5e31413fb454 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3637,6 +3637,9 @@ int r600_irq_set(struct radeon_device *rdev)
 		WREG32(RV770_CG_THERMAL_INT, thermal_int);
 	}
 
+	/* posting read */
+	RREG32(R_000E50_SRBM_STATUS);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 077/165] drm/radeon: do a posting read in evergreen_set_irq
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (75 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 076/165] drm/radeon: do a posting read in r600_set_irq Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 078/165] drm/radeon: do a posting read in si_set_irq Luis Henriques
                   ` (87 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit c320bb5f6dc0cb88a811cbaf839303e0a3916a92 upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/evergreen.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index d65a96562498..5428b692f9a2 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -4589,6 +4589,9 @@ int evergreen_irq_set(struct radeon_device *rdev)
 	WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, afmt5);
 	WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, afmt6);
 
+	/* posting read */
+	RREG32(SRBM_STATUS);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 078/165] drm/radeon: do a posting read in si_set_irq
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (76 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 077/165] drm/radeon: do a posting read in evergreen_set_irq Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 079/165] drm/radeon: do a posting read in cik_set_irq Luis Henriques
                   ` (86 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 0586915ec10d0ae60de5cd3381ad25a704760402 upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/si.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 23d0bbb64db5..74f41809bb42 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -5972,6 +5972,9 @@ int si_irq_set(struct radeon_device *rdev)
 
 	WREG32(CG_THERMAL_INT, thermal_int);
 
+	/* posting read */
+	RREG32(SRBM_STATUS);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 079/165] drm/radeon: do a posting read in cik_set_irq
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (77 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 078/165] drm/radeon: do a posting read in si_set_irq Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 080/165] drm/radeon: fix DRM_IOCTL_RADEON_CS oops Luis Henriques
                   ` (85 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit cffefd9bb31cd35ab745d3b49005d10616d25bdc upstream.

To make sure the writes go through the pci bridge.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=90741

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/cik.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index f898ed31cffb..574d1f4ec7e5 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -7185,6 +7185,9 @@ int cik_irq_set(struct radeon_device *rdev)
 	WREG32(DC_HPD5_INT_CONTROL, hpd5);
 	WREG32(DC_HPD6_INT_CONTROL, hpd6);
 
+	/* posting read */
+	RREG32(SRBM_STATUS);
+
 	return 0;
 }
 

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

* [PATCH 3.16.y-ckt 080/165] drm/radeon: fix DRM_IOCTL_RADEON_CS oops
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (78 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 079/165] drm/radeon: do a posting read in cik_set_irq Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 081/165] drm/radeon: fix interlaced modes on DCE8 Luis Henriques
                   ` (84 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tommi Rantala, Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tommi Rantala <tt.rantala@gmail.com>

commit a28b2a47edcd0cb7c051b445f71a426000394606 upstream.

Passing zeroed drm_radeon_cs struct to DRM_IOCTL_RADEON_CS produces the
following oops.

Fix by always calling INIT_LIST_HEAD() to avoid the crash in list_sort().

----------------------------------

 #include <stdint.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <drm/radeon_drm.h>

 static const struct drm_radeon_cs cs;

 int main(int argc, char **argv)
 {
         return ioctl(open(argv[1], O_RDWR), DRM_IOCTL_RADEON_CS, &cs);
 }

----------------------------------

[ttrantal@test2 ~]$ ./main /dev/dri/card0
[   46.904650] BUG: unable to handle kernel NULL pointer dereference at           (null)
[   46.905022] IP: [<ffffffff814d6df2>] list_sort+0x42/0x240
[   46.905022] PGD 68f29067 PUD 688b5067 PMD 0
[   46.905022] Oops: 0002 [#1] SMP
[   46.905022] CPU: 0 PID: 2413 Comm: main Not tainted 4.0.0-rc1+ #58
[   46.905022] Hardware name: Hewlett-Packard HP Compaq dc5750 Small Form Factor/0A64h, BIOS 786E3 v02.10 01/25/2007
[   46.905022] task: ffff880058e2bcc0 ti: ffff880058e64000 task.ti: ffff880058e64000
[   46.905022] RIP: 0010:[<ffffffff814d6df2>]  [<ffffffff814d6df2>] list_sort+0x42/0x240
[   46.905022] RSP: 0018:ffff880058e67998  EFLAGS: 00010246
[   46.905022] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[   46.905022] RDX: ffffffff81644410 RSI: ffff880058e67b40 RDI: ffff880058e67a58
[   46.905022] RBP: ffff880058e67a88 R08: 0000000000000000 R09: 0000000000000000
[   46.905022] R10: ffff880058e2bcc0 R11: ffffffff828e6ca0 R12: ffffffff81644410
[   46.905022] R13: ffff8800694b8018 R14: 0000000000000000 R15: ffff880058e679b0
[   46.905022] FS:  00007fdc65a65700(0000) GS:ffff88006d600000(0000) knlGS:0000000000000000
[   46.905022] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   46.905022] CR2: 0000000000000000 CR3: 0000000058dd9000 CR4: 00000000000006f0
[   46.905022] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   46.905022] DR3: 0000000000000000 DR6: 00000000ffff4ff0 DR7: 0000000000000400
[   46.905022] Stack:
[   46.905022]  ffff880058e67b40 ffff880058e2bcc0 ffff880058e67a78 0000000000000000
[   46.905022]  0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   46.905022]  0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   46.905022] Call Trace:
[   46.905022]  [<ffffffff81644a65>] radeon_cs_parser_fini+0x195/0x220
[   46.905022]  [<ffffffff81645069>] radeon_cs_ioctl+0xa9/0x960
[   46.905022]  [<ffffffff815e1f7c>] drm_ioctl+0x19c/0x640
[   46.905022]  [<ffffffff810f8fdd>] ? trace_hardirqs_on_caller+0xfd/0x1c0
[   46.905022]  [<ffffffff810f90ad>] ? trace_hardirqs_on+0xd/0x10
[   46.905022]  [<ffffffff8160c066>] radeon_drm_ioctl+0x46/0x80
[   46.905022]  [<ffffffff81211868>] do_vfs_ioctl+0x318/0x570
[   46.905022]  [<ffffffff81462ef6>] ? selinux_file_ioctl+0x56/0x110
[   46.905022]  [<ffffffff81211b41>] SyS_ioctl+0x81/0xa0
[   46.905022]  [<ffffffff81dc6312>] system_call_fastpath+0x12/0x17
[   46.905022] Code: 48 89 b5 10 ff ff ff 0f 84 03 01 00 00 4c 8d bd 28 ff ff
ff 31 c0 48 89 fb b9 15 00 00 00 49 89 d4 4c 89 ff f3 48 ab 48 8b 46 08 <48> c7
00 00 00 00 00 48 8b 0e 48 85 c9 0f 84 7d 00 00 00 c7 85
[   46.905022] RIP  [<ffffffff814d6df2>] list_sort+0x42/0x240
[   46.905022]  RSP <ffff880058e67998>
[   46.905022] CR2: 0000000000000000
[   47.149253] ---[ end trace 09576b4e8b2c20b8 ]---

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_cs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 4aa1ede7b7b5..ecaaec20655a 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -243,11 +243,13 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
 	u32 ring = RADEON_CS_RING_GFX;
 	s32 priority = 0;
 
+	INIT_LIST_HEAD(&p->validated);
+
 	if (!cs->num_chunks) {
 		return 0;
 	}
+
 	/* get chunks */
-	INIT_LIST_HEAD(&p->validated);
 	p->idx = 0;
 	p->ib.sa_bo = NULL;
 	p->ib.semaphore = NULL;

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

* [PATCH 3.16.y-ckt 081/165] drm/radeon: fix interlaced modes on DCE8
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (79 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 080/165] drm/radeon: fix DRM_IOCTL_RADEON_CS oops Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 082/165] ACPI / video: Load the module even if ACPI is disabled Luis Henriques
                   ` (83 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit 77ae5f4b48a0445426c9c1ef7c0f28b717e35d55 upstream.

Need to double the viewport height.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/atombios_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index dce0d3918fa7..9f0e62529c46 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1405,6 +1405,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
 	       (x << 16) | y);
 	viewport_w = crtc->mode.hdisplay;
 	viewport_h = (crtc->mode.vdisplay + 1) & ~1;
+	if ((rdev->family >= CHIP_BONAIRE) &&
+	    (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE))
+		viewport_h *= 2;
 	WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
 	       (viewport_w << 16) | viewport_h);
 

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

* [PATCH 3.16.y-ckt 082/165] ACPI / video: Load the module even if ACPI is disabled
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (80 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 081/165] drm/radeon: fix interlaced modes on DCE8 Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 083/165] ASoC: omap-pcm: Correct dma mask Luis Henriques
                   ` (82 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Wilson, Daniel Vetter, Jani Nikula, Rafael J. Wysocki,
	Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Wilson <chris@chris-wilson.co.uk>

commit 6e17cb12881ba8d5e456b89f072dc6b70048af36 upstream.

i915.ko depends upon the acpi/video.ko module and so refuses to load if
ACPI is disabled at runtime if for example the BIOS is broken beyond
repair. acpi/video provides an optional service for i915.ko and so we
should just allow the modules to load, but do no nothing in order to let
the machines boot correctly.

Reported-by: Bill Augur <bill-auger@programmer.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Acked-by: Aaron Lu <aaron.lu@intel.com>
[ rjw: Fixed up the new comment in acpi_video_init() ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/video.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 0f9bf52792b5..095b94f6b9d8 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -2301,6 +2301,17 @@ EXPORT_SYMBOL(acpi_video_unregister_backlight);
 
 static int __init acpi_video_init(void)
 {
+	/*
+	 * Let the module load even if ACPI is disabled (e.g. due to
+	 * a broken BIOS) so that i915.ko can still be loaded on such
+	 * old systems without an AcpiOpRegion.
+	 *
+	 * acpi_video_register() will report -ENODEV later as well due
+	 * to acpi_disabled when i915.ko tries to register itself afterwards.
+	 */
+	if (acpi_disabled)
+		return 0;
+
 	dmi_check_system(video_dmi_table);
 
 	if (intel_opregion_present())

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

* [PATCH 3.16.y-ckt 083/165] ASoC: omap-pcm: Correct dma mask
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (81 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 082/165] ACPI / video: Load the module even if ACPI is disabled Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 084/165] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization Luis Henriques
                   ` (81 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Ujfalusi, Mark Brown, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

commit d51199a83a2cf82a291d19ee852c44caa511427d upstream.

DMA_BIT_MASK of 64 is not valid dma address mask for OMAPs, it should be
set to 32.
The 64 was introduced by commit (in 2009):
a152ff24b978 ASoC: OMAP: Make DMA 64 aligned

But the dma_mask and coherent_dma_mask can not be used to specify alignment.

Fixes: a152ff24b978 (ASoC: OMAP: Make DMA 64 aligned)
Reported-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/omap/omap-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 8d809f8509c8..25ef4919813d 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -200,7 +200,7 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	struct snd_pcm *pcm = rtd->pcm;
 	int ret;
 
-	ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(64));
+	ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
 	if (ret)
 		return ret;
 

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

* [PATCH 3.16.y-ckt 084/165] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (82 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 083/165] ASoC: omap-pcm: Correct dma mask Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 085/165] Btrfs: fix data loss in the fast fsync path Luis Henriques
                   ` (80 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Lutomirski, Borislav Petkov, Denys Vlasenko, H. Peter Anvin,
	Linus Torvalds, Oleg Nesterov, Thomas Gleixner, Ingo Molnar,
	Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Lutomirski <luto@amacapital.net>

commit 956421fbb74c3a6261903f3836c0740187cf038b upstream.

'ret_from_fork' checks TIF_IA32 to determine whether 'pt_regs' and
the related state make sense for 'ret_from_sys_call'.  This is
entirely the wrong check.  TS_COMPAT would make a little more
sense, but there's really no point in keeping this optimization
at all.

This fixes a return to the wrong user CS if we came from int
0x80 in a 64-bit task.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/4710be56d76ef994ddf59087aad98c000fbab9a4.1424989793.git.luto@amacapital.net
[ Backported from tip:x86/asm. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/entry_64.S | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 902a14d02882..94aa18a9cc11 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -335,11 +335,14 @@ ENTRY(ret_from_fork)
 	testl $3, CS-ARGOFFSET(%rsp)		# from kernel_thread?
 	jz   1f
 
-	testl $_TIF_IA32, TI_flags(%rcx)	# 32-bit compat task needs IRET
-	jnz  int_ret_from_sys_call
-
-	RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET
-	jmp ret_from_sys_call			# go to the SYSRET fastpath
+	/*
+	 * By the time we get here, we have no idea whether our pt_regs,
+	 * ti flags, and ti status came from the 64-bit SYSCALL fast path,
+	 * the slow path, or one of the ia32entry paths.
+	 * Use int_ret_from_sys_call to return, since it can safely handle
+	 * all of the above.
+	 */
+	jmp  int_ret_from_sys_call
 
 1:
 	subq $REST_SKIP, %rsp	# leave space for volatiles

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

* [PATCH 3.16.y-ckt 085/165] Btrfs: fix data loss in the fast fsync path
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (83 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 084/165] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 086/165] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Luis Henriques
                   ` (79 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe Manana, Chris Mason, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Filipe Manana <fdmanana@suse.com>

commit 3a8b36f378060d20062a0918e99fae39ff077bf0 upstream.

When using the fast file fsync code path we can miss the fact that new
writes happened since the last file fsync and therefore return without
waiting for the IO to finish and write the new extents to the fsync log.

Here's an example scenario where the fsync will miss the fact that new
file data exists that wasn't yet durably persisted:

1. fs_info->last_trans_committed == N - 1 and current transaction is
   transaction N (fs_info->generation == N);

2. do a buffered write;

3. fsync our inode, this clears our inode's full sync flag, starts
   an ordered extent and waits for it to complete - when it completes
   at btrfs_finish_ordered_io(), the inode's last_trans is set to the
   value N (via btrfs_update_inode_fallback -> btrfs_update_inode ->
   btrfs_set_inode_last_trans);

4. transaction N is committed, so fs_info->last_trans_committed is now
   set to the value N and fs_info->generation remains with the value N;

5. do another buffered write, when this happens btrfs_file_write_iter
   sets our inode's last_trans to the value N + 1 (that is
   fs_info->generation + 1 == N + 1);

6. transaction N + 1 is started and fs_info->generation now has the
   value N + 1;

7. transaction N + 1 is committed, so fs_info->last_trans_committed
   is set to the value N + 1;

8. fsync our inode - because it doesn't have the full sync flag set,
   we only start the ordered extent, we don't wait for it to complete
   (only in a later phase) therefore its last_trans field has the
   value N + 1 set previously by btrfs_file_write_iter(), and so we
   have:

       inode->last_trans <= fs_info->last_trans_committed
           (N + 1)              (N + 1)

   Which made us not log the last buffered write and exit the fsync
   handler immediately, returning success (0) to user space and resulting
   in data loss after a crash.

This can actually be triggered deterministically and the following excerpt
from a testcase I made for xfstests triggers the issue. It moves a dummy
file across directories and then fsyncs the old parent directory - this
is just to trigger a transaction commit, so moving files around isn't
directly related to the issue but it was chosen because running 'sync' for
example does more than just committing the current transaction, as it
flushes/waits for all file data to be persisted. The issue can also happen
at random periods, since the transaction kthread periodicaly commits the
current transaction (about every 30 seconds by default).
The body of the test is:

  _scratch_mkfs >> $seqres.full 2>&1
  _init_flakey
  _mount_flakey

  # Create our main test file 'foo', the one we check for data loss.
  # By doing an fsync against our file, it makes btrfs clear the 'needs_full_sync'
  # bit from its flags (btrfs inode specific flags).
  $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 8K" \
                  -c "fsync" $SCRATCH_MNT/foo | _filter_xfs_io

  # Now create one other file and 2 directories. We will move this second file
  # from one directory to the other later because it forces btrfs to commit its
  # currently open transaction if we fsync the old parent directory. This is
  # necessary to trigger the data loss bug that affected btrfs.
  mkdir $SCRATCH_MNT/testdir_1
  touch $SCRATCH_MNT/testdir_1/bar
  mkdir $SCRATCH_MNT/testdir_2

  # Make sure everything is durably persisted.
  sync

  # Write more 8Kb of data to our file.
  $XFS_IO_PROG -c "pwrite -S 0xbb 8K 8K" $SCRATCH_MNT/foo | _filter_xfs_io

  # Move our 'bar' file into a new directory.
  mv $SCRATCH_MNT/testdir_1/bar $SCRATCH_MNT/testdir_2/bar

  # Fsync our first directory. Because it had a file moved into some other
  # directory, this made btrfs commit the currently open transaction. This is
  # a condition necessary to trigger the data loss bug.
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir_1

  # Now fsync our main test file. If the fsync succeeds, we expect the 8Kb of
  # data we wrote previously to be persisted and available if a crash happens.
  # This did not happen with btrfs, because of the transaction commit that
  # happened when we fsynced the parent directory.
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo

  # Simulate a crash/power loss.
  _load_flakey_table $FLAKEY_DROP_WRITES
  _unmount_flakey

  _load_flakey_table $FLAKEY_ALLOW_WRITES
  _mount_flakey

  # Now check that all data we wrote before are available.
  echo "File content after log replay:"
  od -t x1 $SCRATCH_MNT/foo

  status=0
  exit

The expected golden output for the test, which is what we get with this
fix applied (or when running against ext3/4 and xfs), is:

  wrote 8192/8192 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  wrote 8192/8192 bytes at offset 8192
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  File content after log replay:
  0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
  *
  0020000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
  *
  0040000

Without this fix applied, the output shows the test file does not have
the second 8Kb extent that we successfully fsynced:

  wrote 8192/8192 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  wrote 8192/8192 bytes at offset 8192
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  File content after log replay:
  0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
  *
  0020000

So fix this by skipping the fsync only if we're doing a full sync and
if the inode's last_trans is <= fs_info->last_trans_committed, or if
the inode is already in the log. Also remove setting the inode's
last_trans in btrfs_file_write_iter since it's useless/unreliable.

Also because btrfs_file_write_iter no longer sets inode->last_trans to
fs_info->generation + 1, don't set last_trans to 0 if we bail out and don't
bail out if last_trans is 0, otherwise something as simple as the following
example wouldn't log the second write on the last fsync:

  1. write to file

  2. fsync file

  3. fsync file
       |--> btrfs_inode_in_log() returns true and it set last_trans to 0

  4. write to file
       |--> btrfs_file_write_iter() no longers sets last_trans, so it
            remained with a value of 0
  5. fsync
       |--> inode->last_trans == 0, so it bails out without logging the
            second write

A test case for xfstests will be sent soon.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/file.c | 56 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 2a15294f1683..39aa46612541 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1806,22 +1806,10 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,
 	mutex_unlock(&inode->i_mutex);
 
 	/*
-	 * we want to make sure fsync finds this change
-	 * but we haven't joined a transaction running right now.
-	 *
-	 * Later on, someone is sure to update the inode and get the
-	 * real transid recorded.
-	 *
-	 * We set last_trans now to the fs_info generation + 1,
-	 * this will either be one more than the running transaction
-	 * or the generation used for the next transaction if there isn't
-	 * one running right now.
-	 *
 	 * We also have to set last_sub_trans to the current log transid,
 	 * otherwise subsequent syncs to a file that's been synced in this
 	 * transaction will appear to have already occured.
 	 */
-	BTRFS_I(inode)->last_trans = root->fs_info->generation + 1;
 	BTRFS_I(inode)->last_sub_trans = root->log_transid;
 	if (num_written > 0) {
 		err = generic_write_sync(file, pos, num_written);
@@ -1909,25 +1897,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	atomic_inc(&root->log_batch);
 
 	/*
-	 * check the transaction that last modified this inode
-	 * and see if its already been committed
-	 */
-	if (!BTRFS_I(inode)->last_trans) {
-		mutex_unlock(&inode->i_mutex);
-		goto out;
-	}
-
-	/*
-	 * if the last transaction that changed this file was before
-	 * the current transaction, we can bail out now without any
-	 * syncing
+	 * If the last transaction that changed this file was before the current
+	 * transaction and we have the full sync flag set in our inode, we can
+	 * bail out now without any syncing.
+	 *
+	 * Note that we can't bail out if the full sync flag isn't set. This is
+	 * because when the full sync flag is set we start all ordered extents
+	 * and wait for them to fully complete - when they complete they update
+	 * the inode's last_trans field through:
+	 *
+	 *     btrfs_finish_ordered_io() ->
+	 *         btrfs_update_inode_fallback() ->
+	 *             btrfs_update_inode() ->
+	 *                 btrfs_set_inode_last_trans()
+	 *
+	 * So we are sure that last_trans is up to date and can do this check to
+	 * bail out safely. For the fast path, when the full sync flag is not
+	 * set in our inode, we can not do it because we start only our ordered
+	 * extents and don't wait for them to complete (that is when
+	 * btrfs_finish_ordered_io runs), so here at this point their last_trans
+	 * value might be less than or equals to fs_info->last_trans_committed,
+	 * and setting a speculative last_trans for an inode when a buffered
+	 * write is made (such as fs_info->generation + 1 for example) would not
+	 * be reliable since after setting the value and before fsync is called
+	 * any number of transactions can start and commit (transaction kthread
+	 * commits the current transaction periodically), and a transaction
+	 * commit does not start nor waits for ordered extents to complete.
 	 */
 	smp_mb();
 	if (btrfs_inode_in_log(inode, root->fs_info->generation) ||
-	    BTRFS_I(inode)->last_trans <=
-	    root->fs_info->last_trans_committed) {
-		BTRFS_I(inode)->last_trans = 0;
-
+	    (full_sync && BTRFS_I(inode)->last_trans <=
+	     root->fs_info->last_trans_committed)) {
 		/*
 		 * We'v had everything committed since the last time we were
 		 * modified so clear this flag in case it was set for whatever

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

* [PATCH 3.16.y-ckt 086/165] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref.
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (84 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 085/165] Btrfs: fix data loss in the fast fsync path Luis Henriques
@ 2015-03-25 14:00 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 087/165] xhci: fix reporting of 0-sized URBs in control endpoint Luis Henriques
                   ` (78 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Quentin Casasnovas, Chris Mason, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Quentin Casasnovas <quentin.casasnovas@oracle.com>

commit dd9ef135e3542ffc621c4eb7f0091870ec7a1504 upstream.

Improper arithmetics when calculting the address of the extended ref could
lead to an out of bounds memory read and kernel panic.

Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/tree-log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 76bbe6557eb6..0a8194955e6b 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1007,7 +1007,7 @@ again:
 		base = btrfs_item_ptr_offset(leaf, path->slots[0]);
 
 		while (cur_offset < item_size) {
-			extref = (struct btrfs_inode_extref *)base + cur_offset;
+			extref = (struct btrfs_inode_extref *)(base + cur_offset);
 
 			victim_name_len = btrfs_inode_extref_name_len(leaf, extref);
 

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

* [PATCH 3.16.y-ckt 087/165] xhci: fix reporting of 0-sized URBs in control endpoint
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (85 preceding siblings ...)
  2015-03-25 14:00 ` [PATCH 3.16.y-ckt 086/165] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 088/165] xhci: Workaround for PME stuck issues in Intel xhci Luis Henriques
                   ` (77 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Aleksander Morgado, Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Aleksander Morgado <aleksander@aleksander.es>

commit 45ba2154d12fc43b70312198ec47085f10be801a upstream.

When a control transfer has a short data stage, the xHCI controller generates
two transfer events: a COMP_SHORT_TX event that specifies the untransferred
amount, and a COMP_SUCCESS event. But when the data stage is not short, only the
COMP_SUCCESS event occurs. Therefore, xhci-hcd must set urb->actual_length to
urb->transfer_buffer_length while processing the COMP_SUCCESS event, unless
urb->actual_length was set already by a previous COMP_SHORT_TX event.

The driver checks this by seeing whether urb->actual_length == 0, but this alone
is the wrong test, as it is entirely possible for a short transfer to have an
urb->actual_length = 0.

This patch changes the xhci driver to rely on a new td->urb_length_set flag,
which is set to true when a COMP_SHORT_TX event is received and the URB length
updated at that stage.

This fixes a bug which affected the HSO plugin, which relies on URBs with
urb->actual_length == 0 to halt re-submitting the RX URB in the control
endpoint.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-ring.c | 10 ++++++++--
 drivers/usb/host/xhci.h      |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 17df04a2d18b..5e4e1d1d7de7 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1981,7 +1981,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
 	if (event_trb != ep_ring->dequeue) {
 		/* The event was for the status stage */
 		if (event_trb == td->last_trb) {
-			if (td->urb->actual_length != 0) {
+			if (td->urb_length_set) {
 				/* Don't overwrite a previously set error code
 				 */
 				if ((*status == -EINPROGRESS || *status == 0) &&
@@ -1995,7 +1995,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
 					td->urb->transfer_buffer_length;
 			}
 		} else {
-		/* Maybe the event was for the data stage? */
+			/*
+			 * Maybe the event was for the data stage? If so, update
+			 * already the actual_length of the URB and flag it as
+			 * set, so that it is not overwritten in the event for
+			 * the last TRB.
+			 */
+			td->urb_length_set = true;
 			td->urb->actual_length =
 				td->urb->transfer_buffer_length -
 				EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index c57261affada..5b6a8ddda5cb 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1,3 +1,4 @@
+
 /*
  * xHCI host controller driver
  *
@@ -1289,6 +1290,8 @@ struct xhci_td {
 	struct xhci_segment	*start_seg;
 	union xhci_trb		*first_trb;
 	union xhci_trb		*last_trb;
+	/* actual_length of the URB has already been set */
+	bool			urb_length_set;
 };
 
 /* xHCI command default timeout value */

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

* [PATCH 3.16.y-ckt 088/165] xhci: Workaround for PME stuck issues in Intel xhci
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (86 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 087/165] xhci: fix reporting of 0-sized URBs in control endpoint Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 089/165] Change email address for 8250_pci Luis Henriques
                   ` (76 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mathias Nyman, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit b8cb91e058cd0c0f02059c1207293c5b31d350fa upstream.

The xhci in Intel Sunrisepoint and Cherryview platforms need a driver
workaround for a Stuck PME that might either block PME events in suspend,
or create spurious PME events preventing runtime suspend.

Workaround is to clear a internal PME flag, BIT(28) in a vendor specific
PMCTRL register at offset 0x80a4, in both suspend resume callbacks

Without this, xhci connected usb devices might never be able to wake up the
system from suspend, or prevent device from going to suspend (xhci d3)

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-pci.c | 30 ++++++++++++++++++++++++++++++
 drivers/usb/host/xhci.h     |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fd8c8e669cac..c947bfd260a9 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -37,6 +37,9 @@
 
 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI	0x8c31
 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI	0x9c31
+#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI		0x22b5
+#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI		0xa12f
+#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI	0x9d2f
 
 static const char hcd_name[] = "xhci_hcd";
 
@@ -131,6 +134,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
 		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
 	}
+	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
+		(pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
+		 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
+		 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI)) {
+		xhci->quirks |= XHCI_PME_STUCK_QUIRK;
+	}
 	if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
 			pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
 		xhci->quirks |= XHCI_RESET_ON_RESUME;
@@ -157,6 +166,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 				"QUIRK: Resetting on resume");
 }
 
+/*
+ * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
+ * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4
+ */
+static void xhci_pme_quirk(struct xhci_hcd *xhci)
+{
+	u32 val;
+	void __iomem *reg;
+
+	reg = (void __iomem *) xhci->cap_regs + 0x80a4;
+	val = readl(reg);
+	writel(val | BIT(28), reg);
+	readl(reg);
+}
+
 /* called during probe() after chip reset completes */
 static int xhci_pci_setup(struct usb_hcd *hcd)
 {
@@ -281,6 +305,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	if (xhci_compliance_mode_recovery_timer_quirk_check())
 		pdev->no_d3cold = true;
 
+	if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
+		xhci_pme_quirk(xhci);
+
 	return xhci_suspend(xhci, do_wakeup);
 }
 
@@ -311,6 +338,9 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL)
 		usb_enable_intel_xhci_ports(pdev);
 
+	if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
+		xhci_pme_quirk(xhci);
+
 	retval = xhci_resume(xhci, hibernated);
 	return retval;
 }
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 5b6a8ddda5cb..d40a72b69f26 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1564,6 +1564,7 @@ struct xhci_hcd {
 #define XHCI_SPURIOUS_WAKEUP	(1 << 18)
 /* For controllers with a broken beyond repair streams implementation */
 #define XHCI_BROKEN_STREAMS	(1 << 19)
+#define XHCI_PME_STUCK_QUIRK	(1 << 20)
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
 	/* There are two roothubs to keep track of bus suspend info for */

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

* [PATCH 3.16.y-ckt 089/165] Change email address for 8250_pci
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (87 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 088/165] xhci: Workaround for PME stuck issues in Intel xhci Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 090/165] tty: fix up atime/mtime mess, take four Luis Henriques
                   ` (75 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Russell King, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit f2e0ea861117bda073d1d7ffbd3120c07c0d5d34 upstream.

I'm still receiving reports to my email address, so let's point this
at the linux-serial mailing list instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/serial/8250/8250_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 370f6e46caf5..18a2660ff734 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -66,7 +66,7 @@ static void moan_device(const char *str, struct pci_dev *dev)
 	       "Please send the output of lspci -vv, this\n"
 	       "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n"
 	       "manufacturer and name of serial board or\n"
-	       "modem board to rmk+serial@arm.linux.org.uk.\n",
+	       "modem board to <linux-serial@vger.kernel.org>.\n",
 	       pci_name(dev), str, dev->vendor, dev->device,
 	       dev->subsystem_vendor, dev->subsystem_device);
 }

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

* [PATCH 3.16.y-ckt 090/165] tty: fix up atime/mtime mess, take four
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (88 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 089/165] Change email address for 8250_pci Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 091/165] console: Fix console name size mismatch Luis Henriques
                   ` (74 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Slaby, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Slaby <jslaby@suse.cz>

commit f0bf0bd07943bfde8f5ac39a32664810a379c7d3 upstream.

This problem was taken care of three times already in
* b0de59b5733d18b0d1974a060860a8b5c1b36a2e (TTY: do not update
  atime/mtime on read/write),
* 37b7f3c76595e23257f61bd80b223de8658617ee (TTY: fix atime/mtime
  regression), and
* b0b885657b6c8ef63a46bc9299b2a7715d19acde (tty: fix up atime/mtime
  mess, take three)

But it still misses one point. As John Paul correctly points out, we
do not care about setting date. If somebody ever changes wall
time backwards (by mistake for example), tty timestamps are never
updated until the original wall time passes.

So check the absolute difference of times and if it large than "8
seconds or so", always update the time. That means we will update
immediatelly when changing time. Ergo, CAP_SYS_TIME can foul the
check, but it was always that way.

Thanks John for serving me this so nicely debugged.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: John Paul Perry <john_paul.perry@alcatel-lucent.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/tty_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index fd4095cd4bd6..3ab9cca090be 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -996,8 +996,8 @@ EXPORT_SYMBOL(start_tty);
 /* We limit tty time update visibility to every 8 seconds or so. */
 static void tty_update_time(struct timespec *time)
 {
-	unsigned long sec = get_seconds() & ~7;
-	if ((long)(sec - time->tv_sec) > 0)
+	unsigned long sec = get_seconds();
+	if (abs(sec - time->tv_sec) & ~7)
 		time->tv_sec = sec;
 }
 

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

* [PATCH 3.16.y-ckt 091/165] console: Fix console name size mismatch
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (89 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 090/165] tty: fix up atime/mtime mess, take four Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 092/165] net: irda: fix wait_until_sent poll timeout Luis Henriques
                   ` (73 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Hurley <peter@hurleysoftware.com>

commit 30a22c215a0007603ffc08021f2e8b64018517dd upstream.

commit 6ae9200f2cab7 ("enlarge console.name") increased the storage
for the console name to 16 bytes, but not the corresponding
struct console_cmdline::name storage. Console names longer than
8 bytes cause read beyond end-of-string and failure to match
console; I'm not sure if there are other unexpected consequences.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/printk/console_cmdline.h | 2 +-
 kernel/printk/printk.c          | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h
index cbd69d842341..2ca4a8b5fe57 100644
--- a/kernel/printk/console_cmdline.h
+++ b/kernel/printk/console_cmdline.h
@@ -3,7 +3,7 @@
 
 struct console_cmdline
 {
-	char	name[8];			/* Name of the driver	    */
+	char	name[16];			/* Name of the driver	    */
 	int	index;				/* Minor dev. to use	    */
 	char	*options;			/* Options for the driver   */
 #ifdef CONFIG_A11Y_BRAILLE_CONSOLE
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 971285d5b7a0..cce20d2f38d5 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2388,6 +2388,7 @@ void register_console(struct console *newcon)
 	for (i = 0, c = console_cmdline;
 	     i < MAX_CMDLINECONSOLES && c->name[0];
 	     i++, c++) {
+		BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name));
 		if (strcmp(c->name, newcon->name) != 0)
 			continue;
 		if (newcon->index >= 0 &&

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

* [PATCH 3.16.y-ckt 092/165] net: irda: fix wait_until_sent poll timeout
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (90 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 091/165] console: Fix console name size mismatch Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 093/165] USB: serial: fix infinite wait_until_sent timeout Luis Henriques
                   ` (72 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 2c3fbe3cf28fbd7001545a92a83b4f8acfd9fa36 upstream.

In case an infinite timeout (0) is requested, the irda wait_until_sent
implementation would use a zero poll timeout rather than the default
200ms.

Note that wait_until_sent is currently never called with a 0-timeout
argument due to a bug in tty_wait_until_sent.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/irda/ircomm/ircomm_tty.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 2ba8b9705bb7..fdcb9688b5d3 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -818,7 +818,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
 	orig_jiffies = jiffies;
 
 	/* Set poll time to 200 ms */
-	poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200));
+	poll_time = msecs_to_jiffies(200);
+	if (timeout)
+		poll_time = min_t(unsigned long, timeout, poll_time);
 
 	spin_lock_irqsave(&self->spinlock, flags);
 	while (self->tx_skb && self->tx_skb->len) {

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

* [PATCH 3.16.y-ckt 093/165] USB: serial: fix infinite wait_until_sent timeout
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (91 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 092/165] net: irda: fix wait_until_sent poll timeout Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 094/165] TTY: fix tty_wait_until_sent on 64-bit machines Luis Henriques
                   ` (71 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit f528bf4f57e43d1af4b2a5c97f09e43e0338c105 upstream.

Make sure to handle an infinite timeout (0).

Note that wait_until_sent is currently never called with a 0-timeout
argument due to a bug in tty_wait_until_sent.

Fixes: dcf010503966 ("USB: serial: add generic wait_until_sent
implementation")

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/generic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 1bd192290b08..904ab353ecf2 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -258,7 +258,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
 	 * character or at least one jiffy.
 	 */
 	period = max_t(unsigned long, (10 * HZ / bps), 1);
-	period = min_t(unsigned long, period, timeout);
+	if (timeout)
+		period = min_t(unsigned long, period, timeout);
 
 	dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
 					__func__, jiffies_to_msecs(timeout),
@@ -268,7 +269,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
 		schedule_timeout_interruptible(period);
 		if (signal_pending(current))
 			break;
-		if (time_after(jiffies, expire))
+		if (timeout && time_after(jiffies, expire))
 			break;
 	}
 }

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

* [PATCH 3.16.y-ckt 094/165] TTY: fix tty_wait_until_sent on 64-bit machines
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (92 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 093/165] USB: serial: fix infinite wait_until_sent timeout Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 095/165] sunrpc: fix braino in ->poll() Luis Henriques
                   ` (70 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 79fbf4a550ed6a22e1ae1516113e6c7fa5d56a53 upstream.

Fix overflow bug in tty_wait_until_sent on 64-bit machines, where an
infinite timeout (0) would be passed to the underlying tty-driver's
wait_until_sent-operation as a negative timeout (-1), causing it to
return immediately.

This manifests itself for example as tcdrain() returning immediately,
drivers not honouring the drain flags when setting terminal attributes,
or even dropped data on close as a requested infinite closing-wait
timeout would be ignored.

The first symptom  was reported by Asier LLANO who noted that tcdrain()
returned prematurely when using the ftdi_sio usb-serial driver.

Fix this by passing 0 rather than MAX_SCHEDULE_TIMEOUT (LONG_MAX) to the
underlying tty driver.

Note that the serial-core wait_until_sent-implementation is not affected
by this bug due to a lucky chance (comparison to an unsigned maximum
timeout), and neither is the cyclades one that had an explicit check for
negative timeouts, but all other tty drivers appear to be affected.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: ZIV-Asier Llano Palacios <asier.llano@cgglobal.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/tty_ioctl.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 6fd60fece6b4..22da05d27009 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)
 #endif
 	if (!timeout)
 		timeout = MAX_SCHEDULE_TIMEOUT;
+
 	if (wait_event_interruptible_timeout(tty->write_wait,
-			!tty_chars_in_buffer(tty), timeout) >= 0) {
-		if (tty->ops->wait_until_sent)
-			tty->ops->wait_until_sent(tty, timeout);
+			!tty_chars_in_buffer(tty), timeout) < 0) {
+		return;
 	}
+
+	if (timeout == MAX_SCHEDULE_TIMEOUT)
+		timeout = 0;
+
+	if (tty->ops->wait_until_sent)
+		tty->ops->wait_until_sent(tty, timeout);
 }
 EXPORT_SYMBOL(tty_wait_until_sent);
 

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

* [PATCH 3.16.y-ckt 095/165] sunrpc: fix braino in ->poll()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (93 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 094/165] TTY: fix tty_wait_until_sent on 64-bit machines Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 096/165] svcrpc: fix memory leak in gssp_accept_sec_context_upcall Luis Henriques
                   ` (69 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Al Viro, Bruce Fields, Linus Torvalds, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@ZenIV.linux.org.uk>

commit 1711fd9addf214823b993468567cab1f8254fc51 upstream.

POLL_OUT isn't what callers of ->poll() are expecting to see; it's
actually __SI_POLL | 2 and it's a siginfo code, not a poll bitmap
bit...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Bruce Fields <bfields@fieldses.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sunrpc/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 066362141133..48f14003af10 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -920,7 +920,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait,
 	poll_wait(filp, &queue_wait, wait);
 
 	/* alway allow write */
-	mask = POLL_OUT | POLLWRNORM;
+	mask = POLLOUT | POLLWRNORM;
 
 	if (!rp)
 		return mask;

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

* [PATCH 3.16.y-ckt 096/165] svcrpc: fix memory leak in gssp_accept_sec_context_upcall
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (94 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 095/165] sunrpc: fix braino in ->poll() Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 097/165] SUNRPC: Always manipulate rpc_rqst::rq_bc_pa_list under xprt->bc_pa_lock Luis Henriques
                   ` (68 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David A. Ramos, J. Bruce Fields, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Ramos <daramos@stanford.edu>

commit a1d1e9be5a1dafe0ddc2181a9201c2ae29c71eff upstream.

Our UC-KLEE tool found a kernel memory leak of 512 bytes (on x86_64) for
each call to gssp_accept_sec_context_upcall()
(net/sunrpc/auth_gss/gss_rpc_upcall.c). Since it appears that this call
can be triggered by remote connections (at least, from a cursory a
glance at the call chain), it may be exploitable to cause kernel memory
exhaustion. We found the bug in kernel 3.16.3, but it appears to date
back to commit 9dfd87da1aeb0fd364167ad199f40fe96a6a87be (2013-08-20).

The gssp_accept_sec_context_upcall() function performs a pair of calls
to gssp_alloc_receive_pages() and gssp_free_receive_pages().  The first
allocates memory for arg->pages.  The second then frees the pages
pointed to by the arg->pages array, but not the array itself.

Reported-by: David A. Ramos <daramos@stanford.edu>
Fixes: 9dfd87da1aeb ("rpc: fix huge kmalloc's in gss-proxy”)
Signed-off-by: David A. Ramos <daramos@stanford.edu>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sunrpc/auth_gss/gss_rpc_upcall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c
index abbb7dcd1689..59eeed43eda2 100644
--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -217,6 +217,8 @@ static void gssp_free_receive_pages(struct gssx_arg_accept_sec_context *arg)
 
 	for (i = 0; i < arg->npages && arg->pages[i]; i++)
 		__free_page(arg->pages[i]);
+
+	kfree(arg->pages);
 }
 
 static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)

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

* [PATCH 3.16.y-ckt 097/165] SUNRPC: Always manipulate rpc_rqst::rq_bc_pa_list under xprt->bc_pa_lock
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (95 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 096/165] svcrpc: fix memory leak in gssp_accept_sec_context_upcall Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 098/165] ath5k: fix spontaneus AR5312 freezes Luis Henriques
                   ` (67 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chuck Lever, Trond Myklebust, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chuck Lever <chuck.lever@oracle.com>

commit 813b00d63f6ca1ed40a2f4f9c034d59bc424025e upstream.

Other code that accesses rq_bc_pa_list holds xprt->bc_pa_lock.
xprt_complete_bc_request() should do the same.

Fixes: 2ea24497a1b3 ("SUNRPC: RPC callbacks may be split . . .")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sunrpc/backchannel_rqst.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
index 9761a0da964d..1bb4d26fbd6b 100644
--- a/net/sunrpc/backchannel_rqst.c
+++ b/net/sunrpc/backchannel_rqst.c
@@ -309,12 +309,15 @@ void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied)
 	struct rpc_xprt *xprt = req->rq_xprt;
 	struct svc_serv *bc_serv = xprt->bc_serv;
 
+	spin_lock(&xprt->bc_pa_lock);
+	list_del(&req->rq_bc_pa_list);
+	spin_unlock(&xprt->bc_pa_lock);
+
 	req->rq_private_buf.len = copied;
 	set_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
 
 	dprintk("RPC:       add callback request to list\n");
 	spin_lock(&bc_serv->sv_cb_lock);
-	list_del(&req->rq_bc_pa_list);
 	list_add(&req->rq_bc_list, &bc_serv->sv_cb_list);
 	wake_up(&bc_serv->sv_cb_waitq);
 	spin_unlock(&bc_serv->sv_cb_lock);

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

* [PATCH 3.16.y-ckt 098/165] ath5k: fix spontaneus AR5312 freezes
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (96 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 097/165] SUNRPC: Always manipulate rpc_rqst::rq_bc_pa_list under xprt->bc_pa_lock Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 099/165] net: cls_bpf: fix size mismatch on filter preparation Luis Henriques
                   ` (66 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Slaby, Nick Kossifidis, Luis R. Rodriguez, Sergey Ryazanov,
	Kalle Valo, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sergey Ryazanov <ryazanov.s.a@gmail.com>

commit 8bfae4f9938b6c1f033a5159febe97e441d6d526 upstream.

Sometimes while CPU have some load and ath5k doing the wireless
interface reset the whole WiSoC completely freezes. Set of tests shows
that using atomic delay function while we wait interface reset helps to
avoid such freezes.

The easiest way to reproduce this issue: create a station interface,
start continous scan with wpa_supplicant and load CPU by something. Or
just create multiple station interfaces and put them all in continous
scan.

This patch partially reverts the commit 1846ac3dbec0 ("ath5k: Use
usleep_range where possible"), which replaces initial udelay()
by usleep_range().

I do not know actual source of this issue, but all looks like that HW
freeze is caused by transaction on internal SoC bus, while wireless
block is in reset state.

Also I should note that I do not know how many chips are affected, but I
did not see this issue with chips, other than AR5312.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Fixes: 1846ac3dbec0 ("ath5k: Use usleep_range where possible")
Reported-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/ath/ath5k/reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index a3399c4f13a9..b9b651ea9851 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags)
 	regval = ioread32(reg);
 	iowrite32(regval | val, reg);
 	regval = ioread32(reg);
-	usleep_range(100, 150);
+	udelay(100);	/* NB: should be atomic */
 
 	/* Bring BB/MAC out of reset */
 	iowrite32(regval & ~val, reg);

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

* [PATCH 3.16.y-ckt 099/165] net: cls_bpf: fix size mismatch on filter preparation
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (97 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 098/165] ath5k: fix spontaneus AR5312 freezes Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 100/165] net: cls_bpf: fix auto generation of per list handles Luis Henriques
                   ` (65 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <dborkman@redhat.com>

commit 7913ecf69e24bd7575e0d0325eda3b43c8cfa749 upstream.

In cls_bpf_modify_existing(), we read out the number of filter blocks,
do some sanity checks, allocate a block on that size, and copy over the
BPF instruction blob from user space, then pass everything through the
classic BPF checker prior to installation of the classifier.

We should reject mismatches here, there are 2 scenarios: the number of
filter blocks could be smaller than the provided instruction blob, so
we do a partial copy of the BPF program, and thus the instructions will
either be rejected from the verifier or a valid BPF program will be run;
in the other case, we'll end up copying more than we're supposed to,
and most likely the trailing garbage will be rejected by the verifier
as well (i.e. we need to fit instruction pattern, ret {A,K} needs to be
last instruction, load/stores must be correct, etc); in case not, we
would leak memory when dumping back instruction patterns. The code should
have only used nla_len() as Dave noted to avoid this from the beginning.
Anyway, lets fix it by rejecting such load attempts.

Fixes: 7d1d65cb84e1 ("net: sched: cls_bpf: add BPF-based classifier")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sched/cls_bpf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index 13f64df2c710..87f2f1b17181 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -182,6 +182,11 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp,
 	}
 
 	bpf_size = bpf_len * sizeof(*bpf_ops);
+	if (bpf_size != nla_len(tb[TCA_BPF_OPS])) {
+		ret = -EINVAL;
+		goto errout;
+	}
+
 	bpf_ops = kzalloc(bpf_size, GFP_KERNEL);
 	if (bpf_ops == NULL) {
 		ret = -ENOMEM;

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

* [PATCH 3.16.y-ckt 100/165] net: cls_bpf: fix auto generation of per list handles
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (98 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 099/165] net: cls_bpf: fix size mismatch on filter preparation Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 101/165] qlge: Fix qlge_update_hw_vlan_features to handle if interface is down Luis Henriques
                   ` (64 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Borkmann, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <dborkman@redhat.com>

commit 3f2ab135946dcd4eb6af92a53d6d4bd35e7526ca upstream.

When creating a bpf classifier in tc with priority collisions and
invoking automatic unique handle assignment, cls_bpf_grab_new_handle()
will return a wrong handle id which in fact is non-unique. Usually
altering of specific filters is being addressed over major id, but
in case of collisions we result in a filter chain, where handle ids
address individual cls_bpf_progs inside the classifier.

Issue is, in cls_bpf_grab_new_handle() we probe for head->hgen handle
in cls_bpf_get() and in case we found a free handle, we're supposed
to use exactly head->hgen. In case of insufficient numbers of handles,
we bail out later as handle id 0 is not allowed.

Fixes: 7d1d65cb84e1 ("net: sched: cls_bpf: add BPF-based classifier")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sched/cls_bpf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index 87f2f1b17181..d2f034cf6055 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -233,15 +233,21 @@ static u32 cls_bpf_grab_new_handle(struct tcf_proto *tp,
 				   struct cls_bpf_head *head)
 {
 	unsigned int i = 0x80000000;
+	u32 handle;
 
 	do {
 		if (++head->hgen == 0x7FFFFFFF)
 			head->hgen = 1;
 	} while (--i > 0 && cls_bpf_get(tp, head->hgen));
-	if (i == 0)
+
+	if (unlikely(i == 0)) {
 		pr_err("Insufficient number of handles\n");
+		handle = 0;
+	} else {
+		handle = head->hgen;
+	}
 
-	return i;
+	return handle;
 }
 
 static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,

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

* [PATCH 3.16.y-ckt 101/165] qlge: Fix qlge_update_hw_vlan_features to handle if interface is down
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (99 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 100/165] net: cls_bpf: fix auto generation of per list handles Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 102/165] ip6_gre: fix endianness errors in ip6gre_err Luis Henriques
                   ` (63 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Harish Patil, Marcelo Ricardo Leitner, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcelo Leitner <mleitner@redhat.com>

commit 61132bf7fbe3a802df1f68ad08e8ca10d6b30ddc upstream.

Currently qlge_update_hw_vlan_features() will always first put the
interface down, then update features and then bring it up again. But it
is possible to hit this code while the adapter is down and this causes a
non-paired call to napi_disable(), which will get stuck.

This patch fixes it by skipping these down/up actions if the interface
is already down.

Fixes: a45adbe8d352 ("qlge: Enhance nested VLAN (Q-in-Q) handling.")
Cc: Harish Patil <harish.patil@qlogic.com>
Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index b40050e03a56..078da66132d5 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -2351,23 +2351,29 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev,
 {
 	struct ql_adapter *qdev = netdev_priv(ndev);
 	int status = 0;
+	bool need_restart = netif_running(ndev);
 
-	status = ql_adapter_down(qdev);
-	if (status) {
-		netif_err(qdev, link, qdev->ndev,
-			  "Failed to bring down the adapter\n");
-		return status;
+	if (need_restart) {
+		status = ql_adapter_down(qdev);
+		if (status) {
+			netif_err(qdev, link, qdev->ndev,
+				  "Failed to bring down the adapter\n");
+			return status;
+		}
 	}
 
 	/* update the features with resent change */
 	ndev->features = features;
 
-	status = ql_adapter_up(qdev);
-	if (status) {
-		netif_err(qdev, link, qdev->ndev,
-			  "Failed to bring up the adapter\n");
-		return status;
+	if (need_restart) {
+		status = ql_adapter_up(qdev);
+		if (status) {
+			netif_err(qdev, link, qdev->ndev,
+				  "Failed to bring up the adapter\n");
+			return status;
+		}
 	}
+
 	return status;
 }
 

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

* [PATCH 3.16.y-ckt 102/165] ip6_gre: fix endianness errors in ip6gre_err
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (100 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 101/165] qlge: Fix qlge_update_hw_vlan_features to handle if interface is down Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 103/165] PCI: Don't read past the end of sysfs "driver_override" buffer Luis Henriques
                   ` (62 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sabrina Dubroca, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sabrina Dubroca <sd@queasysnail.net>

commit d1e158e2d7a0a91110b206653f0e02376e809150 upstream.

info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/ip6_gre.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 0baac7127c57..07506e7a8917 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -414,7 +414,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		if (code == ICMPV6_HDR_FIELD)
 			teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
 
-		if (teli && teli == info - 2) {
+		if (teli && teli == be32_to_cpu(info) - 2) {
 			tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
 			if (tel->encap_limit == 0) {
 				net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
@@ -426,7 +426,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		}
 		break;
 	case ICMPV6_PKT_TOOBIG:
-		mtu = info - offset;
+		mtu = be32_to_cpu(info) - offset;
 		if (mtu < IPV6_MIN_MTU)
 			mtu = IPV6_MIN_MTU;
 		t->dev->mtu = mtu;

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

* [PATCH 3.16.y-ckt 103/165] PCI: Don't read past the end of sysfs "driver_override" buffer
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (101 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 102/165] ip6_gre: fix endianness errors in ip6gre_err Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 104/165] spi: dw: revisit FIFO size detection again Luis Henriques
                   ` (61 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sasha Levin, Bjorn Helgaas, Konrad Rzeszutek Wilk,
	Alexander Graf, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sasha Levin <sasha.levin@oracle.com>

commit 4efe874aace57dba967624ce1c48322da2447b75 upstream.

When printing the driver_override parameter when it is 4095 and 4094 bytes
long, the printing code would access invalid memory because we need count+1
bytes for printing.

Fixes: 782a985d7af2 ("PCI: Introduce new device binding path using pci_dev.driver_override")
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Alexander Graf <agraf@suse.de>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pci/pci-sysfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 6d04771e4903..045b63ae97d5 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -516,7 +516,8 @@ static ssize_t driver_override_store(struct device *dev,
 	struct pci_dev *pdev = to_pci_dev(dev);
 	char *driver_override, *old = pdev->driver_override, *cp;
 
-	if (count > PATH_MAX)
+	/* We need to keep extra room for a newline */
+	if (count >= (PAGE_SIZE - 1))
 		return -EINVAL;
 
 	driver_override = kstrndup(buf, count, GFP_KERNEL);
@@ -544,7 +545,7 @@ static ssize_t driver_override_show(struct device *dev,
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 
-	return sprintf(buf, "%s\n", pdev->driver_override);
+	return snprintf(buf, PAGE_SIZE, "%s\n", pdev->driver_override);
 }
 static DEVICE_ATTR_RW(driver_override);
 

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

* [PATCH 3.16.y-ckt 104/165] spi: dw: revisit FIFO size detection again
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (102 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 103/165] PCI: Don't read past the end of sysfs "driver_override" buffer Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 105/165] spi: atmel: Fix interrupt setup for PDC transfers Luis Henriques
                   ` (60 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Shevchenko, Mark Brown, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit 9d239d353c319f9ff884c287ce47feb7cdf60ddc upstream.

The commit d297933cc7fc (spi: dw: Fix detecting FIFO depth) tries to fix the
logic of the FIFO detection based on the description on the comments. However,
there is a slight difference between numbers in TX Level and TX FIFO size.

So, by specification the FIFO size would be in a range 2-256 bytes. From TX
Level prospective it means we can set threshold in the range 0-(FIFO size - 1)
bytes. Hence there are currently two issues:
  a) FIFO size 2 bytes is actually skipped since TX Level is 1 bit and could be
     either 0 or 1 byte;
  b) FIFO size is incorrectly decreased by 1 which already done by meaning of
     TX Level register.

This patch fixes it eventually right.

Fixes: d297933cc7fc (spi: dw: Fix detecting FIFO depth)
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi-dw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 32a3718cc5b4..4fc4c20893e1 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -622,13 +622,13 @@ static void spi_hw_init(struct dw_spi *dws)
 	 */
 	if (!dws->fifo_len) {
 		u32 fifo;
-		for (fifo = 2; fifo <= 256; fifo++) {
+		for (fifo = 1; fifo < 256; fifo++) {
 			dw_writew(dws, DW_SPI_TXFLTR, fifo);
 			if (fifo != dw_readw(dws, DW_SPI_TXFLTR))
 				break;
 		}
 
-		dws->fifo_len = (fifo == 2) ? 0 : fifo - 1;
+		dws->fifo_len = (fifo == 1) ? 0 : fifo;
 		dw_writew(dws, DW_SPI_TXFLTR, 0);
 	}
 }

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

* [PATCH 3.16.y-ckt 105/165] spi: atmel: Fix interrupt setup for PDC transfers
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (103 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 104/165] spi: dw: revisit FIFO size detection again Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 106/165] mtd: nand: pxa3xx: Fix PIO FIFO draining Luis Henriques
                   ` (59 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Torsten Fleischer, Mark Brown, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Torsten Fleischer <torfl6749@gmail.com>

commit 76e1d14b316d6f501ebc001e7a5d86b24ce5b615 upstream.

Additionally to the current DMA transfer the PDC allows to set up a next DMA
transfer. This is useful for larger SPI transfers.

The driver currently waits for ENDRX as end of the transfer. But ENDRX is set
when the current DMA transfer is done (RCR = 0), i.e. it doesn't include the
next DMA transfer.
Thus a subsequent SPI transfer could be started although there is currently a
transfer in progress. This can cause invalid accesses to the SPI slave devices
and to SPI transfer errors.

This issue has been observed on a hardware with a M25P128 SPI NOR flash.

So instead of ENDRX we should wait for RXBUFF. This flag is set if there is
no more DMA transfer in progress (RCR = RNCR = 0).

Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi-atmel.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 92a6f0d93233..a65823bddf01 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -781,17 +781,17 @@ static void atmel_spi_pdc_next_xfer(struct spi_master *master,
 			(unsigned long long)xfer->rx_dma);
 	}
 
-	/* REVISIT: We're waiting for ENDRX before we start the next
+	/* REVISIT: We're waiting for RXBUFF before we start the next
 	 * transfer because we need to handle some difficult timing
-	 * issues otherwise. If we wait for ENDTX in one transfer and
-	 * then starts waiting for ENDRX in the next, it's difficult
-	 * to tell the difference between the ENDRX interrupt we're
-	 * actually waiting for and the ENDRX interrupt of the
+	 * issues otherwise. If we wait for TXBUFE in one transfer and
+	 * then starts waiting for RXBUFF in the next, it's difficult
+	 * to tell the difference between the RXBUFF interrupt we're
+	 * actually waiting for and the RXBUFF interrupt of the
 	 * previous transfer.
 	 *
 	 * It should be doable, though. Just not now...
 	 */
-	spi_writel(as, IER, SPI_BIT(ENDRX) | SPI_BIT(OVRES));
+	spi_writel(as, IER, SPI_BIT(RXBUFF) | SPI_BIT(OVRES));
 	spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
 }
 

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

* [PATCH 3.16.y-ckt 106/165] mtd: nand: pxa3xx: Fix PIO FIFO draining
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (104 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 105/165] spi: atmel: Fix interrupt setup for PDC transfers Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 107/165] cpuset: Fix cpuset sched_relax_domain_level Luis Henriques
                   ` (58 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxime Ripard, Brian Norris, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maxime Ripard <maxime.ripard@free-electrons.com>

commit 8dad0386b97c4bd6edd56752ca7f2e735fe5beb4 upstream.

The NDDB register holds the data that are needed by the read and write
commands.

However, during a read PIO access, the datasheet specifies that after each 32
bytes read in that register, when BCH is enabled, we have to make sure that the
RDDREQ bit is set in the NDSR register.

This fixes an issue that was seen on the Armada 385, and presumably other mvebu
SoCs, when a read on a newly erased page would end up in the driver reporting a
timeout from the NAND.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/nand/pxa3xx_nand.c | 48 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 42 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 96b0b1d27df1..bc677362bc73 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -480,6 +480,42 @@ static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask)
 	nand_writel(info, NDCR, ndcr | int_mask);
 }
 
+static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
+{
+	if (info->ecc_bch) {
+		int timeout;
+
+		/*
+		 * According to the datasheet, when reading from NDDB
+		 * with BCH enabled, after each 32 bytes reads, we
+		 * have to make sure that the NDSR.RDDREQ bit is set.
+		 *
+		 * Drain the FIFO 8 32 bits reads at a time, and skip
+		 * the polling on the last read.
+		 */
+		while (len > 8) {
+			__raw_readsl(info->mmio_base + NDDB, data, 8);
+
+			for (timeout = 0;
+			     !(nand_readl(info, NDSR) & NDSR_RDDREQ);
+			     timeout++) {
+				if (timeout >= 5) {
+					dev_err(&info->pdev->dev,
+						"Timeout on RDDREQ while draining the FIFO\n");
+					return;
+				}
+
+				mdelay(1);
+			}
+
+			data += 32;
+			len -= 8;
+		}
+	}
+
+	__raw_readsl(info->mmio_base + NDDB, data, len);
+}
+
 static void handle_data_pio(struct pxa3xx_nand_info *info)
 {
 	unsigned int do_bytes = min(info->data_size, info->chunk_size);
@@ -496,14 +532,14 @@ static void handle_data_pio(struct pxa3xx_nand_info *info)
 				      DIV_ROUND_UP(info->oob_size, 4));
 		break;
 	case STATE_PIO_READING:
-		__raw_readsl(info->mmio_base + NDDB,
-			     info->data_buff + info->data_buff_pos,
-			     DIV_ROUND_UP(do_bytes, 4));
+		drain_fifo(info,
+			   info->data_buff + info->data_buff_pos,
+			   DIV_ROUND_UP(do_bytes, 4));
 
 		if (info->oob_size > 0)
-			__raw_readsl(info->mmio_base + NDDB,
-				     info->oob_buff + info->oob_buff_pos,
-				     DIV_ROUND_UP(info->oob_size, 4));
+			drain_fifo(info,
+				   info->oob_buff + info->oob_buff_pos,
+				   DIV_ROUND_UP(info->oob_size, 4));
 		break;
 	default:
 		dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__,

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

* [PATCH 3.16.y-ckt 107/165] cpuset: Fix cpuset sched_relax_domain_level
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (105 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 106/165] mtd: nand: pxa3xx: Fix PIO FIFO draining Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 108/165] workqueue: fix hang involving racing cancel[_delayed]_work_sync()'s for PREEMPT_NONE Luis Henriques
                   ` (57 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jason Low, Zefan Li, Tejun Heo, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jason Low <jason.low2@hp.com>

commit 283cb41f426b723a0255702b761b0fc5d1b53a81 upstream.

The cpuset.sched_relax_domain_level can control how far we do
immediate load balancing on a system. However, it was found on recent
kernels that echo'ing a value into cpuset.sched_relax_domain_level
did not reduce any immediate load balancing.

The reason this occurred was because the update_domain_attr_tree() traversal
did not update for the "top_cpuset". This resulted in nothing being changed
when modifying the sched_relax_domain_level parameter.

This patch is able to address that problem by having update_domain_attr_tree()
allow updates for the root in the cpuset traversal.

Fixes: fc560a26acce ("cpuset: replace cpuset->stack_list with cpuset_for_each_descendant_pre()")
Signed-off-by: Jason Low <jason.low2@hp.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/cpuset.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 116a4164720a..524a8eef2965 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -503,9 +503,6 @@ static void update_domain_attr_tree(struct sched_domain_attr *dattr,
 
 	rcu_read_lock();
 	cpuset_for_each_descendant_pre(cp, pos_css, root_cs) {
-		if (cp == root_cs)
-			continue;
-
 		/* skip the whole subtree if @cp doesn't have any CPU */
 		if (cpumask_empty(cp->cpus_allowed)) {
 			pos_css = css_rightmost_descendant(pos_css);

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

* [PATCH 3.16.y-ckt 108/165] workqueue: fix hang involving racing cancel[_delayed]_work_sync()'s for PREEMPT_NONE
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (106 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 107/165] cpuset: Fix cpuset sched_relax_domain_level Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 109/165] bnx2x: Force fundamental reset for EEH recovery Luis Henriques
                   ` (56 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tejun Heo, Tomeu Vizoso, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tejun Heo <tj@kernel.org>

commit 8603e1b30027f943cc9c1eef2b291d42c3347af1 upstream.

cancel[_delayed]_work_sync() are implemented using
__cancel_work_timer() which grabs the PENDING bit using
try_to_grab_pending() and then flushes the work item with PENDING set
to prevent the on-going execution of the work item from requeueing
itself.

try_to_grab_pending() can always grab PENDING bit without blocking
except when someone else is doing the above flushing during
cancelation.  In that case, try_to_grab_pending() returns -ENOENT.  In
this case, __cancel_work_timer() currently invokes flush_work().  The
assumption is that the completion of the work item is what the other
canceling task would be waiting for too and thus waiting for the same
condition and retrying should allow forward progress without excessive
busy looping

Unfortunately, this doesn't work if preemption is disabled or the
latter task has real time priority.  Let's say task A just got woken
up from flush_work() by the completion of the target work item.  If,
before task A starts executing, task B gets scheduled and invokes
__cancel_work_timer() on the same work item, its try_to_grab_pending()
will return -ENOENT as the work item is still being canceled by task A
and flush_work() will also immediately return false as the work item
is no longer executing.  This puts task B in a busy loop possibly
preventing task A from executing and clearing the canceling state on
the work item leading to a hang.

task A			task B			worker

						executing work
__cancel_work_timer()
  try_to_grab_pending()
  set work CANCELING
  flush_work()
    block for work completion
						completion, wakes up A
			__cancel_work_timer()
			while (forever) {
			  try_to_grab_pending()
			    -ENOENT as work is being canceled
			  flush_work()
			    false as work is no longer executing
			}

This patch removes the possible hang by updating __cancel_work_timer()
to explicitly wait for clearing of CANCELING rather than invoking
flush_work() after try_to_grab_pending() fails with -ENOENT.

Link: http://lkml.kernel.org/g/20150206171156.GA8942@axis.com

v3: bit_waitqueue() can't be used for work items defined in vmalloc
    area.  Switched to custom wake function which matches the target
    work item and exclusive wait and wakeup.

v2: v1 used wake_up() on bit_waitqueue() which leads to NULL deref if
    the target bit waitqueue has wait_bit_queue's on it.  Use
    DEFINE_WAIT_BIT() and __wake_up_bit() instead.  Reported by Tomeu
    Vizoso.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Rabin Vincent <rabin.vincent@axis.com>
Cc: Tomeu Vizoso <tomeu.vizoso@gmail.com>
Tested-by: Jesper Nilsson <jesper.nilsson@axis.com>
Tested-by: Rabin Vincent <rabin.vincent@axis.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/workqueue.h |  3 ++-
 kernel/workqueue.c        | 56 +++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index b996e6cde6bb..9eb54f41623e 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -70,7 +70,8 @@ enum {
 	/* data contains off-queue information when !WORK_STRUCT_PWQ */
 	WORK_OFFQ_FLAG_BASE	= WORK_STRUCT_COLOR_SHIFT,
 
-	WORK_OFFQ_CANCELING	= (1 << WORK_OFFQ_FLAG_BASE),
+	__WORK_OFFQ_CANCELING	= WORK_OFFQ_FLAG_BASE,
+	WORK_OFFQ_CANCELING	= (1 << __WORK_OFFQ_CANCELING),
 
 	/*
 	 * When a work item is off queue, its high bits point to the last
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index df106f238d58..cb7db323d1fb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2769,19 +2769,57 @@ bool flush_work(struct work_struct *work)
 }
 EXPORT_SYMBOL_GPL(flush_work);
 
+struct cwt_wait {
+	wait_queue_t		wait;
+	struct work_struct	*work;
+};
+
+static int cwt_wakefn(wait_queue_t *wait, unsigned mode, int sync, void *key)
+{
+	struct cwt_wait *cwait = container_of(wait, struct cwt_wait, wait);
+
+	if (cwait->work != key)
+		return 0;
+	return autoremove_wake_function(wait, mode, sync, key);
+}
+
 static bool __cancel_work_timer(struct work_struct *work, bool is_dwork)
 {
+	static DECLARE_WAIT_QUEUE_HEAD(cancel_waitq);
 	unsigned long flags;
 	int ret;
 
 	do {
 		ret = try_to_grab_pending(work, is_dwork, &flags);
 		/*
-		 * If someone else is canceling, wait for the same event it
-		 * would be waiting for before retrying.
+		 * If someone else is already canceling, wait for it to
+		 * finish.  flush_work() doesn't work for PREEMPT_NONE
+		 * because we may get scheduled between @work's completion
+		 * and the other canceling task resuming and clearing
+		 * CANCELING - flush_work() will return false immediately
+		 * as @work is no longer busy, try_to_grab_pending() will
+		 * return -ENOENT as @work is still being canceled and the
+		 * other canceling task won't be able to clear CANCELING as
+		 * we're hogging the CPU.
+		 *
+		 * Let's wait for completion using a waitqueue.  As this
+		 * may lead to the thundering herd problem, use a custom
+		 * wake function which matches @work along with exclusive
+		 * wait and wakeup.
 		 */
-		if (unlikely(ret == -ENOENT))
-			flush_work(work);
+		if (unlikely(ret == -ENOENT)) {
+			struct cwt_wait cwait;
+
+			init_wait(&cwait.wait);
+			cwait.wait.func = cwt_wakefn;
+			cwait.work = work;
+
+			prepare_to_wait_exclusive(&cancel_waitq, &cwait.wait,
+						  TASK_UNINTERRUPTIBLE);
+			if (work_is_canceling(work))
+				schedule();
+			finish_wait(&cancel_waitq, &cwait.wait);
+		}
 	} while (unlikely(ret < 0));
 
 	/* tell other tasks trying to grab @work to back off */
@@ -2790,6 +2828,16 @@ static bool __cancel_work_timer(struct work_struct *work, bool is_dwork)
 
 	flush_work(work);
 	clear_work_data(work);
+
+	/*
+	 * Paired with prepare_to_wait() above so that either
+	 * waitqueue_active() is visible here or !work_is_canceling() is
+	 * visible there.
+	 */
+	smp_mb();
+	if (waitqueue_active(&cancel_waitq))
+		__wake_up(&cancel_waitq, TASK_NORMAL, 1, work);
+
 	return ret;
 }
 

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

* [PATCH 3.16.y-ckt 109/165] bnx2x: Force fundamental reset for EEH recovery
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (107 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 108/165] workqueue: fix hang involving racing cancel[_delayed]_work_sync()'s for PREEMPT_NONE Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 110/165] xen/events: avoid NULL pointer dereference in dom0 on large machines Luis Henriques
                   ` (55 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Brian King, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Brian King <brking@linux.vnet.ibm.com>

commit da293700568ed3d96fcf062ac15d7d7c41377f11 upstream.

EEH recovery for bnx2x based adapters is not reliable on all Power
systems using the default hot reset, which can result in an
unrecoverable EEH error. Forcing the use of fundamental reset
during EEH recovery fixes this.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 73cfb21899a7..b0c3b33edf84 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12496,6 +12496,9 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
 	pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS,
 			       PCICFG_VENDOR_ID_OFFSET);
 
+	/* Set PCIe reset type to fundamental for EEH recovery */
+	pdev->needs_freset = 1;
+
 	/* AER (Advanced Error reporting) configuration */
 	rc = pci_enable_pcie_error_reporting(pdev);
 	if (!rc)

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

* [PATCH 3.16.y-ckt 110/165] xen/events: avoid NULL pointer dereference in dom0 on large machines
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (108 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 109/165] bnx2x: Force fundamental reset for EEH recovery Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 111/165] spi: pl022: Fix race in giveback() leading to driver lock-up Luis Henriques
                   ` (54 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Juergen Gross, David Vrabel, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Juergen Gross <jgross@suse.com>

commit 85e40b0539b24518c8bdf63e2605c8522377d00f upstream.

Using the pvops kernel a NULL pointer dereference was detected on a
large machine (144 processors) when booting as dom0 in
evtchn_fifo_unmask() during assignment of a pirq.

The event channel in question was the first to need a new entry in
event_array[] in events_fifo.c. Unfortunately xen_irq_info_pirq_setup()
is called with evtchn being 0 for a new pirq and the real event channel
number is assigned to the pirq only during __startup_pirq().

It is mandatory to call xen_evtchn_port_setup() after assigning the
event channel number to the pirq to make sure all memory needed for the
event channel is allocated.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/xen/events/events_base.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index c919d3d5c845..82fbb0cd8f65 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -526,20 +526,26 @@ static unsigned int __startup_pirq(unsigned int irq)
 	pirq_query_unmask(irq);
 
 	rc = set_evtchn_to_irq(evtchn, irq);
-	if (rc != 0) {
-		pr_err("irq%d: Failed to set port to irq mapping (%d)\n",
-		       irq, rc);
-		xen_evtchn_close(evtchn);
-		return 0;
-	}
+	if (rc)
+		goto err;
+
 	bind_evtchn_to_cpu(evtchn, 0);
 	info->evtchn = evtchn;
 
+	rc = xen_evtchn_port_setup(info);
+	if (rc)
+		goto err;
+
 out:
 	unmask_evtchn(evtchn);
 	eoi_pirq(irq_get_irq_data(irq));
 
 	return 0;
+
+err:
+	pr_err("irq%d: Failed to set port to irq mapping (%d)\n", irq, rc);
+	xen_evtchn_close(evtchn);
+	return 0;
 }
 
 static unsigned int startup_pirq(struct irq_data *data)

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

* [PATCH 3.16.y-ckt 111/165] spi: pl022: Fix race in giveback() leading to driver lock-up
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (109 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 110/165] xen/events: avoid NULL pointer dereference in dom0 on large machines Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 112/165] tpm/ibmvtpm: Additional LE support for tpm_ibmvtpm_send Luis Henriques
                   ` (53 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Sverdlin, Mark Brown, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

commit cd6fa8d2ca53cac3226fdcffcf763be390abae32 upstream.

Commit fd316941c ("spi/pl022: disable port when unused") introduced a race,
which leads to possible driver lock up (easily reproducible on SMP).

The problem happens in giveback() function where the completion of the transfer
is signalled to SPI subsystem and then the HW SPI controller is disabled. Another
transfer might be setup in between, which brings driver in locked-up state.

Exact event sequence on SMP:

core0                                   core1

                                        => pump_transfers()
                                        /* message->state == STATE_DONE */
                                          => giveback()
                                            => spi_finalize_current_message()

=> pl022_unprepare_transfer_hardware()
=> pl022_transfer_one_message
  => flush()
  => do_interrupt_dma_transfer()
    => set_up_next_transfer()
    /* Enable SSP, turn on interrupts */
    writew((readw(SSP_CR1(pl022->virtbase)) |
           SSP_CR1_MASK_SSE), SSP_CR1(pl022->virtbase));

...

=> pl022_interrupt_handler()
  => readwriter()

                                        /* disable the SPI/SSP operation */
                                        => writew((readw(SSP_CR1(pl022->virtbase)) &
                                                  (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));

Lockup! SPI controller is disabled and the data will never be received. Whole
SPI subsystem is waiting for transfer ACK and blocked.

So, only signal transfer completion after disabling the controller.

Fixes: fd316941c (spi/pl022: disable port when unused)
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi-pl022.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index abc69c00e693..02798036df8f 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -502,12 +502,12 @@ static void giveback(struct pl022 *pl022)
 	pl022->cur_msg = NULL;
 	pl022->cur_transfer = NULL;
 	pl022->cur_chip = NULL;
-	spi_finalize_current_message(pl022->master);
 
 	/* disable the SPI/SSP operation */
 	writew((readw(SSP_CR1(pl022->virtbase)) &
 		(~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));
 
+	spi_finalize_current_message(pl022->master);
 }
 
 /**

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

* [PATCH 3.16.y-ckt 112/165] tpm/ibmvtpm: Additional LE support for tpm_ibmvtpm_send
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (110 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 111/165] spi: pl022: Fix race in giveback() leading to driver lock-up Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 113/165] libsas: Fix Kernel Crash in smp_execute_task Luis Henriques
                   ` (52 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Joy Latten, Peter Huewe, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "jmlatten@linux.vnet.ibm.com" <jmlatten@linux.vnet.ibm.com>

commit 62dfd912ab3b5405b6fe72d0135c37e9648071f1 upstream.

Problem: When IMA and VTPM are both enabled in kernel config,
kernel hangs during bootup on LE OS.

Why?: IMA calls tpm_pcr_read() which results in tpm_ibmvtpm_send
and tpm_ibmtpm_recv getting called. A trace showed that
tpm_ibmtpm_recv was hanging.

Resolution: tpm_ibmtpm_recv was hanging because tpm_ibmvtpm_send
was sending CRQ message that probably did not make much sense
to phype because of Endianness. The fix below sends correctly
converted CRQ for LE. This was not caught before because it
seems IMA is not enabled by default in kernel config and
IMA exercises this particular code path in vtpm.

Tested with IMA and VTPM enabled in kernel config and VTPM
enabled on both a BE OS and a LE OS ppc64 lpar. This exercised
CRQ and TPM command code paths in vtpm.
Patch is against Peter's tpmdd tree on github which included
Vicky's previous vtpm le patches.

Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
Reviewed-by: Ashley Lai <ashley@ahsleylai.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 10 +++++-----
 drivers/char/tpm/tpm_ibmvtpm.h |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index eff9d5870034..102463ba745d 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -124,7 +124,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
 {
 	struct ibmvtpm_dev *ibmvtpm;
 	struct ibmvtpm_crq crq;
-	u64 *word = (u64 *) &crq;
+	__be64 *word = (__be64 *)&crq;
 	int rc;
 
 	ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip);
@@ -145,11 +145,11 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
 	memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count);
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_TPM_COMMAND;
-	crq.len = (u16)count;
-	crq.data = ibmvtpm->rtce_dma_handle;
+	crq.len = cpu_to_be16(count);
+	crq.data = cpu_to_be32(ibmvtpm->rtce_dma_handle);
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]),
-			      cpu_to_be64(word[1]));
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]),
+			      be64_to_cpu(word[1]));
 	if (rc != H_SUCCESS) {
 		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
 		rc = 0;
diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h
index bd82a791f995..b2c231b1beec 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.h
+++ b/drivers/char/tpm/tpm_ibmvtpm.h
@@ -22,9 +22,9 @@
 struct ibmvtpm_crq {
 	u8 valid;
 	u8 msg;
-	u16 len;
-	u32 data;
-	u64 reserved;
+	__be16 len;
+	__be32 data;
+	__be64 reserved;
 } __attribute__((packed, aligned(8)));
 
 struct ibmvtpm_crq_queue {

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

* [PATCH 3.16.y-ckt 113/165] libsas: Fix Kernel Crash in smp_execute_task
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (111 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 112/165] tpm/ibmvtpm: Additional LE support for tpm_ibmvtpm_send Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 114/165] irqchip: armada-370-xp: Fix chained per-cpu interrupts Luis Henriques
                   ` (51 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: James Bottomley, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Bottomley <JBottomley@Parallels.com>

commit 6302ce4d80aa82b3fdb5c5cd68e7268037091b47 upstream.

This crash was reported:

[  366.947370] sd 3:0:1:0: [sdb] Spinning up disk....
[  368.804046] BUG: unable to handle kernel NULL pointer dereference at           (null)
[  368.804072] IP: [<ffffffff81358457>] __mutex_lock_common.isra.7+0x9c/0x15b
[  368.804098] PGD 0
[  368.804114] Oops: 0002 [#1] SMP
[  368.804143] CPU 1
[  368.804151] Modules linked in: sg netconsole s3g(PO) uinput joydev hid_multitouch usbhid hid snd_hda_codec_via cpufreq_userspace cpufreq_powersave cpufreq_stats uhci_hcd cpufreq_conservative snd_hda_intel snd_hda_codec snd_hwdep snd_pcm sdhci_pci snd_page_alloc sdhci snd_timer snd psmouse evdev serio_raw pcspkr soundcore xhci_hcd shpchp s3g_drm(O) mvsas mmc_core ahci libahci drm i2c_core acpi_cpufreq mperf video processor button thermal_sys dm_dmirror exfat_fs exfat_core dm_zcache dm_mod padlock_aes aes_generic padlock_sha iscsi_target_mod target_core_mod configfs sswipe libsas libata scsi_transport_sas picdev via_cputemp hwmon_vid fuse parport_pc ppdev lp parport autofs4 ext4 crc16 mbcache jbd2 sd_mod crc_t10dif usb_storage scsi_mod ehci_hcd usbcore usb_common
[  368.804749]
[  368.804764] Pid: 392, comm: kworker/u:3 Tainted: P        W  O 3.4.87-logicube-ng.22 #1 To be filled by O.E.M. To be filled by O.E.M./EPIA-M920
[  368.804802] RIP: 0010:[<ffffffff81358457>]  [<ffffffff81358457>] __mutex_lock_common.isra.7+0x9c/0x15b
[  368.804827] RSP: 0018:ffff880117001cc0  EFLAGS: 00010246
[  368.804842] RAX: 0000000000000000 RBX: ffff8801185030d0 RCX: ffff88008edcb420
[  368.804857] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff8801185030d4
[  368.804873] RBP: ffff8801181531c0 R08: 0000000000000020 R09: 00000000fffffffe
[  368.804885] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801185030d4
[  368.804899] R13: 0000000000000002 R14: ffff880117001fd8 R15: ffff8801185030d8
[  368.804916] FS:  0000000000000000(0000) GS:ffff88011fc80000(0000) knlGS:0000000000000000
[  368.804931] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  368.804946] CR2: 0000000000000000 CR3: 000000000160b000 CR4: 00000000000006e0
[  368.804962] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  368.804978] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  368.804995] Process kworker/u:3 (pid: 392, threadinfo ffff880117000000, task ffff8801181531c0)
[  368.805009] Stack:
[  368.805017]  ffff8801185030d8 0000000000000000 ffffffff8161ddf0 ffffffff81056f7c
[  368.805062]  000000000000b503 ffff8801185030d0 ffff880118503000 0000000000000000
[  368.805100]  ffff8801185030d0 ffff8801188b8000 ffff88008edcb420 ffffffff813583ac
[  368.805135] Call Trace:
[  368.805153]  [<ffffffff81056f7c>] ? up+0xb/0x33
[  368.805168]  [<ffffffff813583ac>] ? mutex_lock+0x16/0x25
[  368.805194]  [<ffffffffa018c414>] ? smp_execute_task+0x4e/0x222 [libsas]
[  368.805217]  [<ffffffffa018ce1c>] ? sas_find_bcast_dev+0x3c/0x15d [libsas]
[  368.805240]  [<ffffffffa018ce4f>] ? sas_find_bcast_dev+0x6f/0x15d [libsas]
[  368.805264]  [<ffffffffa018e989>] ? sas_ex_revalidate_domain+0x37/0x2ec [libsas]
[  368.805280]  [<ffffffff81355a2a>] ? printk+0x43/0x48
[  368.805296]  [<ffffffff81359a65>] ? _raw_spin_unlock_irqrestore+0xc/0xd
[  368.805318]  [<ffffffffa018b767>] ? sas_revalidate_domain+0x85/0xb6 [libsas]
[  368.805336]  [<ffffffff8104e5d9>] ? process_one_work+0x151/0x27c
[  368.805351]  [<ffffffff8104f6cd>] ? worker_thread+0xbb/0x152
[  368.805366]  [<ffffffff8104f612>] ? manage_workers.isra.29+0x163/0x163
[  368.805382]  [<ffffffff81052c4e>] ? kthread+0x79/0x81
[  368.805399]  [<ffffffff8135fea4>] ? kernel_thread_helper+0x4/0x10
[  368.805416]  [<ffffffff81052bd5>] ? kthread_flush_work_fn+0x9/0x9
[  368.805431]  [<ffffffff8135fea0>] ? gs_change+0x13/0x13
[  368.805442] Code: 83 7d 30 63 7e 04 f3 90 eb ab 4c 8d 63 04 4c 8d 7b 08 4c 89 e7 e8 fa 15 00 00 48 8b 43 10 4c 89 3c 24 48 89 63 10 48 89 44 24 08 <48> 89 20 83 c8 ff 48 89 6c 24 10 87 03 ff c8 74 35 4d 89 ee 41
[  368.805851] RIP  [<ffffffff81358457>] __mutex_lock_common.isra.7+0x9c/0x15b
[  368.805877]  RSP <ffff880117001cc0>
[  368.805886] CR2: 0000000000000000
[  368.805899] ---[ end trace b720682065d8f4cc ]---

It's directly caused by 89d3cf6 [SCSI] libsas: add mutex for SMP task
execution, but shows a deeper cause: expander functions expect to be able to
cast to and treat domain devices as expanders.  The correct fix is to only do
expander discover when we know we've got an expander device to avoid wrongly
casting a non-expander device.

Reported-by: Praveen Murali <pmurali@logicube.com>
Tested-by: Praveen Murali <pmurali@logicube.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/libsas/sas_discover.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 62b58d38ce2e..60de66252fa2 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -500,6 +500,7 @@ static void sas_revalidate_domain(struct work_struct *work)
 	struct sas_discovery_event *ev = to_sas_discovery_event(work);
 	struct asd_sas_port *port = ev->port;
 	struct sas_ha_struct *ha = port->ha;
+	struct domain_device *ddev = port->port_dev;
 
 	/* prevent revalidation from finding sata links in recovery */
 	mutex_lock(&ha->disco_mutex);
@@ -514,8 +515,9 @@ static void sas_revalidate_domain(struct work_struct *work)
 	SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
 		    task_pid_nr(current));
 
-	if (port->port_dev)
-		res = sas_ex_revalidate_domain(port->port_dev);
+	if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE ||
+		     ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE))
+		res = sas_ex_revalidate_domain(ddev);
 
 	SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
 		    port->id, task_pid_nr(current), res);

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

* [PATCH 3.16.y-ckt 114/165] irqchip: armada-370-xp: Fix chained per-cpu interrupts
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (112 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 113/165] libsas: Fix Kernel Crash in smp_execute_task Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 115/165] ALSA: hda - Fix regression of HD-audio controller fallback modes Luis Henriques
                   ` (50 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxime Ripard, Jason Cooper, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maxime Ripard <maxime.ripard@free-electrons.com>

commit 5724be8464dceac047c1eaddaa3651cea0ec16ca upstream.

On the Cortex-A9-based Armada SoCs, the MPIC is not the primary interrupt
controller. Yet, it still has to handle some per-cpu interrupt.

To do so, it is chained with the GIC using a per-cpu interrupt. However, the
current code only call irq_set_chained_handler, which is called and enable that
interrupt only on the boot CPU, which means that the parent per-CPU interrupt
is never unmasked on the secondary CPUs, preventing the per-CPU interrupt to
actually work as expected.

This was not seen until now since the only MPIC PPI users were the Marvell
timers that were not working, but not used either since the system use the ARM
TWD by default, and the ethernet controllers, that are faking there interrupts
as SPI, and don't really expect to have interrupts on the secondary cores
anyway.

Add a CPU notifier that will enable the PPI on the secondary cores when they
are brought up.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1425378443-28822-1-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/irqchip/irq-armada-370-xp.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 1cb538fd85e9..f9597b75fa3d 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -67,6 +67,7 @@
 static void __iomem *per_cpu_int_base;
 static void __iomem *main_int_base;
 static struct irq_domain *armada_370_xp_mpic_domain;
+static int parent_irq;
 #ifdef CONFIG_PCI_MSI
 static struct irq_domain *armada_370_xp_msi_domain;
 static DECLARE_BITMAP(msi_used, PCI_MSI_DOORBELL_NR);
@@ -360,6 +361,7 @@ static int armada_xp_mpic_secondary_init(struct notifier_block *nfb,
 {
 	if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
 		armada_xp_mpic_smp_cpu_init();
+
 	return NOTIFY_OK;
 }
 
@@ -368,6 +370,20 @@ static struct notifier_block armada_370_xp_mpic_cpu_notifier = {
 	.priority = 100,
 };
 
+static int mpic_cascaded_secondary_init(struct notifier_block *nfb,
+					unsigned long action, void *hcpu)
+{
+	if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
+		enable_percpu_irq(parent_irq, IRQ_TYPE_NONE);
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block mpic_cascaded_cpu_notifier = {
+	.notifier_call = mpic_cascaded_secondary_init,
+	.priority = 100,
+};
+
 #endif /* CONFIG_SMP */
 
 static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
@@ -494,7 +510,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
 					     struct device_node *parent)
 {
 	struct resource main_int_res, per_cpu_int_res;
-	int parent_irq, nr_irqs, i;
+	int nr_irqs, i;
 	u32 control;
 
 	BUG_ON(of_address_to_resource(node, 0, &main_int_res));
@@ -542,6 +558,9 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
 		register_cpu_notifier(&armada_370_xp_mpic_cpu_notifier);
 #endif
 	} else {
+#ifdef CONFIG_SMP
+		register_cpu_notifier(&mpic_cascaded_cpu_notifier);
+#endif
 		irq_set_chained_handler(parent_irq,
 					armada_370_xp_mpic_handle_cascade_irq);
 	}

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

* [PATCH 3.16.y-ckt 115/165] ALSA: hda - Fix regression of HD-audio controller fallback modes
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (113 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 114/165] irqchip: armada-370-xp: Fix chained per-cpu interrupts Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 116/165] can: add missing initialisations in CAN related skbuffs Luis Henriques
                   ` (49 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit a1f3f1ca66bd12c339b17a0c2ef93a093f90a277 upstream.

The commit [63e51fd708f5: ALSA: hda - Don't take unresponsive D3
transition too serious] introduced a conditional fallback behavior to
the HD-audio controller depending on the flag set.  However, it
introduced a silly bug, too, that the flag was evaluated in a reverse
way.  This resulted in a regression of HD-audio controller driver
where it can't go to the fallback mode at communication errors.

Unfortunately (or fortunately?) this didn't come up until recently
because the affected code path is an error handling that happens only
on an unstable hardware chip.  Most of recent chips work stably, thus
they didn't hit this problem.  Now, we've got a regression report with
a VIA chip, and this seems indeed requiring the fallback to the
polling mode, and finally the bug was revealed.

The fix is a oneliner to remove the wrong logical NOT in the check.
(Lesson learned - be careful about double negation.)

The bug should be backported to stable, but the patch won't be
applicable to 3.13 or earlier because of the code splits.  The stable
fix patches for earlier kernels will be posted later manually.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94021
Fixes: 63e51fd708f5 ('ALSA: hda - Don't take unresponsive D3 transition too serious')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index e476a198c15f..c6136597785a 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1244,7 +1244,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
 		}
 	}
 
-	if (!bus->no_response_fallback)
+	if (bus->no_response_fallback)
 		return -1;
 
 	if (!chip->polling_mode && chip->poll_count < 2) {

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

* [PATCH 3.16.y-ckt 116/165] can: add missing initialisations in CAN related skbuffs
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (114 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 115/165] ALSA: hda - Fix regression of HD-audio controller fallback modes Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 117/165] can: kvaser_usb: Avoid double free on URB submission failures Luis Henriques
                   ` (48 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Hartkopp, Marc Kleine-Budde, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Oliver Hartkopp <socketcan@hartkopp.net>

commit 969439016d2cf61fef53a973d7e6d2061c3793b1 upstream.

When accessing CAN network interfaces with AF_PACKET sockets e.g. by dhclient
this can lead to a skb_under_panic due to missing skb initialisations.

Add the missing initialisations at the CAN skbuff creation times on driver
level (rx path) and in the network layer (tx path).

Reported-by: Austin Schuh <austin@peloton-tech.com>
Reported-by: Daniel Steer <daniel.steer@mclaren.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/dev.c | 8 ++++++++
 net/can/af_can.c      | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 9b04d0a9356d..c543c3aaee4d 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -501,6 +501,10 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
 	skb->pkt_type = PACKET_BROADCAST;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 
+	skb_reset_mac_header(skb);
+	skb_reset_network_header(skb);
+	skb_reset_transport_header(skb);
+
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = dev->ifindex;
 
@@ -525,6 +529,10 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
 	skb->pkt_type = PACKET_BROADCAST;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 
+	skb_reset_mac_header(skb);
+	skb_reset_network_header(skb);
+	skb_reset_transport_header(skb);
+
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = dev->ifindex;
 
diff --git a/net/can/af_can.c b/net/can/af_can.c
index ce82337521f6..d6030d6949df 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -262,6 +262,9 @@ int can_send(struct sk_buff *skb, int loop)
 		goto inval_skb;
 	}
 
+	skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+	skb_reset_mac_header(skb);
 	skb_reset_network_header(skb);
 	skb_reset_transport_header(skb);
 

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

* [PATCH 3.16.y-ckt 117/165] can: kvaser_usb: Avoid double free on URB submission failures
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (115 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 116/165] can: add missing initialisations in CAN related skbuffs Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 118/165] can: kvaser_usb: Read all messages in a bulk-in URB buffer Luis Henriques
                   ` (47 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ahmed S. Darwish, Marc Kleine-Budde, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

commit deb2701cf704a2fd03a8b598bf73df3edb08818d upstream.

Upon a URB submission failure, the driver calls usb_free_urb()
but then manually frees the URB buffer by itself.  Meanwhile
usb_free_urb() has alredy freed out that transfer buffer since
we're the only code path holding a reference to this URB.

Remove two of such invalid manual free().

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/usb/kvaser_usb.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 8b255e777cc7..fa12e7cfcc95 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -595,7 +595,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv,
 		netdev_err(netdev, "Error transmitting URB\n");
 		usb_unanchor_urb(urb);
 		usb_free_urb(urb);
-		kfree(buf);
 		return err;
 	}
 
@@ -1281,8 +1280,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	struct urb *urb;
 	void *buf;
 	struct kvaser_msg *msg;
-	int i, err;
-	int ret = NETDEV_TX_OK;
+	int i, err, ret = NETDEV_TX_OK;
 
 	if (can_dropped_invalid_skb(netdev, skb))
 		return NETDEV_TX_OK;
@@ -1299,7 +1297,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	if (!buf) {
 		stats->tx_dropped++;
 		dev_kfree_skb(skb);
-		goto nobufmem;
+		goto freeurb;
 	}
 
 	msg = buf;
@@ -1336,8 +1334,10 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 	/* This should never happen; it implies a flow control bug */
 	if (!context) {
 		netdev_warn(netdev, "cannot find free context\n");
+
+		kfree(buf);
 		ret =  NETDEV_TX_BUSY;
-		goto releasebuf;
+		goto freeurb;
 	}
 
 	context->priv = priv;
@@ -1374,16 +1374,12 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
 		else
 			netdev_warn(netdev, "Failed tx_urb %d\n", err);
 
-		goto releasebuf;
+		goto freeurb;
 	}
 
-	usb_free_urb(urb);
-
-	return NETDEV_TX_OK;
+	ret = NETDEV_TX_OK;
 
-releasebuf:
-	kfree(buf);
-nobufmem:
+freeurb:
 	usb_free_urb(urb);
 	return ret;
 }

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

* [PATCH 3.16.y-ckt 118/165] can: kvaser_usb: Read all messages in a bulk-in URB buffer
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (116 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 117/165] can: kvaser_usb: Avoid double free on URB submission failures Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 119/165] ftrace: Fix en(dis)able graph caller when en(dis)abling record via sysctl Luis Henriques
                   ` (46 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ahmed S. Darwish, Marc Kleine-Budde, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Ahmed S. Darwish" <ahmed.darwish@valeo.com>

commit 2fec5104f9c61de4cf2205aa355101e19a81f490 upstream.

The Kvaser firmware can only read and write messages that are
not crossing the USB endpoint's wMaxPacketSize boundary. While
receiving commands from the CAN device, if the next command in
the same URB buffer crossed that max packet size boundary, the
firmware puts a zero-length placeholder command in its place
then moves the real command to the next boundary mark.

The driver did not recognize such behavior, leading to missing
a good number of rx events during a heavy rx load session.

Moreover, a tx URB context only gets freed upon receiving its
respective tx ACK event. Over time, the free tx URB contexts
pool gets depleted due to the missing ACK events. Consequently,
the netif transmission queue gets __permanently__ stopped; no
frames could be sent again except after restarting the CAN
newtwork interface.

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/usb/kvaser_usb.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index fa12e7cfcc95..66b259bd9bce 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -12,6 +12,7 @@
  * Copyright (C) 2012 Olivier Sobrie <olivier@sobrie.be>
  */
 
+#include <linux/kernel.h>
 #include <linux/completion.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
@@ -403,8 +404,15 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id,
 		while (pos <= actual_len - MSG_HEADER_LEN) {
 			tmp = buf + pos;
 
-			if (!tmp->len)
-				break;
+			/* Handle messages crossing the USB endpoint max packet
+			 * size boundary. Check kvaser_usb_read_bulk_callback()
+			 * for further details.
+			 */
+			if (tmp->len == 0) {
+				pos = round_up(pos,
+					       dev->bulk_in->wMaxPacketSize);
+				continue;
+			}
 
 			if (pos + tmp->len > actual_len) {
 				dev_err(dev->udev->dev.parent,
@@ -982,8 +990,19 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
 	while (pos <= urb->actual_length - MSG_HEADER_LEN) {
 		msg = urb->transfer_buffer + pos;
 
-		if (!msg->len)
-			break;
+		/* The Kvaser firmware can only read and write messages that
+		 * does not cross the USB's endpoint wMaxPacketSize boundary.
+		 * If a follow-up command crosses such boundary, firmware puts
+		 * a placeholder zero-length command in its place then aligns
+		 * the real command to the next max packet size.
+		 *
+		 * Handle such cases or we're going to miss a significant
+		 * number of events in case of a heavy rx load on the bus.
+		 */
+		if (msg->len == 0) {
+			pos = round_up(pos, dev->bulk_in->wMaxPacketSize);
+			continue;
+		}
 
 		if (pos + msg->len > urb->actual_length) {
 			dev_err(dev->udev->dev.parent, "Format error\n");
@@ -991,7 +1010,6 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
 		}
 
 		kvaser_usb_handle_message(dev, msg);
-
 		pos += msg->len;
 	}
 

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

* [PATCH 3.16.y-ckt 119/165] ftrace: Fix en(dis)able graph caller when en(dis)abling record via sysctl
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (117 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 118/165] can: kvaser_usb: Read all messages in a bulk-in URB buffer Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 120/165] ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled Luis Henriques
                   ` (45 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pratyush Anand, Steven Rostedt, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pratyush Anand <panand@redhat.com>

commit 1619dc3f8f555ee1cdd3c75db3885d5715442b12 upstream.

When ftrace is enabled globally through the proc interface, we must check if
ftrace_graph_active is set. If it is set, then we should also pass the
FTRACE_START_FUNC_RET command to ftrace_run_update_code(). Similarly, when
ftrace is disabled globally through the proc interface, we must check if
ftrace_graph_active is set. If it is set, then we should also pass the
FTRACE_STOP_FUNC_RET command to ftrace_run_update_code().

Consider the following situation.

 # echo 0 > /proc/sys/kernel/ftrace_enabled

After this ftrace_enabled = 0.

 # echo function_graph > /sys/kernel/debug/tracing/current_tracer

Since ftrace_enabled = 0, ftrace_enable_ftrace_graph_caller() is never
called.

 # echo 1 > /proc/sys/kernel/ftrace_enabled

Now ftrace_enabled will be set to true, but still
ftrace_enable_ftrace_graph_caller() will not be called, which is not
desired.

Further if we execute the following after this:
  # echo nop > /sys/kernel/debug/tracing/current_tracer

Now since ftrace_enabled is set it will call
ftrace_disable_ftrace_graph_caller(), which causes a kernel warning on
the ARM platform.

On the ARM platform, when ftrace_enable_ftrace_graph_caller() is called,
it checks whether the old instruction is a nop or not. If it's not a nop,
then it returns an error. If it is a nop then it replaces instruction at
that address with a branch to ftrace_graph_caller.
ftrace_disable_ftrace_graph_caller() behaves just the opposite. Therefore,
if generic ftrace code ever calls either ftrace_enable_ftrace_graph_caller()
or ftrace_disable_ftrace_graph_caller() consecutively two times in a row,
then it will return an error, which will cause the generic ftrace code to
raise a warning.

Note, x86 does not have an issue with this because the architecture
specific code for ftrace_enable_ftrace_graph_caller() and
ftrace_disable_ftrace_graph_caller() does not check the previous state,
and calling either of these functions twice in a row has no ill effect.

Link: http://lkml.kernel.org/r/e4fbe64cdac0dd0e86a3bf914b0f83c0b419f146.1425666454.git.panand@redhat.com

Signed-off-by: Pratyush Anand <panand@redhat.com>
[
  removed extra if (ftrace_start_up) and defined ftrace_graph_active as 0
  if CONFIG_FUNCTION_GRAPH_TRACER is not set.
]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/ftrace.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ca167e660e10..054f9bbe5f12 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1048,6 +1048,12 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
 
 static struct pid * const ftrace_swapper_pid = &init_struct_pid;
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+static int ftrace_graph_active;
+#else
+# define ftrace_graph_active 0
+#endif
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 #ifndef CONFIG_FTRACE_MCOUNT_RECORD
@@ -2211,24 +2217,36 @@ static int ftrace_shutdown(struct ftrace_ops *ops, int command)
 
 static void ftrace_startup_sysctl(void)
 {
+	int command;
+
 	if (unlikely(ftrace_disabled))
 		return;
 
 	/* Force update next time */
 	saved_ftrace_func = NULL;
 	/* ftrace_start_up is true if we want ftrace running */
-	if (ftrace_start_up)
-		ftrace_run_update_code(FTRACE_UPDATE_CALLS);
+	if (ftrace_start_up) {
+		command = FTRACE_UPDATE_CALLS;
+		if (ftrace_graph_active)
+			command |= FTRACE_START_FUNC_RET;
+		ftrace_run_update_code(command);
+	}
 }
 
 static void ftrace_shutdown_sysctl(void)
 {
+	int command;
+
 	if (unlikely(ftrace_disabled))
 		return;
 
 	/* ftrace_start_up is true if ftrace is running */
-	if (ftrace_start_up)
-		ftrace_run_update_code(FTRACE_DISABLE_CALLS);
+	if (ftrace_start_up) {
+		command = FTRACE_DISABLE_CALLS;
+		if (ftrace_graph_active)
+			command |= FTRACE_STOP_FUNC_RET;
+		ftrace_run_update_code(command);
+	}
 }
 
 static cycle_t		ftrace_update_time;
@@ -4924,8 +4942,6 @@ static struct ftrace_ops graph_ops = {
 	ASSIGN_OPS_HASH(graph_ops, &global_ops.local_hash)
 };
 
-static int ftrace_graph_active;
-
 int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
 {
 	return 0;

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

* [PATCH 3.16.y-ckt 120/165] ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (118 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 119/165] ftrace: Fix en(dis)able graph caller when en(dis)abling record via sysctl Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 121/165] ARM: imx6qdl-sabresd: set swbst_reg as vbus's parent reg Luis Henriques
                   ` (44 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

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

commit 524a38682573b2e15ab6317ccfe50280441514be upstream.

Some archs (specifically PowerPC), are sensitive with the ordering of
the enabling of the calls to function tracing and setting of the
function to use to be traced.

That is, update_ftrace_function() sets what function the ftrace_caller
trampoline should call. Some archs require this to be set before
calling ftrace_run_update_code().

Another bug was discovered, that ftrace_startup_sysctl() called
ftrace_run_update_code() directly. If the function the ftrace_caller
trampoline changes, then it will not be updated. Instead a call
to ftrace_startup_enable() should be called because it tests to see
if the callback changed since the code was disabled, and will
tell the arch to update appropriately. Most archs do not need this
notification, but PowerPC does.

The problem could be seen by the following commands:

 # echo 0 > /proc/sys/kernel/ftrace_enabled
 # echo function > /sys/kernel/debug/tracing/current_tracer
 # echo 1 > /proc/sys/kernel/ftrace_enabled
 # cat /sys/kernel/debug/tracing/trace

The trace will show that function tracing was not active.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/ftrace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 054f9bbe5f12..6cf0ed87edbc 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2229,7 +2229,7 @@ static void ftrace_startup_sysctl(void)
 		command = FTRACE_UPDATE_CALLS;
 		if (ftrace_graph_active)
 			command |= FTRACE_START_FUNC_RET;
-		ftrace_run_update_code(command);
+		ftrace_startup_enable(command);
 	}
 }
 
@@ -4914,12 +4914,12 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
 
 	if (ftrace_enabled) {
 
-		ftrace_startup_sysctl();
-
 		/* we are starting ftrace again */
 		if (ftrace_ops_list != &ftrace_list_end)
 			update_ftrace_function();
 
+		ftrace_startup_sysctl();
+
 	} else {
 		/* stopping ftrace calls (just send to ftrace_stub) */
 		ftrace_trace_function = ftrace_stub;

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

* [PATCH 3.16.y-ckt 121/165] ARM: imx6qdl-sabresd: set swbst_reg as vbus's parent reg
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (119 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 120/165] ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 122/165] ARM: imx6sl-evk: " Luis Henriques
                   ` (43 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Peter Chen, Shawn Guo, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Chen <peter.chen@freescale.com>

commit 40f737791d4dab26bf23a6331609c604142228bd upstream.

USB vbus 5V is from PMIC SWBST, so set swbst_reg as vbus's
parent reg, it fixed a bug that the voltage of vbus is incorrect
due to swbst_reg is disabled after boots up.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 40ea36534643..c3752cdb8b93 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -35,6 +35,7 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio3 22 0>;
 			enable-active-high;
+			vin-supply = <&swbst_reg>;
 		};
 
 		reg_usb_h1_vbus: regulator@1 {
@@ -45,6 +46,7 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio1 29 0>;
 			enable-active-high;
+			vin-supply = <&swbst_reg>;
 		};
 
 		reg_audio: regulator@2 {

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

* [PATCH 3.16.y-ckt 122/165] ARM: imx6sl-evk: set swbst_reg as vbus's parent reg
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (120 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 121/165] ARM: imx6qdl-sabresd: set swbst_reg as vbus's parent reg Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 123/165] drm/radeon: drop setting UPLL to sleep mode Luis Henriques
                   ` (42 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Peter Chen, Shawn Guo, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Chen <peter.chen@freescale.com>

commit 2de9dd0391a74e80922c1bc95a78cedf85bcdc9e upstream.

USB vbus 5V is from PMIC SWBST, so set swbst_reg as vbus's
parent reg, it fixed a bug that the voltage of vbus is incorrect
due to swbst_reg is disabled after boots up.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/imx6sl-evk.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
index a8d9a93fab85..fc4a265a26ac 100644
--- a/arch/arm/boot/dts/imx6sl-evk.dts
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -45,6 +45,7 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio4 0 0>;
 			enable-active-high;
+			vin-supply = <&swbst_reg>;
 		};
 
 		reg_usb_otg2_vbus: regulator@1 {
@@ -55,6 +56,7 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio4 2 0>;
 			enable-active-high;
+			vin-supply = <&swbst_reg>;
 		};
 
 		reg_aud3v: regulator@2 {

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

* [PATCH 3.16.y-ckt 123/165] drm/radeon: drop setting UPLL to sleep mode
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (121 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 122/165] ARM: imx6sl-evk: " Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 124/165] xen-pciback: limit guest control of command register Luis Henriques
                   ` (41 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christian König, Alex Deucher, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>

commit a17d4996e051e78d164989b894608cf37cd5110b upstream.

Just keep it working, seems to fix some PLL problems.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73378

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/si.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 74f41809bb42..b9368bc50570 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -6894,8 +6894,7 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk)
 	WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_BYPASS_EN_MASK, ~UPLL_BYPASS_EN_MASK);
 
 	if (!vclk || !dclk) {
-		/* keep the Bypass mode, put PLL to sleep */
-		WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_SLEEP_MASK, ~UPLL_SLEEP_MASK);
+		/* keep the Bypass mode */
 		return 0;
 	}
 
@@ -6911,8 +6910,7 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk)
 	/* set VCO_MODE to 1 */
 	WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_VCO_MODE_MASK, ~UPLL_VCO_MODE_MASK);
 
-	/* toggle UPLL_SLEEP to 1 then back to 0 */
-	WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_SLEEP_MASK, ~UPLL_SLEEP_MASK);
+	/* disable sleep mode */
 	WREG32_P(CG_UPLL_FUNC_CNTL, 0, ~UPLL_SLEEP_MASK);
 
 	/* deassert UPLL_RESET */

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

* [PATCH 3.16.y-ckt 124/165] xen-pciback: limit guest control of command register
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (122 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 123/165] drm/radeon: drop setting UPLL to sleep mode Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 125/165] ALSA: hda - Fix built-in mic on Compaq Presario CQ60 Luis Henriques
                   ` (40 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Beulich, David Vrabel, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Beulich <JBeulich@suse.com>

commit af6fc858a35b90e89ea7a7ee58e66628c55c776b upstream.

Otherwise the guest can abuse that control to cause e.g. PCIe
Unsupported Request responses by disabling memory and/or I/O decoding
and subsequently causing (CPU side) accesses to the respective address
ranges, which (depending on system configuration) may be fatal to the
host.

Note that to alter any of the bits collected together as
PCI_COMMAND_GUEST permissive mode is now required to be enabled
globally or on the specific device.

This is CVE-2015-2150 / XSA-120.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/xen/xen-pciback/conf_space.c        |  2 +-
 drivers/xen/xen-pciback/conf_space.h        |  2 +
 drivers/xen/xen-pciback/conf_space_header.c | 61 +++++++++++++++++++++++------
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c
index 46ae0f9f02ad..75fe3d466515 100644
--- a/drivers/xen/xen-pciback/conf_space.c
+++ b/drivers/xen/xen-pciback/conf_space.c
@@ -16,7 +16,7 @@
 #include "conf_space.h"
 #include "conf_space_quirks.h"
 
-static bool permissive;
+bool permissive;
 module_param(permissive, bool, 0644);
 
 /* This is where xen_pcibk_read_config_byte, xen_pcibk_read_config_word,
diff --git a/drivers/xen/xen-pciback/conf_space.h b/drivers/xen/xen-pciback/conf_space.h
index e56c934ad137..2e1d73d1d5d0 100644
--- a/drivers/xen/xen-pciback/conf_space.h
+++ b/drivers/xen/xen-pciback/conf_space.h
@@ -64,6 +64,8 @@ struct config_field_entry {
 	void *data;
 };
 
+extern bool permissive;
+
 #define OFFSET(cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset)
 
 /* Add fields to a device - the add_fields macro expects to get a pointer to
diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c
index c5ee82587e8c..2d7369391472 100644
--- a/drivers/xen/xen-pciback/conf_space_header.c
+++ b/drivers/xen/xen-pciback/conf_space_header.c
@@ -11,6 +11,10 @@
 #include "pciback.h"
 #include "conf_space.h"
 
+struct pci_cmd_info {
+	u16 val;
+};
+
 struct pci_bar_info {
 	u32 val;
 	u32 len_val;
@@ -20,22 +24,36 @@ struct pci_bar_info {
 #define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO))
 #define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER)
 
-static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)
+/* Bits guests are allowed to control in permissive mode. */
+#define PCI_COMMAND_GUEST (PCI_COMMAND_MASTER|PCI_COMMAND_SPECIAL| \
+			   PCI_COMMAND_INVALIDATE|PCI_COMMAND_VGA_PALETTE| \
+			   PCI_COMMAND_WAIT|PCI_COMMAND_FAST_BACK)
+
+static void *command_init(struct pci_dev *dev, int offset)
 {
-	int i;
-	int ret;
-
-	ret = xen_pcibk_read_config_word(dev, offset, value, data);
-	if (!pci_is_enabled(dev))
-		return ret;
-
-	for (i = 0; i < PCI_ROM_RESOURCE; i++) {
-		if (dev->resource[i].flags & IORESOURCE_IO)
-			*value |= PCI_COMMAND_IO;
-		if (dev->resource[i].flags & IORESOURCE_MEM)
-			*value |= PCI_COMMAND_MEMORY;
+	struct pci_cmd_info *cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
+	int err;
+
+	if (!cmd)
+		return ERR_PTR(-ENOMEM);
+
+	err = pci_read_config_word(dev, PCI_COMMAND, &cmd->val);
+	if (err) {
+		kfree(cmd);
+		return ERR_PTR(err);
 	}
 
+	return cmd;
+}
+
+static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)
+{
+	int ret = pci_read_config_word(dev, offset, value);
+	const struct pci_cmd_info *cmd = data;
+
+	*value &= PCI_COMMAND_GUEST;
+	*value |= cmd->val & ~PCI_COMMAND_GUEST;
+
 	return ret;
 }
 
@@ -43,6 +61,8 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 {
 	struct xen_pcibk_dev_data *dev_data;
 	int err;
+	u16 val;
+	struct pci_cmd_info *cmd = data;
 
 	dev_data = pci_get_drvdata(dev);
 	if (!pci_is_enabled(dev) && is_enable_cmd(value)) {
@@ -83,6 +103,19 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 		}
 	}
 
+	cmd->val = value;
+
+	if (!permissive && (!dev_data || !dev_data->permissive))
+		return 0;
+
+	/* Only allow the guest to control certain bits. */
+	err = pci_read_config_word(dev, offset, &val);
+	if (err || val == value)
+		return err;
+
+	value &= PCI_COMMAND_GUEST;
+	value |= val & ~PCI_COMMAND_GUEST;
+
 	return pci_write_config_word(dev, offset, value);
 }
 
@@ -282,6 +315,8 @@ static const struct config_field header_common[] = {
 	{
 	 .offset    = PCI_COMMAND,
 	 .size      = 2,
+	 .init      = command_init,
+	 .release   = bar_release,
 	 .u.w.read  = command_read,
 	 .u.w.write = command_write,
 	},

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

* [PATCH 3.16.y-ckt 125/165] ALSA: hda - Fix built-in mic on Compaq Presario CQ60
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (123 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 124/165] xen-pciback: limit guest control of command register Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 126/165] drm/vmwgfx: Fix a couple of lock dependency violations Luis Henriques
                   ` (39 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit ddb6ca75b5671b8fbf1909bc588c449ee74b34f9 upstream.

Compaq Presario CQ60 laptop with CX20561 gives a wrong pin for the
built-in mic NID 0x17 instead of NID 0x1d, and it results in the
non-working mic.  This patch just remaps the pin correctly via fixup.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=920604
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_conexant.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index c5eded4f9ed3..c7c3c153be31 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -2829,6 +2829,7 @@ enum {
 	CXT_PINCFG_LENOVO_TP410,
 	CXT_PINCFG_LEMOTE_A1004,
 	CXT_PINCFG_LEMOTE_A1205,
+	CXT_PINCFG_COMPAQ_CQ60,
 	CXT_FIXUP_STEREO_DMIC,
 	CXT_FIXUP_INC_MIC_BOOST,
 	CXT_FIXUP_HEADPHONE_MIC_PIN,
@@ -3265,6 +3266,15 @@ static const struct hda_fixup cxt_fixups[] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = cxt_pincfg_lemote,
 	},
+	[CXT_PINCFG_COMPAQ_CQ60] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			/* 0x17 was falsely set up as a mic, it should 0x1d */
+			{ 0x17, 0x400001f0 },
+			{ 0x1d, 0x97a70120 },
+			{ }
+		}
+	},
 	[CXT_FIXUP_STEREO_DMIC] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = cxt_fixup_stereo_dmic,
@@ -3374,6 +3384,7 @@ static const struct hda_model_fixup cxt5047_fixup_models[] = {
 };
 
 static const struct snd_pci_quirk cxt5051_fixups[] = {
+	SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60),
 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
 	{}
 };

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

* [PATCH 3.16.y-ckt 126/165] drm/vmwgfx: Fix a couple of lock dependency violations
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (124 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 125/165] ALSA: hda - Fix built-in mic on Compaq Presario CQ60 Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 127/165] drm/vmwgfx: Reorder device takedown somewhat Luis Henriques
                   ` (38 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Thomas Hellstrom, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Hellstrom <thellstrom@vmware.com>

commit 5151adb37a5918957f4c33a8d8e7629c0fb00563 upstream.

Experimental lockdep annotation added to the TTM lock has unveiled a
couple of lock dependency violations in the vmwgfx driver. In both
cases it turns out that the device_private::reservation_sem is not
needed so the offending code is moved out of that lock.

Acked-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |  8 +++-----
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c     | 14 +++-----------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 87df0b3674fd..6f6fa7d2db47 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2759,13 +2759,11 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
 				  NULL, arg->command_size, arg->throttle_us,
 				  (void __user *)(unsigned long)arg->fence_rep,
 				  NULL);
-
+	ttm_read_unlock(&dev_priv->reservation_sem);
 	if (unlikely(ret != 0))
-		goto out_unlock;
+		return ret;
 
 	vmw_kms_cursor_post_execbuf(dev_priv);
 
-out_unlock:
-	ttm_read_unlock(&dev_priv->reservation_sem);
-	return ret;
+	return 0;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index bedf18c054d1..d61f6d5ae094 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -2037,23 +2037,17 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
 	int i;
 	struct drm_mode_config *mode_config = &dev->mode_config;
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
-	if (unlikely(ret != 0))
-		return ret;
-
 	if (!arg->num_outputs) {
 		struct drm_vmw_rect def_rect = {0, 0, 800, 600};
 		vmw_du_update_layout(dev_priv, 1, &def_rect);
-		goto out_unlock;
+		return 0;
 	}
 
 	rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect);
 	rects = kcalloc(arg->num_outputs, sizeof(struct drm_vmw_rect),
 			GFP_KERNEL);
-	if (unlikely(!rects)) {
-		ret = -ENOMEM;
-		goto out_unlock;
-	}
+	if (unlikely(!rects))
+		return -ENOMEM;
 
 	user_rects = (void __user *)(unsigned long)arg->rects;
 	ret = copy_from_user(rects, user_rects, rects_size);
@@ -2078,7 +2072,5 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
 
 out_free:
 	kfree(rects);
-out_unlock:
-	ttm_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }

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

* [PATCH 3.16.y-ckt 127/165] drm/vmwgfx: Reorder device takedown somewhat
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (125 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 126/165] drm/vmwgfx: Fix a couple of lock dependency violations Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 128/165] ALSA: control: Add sanity checks for user ctl id name string Luis Henriques
                   ` (37 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Thomas Hellstrom, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Hellstrom <thellstrom@vmware.com>

commit 3458390b9f0ba784481d23134798faee27b5f16f upstream.

To take down the MOB and GMR memory types, the driver may have to issue
fence objects and thus make sure that the fence manager is taken down
after those memory types.
Reorder device init accordingly.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 77 +++++++++++++++++++------------------
 1 file changed, 40 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 68e45146e27f..9a03ee69f756 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -735,32 +735,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 		goto out_err1;
 	}
 
-	ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM,
-			     (dev_priv->vram_size >> PAGE_SHIFT));
-	if (unlikely(ret != 0)) {
-		DRM_ERROR("Failed initializing memory manager for VRAM.\n");
-		goto out_err2;
-	}
-
-	dev_priv->has_gmr = true;
-	if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) ||
-	    refuse_dma || ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_GMR,
-					 VMW_PL_GMR) != 0) {
-		DRM_INFO("No GMR memory available. "
-			 "Graphics memory resources are very limited.\n");
-		dev_priv->has_gmr = false;
-	}
-
-	if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) {
-		dev_priv->has_mob = true;
-		if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB,
-				   VMW_PL_MOB) != 0) {
-			DRM_INFO("No MOB memory available. "
-				 "3D will be disabled.\n");
-			dev_priv->has_mob = false;
-		}
-	}
-
 	dev_priv->mmio_mtrr = arch_phys_wc_add(dev_priv->mmio_start,
 					       dev_priv->mmio_size);
 
@@ -823,6 +797,33 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 		goto out_no_fman;
 	}
 
+
+	ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM,
+			     (dev_priv->vram_size >> PAGE_SHIFT));
+	if (unlikely(ret != 0)) {
+		DRM_ERROR("Failed initializing memory manager for VRAM.\n");
+		goto out_no_vram;
+	}
+
+	dev_priv->has_gmr = true;
+	if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) ||
+	    refuse_dma || ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_GMR,
+					 VMW_PL_GMR) != 0) {
+		DRM_INFO("No GMR memory available. "
+			 "Graphics memory resources are very limited.\n");
+		dev_priv->has_gmr = false;
+	}
+
+	if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) {
+		dev_priv->has_mob = true;
+		if (ttm_bo_init_mm(&dev_priv->bdev, VMW_PL_MOB,
+				   VMW_PL_MOB) != 0) {
+			DRM_INFO("No MOB memory available. "
+				 "3D will be disabled.\n");
+			dev_priv->has_mob = false;
+		}
+	}
+
 	vmw_kms_save_vga(dev_priv);
 
 	/* Start kms and overlay systems, needs fifo. */
@@ -848,6 +849,12 @@ out_no_fifo:
 	vmw_kms_close(dev_priv);
 out_no_kms:
 	vmw_kms_restore_vga(dev_priv);
+	if (dev_priv->has_mob)
+		(void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
+	if (dev_priv->has_gmr)
+		(void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
+	(void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
+out_no_vram:
 	vmw_fence_manager_takedown(dev_priv->fman);
 out_no_fman:
 	if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
@@ -863,12 +870,6 @@ out_err4:
 	iounmap(dev_priv->mmio_virt);
 out_err3:
 	arch_phys_wc_del(dev_priv->mmio_mtrr);
-	if (dev_priv->has_mob)
-		(void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
-	if (dev_priv->has_gmr)
-		(void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
-	(void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
-out_err2:
 	(void)ttm_bo_device_release(&dev_priv->bdev);
 out_err1:
 	vmw_ttm_global_release(dev_priv);
@@ -898,6 +899,13 @@ static int vmw_driver_unload(struct drm_device *dev)
 	}
 	vmw_kms_close(dev_priv);
 	vmw_overlay_close(dev_priv);
+
+	if (dev_priv->has_mob)
+		(void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
+	if (dev_priv->has_gmr)
+		(void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
+	(void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
+
 	vmw_fence_manager_takedown(dev_priv->fman);
 	if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
 		drm_irq_uninstall(dev_priv->dev);
@@ -909,11 +917,6 @@ static int vmw_driver_unload(struct drm_device *dev)
 	ttm_object_device_release(&dev_priv->tdev);
 	iounmap(dev_priv->mmio_virt);
 	arch_phys_wc_del(dev_priv->mmio_mtrr);
-	if (dev_priv->has_mob)
-		(void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
-	if (dev_priv->has_gmr)
-		(void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
-	(void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
 	(void)ttm_bo_device_release(&dev_priv->bdev);
 	vmw_ttm_global_release(dev_priv);
 

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

* [PATCH 3.16.y-ckt 128/165] ALSA: control: Add sanity checks for user ctl id name string
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (126 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 127/165] drm/vmwgfx: Reorder device takedown somewhat Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 129/165] ALSA: snd-usb: add quirks for Roland UA-22 Luis Henriques
                   ` (36 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit be3bb8236db2d0fcd705062ae2e2a9d75131222f upstream.

There was no check about the id string of user control elements, so we
accepted even a control element with an empty string, which is
obviously bogus.  This patch adds more sanity checks of id strings.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/core/control.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/core/control.c b/sound/core/control.c
index f0b0e14497a5..8cdf0a4b327b 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1167,6 +1167,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
 
 	if (info->count < 1)
 		return -EINVAL;
+	if (!*info->id.name)
+		return -EINVAL;
+	if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name))
+		return -EINVAL;
 	access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
 		(info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|
 				 SNDRV_CTL_ELEM_ACCESS_INACTIVE|

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

* [PATCH 3.16.y-ckt 129/165] ALSA: snd-usb: add quirks for Roland UA-22
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (127 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 128/165] ALSA: control: Add sanity checks for user ctl id name string Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 130/165] Revert "i2c: core: Dispose OF IRQ mapping at client removal time" Luis Henriques
                   ` (35 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Mack, Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Mack <daniel@zonque.org>

commit fcdcd1dec6d2c7b718385ec743ae5a9a233edad4 upstream.

The device complies to the UAC1 standard but hides that fact with
proprietary descriptors. The autodetect quirk for Roland devices
catches the audio interface but misses the MIDI part, so a specific
quirk is needed.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reported-by: Rafa Lafuente <rafalafuente@gmail.com>
Tested-by: Raphaël Doursenaud <raphael@doursenaud.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/usb/quirks-table.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 83bddbdb90e9..5293b5ac8b9d 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -1773,6 +1773,36 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		}
 	}
 },
+{
+	USB_DEVICE(0x0582, 0x0159),
+	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+		/* .vendor_name = "Roland", */
+		/* .product_name = "UA-22", */
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = (const struct snd_usb_audio_quirk[]) {
+			{
+				.ifnum = 0,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_MIDI_FIXED_ENDPOINT,
+				.data = & (const struct snd_usb_midi_endpoint_info) {
+					.out_cables = 0x0001,
+					.in_cables = 0x0001
+				}
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
 /* this catches most recent vendor-specific Roland devices */
 {
 	.match_flags = USB_DEVICE_ID_MATCH_VENDOR |

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

* [PATCH 3.16.y-ckt 130/165] Revert "i2c: core: Dispose OF IRQ mapping at client removal time"
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (128 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 129/165] ALSA: snd-usb: add quirks for Roland UA-22 Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 131/165] ALSA: hda - Set single_adc_amp flag for CS420x codecs Luis Henriques
                   ` (34 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jakub Kicinski, Wolfram Sang, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jakub Kicinski <kubakici@wp.pl>

commit a49445727014216703a3c28ccee4cef36d41571e upstream.

This reverts commit e4df3a0b6228
("i2c: core: Dispose OF IRQ mapping at client removal time")

Calling irq_dispose_mapping() will destroy the mapping and disassociate
the IRQ from the IRQ chip to which it belongs. Keeping it is OK, because
existent mappings are reused properly.

Also, this commit breaks drivers using devm* for IRQ management on
OF-based systems because devm* cleanup happens in device code, after
bus's remove() method returns.

Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
Reported-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[wsa: updated the commit message with findings fromt the other bug report]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Fixes: e4df3a0b6228
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/i2c/i2c-core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4716eb0bddcd..7c7f4b856bad 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -297,9 +297,6 @@ static int i2c_device_remove(struct device *dev)
 		status = driver->remove(client);
 	}
 
-	if (dev->of_node)
-		irq_dispose_mapping(client->irq);
-
 	acpi_dev_pm_detach(&client->dev, true);
 	return status;
 }

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

* [PATCH 3.16.y-ckt 131/165] ALSA: hda - Set single_adc_amp flag for CS420x codecs
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (129 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 130/165] Revert "i2c: core: Dispose OF IRQ mapping at client removal time" Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 132/165] ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic Luis Henriques
                   ` (33 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit bad994f5b4ab57eec8d56c180edca00505c3eeb2 upstream.

CS420x codecs seem to deal only the single amps of ADC nodes even
though the nodes receive multiple inputs.  This leads to the
inconsistent amp value after S3/S4 resume, for example.

The fix is just to set codec->single_adc_amp flag.  Then the driver
handles these ADC amps as if single connections.

Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_cirrus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 387f0b551889..8deff55271c6 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -586,6 +586,7 @@ static int patch_cs420x(struct hda_codec *codec)
 		return -ENOMEM;
 
 	spec->gen.automute_hook = cs_automute;
+	codec->single_adc_amp = 1;
 
 	snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl,
 			   cs420x_fixups);

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

* [PATCH 3.16.y-ckt 132/165] ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (130 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 131/165] ALSA: hda - Set single_adc_amp flag for CS420x codecs Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 133/165] nilfs2: fix deadlock of segment constructor during recovery Luis Henriques
                   ` (32 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 2ddee91abe9cc34ddb6294ee14702b46ae07d460 upstream.

MacBook Air 5,2 has the same problem as MacBook Pro 8,1 where the
built-in mic records only the right channel.  Apply the same
workaround as MBP8,1 to spread the mono channel via a Cirrus codec
vendor-specific COEF setup.

Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_cirrus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 8deff55271c6..6928c3290163 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -395,6 +395,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81),
 	SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
 	SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
+	SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81),
 	SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42),
 	SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
 	{} /* terminator */

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

* [PATCH 3.16.y-ckt 133/165] nilfs2: fix deadlock of segment constructor during recovery
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (131 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 132/165] ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 134/165] ALSA: hda - Don't access stereo amps for mono channel widgets Luis Henriques
                   ` (31 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ryusuke Konishi, Al Viro, Andrew Morton, Linus Torvalds, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

commit 283ee1482f349d6c0c09dfb725db5880afc56813 upstream.

According to a report from Yuxuan Shui, nilfs2 in kernel 3.19 got stuck
during recovery at mount time.  The code path that caused the deadlock was
as follows:

  nilfs_fill_super()
    load_nilfs()
      nilfs_salvage_orphan_logs()
        * Do roll-forwarding, attach segment constructor for recovery,
          and kick it.

        nilfs_segctor_thread()
          nilfs_segctor_thread_construct()
           * A lock is held with nilfs_transaction_lock()
             nilfs_segctor_do_construct()
               nilfs_segctor_drop_written_files()
                 iput()
                   iput_final()
                     write_inode_now()
                       writeback_single_inode()
                         __writeback_single_inode()
                           do_writepages()
                             nilfs_writepage()
                               nilfs_construct_dsync_segment()
                                 nilfs_transaction_lock() --> deadlock

This can happen if commit 7ef3ff2fea8b ("nilfs2: fix deadlock of segment
constructor over I_SYNC flag") is applied and roll-forward recovery was
performed at mount time.  The roll-forward recovery can happen if datasync
write is done and the file system crashes immediately after that.  For
instance, we can reproduce the issue with the following steps:

 < nilfs2 is mounted on /nilfs (device: /dev/sdb1) >
 # dd if=/dev/zero of=/nilfs/test bs=4k count=1 && sync
 # dd if=/dev/zero of=/nilfs/test conv=notrunc oflag=dsync bs=4k
 count=1 && reboot -nfh
 < the system will immediately reboot >
 # mount -t nilfs2 /dev/sdb1 /nilfs

The deadlock occurs because iput() can run segment constructor through
writeback_single_inode() if MS_ACTIVE flag is not set on sb->s_flags.  The
above commit changed segment constructor so that it calls iput()
asynchronously for inodes with i_nlink == 0, but that change was
imperfect.

This fixes the another deadlock by deferring iput() in segment constructor
even for the case that mount is not finished, that is, for the case that
MS_ACTIVE flag is not set.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Reported-by: Yuxuan Shui <yshuiv7@gmail.com>
Tested-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nilfs2/segment.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 5bee81674d53..14538a865102 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1906,6 +1906,7 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
 					     struct the_nilfs *nilfs)
 {
 	struct nilfs_inode_info *ii, *n;
+	int during_mount = !(sci->sc_super->s_flags & MS_ACTIVE);
 	int defer_iput = false;
 
 	spin_lock(&nilfs->ns_inode_lock);
@@ -1918,10 +1919,10 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
 		brelse(ii->i_bh);
 		ii->i_bh = NULL;
 		list_del_init(&ii->i_dirty);
-		if (!ii->vfs_inode.i_nlink) {
+		if (!ii->vfs_inode.i_nlink || during_mount) {
 			/*
-			 * Defer calling iput() to avoid a deadlock
-			 * over I_SYNC flag for inodes with i_nlink == 0
+			 * Defer calling iput() to avoid deadlocks if
+			 * i_nlink == 0 or mount is not yet finished.
 			 */
 			list_add_tail(&ii->i_dirty, &sci->sc_iput_queue);
 			defer_iput = true;

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

* [PATCH 3.16.y-ckt 134/165] ALSA: hda - Don't access stereo amps for mono channel widgets
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (132 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 133/165] nilfs2: fix deadlock of segment constructor during recovery Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 135/165] ARM: at91: pm: fix at91rm9200 standby Luis Henriques
                   ` (30 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit ef403edb75580a3ec5d155f5de82155f0419c621 upstream.

The current HDA generic parser initializes / modifies the amp values
always in stereo, but this seems causing the problem on ALC3229 codec
that has a few mono channel widgets: namely, these mono widgets react
to actions for both channels equally.

In the driver code, we do care the mono channel and create a control
only for the left channel (as defined in HD-audio spec) for such a
node.  When the control is updated, only the left channel value is
changed.  However, in the resume, the right channel value is also
restored from the initial value we took as stereo, and this overwrites
the left channel value.  This ends up being the silent output as the
right channel has been never touched and remains muted.

This patch covers the places where unconditional stereo amp accesses
are done and converts to the conditional accesses.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94581
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_generic.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 589e47c5aeb3..b756dd2906e4 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -658,7 +658,23 @@ static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx)
 {
 	unsigned int caps = query_amp_caps(codec, nid, dir);
 	int val = get_amp_val_to_activate(codec, nid, dir, caps, false);
-	snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val);
+
+	if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
+		snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val);
+	else
+		snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val);
+}
+
+/* update the amp, doing in stereo or mono depending on NID */
+static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx,
+		      unsigned int mask, unsigned int val)
+{
+	if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
+		return snd_hda_codec_amp_stereo(codec, nid, dir, idx,
+						mask, val);
+	else
+		return snd_hda_codec_amp_update(codec, nid, 0, dir, idx,
+						mask, val);
 }
 
 /* calculate amp value mask we can modify;
@@ -698,7 +714,7 @@ static void activate_amp(struct hda_codec *codec, hda_nid_t nid, int dir,
 		return;
 
 	val &= mask;
-	snd_hda_codec_amp_stereo(codec, nid, dir, idx, mask, val);
+	update_amp(codec, nid, dir, idx, mask, val);
 }
 
 static void activate_amp_out(struct hda_codec *codec, struct nid_path *path,
@@ -4336,13 +4352,11 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix)
 	has_amp = nid_has_mute(codec, mix, HDA_INPUT);
 	for (i = 0; i < nums; i++) {
 		if (has_amp)
-			snd_hda_codec_amp_stereo(codec, mix,
-						 HDA_INPUT, i,
-						 0xff, HDA_AMP_MUTE);
+			update_amp(codec, mix, HDA_INPUT, i,
+				   0xff, HDA_AMP_MUTE);
 		else if (nid_has_volume(codec, conn[i], HDA_OUTPUT))
-			snd_hda_codec_amp_stereo(codec, conn[i],
-						 HDA_OUTPUT, 0,
-						 0xff, HDA_AMP_MUTE);
+			update_amp(codec, conn[i], HDA_OUTPUT, 0,
+				   0xff, HDA_AMP_MUTE);
 	}
 }
 

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

* [PATCH 3.16.y-ckt 135/165] ARM: at91: pm: fix at91rm9200 standby
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (133 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 134/165] ALSA: hda - Don't access stereo amps for mono channel widgets Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 136/165] ARM: dts: DRA7x: Fix the bypass clock source for dpll_iva and others Luis Henriques
                   ` (29 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexandre Belloni, Nicolas Ferre, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexandre Belloni <alexandre.belloni@free-electrons.com>

commit 84e871660bebfddb9a62ebd6f19d02536e782f0a upstream.

at91rm9200 standby and suspend to ram has been broken since
00482a4078f4. It is wrongly using AT91_BASE_SYS which is a physical address
and actually doesn't correspond to any register on at91rm9200.

Use the correct at91_ramc_base[0] instead.

Fixes: 00482a4078f4 (ARM: at91: implement the standby function for pm/cpuidle)

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-at91/pm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index c5101dcb4fb0..1d4df3b70ebc 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -45,7 +45,7 @@ static inline void at91rm9200_standby(void)
 		"    mcr    p15, 0, %0, c7, c0, 4\n\t"
 		"    str    %5, [%1, %2]"
 		:
-		: "r" (0), "r" (AT91_BASE_SYS), "r" (AT91RM9200_SDRAMC_LPR),
+		: "r" (0), "r" (at91_ramc_base[0]), "r" (AT91RM9200_SDRAMC_LPR),
 		  "r" (1), "r" (AT91RM9200_SDRAMC_SRR),
 		  "r" (lpr));
 }

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

* [PATCH 3.16.y-ckt 136/165] ARM: dts: DRA7x: Fix the bypass clock source for dpll_iva and others
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (134 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 135/165] ARM: at91: pm: fix at91rm9200 standby Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 137/165] ARM: dts: am33xx-clocks: Fix ehrpwm tbclk data on am33xx Luis Henriques
                   ` (28 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ravikumar Kattekola, Tony Lindgren, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ravikumar Kattekola <rk@ti.com>

commit d2192ea09858a8535b056fcede1a41d824e0b3d8 upstream.

Fixes: ee6c750761 (ARM: dts: dra7 clock data)

On DRA7x, For DPLL_IVA, the ref clock(CLKINP) is connected to sys_clk1 and
the bypass input(CLKINPULOW) is connected to iva_dpll_hs_clk_div clock.
But the bypass input is not directly routed to bypass clkout instead
both CLKINP and CLKINPULOW are connected to bypass clkout via a mux.

This mux is controlled by the bit - CM_CLKSEL_DPLL_IVA[23]:DPLL_BYP_CLKSEL
and it's POR value is zero which selects the CLKINP as bypass clkout.
which means iva_dpll_hs_clk_div is not the bypass clock for dpll_iva_ck

Fix this by adding another mux clock as parent in bypass mode.

This design is common to most of the PLLs and the rest have only one bypass
clock. Below is a list of the DPLLs that need this fix:

DPLL_IVA, DPLL_DDR,
DPLL_DSP, DPLL_EVE,
DPLL_GMAC, DPLL_PER,
DPLL_USB and DPLL_CORE

Signed-off-by: Ravikumar Kattekola <rk@ti.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 90 ++++++++++++++++++++++++++++++++----
 1 file changed, 81 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi
index dc7a292fe939..379e4d5056ac 100644
--- a/arch/arm/boot/dts/dra7xx-clocks.dtsi
+++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi
@@ -243,10 +243,18 @@
 		ti,invert-autoidle-bit;
 	};
 
+	dpll_core_byp_mux: dpll_core_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		ti,bit-shift = <23>;
+		reg = <0x012c>;
+	};
+
 	dpll_core_ck: dpll_core_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-core-clock";
-		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		clocks = <&sys_clkin1>, <&dpll_core_byp_mux>;
 		reg = <0x0120>, <0x0124>, <0x012c>, <0x0128>;
 	};
 
@@ -309,10 +317,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_dsp_byp_mux: dpll_dsp_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&dsp_dpll_hs_clk_div>;
+		ti,bit-shift = <23>;
+		reg = <0x0240>;
+	};
+
 	dpll_dsp_ck: dpll_dsp_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&dsp_dpll_hs_clk_div>;
+		clocks = <&sys_clkin1>, <&dpll_dsp_byp_mux>;
 		reg = <0x0234>, <0x0238>, <0x0240>, <0x023c>;
 	};
 
@@ -335,10 +351,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_iva_byp_mux: dpll_iva_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&iva_dpll_hs_clk_div>;
+		ti,bit-shift = <23>;
+		reg = <0x01ac>;
+	};
+
 	dpll_iva_ck: dpll_iva_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&iva_dpll_hs_clk_div>;
+		clocks = <&sys_clkin1>, <&dpll_iva_byp_mux>;
 		reg = <0x01a0>, <0x01a4>, <0x01ac>, <0x01a8>;
 	};
 
@@ -361,10 +385,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_gpu_byp_mux: dpll_gpu_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		ti,bit-shift = <23>;
+		reg = <0x02e4>;
+	};
+
 	dpll_gpu_ck: dpll_gpu_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		clocks = <&sys_clkin1>, <&dpll_gpu_byp_mux>;
 		reg = <0x02d8>, <0x02dc>, <0x02e4>, <0x02e0>;
 	};
 
@@ -398,10 +430,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_ddr_byp_mux: dpll_ddr_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		ti,bit-shift = <23>;
+		reg = <0x021c>;
+	};
+
 	dpll_ddr_ck: dpll_ddr_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		clocks = <&sys_clkin1>, <&dpll_ddr_byp_mux>;
 		reg = <0x0210>, <0x0214>, <0x021c>, <0x0218>;
 	};
 
@@ -416,10 +456,18 @@
 		ti,invert-autoidle-bit;
 	};
 
+	dpll_gmac_byp_mux: dpll_gmac_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		ti,bit-shift = <23>;
+		reg = <0x02b4>;
+	};
+
 	dpll_gmac_ck: dpll_gmac_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&dpll_abe_m3x2_ck>;
+		clocks = <&sys_clkin1>, <&dpll_gmac_byp_mux>;
 		reg = <0x02a8>, <0x02ac>, <0x02b4>, <0x02b0>;
 	};
 
@@ -482,10 +530,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_eve_byp_mux: dpll_eve_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&eve_dpll_hs_clk_div>;
+		ti,bit-shift = <23>;
+		reg = <0x0290>;
+	};
+
 	dpll_eve_ck: dpll_eve_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&eve_dpll_hs_clk_div>;
+		clocks = <&sys_clkin1>, <&dpll_eve_byp_mux>;
 		reg = <0x0284>, <0x0288>, <0x0290>, <0x028c>;
 	};
 
@@ -1216,10 +1272,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_per_byp_mux: dpll_per_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&per_dpll_hs_clk_div>;
+		ti,bit-shift = <23>;
+		reg = <0x014c>;
+	};
+
 	dpll_per_ck: dpll_per_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-clock";
-		clocks = <&sys_clkin1>, <&per_dpll_hs_clk_div>;
+		clocks = <&sys_clkin1>, <&dpll_per_byp_mux>;
 		reg = <0x0140>, <0x0144>, <0x014c>, <0x0148>;
 	};
 
@@ -1242,10 +1306,18 @@
 		clock-div = <1>;
 	};
 
+	dpll_usb_byp_mux: dpll_usb_byp_mux {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_clkin1>, <&usb_dpll_hs_clk_div>;
+		ti,bit-shift = <23>;
+		reg = <0x018c>;
+	};
+
 	dpll_usb_ck: dpll_usb_ck {
 		#clock-cells = <0>;
 		compatible = "ti,omap4-dpll-j-type-clock";
-		clocks = <&sys_clkin1>, <&usb_dpll_hs_clk_div>;
+		clocks = <&sys_clkin1>, <&dpll_usb_byp_mux>;
 		reg = <0x0180>, <0x0184>, <0x018c>, <0x0188>;
 	};
 

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

* [PATCH 3.16.y-ckt 137/165] ARM: dts: am33xx-clocks: Fix ehrpwm tbclk data on am33xx
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (135 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 136/165] ARM: dts: DRA7x: Fix the bypass clock source for dpll_iva and others Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 138/165] ARM: dts: am43xx-clocks: Fix ehrpwm tbclk data on am43xx Luis Henriques
                   ` (27 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vignesh R, Tony Lindgren, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vignesh R <vigneshr@ti.com>

commit 6e22616eba7e25fac5aa6cb6563471afa1815ec2 upstream.

ehrpwm tbclk is wrongly modelled as deriving from dpll_per_m2_ck.
The TRM says tbclk is derived from SYSCLKOUT. SYSCLKOUT nothing but the
functional clock of pwmss (l4ls_gclk).
Fix this by changing source of ehrpwmx_tbclk to l4ls_gclk.

Fixes: 9e100ebafb91: ("Fix ehrpwm tbclk data")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/am33xx-clocks.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx-clocks.dtsi b/arch/arm/boot/dts/am33xx-clocks.dtsi
index 712edce7d6fb..071b56aa0c7e 100644
--- a/arch/arm/boot/dts/am33xx-clocks.dtsi
+++ b/arch/arm/boot/dts/am33xx-clocks.dtsi
@@ -99,7 +99,7 @@
 	ehrpwm0_tbclk: ehrpwm0_tbclk@44e10664 {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <0>;
 		reg = <0x0664>;
 	};
@@ -107,7 +107,7 @@
 	ehrpwm1_tbclk: ehrpwm1_tbclk@44e10664 {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <1>;
 		reg = <0x0664>;
 	};
@@ -115,7 +115,7 @@
 	ehrpwm2_tbclk: ehrpwm2_tbclk@44e10664 {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <2>;
 		reg = <0x0664>;
 	};

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

* [PATCH 3.16.y-ckt 138/165] ARM: dts: am43xx-clocks: Fix ehrpwm tbclk data on am43xx
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (136 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 137/165] ARM: dts: am33xx-clocks: Fix ehrpwm tbclk data on am33xx Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 139/165] clk: divider: fix calculation of maximal parent rate for a given divider Luis Henriques
                   ` (26 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vignesh R, Tony Lindgren, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Vignesh R <vigneshr@ti.com>

commit 7d53d25578486d65bd7cd242bc7816b40e55e62b upstream.

ehrpwm tbclk is wrongly modelled as deriving from dpll_per_m2_ck.
The TRM says tbclk is derived from SYSCLKOUT. SYSCLKOUT nothing but the
functional clock of pwmss (l4ls_gclk).
Fix this by changing source of ehrpwmx_tbclk to l4ls_gclk.

Fixes: 4da1c67719f61 ("add tbclk data for ehrpwm")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/boot/dts/am43xx-clocks.dtsi | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/am43xx-clocks.dtsi b/arch/arm/boot/dts/am43xx-clocks.dtsi
index c7dc9dab93a4..cfb49686ab6a 100644
--- a/arch/arm/boot/dts/am43xx-clocks.dtsi
+++ b/arch/arm/boot/dts/am43xx-clocks.dtsi
@@ -107,7 +107,7 @@
 	ehrpwm0_tbclk: ehrpwm0_tbclk {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <0>;
 		reg = <0x0664>;
 	};
@@ -115,7 +115,7 @@
 	ehrpwm1_tbclk: ehrpwm1_tbclk {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <1>;
 		reg = <0x0664>;
 	};
@@ -123,7 +123,7 @@
 	ehrpwm2_tbclk: ehrpwm2_tbclk {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <2>;
 		reg = <0x0664>;
 	};
@@ -131,7 +131,7 @@
 	ehrpwm3_tbclk: ehrpwm3_tbclk {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <4>;
 		reg = <0x0664>;
 	};
@@ -139,7 +139,7 @@
 	ehrpwm4_tbclk: ehrpwm4_tbclk {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <5>;
 		reg = <0x0664>;
 	};
@@ -147,7 +147,7 @@
 	ehrpwm5_tbclk: ehrpwm5_tbclk {
 		#clock-cells = <0>;
 		compatible = "ti,gate-clock";
-		clocks = <&dpll_per_m2_ck>;
+		clocks = <&l4ls_gclk>;
 		ti,bit-shift = <6>;
 		reg = <0x0664>;
 	};

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

* [PATCH 3.16.y-ckt 139/165] clk: divider: fix calculation of maximal parent rate for a given divider
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (137 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 138/165] ARM: dts: am43xx-clocks: Fix ehrpwm tbclk data on am43xx Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 140/165] clk: divider: fix selection of divider when rounding to closest Luis Henriques
                   ` (25 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Michael Turquette, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit da321133b53caf7889ed3ca1dabe4cc368db2604 upstream.

The rate provided at the output of a clk-divider is calculated as:

	DIV_ROUND_UP(parent_rate, div)

since commit b11d282dbea2 (clk: divider: fix rate calculation for
fractional rates). So to yield a rate not bigger than r parent_rate
must be <= r * div.

The effect of choosing a parent rate that is too big as was done before
this patch results in wrongly ruling out good dividers.

Note that this is not a complete fix as __clk_round_rate might return a
value >= its 2nd parameter. Also for dividers with
CLK_DIVIDER_ROUND_CLOSEST set the calculation is not accurate. But this
fixes the test case by Sascha Hauer that uses a chain of three dividers
under a fixed clock.

Fixes: b11d282dbea2 (clk: divider: fix rate calculation for fractional rates)
Suggested-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/clk-divider.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index c0a842b335c5..fd28adedee6c 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -129,12 +129,6 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw,
 	return DIV_ROUND_UP(parent_rate, div);
 }
 
-/*
- * The reverse of DIV_ROUND_UP: The maximum number which
- * divided by m is r
- */
-#define MULT_ROUND_UP(r, m) ((r) * (m) + (m) - 1)
-
 static bool _is_valid_table_div(const struct clk_div_table *table,
 							 unsigned int div)
 {
@@ -300,7 +294,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
 			return i;
 		}
 		parent_rate = __clk_round_rate(__clk_get_parent(hw->clk),
-				MULT_ROUND_UP(rate, i));
+					       rate * i);
 		now = DIV_ROUND_UP(parent_rate, i);
 		if (_is_best_div(divider, rate, now, best)) {
 			bestdiv = i;

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

* [PATCH 3.16.y-ckt 140/165] clk: divider: fix selection of divider when rounding to closest
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (138 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 139/165] clk: divider: fix calculation of maximal parent rate for a given divider Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 141/165] USB: serial: add Google simple serial SubClass support Luis Henriques
                   ` (24 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Michael Turquette, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit 26bac95aa88c2b1747808c0b885abe7814c0165d upstream.

It's an invalid approach to assume that among two divider values
the one nearer the exact divider is the better one.

Assume a parent rate of 1000 Hz, a divider with CLK_DIVIDER_POWER_OF_TWO
and a target rate of 89 Hz. The exact divider is ~ 11.236 so 8 and 16
are the candidates to choose from yielding rates 125 Hz and 62.5 Hz
respectivly. While 8 is nearer to 11.236 than 16 is, the latter is still
the better divider as 62.5 is nearer to 89 than 125 is.

Fixes: 774b514390b1 (clk: divider: Add round to closest divider)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/clk-divider.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index fd28adedee6c..a52154caf526 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -202,6 +202,7 @@ static int _div_round_closest(struct clk_divider *divider,
 		unsigned long parent_rate, unsigned long rate)
 {
 	int up, down, div;
+	unsigned long up_rate, down_rate;
 
 	up = down = div = DIV_ROUND_CLOSEST(parent_rate, rate);
 
@@ -213,7 +214,10 @@ static int _div_round_closest(struct clk_divider *divider,
 		down = _round_down_table(divider->table, div);
 	}
 
-	return (up - div) <= (div - down) ? up : down;
+	up_rate = DIV_ROUND_UP(parent_rate, up);
+	down_rate = DIV_ROUND_UP(parent_rate, down);
+
+	return (rate - up_rate) <= (down_rate - rate) ? up : down;
 }
 
 static int _div_round(struct clk_divider *divider, unsigned long parent_rate,

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

* [PATCH 3.16.y-ckt 141/165] USB: serial: add Google simple serial SubClass support
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (139 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 140/165] clk: divider: fix selection of divider when rounding to closest Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 142/165] HID: add support for MS Surface Pro 3 Type Cover Luis Henriques
                   ` (23 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Anton Staaf, Johan Hovold, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Anton Staaf <robotboy@chromium.org>

commit 679315e5fae1e4614eed0d9aa26999ddcb6a0f77 upstream.

Add support for Google devices that export simple serial
interfaces using the vendor specific SubClass/Protocol pair
0x50/0x01.

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
[johan: move id entries and update Kconfig]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/Kconfig             |  1 +
 drivers/usb/serial/usb-serial-simple.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 3ce5c74b29e4..6f483b8a4f56 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -59,6 +59,7 @@ config USB_SERIAL_SIMPLE
 	  driver.  Specifically, it supports:
 		- Suunto ANT+ USB device.
 		- Fundamental Software dongle.
+		- Google USB serial devices
 		- HP4x calculators
 		- a number of Motorola phones
 		- Siemens USB/MPI adapter.
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
index fb79775447b0..e5ad1ee6cb5f 100644
--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -50,6 +50,14 @@ DEVICE(funsoft, FUNSOFT_IDS);
 	{ USB_DEVICE(0x8087, 0x0716) }
 DEVICE(flashloader, FLASHLOADER_IDS);
 
+/* Google Serial USB SubClass */
+#define GOOGLE_IDS()						\
+	{ USB_VENDOR_AND_INTERFACE_INFO(0x18d1,			\
+					USB_CLASS_VENDOR_SPEC,	\
+					0x50,			\
+					0x01) }
+DEVICE(google, GOOGLE_IDS);
+
 /* ViVOpay USB Serial Driver */
 #define VIVOPAY_IDS()			\
 	{ USB_DEVICE(0x1d5f, 0x1004) }	/* ViVOpay 8800 */
@@ -85,6 +93,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
 	&zio_device,
 	&funsoft_device,
 	&flashloader_device,
+	&google_device,
 	&vivopay_device,
 	&moto_modem_device,
 	&hp4x_device,
@@ -97,6 +106,7 @@ static const struct usb_device_id id_table[] = {
 	ZIO_IDS(),
 	FUNSOFT_IDS(),
 	FLASHLOADER_IDS(),
+	GOOGLE_IDS(),
 	VIVOPAY_IDS(),
 	MOTO_IDS(),
 	HP4X_IDS(),

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

* [PATCH 3.16.y-ckt 142/165] HID: add support for MS Surface Pro 3 Type Cover
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (140 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 141/165] USB: serial: add Google simple serial SubClass support Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 143/165] HID: apple: fix battery support for the 2009 ANSI wireless keyboard Luis Henriques
                   ` (22 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alan Wu, Jiri Kosina, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Wu <alan.c.wu@gmail.com>

commit be3b16341d5cd8cf2a64fcc7a604a8efe6599ff0 upstream.

Surface Pro 3 Type Cover that works with Ubuntu (and possibly Arch) from this thread. Both trackpad and keyboard work after compiling my own kernel.
http://ubuntuforums.org/showthread.php?t=2231207&page=2&s=44910e0c56047e4f93dfd9fea58121ef

Also includes Jarrad Whitaker's message which sources
http://winaero.com/blog/how-to-install-linux-on-surface-pro-3/
which he says is sourced from a Russian site

Signed-off-by: Alan Wu <alan.c.wu@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-core.c          | 6 ++++++
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/hid-microsoft.c     | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 10 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 85f70c62b3ab..491347cacacb 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -702,6 +702,11 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 	if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
 	    type == HID_COLLECTION_PHYSICAL)
 		hid->group = HID_GROUP_SENSOR_HUB;
+
+	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
+	    hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 &&
+	    hid->group == HID_GROUP_MULTITOUCH)
+		hid->group = HID_GROUP_GENERIC;
 }
 
 static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
@@ -1845,6 +1850,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1bda12b7af69..9371799e5b8b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -646,6 +646,7 @@
 #define USB_DEVICE_ID_MS_SURFACE_PRO_2   0x0799
 #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
 #define USB_DEVICE_ID_MS_TYPE_COVER_2    0x07a9
+#define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
 
 #define USB_VENDOR_ID_MOJO		0x8282
 #define USB_DEVICE_ID_RETRO_ADAPTER	0x3201
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 8ba17a946f2a..cacda43f6a6f 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -274,6 +274,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_NOGET },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
 		.driver_data = MS_DUPLICATE_USAGES },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
+		.driver_data = MS_HIDINPUT },
 
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
 		.driver_data = MS_PRESENTER },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index f10dffa795cd..fac9650bd395 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -79,6 +79,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },

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

* [PATCH 3.16.y-ckt 143/165] HID: apple: fix battery support for the 2009 ANSI wireless keyboard
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (141 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 142/165] HID: add support for MS Surface Pro 3 Type Cover Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 144/165] HID: microsoft: add support for Japanese Surface Type Cover 3 Luis Henriques
                   ` (21 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ross Skaliotis, Jiri Kosina, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ross Skaliotis <rskaliotis@gmail.com>

commit cbd366bea2b8513bc0fc1c9e8832cb0ab221d6d5 upstream.

Enabled quirks necessary for correct battery capacity reporting. Cleaned up
surrounding style.

Signed-off-by: Ross Skaliotis <rskaliotis@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-input.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 79fa1cd9dfdd..197128ed8225 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -306,10 +306,13 @@ static enum power_supply_property hidinput_battery_props[] = {
 
 static const struct hid_device_id hid_battery_quirks[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
-			USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
-	HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
+	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
+	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
-			       USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
 	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
 			       USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),

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

* [PATCH 3.16.y-ckt 144/165] HID: microsoft: add support for Japanese Surface Type Cover 3
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (142 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 143/165] HID: apple: fix battery support for the 2009 ANSI wireless keyboard Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 145/165] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2 Luis Henriques
                   ` (20 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alan Wu, Jiri Kosina, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Wu <alan.c.wu@gmail.com>

commit 5e7e9e90b5867a3754159a8ce524299d930fbac8 upstream.

Based on code for the US Surface Type Cover 3
from commit be3b16341d5cd8cf2a64fcc7a604a8efe6599ff0
("HID: add support for MS Surface Pro 3 Type Cover"):

Signed-off-by: Alan Wu <alan.c.wu@gmail.com>
Tested-by: Karlis Dreizis <karlisdreizis@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-core.c          | 4 +++-
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/hid-microsoft.c     | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 491347cacacb..2142aedfff10 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -704,7 +704,8 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 		hid->group = HID_GROUP_SENSOR_HUB;
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
-	    hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 &&
+	    (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
+	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP) &&
 	    hid->group == HID_GROUP_MULTITOUCH)
 		hid->group = HID_GROUP_GENERIC;
 }
@@ -1851,6 +1852,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 9371799e5b8b..1f5efa897cbd 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -647,6 +647,7 @@
 #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
 #define USB_DEVICE_ID_MS_TYPE_COVER_2    0x07a9
 #define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
+#define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd
 
 #define USB_VENDOR_ID_MOJO		0x8282
 #define USB_DEVICE_ID_RETRO_ADAPTER	0x3201
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index cacda43f6a6f..fbaea6eb882e 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -276,6 +276,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_DUPLICATE_USAGES },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
 		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP),
+		.driver_data = MS_HIDINPUT },
 
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
 		.driver_data = MS_PRESENTER },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index fac9650bd395..913c9e0d2963 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -80,6 +80,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },

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

* [PATCH 3.16.y-ckt 145/165] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (143 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 144/165] HID: microsoft: add support for Japanese Surface Type Cover 3 Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 146/165] usb: gadget: function: phonet: balance usb_ep_disable calls Luis Henriques
                   ` (19 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jim Keir, Jiri Kosina, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jim Keir <jimkeir@oracledbadirect.com>

commit afd700d933963d07391e3e3dfbfbc05e905960ef upstream.

The FF2 driver (usbhid/hid-pidff.c) sends commands to the stick during ff_init.
However, this is called inside a block where driver_input_lock is locked, so
the results of these initial commands are discarded. This behavior is the
"killer", without this nothing else works.

ff_init issues commands using "hid_hw_request". This eventually goes to
hid_input_report, which returns -EBUSY because driver_input_lock is locked. The
change is to delay the ff_init call in hid-core.c until after this lock has
been released.

Calling hid_device_io_start() releases the lock so the device can be
configured.  We also need to call hid_device_io_stop() on exit for the lock to
remain locked while ending the init of the drivers.

[ benjamin.tissoires@redhat.com: imrpoved the changelog a lot ]

Signed-off-by: Jim Keir <jimkeir@oracledbadirect.com>
Reviewed-by: Benjamin.tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/usbhid/hid-pidff.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index 10b616702780..0b531c6a76a5 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1252,6 +1252,8 @@ int hid_pidff_init(struct hid_device *hid)
 
 	pidff->hid = hid;
 
+	hid_device_io_start(hid);
+
 	pidff_find_reports(hid, HID_OUTPUT_REPORT, pidff);
 	pidff_find_reports(hid, HID_FEATURE_REPORT, pidff);
 
@@ -1315,9 +1317,13 @@ int hid_pidff_init(struct hid_device *hid)
 
 	hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
 
+	hid_device_io_stop(hid);
+
 	return 0;
 
  fail:
+	hid_device_io_stop(hid);
+
 	kfree(pidff);
 	return error;
 }

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

* [PATCH 3.16.y-ckt 146/165] usb: gadget: function: phonet: balance usb_ep_disable calls
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (144 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 145/165] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2 Luis Henriques
@ 2015-03-25 14:01 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 147/165] usb: musb: core: add pm_runtime_irq_safe() Luis Henriques
                   ` (18 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:01 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <balbi@ti.com>

commit 9ec36f7fe20ef919cc15171e1da1b6739222541a upstream.

f_phonet's ->set_alt() method will call usb_ep_disable()
potentially on an endpoint which is already disabled. That's
something the gadget/function driver must guarantee that it's
always balanced.

In order to balance the calls, just make sure the endpoint
was enabled before by means of checking the validity of
driver_data.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16:
  - file rename: drivers/usb/gadget/function/f_phonet.c ->
    drivers/usb/gadget/f_phonet.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/gadget/f_phonet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index f2b781773eed..c2f12c85c6f8 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 			return -EINVAL;
 
 		spin_lock(&port->lock);
-		__pn_reset(f);
+
+		if (fp->in_ep->driver_data)
+			__pn_reset(f);
+
 		if (alt == 1) {
 			int i;
 

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

* [PATCH 3.16.y-ckt 147/165] usb: musb: core: add pm_runtime_irq_safe()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (145 preceding siblings ...)
  2015-03-25 14:01 ` [PATCH 3.16.y-ckt 146/165] usb: gadget: function: phonet: balance usb_ep_disable calls Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 148/165] cdc-acm: Add support for Denso cradle CU-321 Luis Henriques
                   ` (17 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <balbi@ti.com>

commit 3e43a0725637299a14369e3ef109c25a8ec5c008 upstream.

We need a pm_runtime_get_sync() call from
within musb_gadget_pullup() to make sure
registers are accessible at that time.

The problem is that musb_gadget_pullup() is
called with IRQs disabled and, because of that,
we need to tell pm_runtime that this pm_runtime_get_sync()
is IRQ safe.

We can simply add pm_runtime_irq_safe(), however, because
we need to make our read/write accessor function pointers
have been initialized before trying to use them. This means
that all pm_runtime initialization for musb_core needs to
be moved down so that when we call pm_runtime_irq_safe(),
the pm_runtime_get_sync() that it calls on the parent, won't
cause a crash due to NULL musb_read/write accessors.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/musb/musb_core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index eff3c5cf84f4..a9ac102ee7a0 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1892,16 +1892,18 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 		goto fail0;
 	}
 
-	pm_runtime_use_autosuspend(musb->controller);
-	pm_runtime_set_autosuspend_delay(musb->controller, 200);
-	pm_runtime_enable(musb->controller);
-
 	spin_lock_init(&musb->lock);
 	musb->board_set_power = plat->set_power;
 	musb->min_power = plat->min_power;
 	musb->ops = plat->platform_ops;
 	musb->port_mode = plat->mode;
 
+	/* We need musb_read/write functions initialized for PM */
+	pm_runtime_use_autosuspend(musb->controller);
+	pm_runtime_set_autosuspend_delay(musb->controller, 200);
+	pm_runtime_irq_safe(musb->controller);
+	pm_runtime_enable(musb->controller);
+
 	/* The musb_platform_init() call:
 	 *   - adjusts musb->mregs
 	 *   - sets the musb->isr

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

* [PATCH 3.16.y-ckt 148/165] cdc-acm: Add support for Denso cradle CU-321
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (146 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 147/165] usb: musb: core: add pm_runtime_irq_safe() Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 149/165] HID: microsoft: Add ID for NE7K wireless keyboard Luis Henriques
                   ` (16 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjoern Gerhart, Greg Kroah-Hartman, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B6rn=20Gerhart?= <oss@airbjorn.de>

commit b20b1618b8fca858c83e52da4aa22cd6b13b0359 upstream.

In order to support an older USB cradle by Denso, I added its vendor- and product-ID to the array of usb_device_id acm_ids. In this way cdc-acm feels responsible for this cradle. The related /dev/ttyACM node is being created properly, and the data transfer works.

However, later cradle models by Denso do have proper descriptors, so the patch is not required for these. At the same time both the older and the later model have the same vendor- and product-ID, but they both work with the patched driver.

Declaration of the Denso cradles I tested:
- both models have the same IDs: vendorID 0x076d, productID 0x0006
- older model: Denso CU-321 (descriptors not properly set)
- later model: Denso CU-821 (with proper descriptors)

Signed-off-by: Bjoern Gerhart <oss@airbjorn.de>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/class/cdc-acm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index bffb50450132..bc2cacd3cb68 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1662,6 +1662,8 @@ static int acm_reset_resume(struct usb_interface *intf)
 
 static const struct usb_device_id acm_ids[] = {
 	/* quirky and broken devices */
+	{ USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */
+	.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
 	{ USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
 	.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
 	{ USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */

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

* [PATCH 3.16.y-ckt 149/165] HID: microsoft: Add ID for NE7K wireless keyboard
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (147 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 148/165] cdc-acm: Add support for Denso cradle CU-321 Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 150/165] sparc32: destroy_context() and switch_mm() needs to disable interrupts Luis Henriques
                   ` (15 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jakub Sitnicki, Jiri Kosina, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jakub Sitnicki <jsitnicki@gmail.com>

commit ef567cf9ddb682dbfa840bf4a2600931299f9555 upstream.

Microsoft Natural Wireless Ergonomic Keyboard 7000 has special My
Favorites 1..5 keys which are handled through a vendor-defined usage
page (0xff05).

Apply MS_ERGONOMY quirks handling to USB PID 0x071d (Microsoft Microsoft
2.4GHz Transceiver V1.0) so that the My Favorites 1..5 keys are reported
as KEY_F14..18 events.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=52841
Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-core.c      | 1 +
 drivers/hid/hid-ids.h       | 1 +
 drivers/hid/hid-microsoft.c | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2142aedfff10..5ed3a7b91b4c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1846,6 +1846,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1f5efa897cbd..51a4d9bbbc9d 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -641,6 +641,7 @@
 #define USB_DEVICE_ID_MS_LK6K		0x00f9
 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT	0x0701
 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB	0x0713
+#define USB_DEVICE_ID_MS_NE7K		0x071d
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K	0x0730
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
 #define USB_DEVICE_ID_MS_SURFACE_PRO_2   0x0799
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index fbaea6eb882e..af935eb198c9 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
 		.driver_data = MS_ERGONOMY },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K),
+		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K),
 		.driver_data = MS_ERGONOMY | MS_RDESC },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),

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

* [PATCH 3.16.y-ckt 150/165] sparc32: destroy_context() and switch_mm() needs to disable interrupts.
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (148 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 149/165] HID: microsoft: Add ID for NE7K wireless keyboard Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 151/165] sparc: semtimedop() unreachable due to comparison error Luis Henriques
                   ` (14 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andreas Larsson, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andreas Larsson <andreas@gaisler.com>

commit 66d0f7ec9f1038452178b1993fc07fd96d30fd38 upstream.

Load balancing can be triggered in the critical sections protected by
srmmu_context_spinlock in destroy_context() and switch_mm() and can hang
the cpu waiting for the rq lock of another cpu that in turn has called
switch_mm hangning on srmmu_context_spinlock leading to deadlock.

So, disable interrupt while taking srmmu_context_spinlock in
destroy_context() and switch_mm() so we don't deadlock.

See also commit 77b838fa1ef0 ("[SPARC64]: destroy_context() needs to disable
interrupts.")

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/sparc/mm/srmmu.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index be65f035d18a..5cbc96d801ff 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -460,10 +460,12 @@ static void __init sparc_context_init(int numctx)
 void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm,
 	       struct task_struct *tsk)
 {
+	unsigned long flags;
+
 	if (mm->context == NO_CONTEXT) {
-		spin_lock(&srmmu_context_spinlock);
+		spin_lock_irqsave(&srmmu_context_spinlock, flags);
 		alloc_context(old_mm, mm);
-		spin_unlock(&srmmu_context_spinlock);
+		spin_unlock_irqrestore(&srmmu_context_spinlock, flags);
 		srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
 	}
 
@@ -986,14 +988,15 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 
 void destroy_context(struct mm_struct *mm)
 {
+	unsigned long flags;
 
 	if (mm->context != NO_CONTEXT) {
 		flush_cache_mm(mm);
 		srmmu_ctxd_set(&srmmu_context_table[mm->context], srmmu_swapper_pg_dir);
 		flush_tlb_mm(mm);
-		spin_lock(&srmmu_context_spinlock);
+		spin_lock_irqsave(&srmmu_context_spinlock, flags);
 		free_context(mm->context);
-		spin_unlock(&srmmu_context_spinlock);
+		spin_unlock_irqrestore(&srmmu_context_spinlock, flags);
 		mm->context = NO_CONTEXT;
 	}
 }

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

* [PATCH 3.16.y-ckt 151/165] sparc: semtimedop() unreachable due to comparison error
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (149 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 150/165] sparc32: destroy_context() and switch_mm() needs to disable interrupts Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 152/165] sparc: perf: Remove redundant perf_pmu_{en|dis}able calls Luis Henriques
                   ` (13 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rob Gardner, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Rob Gardner <rob.gardner@oracle.com>

commit 53eb2516972b8c4628651dfcb926cb9ef8b2864a upstream.

A bug was reported that the semtimedop() system call was always
failing eith ENOSYS.

Since SEMCTL is defined as 3, and SEMTIMEDOP is defined as 4,
the comparison "call <= SEMCTL" will always prevent SEMTIMEDOP
from getting through to the semaphore ops switch statement.

This is corrected by changing the comparison to "call <= SEMTIMEDOP".

Orabug: 20633375

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/sparc/kernel/sys_sparc_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index c85403d0496c..30e7ddb27a3a 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -333,7 +333,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
 	long err;
 
 	/* No need for backward compatibility. We can start fresh... */
-	if (call <= SEMCTL) {
+	if (call <= SEMTIMEDOP) {
 		switch (call) {
 		case SEMOP:
 			err = sys_semtimedop(first, ptr,

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

* [PATCH 3.16.y-ckt 152/165] sparc: perf: Remove redundant perf_pmu_{en|dis}able calls
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (150 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 151/165] sparc: semtimedop() unreachable due to comparison error Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 153/165] sparc: perf: Make counting mode actually work Luis Henriques
                   ` (12 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Ahern, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Ahern <david.ahern@oracle.com>

commit 5b0d4b5514bbcce69b516d0742f2cfc84ebd6db3 upstream.

perf_pmu_disable is called by core perf code before pmu->del and the
enable function is called by core perf code afterwards. No need to
call again within sparc_pmu_del.

Ditto for pmu->add and sparc_pmu_add.

Signed-off-by: David Ahern <david.ahern@oracle.com>
Acked-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/sparc/kernel/perf_event.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index c9759ad3f34a..f5e76cf3f54e 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1101,7 +1101,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags)
 	int i;
 
 	local_irq_save(flags);
-	perf_pmu_disable(event->pmu);
 
 	for (i = 0; i < cpuc->n_events; i++) {
 		if (event == cpuc->event[i]) {
@@ -1127,7 +1126,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags)
 		}
 	}
 
-	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 }
 
@@ -1361,7 +1359,6 @@ static int sparc_pmu_add(struct perf_event *event, int ef_flags)
 	unsigned long flags;
 
 	local_irq_save(flags);
-	perf_pmu_disable(event->pmu);
 
 	n0 = cpuc->n_events;
 	if (n0 >= sparc_pmu->max_hw_events)
@@ -1394,7 +1391,6 @@ nocheck:
 
 	ret = 0;
 out:
-	perf_pmu_enable(event->pmu);
 	local_irq_restore(flags);
 	return ret;
 }

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

* [PATCH 3.16.y-ckt 153/165] sparc: perf: Make counting mode actually work
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (151 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 152/165] sparc: perf: Remove redundant perf_pmu_{en|dis}able calls Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 154/165] sparc: Touch NMI watchdog when walking cpus and calling printk Luis Henriques
                   ` (11 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Ahern, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Ahern <david.ahern@oracle.com>

commit d51291cb8f32bfae6b331e1838651f3ddefa73a5 upstream.

Currently perf-stat (aka, counting mode) does not work:

$ perf stat ls
...
 Performance counter stats for 'ls':

          1.585665      task-clock (msec)         #    0.580 CPUs utilized
                24      context-switches          #    0.015 M/sec
                 0      cpu-migrations            #    0.000 K/sec
                86      page-faults               #    0.054 M/sec
   <not supported>      cycles
   <not supported>      stalled-cycles-frontend
   <not supported>      stalled-cycles-backend
   <not supported>      instructions
   <not supported>      branches
   <not supported>      branch-misses

       0.002735100 seconds time elapsed

The reason is that state is never reset (stays with PERF_HES_UPTODATE set).
Add a call to sparc_pmu_enable_event during the added_event handling.
Clean up the encoding since pmu_start calls sparc_pmu_enable_event which
does the same. Passing PERF_EF_RELOAD to sparc_pmu_start means the call
to sparc_perf_event_set_period can be removed as well.

With this patch:

$ perf stat ls
...
 Performance counter stats for 'ls':

          1.552890      task-clock (msec)         #    0.552 CPUs utilized
                24      context-switches          #    0.015 M/sec
                 0      cpu-migrations            #    0.000 K/sec
                86      page-faults               #    0.055 M/sec
         5,748,997      cycles                    #    3.702 GHz
   <not supported>      stalled-cycles-frontend:HG
   <not supported>      stalled-cycles-backend:HG
         1,684,362      instructions:HG           #    0.29  insns per cycle
           295,133      branches:HG               #  190.054 M/sec
            28,007      branch-misses:HG          #    9.49% of all branches

       0.002815665 seconds time elapsed

Signed-off-by: David Ahern <david.ahern@oracle.com>
Acked-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/sparc/kernel/perf_event.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index f5e76cf3f54e..66e7cb9c8e2b 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -960,6 +960,8 @@ out:
 	cpuc->pcr[0] |= cpuc->event[0]->hw.config_base;
 }
 
+static void sparc_pmu_start(struct perf_event *event, int flags);
+
 /* On this PMU each PIC has it's own PCR control register.  */
 static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc)
 {
@@ -972,20 +974,13 @@ static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc)
 		struct perf_event *cp = cpuc->event[i];
 		struct hw_perf_event *hwc = &cp->hw;
 		int idx = hwc->idx;
-		u64 enc;
 
 		if (cpuc->current_idx[i] != PIC_NO_INDEX)
 			continue;
 
-		sparc_perf_event_set_period(cp, hwc, idx);
 		cpuc->current_idx[i] = idx;
 
-		enc = perf_event_get_enc(cpuc->events[i]);
-		cpuc->pcr[idx] &= ~mask_for_index(idx);
-		if (hwc->state & PERF_HES_STOPPED)
-			cpuc->pcr[idx] |= nop_for_index(idx);
-		else
-			cpuc->pcr[idx] |= event_encoding(enc, idx);
+		sparc_pmu_start(cp, PERF_EF_RELOAD);
 	}
 out:
 	for (i = 0; i < cpuc->n_events; i++) {

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

* [PATCH 3.16.y-ckt 154/165] sparc: Touch NMI watchdog when walking cpus and calling printk
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (152 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 153/165] sparc: perf: Make counting mode actually work Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 155/165] sparc64: Fix several bugs in memmove() Luis Henriques
                   ` (10 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Ahern, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Ahern <david.ahern@oracle.com>

commit 31aaa98c248da766ece922bbbe8cc78cfd0bc920 upstream.

With the increase in number of CPUs calls to functions that dump
output to console (e.g., arch_trigger_all_cpu_backtrace) can take
a long time to complete. If IRQs are disabled eventually the NMI
watchdog kicks in and creates more havoc. Avoid by telling the NMI
watchdog everything is ok.

Signed-off-by: David Ahern <david.ahern@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/sparc/kernel/process_64.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 0be7bf978cb1..46a59643bb1c 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -287,6 +287,8 @@ void arch_trigger_all_cpu_backtrace(bool include_self)
 			printk("             TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n",
 			       gp->tpc, gp->o7, gp->i7, gp->rpc);
 		}
+
+		touch_nmi_watchdog();
 	}
 
 	memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
@@ -362,6 +364,8 @@ static void pmu_snapshot_all_cpus(void)
 		       (cpu == this_cpu ? '*' : ' '), cpu,
 		       pp->pcr[0], pp->pcr[1], pp->pcr[2], pp->pcr[3],
 		       pp->pic[0], pp->pic[1], pp->pic[2], pp->pic[3]);
+
+		touch_nmi_watchdog();
 	}
 
 	memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));

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

* [PATCH 3.16.y-ckt 155/165] sparc64: Fix several bugs in memmove().
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (153 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 154/165] sparc: Touch NMI watchdog when walking cpus and calling printk Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 156/165] net: sysctl_net_core: check SNDBUF and RCVBUF for min length Luis Henriques
                   ` (9 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "David S. Miller" <davem@davemloft.net>

commit 2077cef4d5c29cf886192ec32066f783d6a80db8 upstream.

Firstly, handle zero length calls properly.  Believe it or not there
are a few of these happening during early boot.

Next, we can't just drop to a memcpy() call in the forward copy case
where dst <= src.  The reason is that the cache initializing stores
used in the Niagara memcpy() implementations can end up clearing out
cache lines before we've sourced their original contents completely.

For example, considering NG4memcpy, the main unrolled loop begins like
this:

     load   src + 0x00
     load   src + 0x08
     load   src + 0x10
     load   src + 0x18
     load   src + 0x20
     store  dst + 0x00

Assume dst is 64 byte aligned and let's say that dst is src - 8 for
this memcpy() call.  That store at the end there is the one to the
first line in the cache line, thus clearing the whole line, which thus
clobbers "src + 0x28" before it even gets loaded.

To avoid this, just fall through to a simple copy only mildly
optimized for the case where src and dst are 8 byte aligned and the
length is a multiple of 8 as well.  We could get fancy and call
GENmemcpy() but this is good enough for how this thing is actually
used.

Reported-by: David Ahern <david.ahern@oracle.com>
Reported-by: Bob Picco <bpicco@meloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/sparc/lib/memmove.S | 35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/lib/memmove.S b/arch/sparc/lib/memmove.S
index b7f6334e159f..857ad4f8905f 100644
--- a/arch/sparc/lib/memmove.S
+++ b/arch/sparc/lib/memmove.S
@@ -8,9 +8,11 @@
 
 	.text
 ENTRY(memmove) /* o0=dst o1=src o2=len */
-	mov		%o0, %g1
+	brz,pn		%o2, 99f
+	 mov		%o0, %g1
+
 	cmp		%o0, %o1
-	bleu,pt		%xcc, memcpy
+	bleu,pt		%xcc, 2f
 	 add		%o1, %o2, %g7
 	cmp		%g7, %o0
 	bleu,pt		%xcc, memcpy
@@ -24,7 +26,34 @@ ENTRY(memmove) /* o0=dst o1=src o2=len */
 	stb		%g7, [%o0]
 	bne,pt		%icc, 1b
 	 sub		%o0, 1, %o0
-
+99:
 	retl
 	 mov		%g1, %o0
+
+	/* We can't just call memcpy for these memmove cases.  On some
+	 * chips the memcpy uses cache initializing stores and when dst
+	 * and src are close enough, those can clobber the source data
+	 * before we've loaded it in.
+	 */
+2:	or		%o0, %o1, %g7
+	or		%o2, %g7, %g7
+	andcc		%g7, 0x7, %g0
+	bne,pn		%xcc, 4f
+	 nop
+
+3:	ldx		[%o1], %g7
+	add		%o1, 8, %o1
+	subcc		%o2, 8, %o2
+	add		%o0, 8, %o0
+	bne,pt		%icc, 3b
+	 stx		%g7, [%o0 - 0x8]
+	ba,a,pt		%xcc, 99b
+
+4:	ldub		[%o1], %g7
+	add		%o1, 1, %o1
+	subcc		%o2, 1, %o2
+	add		%o0, 1, %o0
+	bne,pt		%icc, 4b
+	 stb		%g7, [%o0 - 0x1]
+	ba,a,pt		%xcc, 99b
 ENDPROC(memmove)

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

* [PATCH 3.16.y-ckt 156/165] net: sysctl_net_core: check SNDBUF and RCVBUF for min length
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (154 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 155/165] sparc64: Fix several bugs in memmove() Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 157/165] rds: avoid potential stack overflow Luis Henriques
                   ` (8 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexey Kodanev, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexey Kodanev <alexey.kodanev@oracle.com>

commit b1cb59cf2efe7971d3d72a7b963d09a512d994c9 upstream.

sysctl has sysctl.net.core.rmem_*/wmem_* parameters which can be
set to incorrect values. Given that 'struct sk_buff' allocates from
rcvbuf, incorrectly set buffer length could result to memory
allocation failures. For example, set them as follows:

    # sysctl net.core.rmem_default=64
      net.core.wmem_default = 64
    # sysctl net.core.wmem_default=64
      net.core.wmem_default = 64
    # ping localhost -s 1024 -i 0 > /dev/null

This could result to the following failure:

skbuff: skb_over_panic: text:ffffffff81628db4 len:-32 put:-32
head:ffff88003a1cc200 data:ffff88003a1cc200 tail:0xffffffe0 end:0xc0 dev:<NULL>
kernel BUG at net/core/skbuff.c:102!
invalid opcode: 0000 [#1] SMP
...
task: ffff88003b7f5550 ti: ffff88003ae88000 task.ti: ffff88003ae88000
RIP: 0010:[<ffffffff8155fbd1>]  [<ffffffff8155fbd1>] skb_put+0xa1/0xb0
RSP: 0018:ffff88003ae8bc68  EFLAGS: 00010296
RAX: 000000000000008d RBX: 00000000ffffffe0 RCX: 0000000000000000
RDX: ffff88003fdcf598 RSI: ffff88003fdcd9c8 RDI: ffff88003fdcd9c8
RBP: ffff88003ae8bc88 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 00000000000002b2 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88003d3f7300 R15: ffff88000012a900
FS:  00007fa0e2b4a840(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000d0f7e0 CR3: 000000003b8fb000 CR4: 00000000000006f0
Stack:
 ffff88003a1cc200 00000000ffffffe0 00000000000000c0 ffffffff818cab1d
 ffff88003ae8bd68 ffffffff81628db4 ffff88003ae8bd48 ffff88003b7f5550
 ffff880031a09408 ffff88003b7f5550 ffff88000012aa48 ffff88000012ab00
Call Trace:
 [<ffffffff81628db4>] unix_stream_sendmsg+0x2c4/0x470
 [<ffffffff81556f56>] sock_write_iter+0x146/0x160
 [<ffffffff811d9612>] new_sync_write+0x92/0xd0
 [<ffffffff811d9cd6>] vfs_write+0xd6/0x180
 [<ffffffff811da499>] SyS_write+0x59/0xd0
 [<ffffffff81651532>] system_call_fastpath+0x12/0x17
Code: 00 00 48 89 44 24 10 8b 87 c8 00 00 00 48 89 44 24 08 48 8b 87 d8 00
      00 00 48 c7 c7 30 db 91 81 48 89 04 24 31 c0 e8 4f a8 0e 00 <0f> 0b
      eb fe 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 48 83
RIP  [<ffffffff8155fbd1>] skb_put+0xa1/0xb0
RSP <ffff88003ae8bc68>
Kernel panic - not syncing: Fatal exception

Moreover, the possible minimum is 1, so we can get another kernel panic:
...
BUG: unable to handle kernel paging request at ffff88013caee5c0
IP: [<ffffffff815604cf>] __alloc_skb+0x12f/0x1f0
...

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/core/sysctl_net_core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index cf9cd13509a7..e731c96eac4b 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -25,6 +25,8 @@
 static int zero = 0;
 static int one = 1;
 static int ushort_max = USHRT_MAX;
+static int min_sndbuf = SOCK_MIN_SNDBUF;
+static int min_rcvbuf = SOCK_MIN_RCVBUF;
 
 #ifdef CONFIG_RPS
 static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
@@ -223,7 +225,7 @@ static struct ctl_table net_core_table[] = {
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= &one,
+		.extra1		= &min_sndbuf,
 	},
 	{
 		.procname	= "rmem_max",
@@ -231,7 +233,7 @@ static struct ctl_table net_core_table[] = {
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= &one,
+		.extra1		= &min_rcvbuf,
 	},
 	{
 		.procname	= "wmem_default",
@@ -239,7 +241,7 @@ static struct ctl_table net_core_table[] = {
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= &one,
+		.extra1		= &min_sndbuf,
 	},
 	{
 		.procname	= "rmem_default",
@@ -247,7 +249,7 @@ static struct ctl_table net_core_table[] = {
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= &one,
+		.extra1		= &min_rcvbuf,
 	},
 	{
 		.procname	= "dev_weight",

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

* [PATCH 3.16.y-ckt 157/165] rds: avoid potential stack overflow
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (155 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 156/165] net: sysctl_net_core: check SNDBUF and RCVBUF for min length Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 158/165] inet_diag: fix possible overflow in inet_diag_dump_one_icsk() Luis Henriques
                   ` (7 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit f862e07cf95d5b62a5fc5e981dd7d0dbaf33a501 upstream.

The rds_iw_update_cm_id function stores a large 'struct rds_sock' object
on the stack in order to pass a pair of addresses. This happens to just
fit withint the 1024 byte stack size warning limit on x86, but just
exceed that limit on ARM, which gives us this warning:

net/rds/iw_rdma.c:200:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]

As the use of this large variable is basically bogus, we can rearrange
the code to not do that. Instead of passing an rds socket into
rds_iw_get_device, we now just pass the two addresses that we have
available in rds_iw_update_cm_id, and we change rds_iw_get_mr accordingly,
to create two address structures on the stack there.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/rds/iw_rdma.c | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
index a817705ce2d0..dba8d0864f18 100644
--- a/net/rds/iw_rdma.c
+++ b/net/rds/iw_rdma.c
@@ -88,7 +88,9 @@ static unsigned int rds_iw_unmap_fastreg_list(struct rds_iw_mr_pool *pool,
 			int *unpinned);
 static void rds_iw_destroy_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr);
 
-static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwdev, struct rdma_cm_id **cm_id)
+static int rds_iw_get_device(struct sockaddr_in *src, struct sockaddr_in *dst,
+			     struct rds_iw_device **rds_iwdev,
+			     struct rdma_cm_id **cm_id)
 {
 	struct rds_iw_device *iwdev;
 	struct rds_iw_cm_id *i_cm_id;
@@ -112,15 +114,15 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd
 				src_addr->sin_port,
 				dst_addr->sin_addr.s_addr,
 				dst_addr->sin_port,
-				rs->rs_bound_addr,
-				rs->rs_bound_port,
-				rs->rs_conn_addr,
-				rs->rs_conn_port);
+				src->sin_addr.s_addr,
+				src->sin_port,
+				dst->sin_addr.s_addr,
+				dst->sin_port);
 #ifdef WORKING_TUPLE_DETECTION
-			if (src_addr->sin_addr.s_addr == rs->rs_bound_addr &&
-			    src_addr->sin_port == rs->rs_bound_port &&
-			    dst_addr->sin_addr.s_addr == rs->rs_conn_addr &&
-			    dst_addr->sin_port == rs->rs_conn_port) {
+			if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr &&
+			    src_addr->sin_port == src->sin_port &&
+			    dst_addr->sin_addr.s_addr == dst->sin_addr.s_addr &&
+			    dst_addr->sin_port == dst->sin_port) {
 #else
 			/* FIXME - needs to compare the local and remote
 			 * ipaddr/port tuple, but the ipaddr is the only
@@ -128,7 +130,7 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd
 			 * zero'ed.  It doesn't appear to be properly populated
 			 * during connection setup...
 			 */
-			if (src_addr->sin_addr.s_addr == rs->rs_bound_addr) {
+			if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr) {
 #endif
 				spin_unlock_irq(&iwdev->spinlock);
 				*rds_iwdev = iwdev;
@@ -180,19 +182,13 @@ int rds_iw_update_cm_id(struct rds_iw_device *rds_iwdev, struct rdma_cm_id *cm_i
 {
 	struct sockaddr_in *src_addr, *dst_addr;
 	struct rds_iw_device *rds_iwdev_old;
-	struct rds_sock rs;
 	struct rdma_cm_id *pcm_id;
 	int rc;
 
 	src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr;
 	dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr;
 
-	rs.rs_bound_addr = src_addr->sin_addr.s_addr;
-	rs.rs_bound_port = src_addr->sin_port;
-	rs.rs_conn_addr = dst_addr->sin_addr.s_addr;
-	rs.rs_conn_port = dst_addr->sin_port;
-
-	rc = rds_iw_get_device(&rs, &rds_iwdev_old, &pcm_id);
+	rc = rds_iw_get_device(src_addr, dst_addr, &rds_iwdev_old, &pcm_id);
 	if (rc)
 		rds_iw_remove_cm_id(rds_iwdev, cm_id);
 
@@ -598,9 +594,17 @@ void *rds_iw_get_mr(struct scatterlist *sg, unsigned long nents,
 	struct rds_iw_device *rds_iwdev;
 	struct rds_iw_mr *ibmr = NULL;
 	struct rdma_cm_id *cm_id;
+	struct sockaddr_in src = {
+		.sin_addr.s_addr = rs->rs_bound_addr,
+		.sin_port = rs->rs_bound_port,
+	};
+	struct sockaddr_in dst = {
+		.sin_addr.s_addr = rs->rs_conn_addr,
+		.sin_port = rs->rs_conn_port,
+	};
 	int ret;
 
-	ret = rds_iw_get_device(rs, &rds_iwdev, &cm_id);
+	ret = rds_iw_get_device(&src, &dst, &rds_iwdev, &cm_id);
 	if (ret || !cm_id) {
 		ret = -ENODEV;
 		goto out;

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

* [PATCH 3.16.y-ckt 158/165] inet_diag: fix possible overflow in inet_diag_dump_one_icsk()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (156 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 157/165] rds: avoid potential stack overflow Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 159/165] caif: fix MSG_OOB test in caif_seqpkt_recvmsg() Luis Henriques
                   ` (6 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit c8e2c80d7ec00d020320f905822bf49c5ad85250 upstream.

inet_diag_dump_one_icsk() allocates too small skb.

Add inet_sk_attr_size() helper right before inet_sk_diag_fill()
so that it can be updated if/when new attributes are added.

iproute2/ss currently does not use this dump_one() interface,
this might explain nobody noticed this problem yet.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/inet_diag.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index e34dccbc4d70..4eeba4e497a0 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -71,6 +71,20 @@ static inline void inet_diag_unlock_handler(
 	mutex_unlock(&inet_diag_table_mutex);
 }
 
+static size_t inet_sk_attr_size(void)
+{
+	return	  nla_total_size(sizeof(struct tcp_info))
+		+ nla_total_size(1) /* INET_DIAG_SHUTDOWN */
+		+ nla_total_size(1) /* INET_DIAG_TOS */
+		+ nla_total_size(1) /* INET_DIAG_TCLASS */
+		+ nla_total_size(sizeof(struct inet_diag_meminfo))
+		+ nla_total_size(sizeof(struct inet_diag_msg))
+		+ nla_total_size(SK_MEMINFO_VARS * sizeof(u32))
+		+ nla_total_size(TCP_CA_NAME_MAX)
+		+ nla_total_size(sizeof(struct tcpvegas_info))
+		+ 64;
+}
+
 int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
 			      struct sk_buff *skb, struct inet_diag_req_v2 *req,
 			      struct user_namespace *user_ns,		      	
@@ -324,9 +338,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_s
 	if (err)
 		goto out;
 
-	rep = nlmsg_new(sizeof(struct inet_diag_msg) +
-			sizeof(struct inet_diag_meminfo) +
-			sizeof(struct tcp_info) + 64, GFP_KERNEL);
+	rep = nlmsg_new(inet_sk_attr_size(), GFP_KERNEL);
 	if (!rep) {
 		err = -ENOMEM;
 		goto out;

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

* [PATCH 3.16.y-ckt 159/165] caif: fix MSG_OOB test in caif_seqpkt_recvmsg()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (157 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 158/165] inet_diag: fix possible overflow in inet_diag_dump_one_icsk() Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 160/165] rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg() Luis Henriques
                   ` (5 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Al Viro, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@ZenIV.linux.org.uk>

commit 3eeff778e00c956875c70b145c52638c313dfb23 upstream.

It should be checking flags, not msg->msg_flags.  It's ->sendmsg()
instances that need to look for that in ->msg_flags, ->recvmsg() ones
(including the other ->recvmsg() instance in that file, as well as
unix_dgram_recvmsg() this one claims to be imitating) check in flags.
Braino had been introduced in commit dcda13 ("caif: Bugfix - use MSG_TRUNC
in receive") back in 2010, so it goes quite a while back.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/caif/caif_socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index e8437094d15f..5e078a0b2455 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -281,7 +281,7 @@ static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock,
 	int copylen;
 
 	ret = -EOPNOTSUPP;
-	if (m->msg_flags&MSG_OOB)
+	if (flags & MSG_OOB)
 		goto read_error;
 
 	skb = skb_recv_datagram(sk, flags, 0 , &ret);

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

* [PATCH 3.16.y-ckt 160/165] rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg()
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (158 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 159/165] caif: fix MSG_OOB test in caif_seqpkt_recvmsg() Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 161/165] Revert "net: cx82310_eth: use common match macro" Luis Henriques
                   ` (4 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Al Viro, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@ZenIV.linux.org.uk>

commit 7d985ed1dca5c90535d67ce92ef6ca520302340a upstream.

[I would really like an ACK on that one from dhowells; it appears to be
quite straightforward, but...]

MSG_PEEK isn't passed to ->recvmsg() via msg->msg_flags; as the matter of
fact, neither the kernel users of rxrpc, nor the syscalls ever set that bit
in there.  It gets passed via flags; in fact, another such check in the same
function is done correctly - as flags & MSG_PEEK.

It had been that way (effectively disabled) for 8 years, though, so the patch
needs beating up - that case had never been tested.  If it is correct, it's
-stable fodder.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/rxrpc/ar-recvmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c
index e9aaa65c0778..0df95463c650 100644
--- a/net/rxrpc/ar-recvmsg.c
+++ b/net/rxrpc/ar-recvmsg.c
@@ -87,7 +87,7 @@ int rxrpc_recvmsg(struct kiocb *iocb, struct socket *sock,
 		if (!skb) {
 			/* nothing remains on the queue */
 			if (copied &&
-			    (msg->msg_flags & MSG_PEEK || timeo == 0))
+			    (flags & MSG_PEEK || timeo == 0))
 				goto out;
 
 			/* wait for a message to turn up */

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

* [PATCH 3.16.y-ckt 161/165] Revert "net: cx82310_eth: use common match macro"
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (159 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 160/165] rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg() Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 162/165] ipv6: fix backtracking for throw routes Luis Henriques
                   ` (3 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ondrej Zary, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ondrej Zary <linux@rainbow-software.org>

commit 8d006e0105978619fb472e150c88b0d49337fe2b upstream.

This reverts commit 11ad714b98f6d9ca0067568442afe3e70eb94845 because
it breaks cx82310_eth.

The custom USB_DEVICE_CLASS macro matches
bDeviceClass, bDeviceSubClass and bDeviceProtocol
but the common USB_DEVICE_AND_INTERFACE_INFO matches
bInterfaceClass, bInterfaceSubClass and bInterfaceProtocol instead, which are
not specified.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/cx82310_eth.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c
index 3eed708a6182..fe48f4c51373 100644
--- a/drivers/net/usb/cx82310_eth.c
+++ b/drivers/net/usb/cx82310_eth.c
@@ -300,9 +300,18 @@ static const struct driver_info	cx82310_info = {
 	.tx_fixup	= cx82310_tx_fixup,
 };
 
+#define USB_DEVICE_CLASS(vend, prod, cl, sc, pr) \
+	.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
+		       USB_DEVICE_ID_MATCH_DEV_INFO, \
+	.idVendor = (vend), \
+	.idProduct = (prod), \
+	.bDeviceClass = (cl), \
+	.bDeviceSubClass = (sc), \
+	.bDeviceProtocol = (pr)
+
 static const struct usb_device_id products[] = {
 	{
-		USB_DEVICE_AND_INTERFACE_INFO(0x0572, 0xcb01, 0xff, 0, 0),
+		USB_DEVICE_CLASS(0x0572, 0xcb01, 0xff, 0, 0),
 		.driver_info = (unsigned long) &cx82310_info
 	},
 	{ },

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

* [PATCH 3.16.y-ckt 162/165] ipv6: fix backtracking for throw routes
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (160 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 161/165] Revert "net: cx82310_eth: use common match macro" Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 163/165] tcp: fix tcp fin memory accounting Luis Henriques
                   ` (2 subsequent siblings)
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Steven Barth, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steven Barth <cyrus@openwrt.org>

commit 73ba57bfae4a1914f6a6dac71e3168dd900e00af upstream.

for throw routes to trigger evaluation of other policy rules
EAGAIN needs to be propagated up to fib_rules_lookup
similar to how its done for IPv4

A simple testcase for verification is:

ip -6 rule add lookup 33333 priority 33333
ip -6 route add throw 2001:db8::1
ip -6 route add 2001:db8::1 via fe80::1 dev wlan0 table 33333
ip route get 2001:db8::1

Signed-off-by: Steven Barth <cyrus@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/fib6_rules.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index b4d5e1d97c1b..27ca79682efb 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -104,6 +104,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
 				goto again;
 			flp6->saddr = saddr;
 		}
+		err = rt->dst.error;
 		goto out;
 	}
 again:

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

* [PATCH 3.16.y-ckt 163/165] tcp: fix tcp fin memory accounting
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (161 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 162/165] ipv6: fix backtracking for throw routes Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 164/165] net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 165/165] tcp: make connect() mem charging friendly Luis Henriques
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Josh Hunt <johunt@akamai.com>

commit d22e1537181188e5dc8cbc51451832625035bdc2 upstream.

tcp_send_fin() does not account for the memory it allocates properly, so
sk_forward_alloc can be negative in cases where we've sent a FIN:

ss example output (ss -amn | grep -B1 f4294):
tcp    FIN-WAIT-1 0      1            192.168.0.1:45520         192.0.2.1:8080
	skmem:(r0,rb87380,t0,tb87380,f4294966016,w1280,o0,bl0)
Acked-by: Eric Dumazet <edumazet@google.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_output.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 64fb6e84127e..faf54abdb4d7 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2697,15 +2697,11 @@ void tcp_send_fin(struct sock *sk)
 	} else {
 		/* Socket is locked, keep trying until memory is available. */
 		for (;;) {
-			skb = alloc_skb_fclone(MAX_TCP_HEADER,
-					       sk->sk_allocation);
+			skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
 			if (skb)
 				break;
 			yield();
 		}
-
-		/* Reserve space for headers and prepare control bits. */
-		skb_reserve(skb, MAX_TCP_HEADER);
 		/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
 		tcp_init_nondata_skb(skb, tp->write_seq,
 				     TCPHDR_ACK | TCPHDR_FIN);

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

* [PATCH 3.16.y-ckt 164/165] net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (162 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 163/165] tcp: fix tcp fin memory accounting Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 165/165] tcp: make connect() mem charging friendly Luis Henriques
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David S. Miller, Dan Carpenter, Catalin Marinas, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Catalin Marinas <catalin.marinas@arm.com>

commit 91edd096e224941131f896b86838b1e59553696a upstream.

Commit db31c55a6fb2 (net: clamp ->msg_namelen instead of returning an
error) introduced the clamping of msg_namelen when the unsigned value
was larger than sizeof(struct sockaddr_storage). This caused a
msg_namelen of -1 to be valid. The native code was subsequently fixed by
commit dbb490b96584 (net: socket: error on a negative msg_namelen).

In addition, the native code sets msg_namelen to 0 when msg_name is
NULL. This was done in commit (6a2a2b3ae075 net:socket: set msg_namelen
to 0 if msg_name is passed as NULL in msghdr struct from userland) and
subsequently updated by 08adb7dabd48 (fold verify_iovec() into
copy_msghdr_from_user()).

This patch brings the get_compat_msghdr() in line with
copy_msghdr_from_user().

Fixes: db31c55a6fb2 (net: clamp ->msg_namelen instead of returning an error)
Cc: David S. Miller <davem@davemloft.net>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: used davem's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/compat.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/compat.c b/net/compat.c
index c48930373e65..53e933eb78b8 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -71,6 +71,13 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg)
 	    __get_user(kmsg->msg_controllen, &umsg->msg_controllen) ||
 	    __get_user(kmsg->msg_flags, &umsg->msg_flags))
 		return -EFAULT;
+
+	if (!tmp1)
+		kmsg->msg_namelen = 0;
+
+	if (kmsg->msg_namelen < 0)
+		return -EINVAL;
+
 	if (kmsg->msg_namelen > sizeof(struct sockaddr_storage))
 		kmsg->msg_namelen = sizeof(struct sockaddr_storage);
 	kmsg->msg_name = compat_ptr(tmp1);

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

* [PATCH 3.16.y-ckt 165/165] tcp: make connect() mem charging friendly
  2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
                   ` (163 preceding siblings ...)
  2015-03-25 14:02 ` [PATCH 3.16.y-ckt 164/165] net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour Luis Henriques
@ 2015-03-25 14:02 ` Luis Henriques
  164 siblings, 0 replies; 166+ messages in thread
From: Luis Henriques @ 2015-03-25 14:02 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 355a901e6cf1b2b763ec85caa2a9f04fbcc4ab4a upstream.

While working on sk_forward_alloc problems reported by Denys
Fedoryshchenko, we found that tcp connect() (and fastopen) do not call
sk_wmem_schedule() for SYN packet (and/or SYN/DATA packet), so
sk_forward_alloc is negative while connect is in progress.

We can fix this by calling regular sk_stream_alloc_skb() both for the
SYN packet (in tcp_connect()) and the syn_data packet in
tcp_send_syn_data()

Then, tcp_send_syn_data() can avoid copying syn_data as we simply
can manipulate syn_data->cb[] to remove SYN flag (and increment seq)

Instead of open coding memcpy_fromiovecend(), simply use this helper.

This leaves in socket write queue clean fast clone skbs.

This was tested against our fastopen packetdrill tests.

Reported-by: Denys Fedoryshchenko <nuclearcat@nuclearcat.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/tcp_output.c | 68 +++++++++++++++++++++------------------------------
 1 file changed, 28 insertions(+), 40 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index faf54abdb4d7..d5457e40f5be 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2954,9 +2954,9 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct tcp_fastopen_request *fo = tp->fastopen_req;
-	int syn_loss = 0, space, i, err = 0, iovlen = fo->data->msg_iovlen;
-	struct sk_buff *syn_data = NULL, *data;
+	int syn_loss = 0, space, err = 0;
 	unsigned long last_syn_loss = 0;
+	struct sk_buff *syn_data;
 
 	tp->rx_opt.mss_clamp = tp->advmss;  /* If MSS is not cached */
 	tcp_fastopen_cache_get(sk, &tp->rx_opt.mss_clamp, &fo->cookie,
@@ -2987,48 +2987,40 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
 	/* limit to order-0 allocations */
 	space = min_t(size_t, space, SKB_MAX_HEAD(MAX_TCP_HEADER));
 
-	syn_data = skb_copy_expand(syn, MAX_TCP_HEADER, space,
-				   sk->sk_allocation);
-	if (syn_data == NULL)
+	syn_data = sk_stream_alloc_skb(sk, space, sk->sk_allocation);
+	if (!syn_data)
 		goto fallback;
+	syn_data->ip_summed = CHECKSUM_PARTIAL;
+	memcpy(syn_data->cb, syn->cb, sizeof(syn->cb));
+	if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space),
+					 fo->data->msg_iov, 0, space))) {
+		kfree_skb(syn_data);
+		goto fallback;
+	}
 
-	for (i = 0; i < iovlen && syn_data->len < space; ++i) {
-		struct iovec *iov = &fo->data->msg_iov[i];
-		unsigned char __user *from = iov->iov_base;
-		int len = iov->iov_len;
+	/* No more data pending in inet_wait_for_connect() */
+	if (space == fo->size)
+		fo->data = NULL;
+	fo->copied = space;
 
-		if (syn_data->len + len > space)
-			len = space - syn_data->len;
-		else if (i + 1 == iovlen)
-			/* No more data pending in inet_wait_for_connect() */
-			fo->data = NULL;
+	tcp_connect_queue_skb(sk, syn_data);
 
-		if (skb_add_data(syn_data, from, len))
-			goto fallback;
-	}
+	err = tcp_transmit_skb(sk, syn_data, 1, sk->sk_allocation);
 
-	/* Queue a data-only packet after the regular SYN for retransmission */
-	data = pskb_copy(syn_data, sk->sk_allocation);
-	if (data == NULL)
-		goto fallback;
-	TCP_SKB_CB(data)->seq++;
-	TCP_SKB_CB(data)->tcp_flags &= ~TCPHDR_SYN;
-	TCP_SKB_CB(data)->tcp_flags = (TCPHDR_ACK|TCPHDR_PSH);
-	tcp_connect_queue_skb(sk, data);
-	fo->copied = data->len;
-
-	/* syn_data is about to be sent, we need to take current time stamps
-	 * for the packets that are in write queue : SYN packet and DATA
-	 */
-	skb_mstamp_get(&syn->skb_mstamp);
-	data->skb_mstamp = syn->skb_mstamp;
+	syn->skb_mstamp = syn_data->skb_mstamp;
 
-	if (tcp_transmit_skb(sk, syn_data, 0, sk->sk_allocation) == 0) {
+	/* Now full SYN+DATA was cloned and sent (or not),
+	 * remove the SYN from the original skb (syn_data)
+	 * we keep in write queue in case of a retransmit, as we
+	 * also have the SYN packet (with no data) in the same queue.
+	 */
+	TCP_SKB_CB(syn_data)->seq++;
+	TCP_SKB_CB(syn_data)->tcp_flags = TCPHDR_ACK | TCPHDR_PSH;
+	if (!err) {
 		tp->syn_data = (fo->copied > 0);
 		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPORIGDATASENT);
 		goto done;
 	}
-	syn_data = NULL;
 
 fallback:
 	/* Send a regular SYN with Fast Open cookie request option */
@@ -3037,7 +3029,6 @@ fallback:
 	err = tcp_transmit_skb(sk, syn, 1, sk->sk_allocation);
 	if (err)
 		tp->syn_fastopen = 0;
-	kfree_skb(syn_data);
 done:
 	fo->cookie.len = -1;  /* Exclude Fast Open option for SYN retries */
 	return err;
@@ -3057,13 +3048,10 @@ int tcp_connect(struct sock *sk)
 		return 0;
 	}
 
-	buff = alloc_skb_fclone(MAX_TCP_HEADER + 15, sk->sk_allocation);
-	if (unlikely(buff == NULL))
+	buff = sk_stream_alloc_skb(sk, 0, sk->sk_allocation);
+	if (unlikely(!buff))
 		return -ENOBUFS;
 
-	/* Reserve space for headers. */
-	skb_reserve(buff, MAX_TCP_HEADER);
-
 	tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN);
 	tp->retrans_stamp = TCP_SKB_CB(buff)->when = tcp_time_stamp;
 	tcp_connect_queue_skb(sk, buff);

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

end of thread, other threads:[~2015-03-25 15:01 UTC | newest]

Thread overview: 166+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 13:59 [3.16.y-ckt stable] Linux 3.16.7-ckt9 stable review Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 001/165] netfilter: nf_tables: disable preemption when restoring chain counters Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 002/165] netfilter: nf_tables: fix leaks in error path of nf_tables_newchain() Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 003/165] ipvs: rerouting to local clients is not needed anymore Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 004/165] netfilter: nft_compat: fix module refcount underflow Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 005/165] netfilter: xt_socket: fix a stack corruption bug Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 006/165] ipvs: add missing ip_vs_pe_put in sync code Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 007/165] flowcache: Fix kernel panic in flow_cache_flush_task Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 008/165] pktgen: fix UDP checksum computation Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 009/165] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 010/165] tcp: make sure skb is not shared before using skb_get() Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 011/165] ipv6: fix ipv6_cow_metrics for non DST_HOST case Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 012/165] rtnetlink: call ->dellink on failure when ->newlink exists Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 013/165] gen_stats.c: Duplicate xstats buffer for later use Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 014/165] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 015/165] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 016/165] net: phy: Fix verification of EEE support in phy_init_eee Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 017/165] ematch: Fix auto-loading of ematch modules Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 018/165] openvswitch: Fix net exit Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 019/165] net: reject creation of netdev names with colons Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 020/165] team: fix possible null pointer dereference in team_handle_frame Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 021/165] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 022/165] macvtap: make sure neighbour code can push ethernet header Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 023/165] usb: plusb: Add support for National Instruments host-to-host cable Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 024/165] udp: only allow UFO for packets from SOCK_DGRAM sockets Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 025/165] net: ping: Return EAFNOSUPPORT when appropriate Luis Henriques
2015-03-25 13:59 ` [PATCH 3.16.y-ckt 026/165] team: don't traverse port list using rcu in team_set_mac_address Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 027/165] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 028/165] xfs: Fix quota type in quota structures when reusing quota file Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 029/165] drm/i915: Dell Chromebook 11 has PWM backlight Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 030/165] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 031/165] gpio: tps65912: fix wrong container_of arguments Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 032/165] ALSA: pcm: Don't leave PREPARED state after draining Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 033/165] metag: Fix KSTK_EIP() and KSTK_ESP() macros Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 034/165] ALSA: hda: controller code - do not export static functions Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 035/165] drm/i915: Check obj->vma_list under the struct_mutex Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 036/165] md/raid1: fix read balance when a drive is write-mostly Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 037/165] ALSA: hda - Disable runtime PM for Panther Point again Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 038/165] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 039/165] drm/radeon: fix 1 RB harvest config setup for TN/RL Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 040/165] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 041/165] nilfs2: fix potential memory overrun on inode Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 042/165] iio: mxs-lradc: separate touchscreen and buffer virtual channels Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 043/165] iio: mxs-lradc: make ADC reads not disable touchscreen interrupts Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 044/165] iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 045/165] iio: mxs-lradc: only update the buffer when its conversions have finished Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 046/165] iio: imu: adis16400: Fix sign extension Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 047/165] iio: mxs-lradc: fix iio channel map regression Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 048/165] iio:adc:mcp3422 Fix incorrect scales table Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 049/165] iio: ad5686: fix optional reference voltage declaration Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 050/165] usb: dwc3: dwc3-omap: Fix disable IRQ Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 051/165] usb: gadget: configfs: don't NUL-terminate (sub)compatible ids Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 052/165] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 053/165] usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 054/165] xhci: Allocate correct amount of scratchpad buffers Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 055/165] USB: usbfs: don't leak kernel data in siginfo Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 056/165] uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539 Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 057/165] efi/libstub: Fix boundary checking in efi_high_alloc() Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 058/165] Revert "USB: serial: make bulk_out_size a lower limit" Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 059/165] USB: ftdi_sio: add PIDs for Actisense USB devices Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 060/165] USB: serial: fix potential use-after-free after failed probe Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 061/165] USB: serial: fix tty-device error handling at probe Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 062/165] USB: mxuport: fix null deref when used as a console Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 063/165] mac80211: Send EAPOL frames at lowest rate Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 064/165] ARC: Fix KSTK_ESP() Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 065/165] USB: serial: cp210x: Adding Seletek device id's Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 066/165] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 067/165] mei: make device disabled on stop unconditionally Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 068/165] NFSv4: Don't call put_rpccred() under the rcu_read_lock() Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 069/165] btrfs: fix lost return value due to variable shadowing Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 070/165] KVM: MIPS: Fix trace event to save PC directly Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 071/165] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 072/165] ecryptfs: ->f_op is never NULL Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 073/165] eCryptfs: don't pass fs-specific ioctl commands through Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 074/165] drm/radeon: do a posting read in r100_set_irq Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 075/165] drm/radeon: do a posting read in rs600_set_irq Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 076/165] drm/radeon: do a posting read in r600_set_irq Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 077/165] drm/radeon: do a posting read in evergreen_set_irq Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 078/165] drm/radeon: do a posting read in si_set_irq Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 079/165] drm/radeon: do a posting read in cik_set_irq Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 080/165] drm/radeon: fix DRM_IOCTL_RADEON_CS oops Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 081/165] drm/radeon: fix interlaced modes on DCE8 Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 082/165] ACPI / video: Load the module even if ACPI is disabled Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 083/165] ASoC: omap-pcm: Correct dma mask Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 084/165] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 085/165] Btrfs: fix data loss in the fast fsync path Luis Henriques
2015-03-25 14:00 ` [PATCH 3.16.y-ckt 086/165] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 087/165] xhci: fix reporting of 0-sized URBs in control endpoint Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 088/165] xhci: Workaround for PME stuck issues in Intel xhci Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 089/165] Change email address for 8250_pci Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 090/165] tty: fix up atime/mtime mess, take four Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 091/165] console: Fix console name size mismatch Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 092/165] net: irda: fix wait_until_sent poll timeout Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 093/165] USB: serial: fix infinite wait_until_sent timeout Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 094/165] TTY: fix tty_wait_until_sent on 64-bit machines Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 095/165] sunrpc: fix braino in ->poll() Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 096/165] svcrpc: fix memory leak in gssp_accept_sec_context_upcall Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 097/165] SUNRPC: Always manipulate rpc_rqst::rq_bc_pa_list under xprt->bc_pa_lock Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 098/165] ath5k: fix spontaneus AR5312 freezes Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 099/165] net: cls_bpf: fix size mismatch on filter preparation Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 100/165] net: cls_bpf: fix auto generation of per list handles Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 101/165] qlge: Fix qlge_update_hw_vlan_features to handle if interface is down Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 102/165] ip6_gre: fix endianness errors in ip6gre_err Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 103/165] PCI: Don't read past the end of sysfs "driver_override" buffer Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 104/165] spi: dw: revisit FIFO size detection again Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 105/165] spi: atmel: Fix interrupt setup for PDC transfers Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 106/165] mtd: nand: pxa3xx: Fix PIO FIFO draining Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 107/165] cpuset: Fix cpuset sched_relax_domain_level Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 108/165] workqueue: fix hang involving racing cancel[_delayed]_work_sync()'s for PREEMPT_NONE Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 109/165] bnx2x: Force fundamental reset for EEH recovery Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 110/165] xen/events: avoid NULL pointer dereference in dom0 on large machines Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 111/165] spi: pl022: Fix race in giveback() leading to driver lock-up Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 112/165] tpm/ibmvtpm: Additional LE support for tpm_ibmvtpm_send Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 113/165] libsas: Fix Kernel Crash in smp_execute_task Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 114/165] irqchip: armada-370-xp: Fix chained per-cpu interrupts Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 115/165] ALSA: hda - Fix regression of HD-audio controller fallback modes Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 116/165] can: add missing initialisations in CAN related skbuffs Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 117/165] can: kvaser_usb: Avoid double free on URB submission failures Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 118/165] can: kvaser_usb: Read all messages in a bulk-in URB buffer Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 119/165] ftrace: Fix en(dis)able graph caller when en(dis)abling record via sysctl Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 120/165] ftrace: Fix ftrace enable ordering of sysctl ftrace_enabled Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 121/165] ARM: imx6qdl-sabresd: set swbst_reg as vbus's parent reg Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 122/165] ARM: imx6sl-evk: " Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 123/165] drm/radeon: drop setting UPLL to sleep mode Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 124/165] xen-pciback: limit guest control of command register Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 125/165] ALSA: hda - Fix built-in mic on Compaq Presario CQ60 Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 126/165] drm/vmwgfx: Fix a couple of lock dependency violations Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 127/165] drm/vmwgfx: Reorder device takedown somewhat Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 128/165] ALSA: control: Add sanity checks for user ctl id name string Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 129/165] ALSA: snd-usb: add quirks for Roland UA-22 Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 130/165] Revert "i2c: core: Dispose OF IRQ mapping at client removal time" Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 131/165] ALSA: hda - Set single_adc_amp flag for CS420x codecs Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 132/165] ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 133/165] nilfs2: fix deadlock of segment constructor during recovery Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 134/165] ALSA: hda - Don't access stereo amps for mono channel widgets Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 135/165] ARM: at91: pm: fix at91rm9200 standby Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 136/165] ARM: dts: DRA7x: Fix the bypass clock source for dpll_iva and others Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 137/165] ARM: dts: am33xx-clocks: Fix ehrpwm tbclk data on am33xx Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 138/165] ARM: dts: am43xx-clocks: Fix ehrpwm tbclk data on am43xx Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 139/165] clk: divider: fix calculation of maximal parent rate for a given divider Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 140/165] clk: divider: fix selection of divider when rounding to closest Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 141/165] USB: serial: add Google simple serial SubClass support Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 142/165] HID: add support for MS Surface Pro 3 Type Cover Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 143/165] HID: apple: fix battery support for the 2009 ANSI wireless keyboard Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 144/165] HID: microsoft: add support for Japanese Surface Type Cover 3 Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 145/165] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2 Luis Henriques
2015-03-25 14:01 ` [PATCH 3.16.y-ckt 146/165] usb: gadget: function: phonet: balance usb_ep_disable calls Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 147/165] usb: musb: core: add pm_runtime_irq_safe() Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 148/165] cdc-acm: Add support for Denso cradle CU-321 Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 149/165] HID: microsoft: Add ID for NE7K wireless keyboard Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 150/165] sparc32: destroy_context() and switch_mm() needs to disable interrupts Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 151/165] sparc: semtimedop() unreachable due to comparison error Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 152/165] sparc: perf: Remove redundant perf_pmu_{en|dis}able calls Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 153/165] sparc: perf: Make counting mode actually work Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 154/165] sparc: Touch NMI watchdog when walking cpus and calling printk Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 155/165] sparc64: Fix several bugs in memmove() Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 156/165] net: sysctl_net_core: check SNDBUF and RCVBUF for min length Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 157/165] rds: avoid potential stack overflow Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 158/165] inet_diag: fix possible overflow in inet_diag_dump_one_icsk() Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 159/165] caif: fix MSG_OOB test in caif_seqpkt_recvmsg() Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 160/165] rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg() Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 161/165] Revert "net: cx82310_eth: use common match macro" Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 162/165] ipv6: fix backtracking for throw routes Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 163/165] tcp: fix tcp fin memory accounting Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 164/165] net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour Luis Henriques
2015-03-25 14:02 ` [PATCH 3.16.y-ckt 165/165] tcp: make connect() mem charging friendly Luis Henriques

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.