All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review
@ 2015-12-09  9:36 Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 001/126] irda: precedence bug in irlmp_seq_hb_idx() Luis Henriques
                   ` (125 more replies)
  0 siblings, 126 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 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-ckt21 stable kernel.

This version contains 126 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/ubuntu/linux.git/log/?h=linux-3.16.y-review

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

The review period for version 3.16.7-ckt21 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

--
 Documentation/filesystems/proc.txt                 |   5 +-
 MAINTAINERS                                        |   1 +
 arch/arm/common/edma.c                             |   6 +-
 arch/arm/mach-pxa/include/mach/pxa27x.h            |   2 +-
 arch/arm/mach-pxa/pxa27x.c                         |   2 +-
 arch/arm/mm/dma-mapping.c                          |   7 +
 arch/arm64/include/asm/ptrace.h                    |  16 +-
 arch/mips/include/asm/atomic.h                     |   2 +-
 arch/s390/kvm/kvm-s390.c                           |   4 +-
 arch/x86/include/uapi/asm/kvm.h                    |   3 +
 arch/x86/include/uapi/asm/svm.h                    |   1 +
 arch/x86/kernel/head_64.S                          |   8 +
 arch/x86/kernel/setup.c                            |   8 +
 arch/x86/kernel/verify_cpu.S                       |  12 +-
 arch/x86/kvm/svm.c                                 |  22 +--
 arch/x86/kvm/vmx.c                                 |  24 +--
 arch/x86/xen/setup.c                               |   2 +-
 arch/xtensa/include/asm/asmmacro.h                 |   7 +-
 arch/xtensa/include/asm/pgtable.h                  |   1 +
 arch/xtensa/include/asm/vectors.h                  |   9 +-
 arch/xtensa/kernel/Makefile                        |   1 +
 arch/xtensa/kernel/entry.S                         |   8 +-
 arch/xtensa/kernel/head.S                          |   2 +-
 arch/xtensa/kernel/setup.c                         |   9 +-
 arch/xtensa/kernel/vectors.S                       |   4 +-
 arch/xtensa/kernel/vmlinux.lds.S                   |  12 +-
 arch/xtensa/lib/usercopy.S                         |   6 +-
 arch/xtensa/platforms/iss/setup.c                  |   2 +
 arch/xtensa/platforms/xt2000/setup.c               |   2 +
 arch/xtensa/platforms/xtfpga/setup.c               |   2 +
 crypto/algif_hash.c                                |  12 +-
 drivers/acpi/osl.c                                 |   9 +-
 drivers/bluetooth/ath3k.c                          |   4 +
 drivers/bluetooth/btusb.c                          |   2 +
 drivers/char/tpm/tpm_ibmvtpm.c                     |   2 +-
 drivers/char/tpm/tpm_of.c                          |   3 +-
 drivers/clk/versatile/clk-icst.c                   |   4 +-
 drivers/dma/dw/core.c                              |  12 +-
 drivers/firewire/ohci.c                            |   5 +
 drivers/gpu/drm/ast/ast_drv.h                      |   1 +
 drivers/gpu/drm/ast/ast_fb.c                       |   7 +
 drivers/gpu/drm/ast/ast_main.c                     |   1 +
 drivers/gpu/drm/ast/ast_mode.c                     |   2 +
 drivers/gpu/drm/drm_crtc.c                         |   5 +-
 drivers/gpu/drm/i915/intel_display.c               |   3 +
 drivers/gpu/drm/radeon/si_dpm.c                    |   2 +
 drivers/hid/hid-core.c                             |   2 +-
 drivers/hsi/controllers/omap_ssi_port.c            |   2 +-
 drivers/hsi/hsi.c                                  |   1 -
 drivers/input/mouse/elantech.c                     |   7 +
 drivers/iommu/intel-iommu.c                        |   9 +-
 drivers/md/dm-mpath.c                              |   7 +-
 drivers/md/raid0.c                                 |  67 +++----
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c      |   9 +-
 drivers/media/v4l2-core/videobuf2-dma-contig.c     |   5 +-
 drivers/mfd/twl6040.c                              |   2 +
 drivers/mtd/mtd_blkdevs.c                          |  10 +-
 drivers/mtd/mtdpart.c                              |   4 +-
 drivers/net/bonding/bond_main.c                    |   1 +
 drivers/net/can/dev.c                              |   2 +-
 drivers/net/ethernet/marvell/mvneta.c              |   2 +-
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |   7 +-
 drivers/net/macvtap.c                              |   2 +-
 drivers/net/usb/qmi_wwan.c                         |  10 +-
 drivers/net/wireless/mwifiex/debugfs.c             |  14 +-
 drivers/of/fdt.c                                   |   5 +-
 drivers/of/of_reserved_mem.c                       |   4 +
 drivers/platform/x86/ideapad-laptop.c              |   7 +
 drivers/power/wm831x_power.c                       |   6 +-
 drivers/rtc/rtc-ds1307.c                           |   4 +-
 drivers/scsi/megaraid/megaraid_sas.h               |   2 +
 drivers/scsi/megaraid/megaraid_sas_base.c          |  15 +-
 drivers/scsi/scsi_sysfs.c                          |  18 +-
 drivers/scsi/storvsc_drv.c                         |   3 +-
 drivers/spi/spi-atmel.c                            |   3 +-
 drivers/spi/spi-dw.c                               |   6 +-
 drivers/spi/spi-ti-qspi.c                          |   3 +-
 drivers/staging/rtl8712/usb_intf.c                 |   1 +
 drivers/thermal/samsung/exynos_tmu.c               |  33 ++--
 drivers/tty/n_tty.c                                |  15 +-
 drivers/usb/host/ehci-orion.c                      |   3 +-
 drivers/usb/serial/qcserial.c                      |   2 +
 fs/binfmt_elf.c                                    |  10 +-
 fs/btrfs/file.c                                    |  16 +-
 fs/btrfs/inode.c                                   |  92 ++++++++--
 fs/btrfs/ioctl.c                                   | 195 ++++++++++++++++-----
 fs/btrfs/xattr.c                                   |   4 +-
 fs/cachefiles/rdwr.c                               |  79 +++++----
 fs/ceph/mds_client.c                               |   2 +-
 fs/ext4/ext4_jbd2.c                                |   6 +-
 fs/ext4/resize.c                                   |   4 +-
 fs/ext4/super.c                                    |  12 +-
 fs/fscache/netfs.c                                 |  38 ++--
 fs/fscache/page.c                                  |   2 +-
 fs/jbd2/journal.c                                  |   6 +-
 fs/lockd/host.c                                    |   7 +-
 fs/lockd/mon.c                                     |  36 ++--
 fs/lockd/netns.h                                   |   1 +
 fs/lockd/svc.c                                     |   1 +
 fs/lockd/svc4proc.c                                |   2 +-
 fs/lockd/svcproc.c                                 |   2 +-
 fs/nfs/nfs4state.c                                 |   2 +-
 fs/pipe.c                                          |   9 +-
 fs/proc/array.c                                    |  16 +-
 fs/proc/base.c                                     |   9 +-
 fs/proc/fd.c                                       |  14 +-
 fs/splice.c                                        |  12 +-
 include/linux/acpi.h                               |   6 +
 include/linux/jbd2.h                               |   1 +
 include/linux/lockd/lockd.h                        |   9 +-
 include/net/inet_common.h                          |   3 +-
 include/net/netfilter/nf_conntrack.h               |   4 -
 kernel/events/core.c                               |   4 +
 kernel/printk/printk.c                             |  12 +-
 lib/devres.c                                       |   2 +-
 mm/slab.c                                          |   5 +-
 net/bluetooth/hidp/core.c                          |  14 ++
 net/core/dst.c                                     |   2 +-
 net/ipv4/ip_output.c                               |   2 +-
 net/ipv4/ipmr.c                                    |   6 +-
 net/ipv4/tcp_input.c                               |   5 +-
 net/ipv6/sit.c                                     |  27 +--
 net/ipv6/tunnel6.c                                 |  12 +-
 net/irda/irlmp.c                                   |   2 +-
 net/mac80211/mlme.c                                |   2 +-
 net/mac80211/trace.h                               |  10 +-
 net/mac80211/util.c                                |   7 +
 net/netfilter/nfnetlink.c                          |   2 +-
 net/packet/af_packet.c                             |  86 +++++----
 net/rds/tcp_recv.c                                 |  11 +-
 net/sunrpc/xprtrdma/verbs.c                        |  66 ++-----
 scripts/recordmcount.h                             |   2 +-
 sound/firewire/bebob/Makefile                      |   2 +-
 sound/firewire/bebob/bebob_maudio.c                |   2 +-
 sound/firewire/fireworks/Makefile                  |   2 +-
 sound/firewire/fireworks/fireworks_command.c       |   2 +-
 sound/pci/hda/hda_intel.c                          |  10 +-
 sound/pci/hda/patch_realtek.c                      |  13 ++
 sound/pci/hda/patch_sigmatel.c                     |   1 +
 tools/perf/Documentation/perf-trace.txt            |   1 -
 140 files changed, 931 insertions(+), 538 deletions(-)

Alex Deucher (1):
      drm/radeon: add quirk for ASUS R7 370

Alexandra Yates (1):
      ALSA: hda - Add Intel Lewisburg device IDs Audio

Andrey Ryabinin (1):
      lockd: create NSM handles per net namespace

Andrzej Hajda (1):
      [media] v4l2-compat-ioctl32: fix alignment for ARM64

Andy Leiserson (1):
      fix calculation of meta_bg descriptor backups

Andy Shevchenko (2):
      spi: dw: explicitly free IRQ handler in dw_spi_remove_host()
      dmaengine: dw: convert to __ffs()

Ani Sinha (1):
      ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.

Arik Nemtsov (1):
      mac80211: allow null chandef in tracing

Arnd Bergmann (2):
      ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
      ceph: fix message length computation

Bjørn Mork (3):
      qmi_wwan: add Sierra Wireless MC74xx/EM74xx
      qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module
      USB: qcserial: add Sierra Wireless MC74xx/EM74xx

Boris BREZILLON (1):
      mtd: mtdpart: fix add_mtd_partitions error path

Borislav Petkov (1):
      x86/cpu: Call verify_cpu() after having entered long mode too

Brian Norris (1):
      mtd: blkdevs: fix potential deadlock + lockdep warnings

Catalin Marinas (1):
      mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE

Chen Yu (1):
      ACPI: Use correct IRQ when uninstalling ACPI interrupt handler

Christoph Hellwig (1):
      scsi: restart list search after unlock in scsi_remove_target

Christophe JAILLET (1):
      TPM: Avoid reference to potentially freed memory

Christophe Leroy (1):
      splice: sendfile() at once fails for big files

Chuck Lever (1):
      xprtrdma: Re-arm after missed events

Daeho Jeong (1):
      ext4, jbd2: ensure entering into panic after recording an error in superblock

Dan Carpenter (3):
      irda: precedence bug in irlmp_seq_hb_idx()
      mwifiex: fix mwifiex_rdeeprom_read()
      devres: fix a for loop bounds check

David Herrmann (1):
      Bluetooth: hidp: fix device disconnect on idle timeout

David Hildenbrand (1):
      KVM: s390: SCA must not cross page boundaries

David Howells (1):
      FS-Cache: Handle a write to the page immediately beyond the EOF marker

David Mosberger-Tang (1):
      spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word

David Ward (1):
      net: qmi_wwan: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module

David Woodhouse (1):
      iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints

Dmitry Tunin (2):
      Bluetooth: ath3k: Add new AR3012 0930:021c id
      Bluetooth: ath3k: Add support of AR3012 0cf3:817b device

Egbert Eich (1):
      drm/ast: Initialized data needed to map fbdev memory

Eric Biggers (1):
      fs/pipe.c: return error code rather than 0 in pipe_write()

Eric Dumazet (4):
      sit: fix sit0 percpu double allocations
      net: avoid NULL deref in inet_ctl_sock_destroy()
      net: fix a race in dst_release()
      packet: fix match_fanout_group()

Eric Northup (1):
      KVM: x86: work around infinite loop in microcode when #AC is delivered

Eric W. Biederman (1):
      ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk

Filipe Manana (5):
      Btrfs: fix file corruption and data loss after cloning inline extents
      Btrfs: fix truncation of compressed and inlined extents
      Btrfs: fix race leading to incorrect item deletion when dropping extents
      Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
      Btrfs: fix race when listing an inode's xattrs

Flavio Leitner (1):
      netfilter: remove dead code

Florian Westphal (1):
      netfilter: nfnetlink: don't probe module if it exists

Francesco Ruggeri (1):
      packet: race condition in packet_bind

Geliang Tang (1):
      hsi: fix double kfree

Greg Kroah-Hartman (1):
      Revert "mm: Check if section present during memory block (un)registering"

Hans de Goede (1):
      ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list

Herbert Xu (1):
      crypto: algif_hash - Only export and import on sockets with data

Hon Ching \\(Vicky\\) Lo (1):
      vTPM: fix memory allocation flag for rtce buffer at kernel boot

Ingo Molnar (1):
      fs/proc, core/debug: Don't expose absolute kernel addresses via wchan

Jani Nikula (1):
      drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015)

Janusz.Dziedzic@tieto.com (1):
      mac80211: fix divide by zero when NOA update

Jason Liu (1):
      drivers: of: of_reserved_mem: fixup the alignment with CMA setup

Jason Wang (1):
      macvtap: unbreak receiving of gro skb with frag list

Jay Vosburgh (1):
      bonding: fix panic on non-ARPHRD_ETHER enslave failure

Johannes Berg (1):
      mac80211: fix driver RSSI event calculations

Jonas Gorski (1):
      usb: ehci-orion: fix probe for !GENERIC_PHY

K. Y. Srinivasan (1):
      storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag

Kailang Yang (1):
      ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back

Kinglong Mee (2):
      FS-Cache: Increase reference of parent after registering, netfs success
      FS-Cache: Don't override netfs's primary_index if registering failed

Kosuke Tatsukawa (1):
      tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c

Krzysztof Kozlowski (1):
      thermal: exynos: Fix unbalanced regulator disable on probe failure

Krzysztof Mazur (1):
      x86/setup: Fix low identity map for >= 2GB kernel range

Larry Finger (1):
      staging: rtl8712: Add device ID for Sitecom WLA2100

Linus Walleij (1):
      clk: versatile-icst: fix memory leak

Lukas Czerner (1):
      ext4: fix potential use after free in __ext4_journal_stop

Lukas Wunner (1):
      drm: Fix return value of drm_framebuffer_init()

Maciej W. Rozycki (1):
      binfmt_elf: Don't clobber passed executable's file header

Malcolm Crossley (1):
      x86/xen: Do not clip xen_e820_map to xen_e820_map_entries when sanitizing map

Marek Szyprowski (2):
      ARM: 8426/1: dma-mapping: add missing range check in dma_mmap()
      ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap()

Marek Vasut (1):
      can: Use correct type in sizeof() in nla_put()

Masahiro Yamada (1):
      of/fdt: fix error checking for earlycon address

Mathias Krause (1):
      printk: prevent userland from spoofing kernel messages

Mauricio Faria de Oliveira (1):
      Revert "dm mpath: fix stalls when handling invalid ioctls"

Max Filippov (3):
      xtensa: fixes for configs without loop option
      xtensa: fix secondary core boot in SMP
      xtensa: nommu: provide _PAGE_CHG_MASK definition

Maxim Sheviakov (2):
      drm/radeon: add quirk for MSI R7 370
      drm/radeon: fix quirk for MSI R7 370 Armor 2X

Maxime Ripard (1):
      net: mvneta: Fix CPU_MAP registers initialisation

Michal Kubeček (1):
      ipv6: fix tunnel error handling

Nadav Amit (1):
      KVM: x86: Defining missing x86 vectors

NeilBrown (2):
      md/raid0: update queue parameter in a safer location.
      md/raid0: apply base queue limits *before* disk_stack_limits

Oleg Nesterov (1):
      proc: actually make proc_fd_permission() thread-friendly

Olga Kornievskaia (1):
      Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount

Paolo Bonzini (2):
      x86/setup: Extend low identity map to cover whole kernel range
      KVM: svm: unconditionally intercept #DB

Peter Feiner (1):
      perf trace: Fix documentation for -i

Peter Oberparleiter (1):
      scsi_sysfs: Fix queue_ramp_up_period return code

Peter Ujfalusi (1):
      ARM: common: edma: Fix channel parameter for irq callbacks

Peter Zijlstra (1):
      perf: Fix inherited events vs. tracepoint filters

Phil Reid (1):
      stmmac: Correctly report PTP capabilities.

Radim Krčmář (1):
      KVM: VMX: fix SMEP and SMAP without EPT

Ralf Baechle (1):
      MIPS: atomic: Fix comment describing atomic64_add_unless's return value.

Richard Purdie (1):
      HID: core: Avoid uninitialized buffer access

Robin Murphy (1):
      arm64: Fix compat register mappings

Roger Quadros (1):
      hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined.

Sowmini Varadhan (1):
      RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv

Stefan Richter (1):
      firewire: ohci: fix JMicron JMB38x IT context discovery

Takashi Iwai (3):
      ALSA: hda - Apply pin fixup for HP ProBook 6550b
      Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled
      ALSA: hda - Disable 64bit address for Creative HDA controllers

Takashi Sakamoto (3):
      ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in
      ALSA: fireworks: use u32 type for be32_to_cpup() macro
      ALSA: bebob: use correct type for __be32 data

Tero Kristo (1):
      rtc: ds1307: Fix alarm programming for mcp794xx

Tiffany Lin (1):
      [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish

Tony Lindgren (1):
      mfd: twl6040: Fix deferred probe handling for clk32k

Valentin Rothberg (1):
      wm831x_power: Use IRQF_ONESHOT to request threaded IRQs

Vignesh R (1):
      spi: ti-qspi: Fix data corruption seen on r/w stress test

Vineet Gupta (1):
      MAINTAINERS: Add public mailing list for ARC

Yinghai Lu (1):
      mm: Check if section present during memory block (un)registering

Yuchung Cheng (1):
      tcp: apply Kern's check on RTTs used for congestion control

libin (1):
      recordmcount: Fix endianness handling bug for nop_mcount

sumit.saxena@avagotech.com (2):
      megaraid_sas: Do not use PAGE_SIZE for max_sectors
      megaraid_sas : SMAP restriction--do not access user memory from IOCTL code

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

* [PATCH 3.16.y-ckt 001/126] irda: precedence bug in irlmp_seq_hb_idx()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Luis Henriques
                   ` (124 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S. Miller, Luis Henriques

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

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

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

commit 50010c20597d14667eff0fdb628309986f195230 upstream.

This is decrementing the pointer, instead of the value stored in the
pointer.  KASan detects it as an out of bounds reference.

Reported-by: "Berry Cheng 程君(成淼)" <chengmiao.cj@alibaba-inc.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/irda/irlmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 98ad6ec4bd3c..8ad149478e19 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -1876,7 +1876,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off)
 	for (element = hashbin_get_first(iter->hashbin);
 	     element != NULL;
 	     element = hashbin_get_next(iter->hashbin)) {
-		if (!off || *off-- == 0) {
+		if (!off || (*off)-- == 0) {
 			/* NB: hashbin left locked */
 			return element;
 		}

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

* [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 001/126] irda: precedence bug in irlmp_seq_hb_idx() Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09 11:27   ` Bjørn Mork
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 003/126] macvtap: unbreak receiving of gro skb with frag list Luis Henriques
                   ` (123 subsequent siblings)
  125 siblings, 1 reply; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, David S. Miller, Luis Henriques

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

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

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit 0db65fcfcded76fe4f74e3ca9f4e2baf67b683ef upstream.

New device IDs shamelessly lifted from the vendor driver.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/qmi_wwan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index b8a82b86f909..f5a0e1034de9 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -760,6 +760,10 @@ static const struct usb_device_id products[] = {
 	{QMI_FIXED_INTF(0x1199, 0x9056, 8)},	/* Sierra Wireless Modem */
 	{QMI_FIXED_INTF(0x1199, 0x9057, 8)},
 	{QMI_FIXED_INTF(0x1199, 0x9061, 8)},	/* Sierra Wireless Modem */
+	{QMI_FIXED_INTF(0x1199, 0x9070, 8)},	/* Sierra Wireless MC74xx/EM74xx */
+	{QMI_FIXED_INTF(0x1199, 0x9070, 10)},	/* Sierra Wireless MC74xx/EM74xx */
+	{QMI_FIXED_INTF(0x1199, 0x9071, 8)},	/* Sierra Wireless MC74xx/EM74xx */
+	{QMI_FIXED_INTF(0x1199, 0x9071, 10)},	/* Sierra Wireless MC74xx/EM74xx */
 	{QMI_FIXED_INTF(0x1bbb, 0x011e, 4)},	/* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
 	{QMI_FIXED_INTF(0x1bbb, 0x0203, 2)},	/* Alcatel L800MA */
 	{QMI_FIXED_INTF(0x2357, 0x0201, 4)},	/* TP-LINK HSUPA Modem MA180 */

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

* [PATCH 3.16.y-ckt 003/126] macvtap: unbreak receiving of gro skb with frag list
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 001/126] irda: precedence bug in irlmp_seq_hb_idx() Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 004/126] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Luis Henriques
                   ` (122 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vlad Yasevich, Michael S. Tsirkin, Jason Wang, David S. Miller,
	Luis Henriques

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

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

From: Jason Wang <jasowang@redhat.com>

commit f23d538bc24a83c16127c2eb82c9cf1adc2b5149 upstream.

We don't have fraglist support in TAP_FEATURES. This will lead
software segmentation of gro skb with frag list. Fixes by having
frag list support in TAP_FEATURES.

With this patch single session of netperf receiving were restored from
about 5Gb/s to about 12Gb/s on mlx4.

Fixes a567dd6252 ("macvtap: simplify usage of tap_features")
Cc: Vlad Yasevich <vyasevic@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/macvtap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index e8c21f911b6f..6185874a088e 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -68,7 +68,7 @@ static const struct proto_ops macvtap_socket_ops;
 #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \
 		      NETIF_F_TSO6 | NETIF_F_UFO)
 #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO)
-#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG)
+#define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG | NETIF_F_FRAGLIST)
 
 static struct macvlan_dev *macvtap_get_vlan_rcu(const struct net_device *dev)
 {

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

* [PATCH 3.16.y-ckt 004/126] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (2 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 003/126] macvtap: unbreak receiving of gro skb with frag list Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 005/126] stmmac: Correctly report PTP capabilities Luis Henriques
                   ` (121 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sowmini Varadhan, David S. Miller, Luis Henriques

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

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

From: Sowmini Varadhan <sowmini.varadhan@oracle.com>

commit 8ce675ff39b9958d1c10f86cf58e357efaafc856 upstream.

Either of pskb_pull() or pskb_trim() may fail under low memory conditions.
If rds_tcp_data_recv() ignores such failures, the application will
receive corrupted data because the skb has not been correctly
carved to the RDS datagram size.

Avoid this by handling pskb_pull/pskb_trim failure in the same
manner as the skb_clone failure: bail out of rds_tcp_data_recv(), and
retry via the deferred call to rds_send_worker() that gets set up on
ENOMEM from rds_tcp_read_sock()

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/rds/tcp_recv.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index 9ae6e0a264ec..2dd88db4a1a2 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -234,8 +234,15 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
 			}
 
 			to_copy = min(tc->t_tinc_data_rem, left);
-			pskb_pull(clone, offset);
-			pskb_trim(clone, to_copy);
+			if (!pskb_pull(clone, offset) ||
+			    pskb_trim(clone, to_copy)) {
+				pr_warn("rds_tcp_data_recv: pull/trim failed "
+					"left %zu data_rem %zu skb_len %d\n",
+					left, tc->t_tinc_data_rem, skb->len);
+				kfree_skb(clone);
+				desc->error = -ENOMEM;
+				goto out;
+			}
 			skb_queue_tail(&tinc->ti_skb_list, clone);
 
 			rdsdebug("skb %p data %p len %d off %u to_copy %zu -> "

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

* [PATCH 3.16.y-ckt 005/126] stmmac: Correctly report PTP capabilities.
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (3 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 004/126] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 006/126] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context Luis Henriques
                   ` (120 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Phil Reid, David S. Miller, Luis Henriques

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

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

From: Phil Reid <preid@electromag.com.au>

commit e6dbe1eb2db0d7a14991c06278dd3030c45fb825 upstream.

priv->hwts_*_en indicate if timestamping is enabled/disabled at run
time. But  priv->dma_cap.time_stamp  and priv->dma_cap.atime_stamp
indicates HW is support for PTPv1/PTPv2.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index c62e67f3c2f0..aa0480402c97 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -723,10 +723,13 @@ static int stmmac_get_ts_info(struct net_device *dev,
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
-	if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) {
+	if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) {
 
-		info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE |
+		info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
+					SOF_TIMESTAMPING_TX_HARDWARE |
+					SOF_TIMESTAMPING_RX_SOFTWARE |
 					SOF_TIMESTAMPING_RX_HARDWARE |
+					SOF_TIMESTAMPING_SOFTWARE |
 					SOF_TIMESTAMPING_RAW_HARDWARE;
 
 		if (priv->ptp_clock)

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

* [PATCH 3.16.y-ckt 006/126] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (4 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 005/126] stmmac: Correctly report PTP capabilities Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 007/126] net: qmi_wwan: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module Luis Henriques
                   ` (119 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ani Sinha, David S. Miller, Luis Henriques

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

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

From: Ani Sinha <ani@arista.com>

commit 44f49dd8b5a606870a1f21101522a0f9c4414784 upstream.

Fixes the following kernel BUG :

BUG: using __this_cpu_add() in preemptible [00000000] code: bash/2758
caller is __this_cpu_preempt_check+0x13/0x15
CPU: 0 PID: 2758 Comm: bash Tainted: P           O   3.18.19 #2
 ffffffff8170eaca ffff880110d1b788 ffffffff81482b2a 0000000000000000
 0000000000000000 ffff880110d1b7b8 ffffffff812010ae ffff880007cab800
 ffff88001a060800 ffff88013a899108 ffff880108b84240 ffff880110d1b7c8
Call Trace:
[<ffffffff81482b2a>] dump_stack+0x52/0x80
[<ffffffff812010ae>] check_preemption_disabled+0xce/0xe1
[<ffffffff812010d4>] __this_cpu_preempt_check+0x13/0x15
[<ffffffff81419d60>] ipmr_queue_xmit+0x647/0x70c
[<ffffffff8141a154>] ip_mr_forward+0x32f/0x34e
[<ffffffff8141af76>] ip_mroute_setsockopt+0xe03/0x108c
[<ffffffff810553fc>] ? get_parent_ip+0x11/0x42
[<ffffffff810e6974>] ? pollwake+0x4d/0x51
[<ffffffff81058ac0>] ? default_wake_function+0x0/0xf
[<ffffffff810553fc>] ? get_parent_ip+0x11/0x42
[<ffffffff810613d9>] ? __wake_up_common+0x45/0x77
[<ffffffff81486ea9>] ? _raw_spin_unlock_irqrestore+0x1d/0x32
[<ffffffff810618bc>] ? __wake_up_sync_key+0x4a/0x53
[<ffffffff8139a519>] ? sock_def_readable+0x71/0x75
[<ffffffff813dd226>] do_ip_setsockopt+0x9d/0xb55
[<ffffffff81429818>] ? unix_seqpacket_sendmsg+0x3f/0x41
[<ffffffff813963fe>] ? sock_sendmsg+0x6d/0x86
[<ffffffff813959d4>] ? sockfd_lookup_light+0x12/0x5d
[<ffffffff8139650a>] ? SyS_sendto+0xf3/0x11b
[<ffffffff810d5738>] ? new_sync_read+0x82/0xaa
[<ffffffff813ddd19>] compat_ip_setsockopt+0x3b/0x99
[<ffffffff813fb24a>] compat_raw_setsockopt+0x11/0x32
[<ffffffff81399052>] compat_sock_common_setsockopt+0x18/0x1f
[<ffffffff813c4d05>] compat_SyS_setsockopt+0x1a9/0x1cf
[<ffffffff813c4149>] compat_SyS_socketcall+0x180/0x1e3
[<ffffffff81488ea1>] cstar_dispatch+0x7/0x1e

Signed-off-by: Ani Sinha <ani@arista.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/ipmr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 65bcaa789043..ac7909c8c8d8 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1674,8 +1674,8 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
 {
 	struct ip_options *opt = &(IPCB(skb)->opt);
 
-	IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
-	IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len);
+	IP_INC_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS);
+	IP_ADD_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len);
 
 	if (unlikely(opt->optlen))
 		ip_forward_options(skb);
@@ -1737,7 +1737,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,
 		 * to blackhole.
 		 */
 
-		IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
+		IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS);
 		ip_rt_put(rt);
 		goto out_free;
 	}

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

* [PATCH 3.16.y-ckt 007/126] net: qmi_wwan: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (5 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 006/126] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 008/126] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ " Luis Henriques
                   ` (118 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Ward, David S. Miller, Luis Henriques

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

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

From: David Ward <david.ward@ll.mit.edu>

commit a8079092c1bbf9aec3756b35256c7816b8845af7 upstream.

This is an HP-branded Sierra Wireless EM7355:
https://bugzilla.redhat.com/show_bug.cgi?id=1223646#c2

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/qmi_wwan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index f5a0e1034de9..6174bb3541f9 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -784,6 +784,7 @@ static const struct usb_device_id products[] = {
 	{QMI_FIXED_INTF(0x413c, 0x81a4, 8)},	/* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x413c, 0x81a8, 8)},	/* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x413c, 0x81a9, 8)},	/* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
+	{QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)},	/* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
 	{QMI_FIXED_INTF(0x03f0, 0x581d, 4)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
 
 	/* 4. Gobi 1000 devices */

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

* [PATCH 3.16.y-ckt 008/126] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (6 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 007/126] net: qmi_wwan: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations Luis Henriques
                   ` (117 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, David S. Miller, Luis Henriques

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

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

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit 70910791731b5956171e1bfcad707766b8e18fee upstream.

The lt4112 is a HP branded Huawei me906e modem. Like other Huawei
modems, it does not have a fixed interface to function mapping.
Instead it uses a Huawei specific scheme: functions are mapped by
subclass and protocol.

However, the HP vendor ID is used for modems from many different
manufacturers using different schemes, so we cannot apply a generic
vendor rule like we do for the Huawei vendor ID.

Replace the previous lt4112 entry pointing to an arbitrary interface
number with a device specific subclass + protocol match.

Reported-and-tested-by: Muri Nicanor <muri+libqmi@immerda.ch>
Tested-by: Martin Hauke <mardnh@gmx.de>
Fixes: bb2bdeb83fb1 ("qmi_wwan: Add support for HP lt4112 LTE/HSPA+ Gobi 4G Modem")
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/usb/qmi_wwan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 6174bb3541f9..4aa8f6b4663b 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -535,6 +535,10 @@ static const struct usb_device_id products[] = {
 					      USB_CDC_PROTO_NONE),
 		.driver_info        = (unsigned long)&qmi_wwan_info,
 	},
+	{	/* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
+		USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
+		.driver_info = (unsigned long)&qmi_wwan_info,
+	},
 
 	/* 3. Combined interface devices matching on interface number */
 	{QMI_FIXED_INTF(0x0408, 0xea42, 4)},	/* Yota / Megafon M100-1 */
@@ -785,7 +789,6 @@ static const struct usb_device_id products[] = {
 	{QMI_FIXED_INTF(0x413c, 0x81a8, 8)},	/* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x413c, 0x81a9, 8)},	/* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)},	/* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
-	{QMI_FIXED_INTF(0x03f0, 0x581d, 4)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
 
 	/* 4. Gobi 1000 devices */
 	{QMI_GOBI1K_DEVICE(0x05c6, 0x9212)},	/* Acer Gobi Modem Device */

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

* [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (7 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 008/126] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ " Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-12  4:18   ` Ben Hutchings
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 010/126] packet: race condition in packet_bind Luis Henriques
                   ` (116 subsequent siblings)
  125 siblings, 1 reply; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Steffen Klassert, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.

sit0 device allocates its percpu storage twice :
- One time in ipip6_tunnel_init()
- One time in ipip6_fb_tunnel_init()

Thus we leak 48 bytes per possible cpu per network namespace dismantle.

ipip6_fb_tunnel_init() can be much simpler and does not
return an error, and should be called after register_netdev()

Note that ipip6_tunnel_clone_6rd() also needs to be called
after register_netdev() (calling ipip6_tunnel_init())

Fixes: ebe084aafb7e ("sit: Use ipip6_tunnel_init as the ndo_init function.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/sit.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 051e9c508933..b5bdd2aeb2f8 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1374,34 +1374,20 @@ static int ipip6_tunnel_init(struct net_device *dev)
 	return 0;
 }
 
-static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
+static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
 {
 	struct ip_tunnel *tunnel = netdev_priv(dev);
 	struct iphdr *iph = &tunnel->parms.iph;
 	struct net *net = dev_net(dev);
 	struct sit_net *sitn = net_generic(net, sit_net_id);
 
-	tunnel->dev = dev;
-	tunnel->net = dev_net(dev);
-
 	iph->version		= 4;
 	iph->protocol		= IPPROTO_IPV6;
 	iph->ihl		= 5;
 	iph->ttl		= 64;
 
-	dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
-	if (!dev->tstats)
-		return -ENOMEM;
-
-	tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst);
-	if (!tunnel->dst_cache) {
-		free_percpu(dev->tstats);
-		return -ENOMEM;
-	}
-
 	dev_hold(dev);
 	rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
-	return 0;
 }
 
 static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[])
@@ -1738,23 +1724,18 @@ static int __net_init sit_init_net(struct net *net)
 	 */
 	sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
 
-	err = ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
-	if (err)
-		goto err_dev_free;
-
-	ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
-
 	if ((err = register_netdev(sitn->fb_tunnel_dev)))
 		goto err_reg_dev;
 
+	ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
+	ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
+
 	t = netdev_priv(sitn->fb_tunnel_dev);
 
 	strcpy(t->parms.name, sitn->fb_tunnel_dev->name);
 	return 0;
 
 err_reg_dev:
-	dev_put(sitn->fb_tunnel_dev);
-err_dev_free:
 	ipip6_dev_free(sitn->fb_tunnel_dev);
 err_alloc_dev:
 	return err;

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

* [PATCH 3.16.y-ckt 010/126] packet: race condition in packet_bind
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (8 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 011/126] net: avoid NULL deref in inet_ctl_sock_destroy() Luis Henriques
                   ` (115 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Francesco Ruggeri, David S. Miller, Luis Henriques

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

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

From: Francesco Ruggeri <fruggeri@aristanetworks.com>

commit 30f7ea1c2b5f5fb7462c5ae44fe2e40cb2d6a474 upstream.

There is a race conditions between packet_notifier and packet_bind{_spkt}.

It happens if packet_notifier(NETDEV_UNREGISTER) executes between the
time packet_bind{_spkt} takes a reference on the new netdevice and the
time packet_do_bind sets po->ifindex.
In this case the notification can be missed.
If this happens during a dev_change_net_namespace this can result in the
netdevice to be moved to the new namespace while the packet_sock in the
old namespace still holds a reference on it. When the netdevice is later
deleted in the new namespace the deletion hangs since the packet_sock
is not found in the new namespace' &net->packet.sklist.
It can be reproduced with the script below.

This patch makes packet_do_bind check again for the presence of the
netdevice in the packet_sock's namespace after the synchronize_net
in unregister_prot_hook.
More in general it also uses the rcu lock for the duration of the bind
to stop dev_change_net_namespace/rollback_registered_many from
going past the synchronize_net following unlist_netdevice, so that
no NETDEV_UNREGISTER notifications can happen on the new netdevice
while the bind is executing. In order to do this some code from
packet_bind{_spkt} is consolidated into packet_do_dev.

import socket, os, time, sys
proto=7
realDev='em1'
vlanId=400
if len(sys.argv) > 1:
   vlanId=int(sys.argv[1])
dev='vlan%d' % vlanId

os.system('taskset -p 0x10 %d' % os.getpid())

s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, proto)
os.system('ip link add link %s name %s type vlan id %d' %
          (realDev, dev, vlanId))
os.system('ip netns add dummy')

pid=os.fork()

if pid == 0:
   # dev should be moved while packet_do_bind is in synchronize net
   os.system('taskset -p 0x20000 %d' % os.getpid())
   os.system('ip link set %s netns dummy' % dev)
   os.system('ip netns exec dummy ip link del %s' % dev)
   s.close()
   sys.exit(0)

time.sleep(.004)
try:
   s.bind(('%s' % dev, proto+1))
except:
   print 'Could not bind socket'
   s.close()
   os.system('ip netns del dummy')
   sys.exit(0)

os.waitpid(pid, 0)
s.close()
os.system('ip netns del dummy')
sys.exit(0)

Signed-off-by: Francesco Ruggeri <fruggeri@arista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 80 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 31 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1f2e7d341781..e6bd6df9e2a2 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2653,22 +2653,40 @@ static int packet_release(struct socket *sock)
  *	Attach a packet hook.
  */
 
-static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
+static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
+			  __be16 proto)
 {
 	struct packet_sock *po = pkt_sk(sk);
 	struct net_device *dev_curr;
 	__be16 proto_curr;
 	bool need_rehook;
+	struct net_device *dev = NULL;
+	int ret = 0;
+	bool unlisted = false;
 
-	if (po->fanout) {
-		if (dev)
-			dev_put(dev);
-
+	if (po->fanout)
 		return -EINVAL;
-	}
 
 	lock_sock(sk);
 	spin_lock(&po->bind_lock);
+	rcu_read_lock();
+
+	if (name) {
+		dev = dev_get_by_name_rcu(sock_net(sk), name);
+		if (!dev) {
+			ret = -ENODEV;
+			goto out_unlock;
+		}
+	} else if (ifindex) {
+		dev = dev_get_by_index_rcu(sock_net(sk), ifindex);
+		if (!dev) {
+			ret = -ENODEV;
+			goto out_unlock;
+		}
+	}
+
+	if (dev)
+		dev_hold(dev);
 
 	proto_curr = po->prot_hook.type;
 	dev_curr = po->prot_hook.dev;
@@ -2676,14 +2694,29 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
 	need_rehook = proto_curr != proto || dev_curr != dev;
 
 	if (need_rehook) {
-		unregister_prot_hook(sk, true);
+		if (po->running) {
+			rcu_read_unlock();
+			__unregister_prot_hook(sk, true);
+			rcu_read_lock();
+			dev_curr = po->prot_hook.dev;
+			if (dev)
+				unlisted = !dev_get_by_index_rcu(sock_net(sk),
+								 dev->ifindex);
+		}
 
 		po->num = proto;
 		po->prot_hook.type = proto;
-		po->prot_hook.dev = dev;
 
-		po->ifindex = dev ? dev->ifindex : 0;
-		packet_cached_dev_assign(po, dev);
+		if (unlikely(unlisted)) {
+			dev_put(dev);
+			po->prot_hook.dev = NULL;
+			po->ifindex = -1;
+			packet_cached_dev_reset(po);
+		} else {
+			po->prot_hook.dev = dev;
+			po->ifindex = dev ? dev->ifindex : 0;
+			packet_cached_dev_assign(po, dev);
+		}
 	}
 	if (dev_curr)
 		dev_put(dev_curr);
@@ -2691,7 +2724,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
 	if (proto == 0 || !need_rehook)
 		goto out_unlock;
 
-	if (!dev || (dev->flags & IFF_UP)) {
+	if (!unlisted && (!dev || (dev->flags & IFF_UP))) {
 		register_prot_hook(sk);
 	} else {
 		sk->sk_err = ENETDOWN;
@@ -2700,9 +2733,10 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
 	}
 
 out_unlock:
+	rcu_read_unlock();
 	spin_unlock(&po->bind_lock);
 	release_sock(sk);
-	return 0;
+	return ret;
 }
 
 /*
@@ -2714,8 +2748,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr,
 {
 	struct sock *sk = sock->sk;
 	char name[15];
-	struct net_device *dev;
-	int err = -ENODEV;
 
 	/*
 	 *	Check legality
@@ -2725,19 +2757,13 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr,
 		return -EINVAL;
 	strlcpy(name, uaddr->sa_data, sizeof(name));
 
-	dev = dev_get_by_name(sock_net(sk), name);
-	if (dev)
-		err = packet_do_bind(sk, dev, pkt_sk(sk)->num);
-	return err;
+	return packet_do_bind(sk, name, 0, pkt_sk(sk)->num);
 }
 
 static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 {
 	struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr;
 	struct sock *sk = sock->sk;
-	struct net_device *dev = NULL;
-	int err;
-
 
 	/*
 	 *	Check legality
@@ -2748,16 +2774,8 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len
 	if (sll->sll_family != AF_PACKET)
 		return -EINVAL;
 
-	if (sll->sll_ifindex) {
-		err = -ENODEV;
-		dev = dev_get_by_index(sock_net(sk), sll->sll_ifindex);
-		if (dev == NULL)
-			goto out;
-	}
-	err = packet_do_bind(sk, dev, sll->sll_protocol ? : pkt_sk(sk)->num);
-
-out:
-	return err;
+	return packet_do_bind(sk, NULL, sll->sll_ifindex,
+			      sll->sll_protocol ? : pkt_sk(sk)->num);
 }
 
 static struct proto packet_proto = {

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

* [PATCH 3.16.y-ckt 011/126] net: avoid NULL deref in inet_ctl_sock_destroy()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (9 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 010/126] packet: race condition in packet_bind Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 012/126] net: fix a race in dst_release() Luis Henriques
                   ` (114 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit 8fa677d2706d325d71dab91bf6e6512c05214e37 upstream.

Under low memory conditions, tcp_sk_init() and icmp_sk_init()
can both iterate on all possible cpus and call inet_ctl_sock_destroy(),
with eventual NULL pointer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.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>
---
 include/net/inet_common.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index fe7994c48b75..fd1da045dabc 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -40,7 +40,8 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family,
 
 static inline void inet_ctl_sock_destroy(struct sock *sk)
 {
-	sk_release_kernel(sk);
+	if (sk)
+		sk_release_kernel(sk);
 }
 
 #endif

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

* [PATCH 3.16.y-ckt 012/126] net: fix a race in dst_release()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (10 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 011/126] net: avoid NULL deref in inet_ctl_sock_destroy() Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 013/126] Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount Luis Henriques
                   ` (113 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit d69bbf88c8d0b367cf3e3a052f6daadf630ee566 upstream.

Only cpu seeing dst refcount going to 0 can safely
dereference dst->flags.

Otherwise an other cpu might already have freed the dst.

Fixes: 27b75c95f10d ("net: avoid RCU for NOCACHE dst")
Reported-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.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/core/dst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index a028409ee438..a80e92346b9b 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -285,7 +285,7 @@ void dst_release(struct dst_entry *dst)
 
 		newrefcnt = atomic_dec_return(&dst->__refcnt);
 		WARN_ON(newrefcnt < 0);
-		if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
+		if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE))
 			call_rcu(&dst->rcu_head, dst_destroy_rcu);
 	}
 }

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

* [PATCH 3.16.y-ckt 013/126] Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (11 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 012/126] net: fix a race in dst_release() Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 014/126] x86/xen: Do not clip xen_e820_map to xen_e820_map_entries when sanitizing map Luis Henriques
                   ` (112 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Olga Kornievskaia, Trond Myklebust, Ben Hutchings, Luis Henriques

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

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

From: Olga Kornievskaia <aglo@umich.edu>

commit a41cbe86df3afbc82311a1640e20858c0cd7e065 upstream.

A test case is as the description says:
open(foobar, O_WRONLY);
sleep()  --> reboot the server
close(foobar)

The bug is because in nfs4state.c in nfs4_reclaim_open_state() a few
line before going to restart, there is
clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &state->flags).

NFS4CLNT_RECLAIM_NOGRACE is a flag for the client states not open
owner states. Value of NFS4CLNT_RECLAIM_NOGRACE is 4 which is the
value of NFS_O_WRONLY_STATE in nfs4_state->flags. So clearing it wipes
out state and when we go to close it, “call_close” doesn’t get set as
state flag is not set and CLOSE doesn’t go on the wire.

Signed-off-by: Olga Kornievskaia <aglo@umich.edu>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/nfs/nfs4state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 46d876487795..577bb8d849f7 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1482,7 +1482,7 @@ restart:
 					spin_unlock(&state->state_lock);
 				}
 				nfs4_put_open_state(state);
-				clear_bit(NFS4CLNT_RECLAIM_NOGRACE,
+				clear_bit(NFS_STATE_RECLAIM_NOGRACE,
 					&state->flags);
 				spin_lock(&sp->so_lock);
 				goto restart;

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

* [PATCH 3.16.y-ckt 014/126] x86/xen: Do not clip xen_e820_map to xen_e820_map_entries when sanitizing map
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (12 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 013/126] Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36   ` Luis Henriques
                   ` (111 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Malcolm Crossley, David Vrabel, Luis Henriques

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

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

From: Malcolm Crossley <malcolm.crossley@citrix.com>

commit 64c98e7f49100b637cd20a6c63508caed6bbba7a upstream.

Sanitizing the e820 map may produce extra E820 entries which would result in
the topmost E820 entries being removed. The removed entries would typically
include the top E820 usable RAM region and thus result in the domain having
signicantly less RAM available to it.

Fix by allowing sanitize_e820_map to use the full size of the allocated E820
array.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[ luis: backported to 3.16:
  - use 'map' instead of 'xen_e820_map_entries' ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/xen/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 2e555163c2fe..dca94c650d6a 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -385,7 +385,7 @@ char * __init xen_memory_setup(void)
 		xen_ignore_unusable(map, memmap.nr_entries);
 
 	/* Make sure the Xen-supplied memory map is well-ordered. */
-	sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
+	sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
 
 	max_pages = xen_get_max_pages();
 	if (max_pages > max_pfn)

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

* [PATCH 3.16.y-ckt 015/126] HID: core: Avoid uninitialized buffer access
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
@ 2015-12-09  9:36   ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Luis Henriques
                     ` (124 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Richard Purdie, Jiri Kosina, linux-input, Darren Hart,
	Jiri Kosina, Luis Henriques

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

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

From: Richard Purdie <richard.purdie@linuxfoundation.org>

commit 79b568b9d0c7c5d81932f4486d50b38efdd6da6d upstream.

hid_connect adds various strings to the buffer but they're all
conditional. You can find circumstances where nothing would be written
to it but the kernel will still print the supposedly empty buffer with
printk. This leads to corruption on the console/in the logs.

Ensure buf is initialized to an empty string.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[dvhart: Initialize string to "" rather than assign buf[0] = NULL;]
Cc: Jiri Kosina <jikos@kernel.org>
Cc: linux-input@vger.kernel.org
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5ed3a7b91b4c..fb16c812816a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1561,7 +1561,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 		"Multi-Axis Controller"
 	};
 	const char *type, *bus;
-	char buf[64];
+	char buf[64] = "";
 	unsigned int i;
 	int len;
 	int ret;

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

* [PATCH 3.16.y-ckt 015/126] HID: core: Avoid uninitialized buffer access
@ 2015-12-09  9:36   ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Kosina, Darren Hart, Jiri Kosina, Richard Purdie,
	linux-input

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

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

From: Richard Purdie <richard.purdie@linuxfoundation.org>

commit 79b568b9d0c7c5d81932f4486d50b38efdd6da6d upstream.

hid_connect adds various strings to the buffer but they're all
conditional. You can find circumstances where nothing would be written
to it but the kernel will still print the supposedly empty buffer with
printk. This leads to corruption on the console/in the logs.

Ensure buf is initialized to an empty string.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[dvhart: Initialize string to "" rather than assign buf[0] = NULL;]
Cc: Jiri Kosina <jikos@kernel.org>
Cc: linux-input@vger.kernel.org
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5ed3a7b91b4c..fb16c812816a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1561,7 +1561,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 		"Multi-Axis Controller"
 	};
 	const char *type, *bus;
-	char buf[64];
+	char buf[64] = "";
 	unsigned int i;
 	int len;
 	int ret;

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

* [PATCH 3.16.y-ckt 016/126] [media] v4l2-compat-ioctl32: fix alignment for ARM64
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (14 preceding siblings ...)
  2015-12-09  9:36   ` Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 017/126] net: mvneta: Fix CPU_MAP registers initialisation Luis Henriques
                   ` (109 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrzej Hajda, Hans Verkuil, Mauro Carvalho Chehab,
	Luis Henriques

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

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

From: Andrzej Hajda <a.hajda@samsung.com>

commit 655e9780ab913a3a06d4a164d55e3b755524186d upstream.

Alignment/padding rules on AMD64 and ARM64 differs. To allow properly match
compatible ioctls on ARM64 kernels without breaking AMD64 some fields
should be aligned using compat_s64 type and in one case struct should be
unpacked.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
[hans.verkuil@cisco.com: use compat_u64 instead of compat_s64 in v4l2_input32]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 7e2411c36419..6822ee43d821 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -264,7 +264,7 @@ static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_
 
 struct v4l2_standard32 {
 	__u32		     index;
-	__u32		     id[2]; /* __u64 would get the alignment wrong */
+	compat_u64	     id;
 	__u8		     name[24];
 	struct v4l2_fract    frameperiod; /* Frames, not fields */
 	__u32		     framelines;
@@ -284,7 +284,7 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32
 {
 	if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) ||
 		put_user(kp->index, &up->index) ||
-		copy_to_user(up->id, &kp->id, sizeof(__u64)) ||
+		put_user(kp->id, &up->id) ||
 		copy_to_user(up->name, kp->name, 24) ||
 		copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) ||
 		put_user(kp->framelines, &up->framelines) ||
@@ -576,10 +576,10 @@ struct v4l2_input32 {
 	__u32	     type;		/*  Type of input */
 	__u32	     audioset;		/*  Associated audios (bitfield) */
 	__u32        tuner;             /*  Associated tuner */
-	v4l2_std_id  std;
+	compat_u64   std;
 	__u32	     status;
 	__u32	     reserved[4];
-} __attribute__ ((packed));
+};
 
 /* The 64-bit v4l2_input struct has extra padding at the end of the struct.
    Otherwise it is identical to the 32-bit version. */
@@ -719,6 +719,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
 struct v4l2_event32 {
 	__u32				type;
 	union {
+		compat_s64		value64;
 		__u8			data[64];
 	} u;
 	__u32				pending;

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

* [PATCH 3.16.y-ckt 017/126] net: mvneta: Fix CPU_MAP registers initialisation
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (15 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 016/126] [media] v4l2-compat-ioctl32: fix alignment for ARM64 Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 018/126] mtd: mtdpart: fix add_mtd_partitions error path Luis Henriques
                   ` (108 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxime Ripard, Gregory CLEMENT, David S. Miller, Luis Henriques

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

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

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

commit 2502d0ef272da7058ef303b849a2c8dc324c2e2e upstream.

The CPU_MAP register is duplicated for each CPUs at different addresses,
each instance being at a different address.

However, the code so far was using CONFIG_NR_CPUS to initialise the CPU_MAP
registers for each registers, while the SoCs embed at most 4 CPUs.

This is especially an issue with multi_v7_defconfig, where CONFIG_NR_CPUS
is currently set to 16, resulting in writes to registers that are not
CPU_MAP.

Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP network unit")
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 03ab691ad683..b6de763afef0 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -941,7 +941,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)
 	/* Set CPU queue access map - all CPUs have access to all RX
 	 * queues and to all TX queues
 	 */
-	for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++)
+	for_each_present_cpu(cpu)
 		mvreg_write(pp, MVNETA_CPU_MAP(cpu),
 			    (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |
 			     MVNETA_CPU_TXQ_ACCESS_ALL_MASK));

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

* [PATCH 3.16.y-ckt 018/126] mtd: mtdpart: fix add_mtd_partitions error path
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (16 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 017/126] net: mvneta: Fix CPU_MAP registers initialisation Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 019/126] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Luis Henriques
                   ` (107 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Boris Brezillon, Brian Norris, Luis Henriques

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

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

From: Boris BREZILLON <boris.brezillon@free-electrons.com>

commit e5bae86797141e4a95e42d825f737cb36d7b8c37 upstream.

If we fail to allocate a partition structure in the middle of the partition
creation process, the already allocated partitions are never removed, which
means they are still present in the partition list and their resources are
never freed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/mtdpart.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 1ca9aec141ff..822d634b9ed5 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -637,8 +637,10 @@ int add_mtd_partitions(struct mtd_info *master,
 
 	for (i = 0; i < nbparts; i++) {
 		slave = allocate_partition(master, parts + i, i, cur_offset);
-		if (IS_ERR(slave))
+		if (IS_ERR(slave)) {
+			del_mtd_partitions(master);
 			return PTR_ERR(slave);
+		}
 
 		mutex_lock(&mtd_partitions_mutex);
 		list_add(&slave->list, &mtd_partitions);

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

* [PATCH 3.16.y-ckt 019/126] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (17 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 018/126] mtd: mtdpart: fix add_mtd_partitions error path Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 020/126] ARM: 8427/1: dma-mapping: add support for offset parameter " Luis Henriques
                   ` (106 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Szyprowski, Russell King, Luis Henriques

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

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

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit 371f0f085f629fc0f66695f572373ca4445a67ad upstream.

dma_mmap() function in IOMMU-based dma-mapping implementation lacked
a check for valid range of mmap parameters (offset and buffer size), what
might have caused access beyond the allocated buffer. This patch fixes
this issue.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mm/dma-mapping.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 0e09af35f69a..59336561d747 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1459,12 +1459,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
 	unsigned long uaddr = vma->vm_start;
 	unsigned long usize = vma->vm_end - vma->vm_start;
 	struct page **pages = __iommu_get_pages(cpu_addr, attrs);
+	unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
+	unsigned long off = vma->vm_pgoff;
 
 	vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot);
 
 	if (!pages)
 		return -ENXIO;
 
+	if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off)
+		return -ENXIO;
+
 	do {
 		int ret = vm_insert_page(vma, uaddr, *pages++);
 		if (ret) {

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

* [PATCH 3.16.y-ckt 020/126] ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (18 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 019/126] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 021/126] mm: Check if section present during memory block (un)registering Luis Henriques
                   ` (105 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Szyprowski, Russell King, Luis Henriques

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

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

From: Marek Szyprowski <m.szyprowski@samsung.com>

commit 7e31210349e9e03a9a4dff31ab5f2bc83e8e84f5 upstream.

IOMMU-based dma_mmap() implementation lacked proper support for offset
parameter used in mmap call (it always assumed that mapping starts from
offset zero). This patch adds support for offset parameter to IOMMU-based
implementation.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mm/dma-mapping.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 59336561d747..832b295eb4a5 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1470,6 +1470,8 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
 	if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off)
 		return -ENXIO;
 
+	pages += off;
+
 	do {
 		int ret = vm_insert_page(vma, uaddr, *pages++);
 		if (ret) {

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

* [PATCH 3.16.y-ckt 021/126] mm: Check if section present during memory block (un)registering
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (19 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 020/126] ARM: 8427/1: dma-mapping: add support for offset parameter " Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 022/126] spi: ti-qspi: Fix data corruption seen on r/w stress test Luis Henriques
                   ` (104 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yinghai Lu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Yinghai Lu <yinghai@kernel.org>

commit 7568fb63f57ac8672f8bf2018171255441238882 upstream.

Tony found on his setup, if memory block size 512M will cause crash
during booting.

 BUG: unable to handle kernel paging request at ffffea0074000020
 IP: [<ffffffff81670527>] get_nid_for_pfn+0x17/0x40
 PGD 128ffcb067 PUD 128ffc9067 PMD 0
 Oops: 0000 [#1] SMP
 Modules linked in:
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc8 #1
...
 Call Trace:
  [<ffffffff81453b56>] ? register_mem_sect_under_node+0x66/0xe0
  [<ffffffff81453eeb>] register_one_node+0x17b/0x240
  [<ffffffff81b1f1ed>] ? pci_iommu_alloc+0x6e/0x6e
  [<ffffffff81b1f229>] topology_init+0x3c/0x95
  [<ffffffff8100213d>] do_one_initcall+0xcd/0x1f0

The system has non continuous RAM address:
 BIOS-e820: [mem 0x0000001300000000-0x0000001cffffffff] usable
 BIOS-e820: [mem 0x0000001d70000000-0x0000001ec7ffefff] usable
 BIOS-e820: [mem 0x0000001f00000000-0x0000002bffffffff] usable
 BIOS-e820: [mem 0x0000002c18000000-0x0000002d6fffefff] usable
 BIOS-e820: [mem 0x0000002e00000000-0x00000039ffffffff] usable

So there are start sections in memory block not present.
For example:
memory block : [0x2c18000000, 0x2c20000000) 512M
first three sections are not present.

Current register_mem_sect_under_node() assume first section is present,
but memory block section number range [start_section_nr, end_section_nr]
would include not present section.

For arch that support vmemmap, we don't setup memmap for struct page area
within not present sections area.

So skip the pfn range that belong to absent section.

Also fixes unregister_mem_sect_under_nodes() that assume one section per
memory block.

Reported-by: Tony Luck <tony.luck@intel.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Fixes: bdee237c0343 ("x86: mm: Use 2GB memory block size on large memory x86-64 systems")
Fixes: 982792c782ef ("x86, mm: probe memory block size for generic x86 64bit")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/base/node.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 5777d10d1e25..7334e47996bc 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -397,7 +397,18 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
 	sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
 	sect_end_pfn += PAGES_PER_SECTION - 1;
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
-		int page_nid;
+		int page_nid, scn_nr;
+
+		/*
+		 * memory block could have several absent sections from start.
+		 * skip pfn range from absent section
+		 */
+		scn_nr = pfn_to_section_nr(pfn);
+		if (!present_section_nr(scn_nr)) {
+			pfn = round_down(pfn + PAGES_PER_SECTION,
+					 PAGES_PER_SECTION) - 1;
+			continue;
+		}
 
 		/*
 		 * memory block could have several absent sections from start.
@@ -443,10 +454,22 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
 		return -ENOMEM;
 	nodes_clear(*unlinked_nodes);
 
-	sect_start_pfn = section_nr_to_pfn(phys_index);
-	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
+	sect_start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
+	sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
+	sect_end_pfn += PAGES_PER_SECTION - 1;
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
-		int nid;
+		int nid, scn_nr;
+
+		/*
+		 * memory block could have several absent sections from start.
+		 * skip pfn range from absent section
+		 */
+		scn_nr = pfn_to_section_nr(pfn);
+		if (!present_section_nr(scn_nr)) {
+			pfn = round_down(pfn + PAGES_PER_SECTION,
+					 PAGES_PER_SECTION) - 1;
+			continue;
+		}
 
 		nid = get_nid_for_pfn(pfn);
 		if (nid < 0)

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

* [PATCH 3.16.y-ckt 022/126] spi: ti-qspi: Fix data corruption seen on r/w stress test
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (20 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 021/126] mm: Check if section present during memory block (un)registering Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 023/126] lockd: create NSM handles per net namespace Luis Henriques
                   ` (103 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vignesh R, Mark Brown, Luis Henriques

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

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

From: Vignesh R <vigneshr@ti.com>

commit bc27a53928981662079aa243915b443370294a03 upstream.

Writing invalid command to QSPI_SPI_CMD_REG will terminate current
transfer and de-assert the chip select. This has to be done before
calling spi_finalize_current_message(). Because
spi_finalize_current_message() will mark the end of current message
transfer and schedule the next transfer. If the chipselect is not
de-asserted before calling spi_finalize_current_message() then the next
transfer will overlap with the previous transfer leading to data
corruption.
__spi_pump_message() can be called either from kthread worker context or
directly from the calling process's context. It is possible that these
two calls can race against each other. But race is serialized by
checking whether master->cur_msg == NULL (pointer to msg being handled
by transfer_one() at present). The master->cur_msg is set to NULL when
spi_finalize_current_message() is called on that message, which means
calling spi_finalize_current_message() allows __spi_sync() to pump next
message in calling process context.
Now if spi-ti-qspi calls spi_finalize_current_message() before we
terminate transfer at hardware side, if __spi_pump_message() is called
from process context then the successive transactions can overlap.

Fix this by moving writing invalid command to QSPI_SPI_CMD_REG to
before calling spi_finalize_current_message() call.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi-ti-qspi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 6c211d1910b0..b68511204367 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -364,11 +364,10 @@ static int ti_qspi_start_transfer_one(struct spi_master *master,
 
 	mutex_unlock(&qspi->list_lock);
 
+	ti_qspi_write(qspi, qspi->cmd | QSPI_INVAL, QSPI_SPI_CMD_REG);
 	m->status = status;
 	spi_finalize_current_message(master);
 
-	ti_qspi_write(qspi, qspi->cmd | QSPI_INVAL, QSPI_SPI_CMD_REG);
-
 	return status;
 }
 

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

* [PATCH 3.16.y-ckt 023/126] lockd: create NSM handles per net namespace
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (21 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 022/126] spi: ti-qspi: Fix data corruption seen on r/w stress test Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering" Luis Henriques
                   ` (102 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrey Ryabinin, J. Bruce Fields, Luis Henriques

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

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

From: Andrey Ryabinin <aryabinin@virtuozzo.com>

commit 0ad95472bf169a3501991f8f33f5147f792a8116 upstream.

Commit cb7323fffa85 ("lockd: create and use per-net NSM
 RPC clients on MON/UNMON requests") introduced per-net
NSM RPC clients. Unfortunately this doesn't make any sense
without per-net nsm_handle.

E.g. the following scenario could happen
Two hosts (X and Y) in different namespaces (A and B) share
the same nsm struct.

1. nsm_monitor(host_X) called => NSM rpc client created,
	nsm->sm_monitored bit set.
2. nsm_mointor(host-Y) called => nsm->sm_monitored already set,
	we just exit. Thus in namespace B ln->nsm_clnt == NULL.
3. host X destroyed => nsm->sm_count decremented to 1
4. host Y destroyed => nsm_unmonitor() => nsm_mon_unmon() => NULL-ptr
	dereference of *ln->nsm_clnt

So this could be fixed by making per-net nsm_handles list,
instead of global. Thus different net namespaces will not be able
share the same nsm_handle.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/lockd/host.c             |  7 ++++---
 fs/lockd/mon.c              | 36 ++++++++++++++++++++++--------------
 fs/lockd/netns.h            |  1 +
 fs/lockd/svc.c              |  1 +
 fs/lockd/svc4proc.c         |  2 +-
 fs/lockd/svcproc.c          |  2 +-
 include/linux/lockd/lockd.h |  9 ++++++---
 7 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 969d589c848d..b5f3c3ab0d5f 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -116,7 +116,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,
 		atomic_inc(&nsm->sm_count);
 	else {
 		host = NULL;
-		nsm = nsm_get_handle(ni->sap, ni->salen,
+		nsm = nsm_get_handle(ni->net, ni->sap, ni->salen,
 					ni->hostname, ni->hostname_len);
 		if (unlikely(nsm == NULL)) {
 			dprintk("lockd: %s failed; no nsm handle\n",
@@ -534,17 +534,18 @@ static struct nlm_host *next_host_state(struct hlist_head *cache,
 
 /**
  * nlm_host_rebooted - Release all resources held by rebooted host
+ * @net:  network namespace
  * @info: pointer to decoded results of NLM_SM_NOTIFY call
  *
  * We were notified that the specified host has rebooted.  Release
  * all resources held by that peer.
  */
-void nlm_host_rebooted(const struct nlm_reboot *info)
+void nlm_host_rebooted(const struct net *net, const struct nlm_reboot *info)
 {
 	struct nsm_handle *nsm;
 	struct nlm_host	*host;
 
-	nsm = nsm_reboot_lookup(info);
+	nsm = nsm_reboot_lookup(net, info);
 	if (unlikely(nsm == NULL))
 		return;
 
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 6ae664b489af..13fac49aff7f 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -51,7 +51,6 @@ struct nsm_res {
 };
 
 static const struct rpc_program	nsm_program;
-static				LIST_HEAD(nsm_handles);
 static				DEFINE_SPINLOCK(nsm_lock);
 
 /*
@@ -259,33 +258,35 @@ void nsm_unmonitor(const struct nlm_host *host)
 	}
 }
 
-static struct nsm_handle *nsm_lookup_hostname(const char *hostname,
-					      const size_t len)
+static struct nsm_handle *nsm_lookup_hostname(const struct list_head *nsm_handles,
+					const char *hostname, const size_t len)
 {
 	struct nsm_handle *nsm;
 
-	list_for_each_entry(nsm, &nsm_handles, sm_link)
+	list_for_each_entry(nsm, nsm_handles, sm_link)
 		if (strlen(nsm->sm_name) == len &&
 		    memcmp(nsm->sm_name, hostname, len) == 0)
 			return nsm;
 	return NULL;
 }
 
-static struct nsm_handle *nsm_lookup_addr(const struct sockaddr *sap)
+static struct nsm_handle *nsm_lookup_addr(const struct list_head *nsm_handles,
+					const struct sockaddr *sap)
 {
 	struct nsm_handle *nsm;
 
-	list_for_each_entry(nsm, &nsm_handles, sm_link)
+	list_for_each_entry(nsm, nsm_handles, sm_link)
 		if (rpc_cmp_addr(nsm_addr(nsm), sap))
 			return nsm;
 	return NULL;
 }
 
-static struct nsm_handle *nsm_lookup_priv(const struct nsm_private *priv)
+static struct nsm_handle *nsm_lookup_priv(const struct list_head *nsm_handles,
+					const struct nsm_private *priv)
 {
 	struct nsm_handle *nsm;
 
-	list_for_each_entry(nsm, &nsm_handles, sm_link)
+	list_for_each_entry(nsm, nsm_handles, sm_link)
 		if (memcmp(nsm->sm_priv.data, priv->data,
 					sizeof(priv->data)) == 0)
 			return nsm;
@@ -350,6 +351,7 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,
 
 /**
  * nsm_get_handle - Find or create a cached nsm_handle
+ * @net: network namespace
  * @sap: pointer to socket address of handle to find
  * @salen: length of socket address
  * @hostname: pointer to C string containing hostname to find
@@ -362,11 +364,13 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,
  * @hostname cannot be found in the handle cache.  Returns NULL if
  * an error occurs.
  */
-struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
+struct nsm_handle *nsm_get_handle(const struct net *net,
+				  const struct sockaddr *sap,
 				  const size_t salen, const char *hostname,
 				  const size_t hostname_len)
 {
 	struct nsm_handle *cached, *new = NULL;
+	struct lockd_net *ln = net_generic(net, lockd_net_id);
 
 	if (hostname && memchr(hostname, '/', hostname_len) != NULL) {
 		if (printk_ratelimit()) {
@@ -381,9 +385,10 @@ retry:
 	spin_lock(&nsm_lock);
 
 	if (nsm_use_hostnames && hostname != NULL)
-		cached = nsm_lookup_hostname(hostname, hostname_len);
+		cached = nsm_lookup_hostname(&ln->nsm_handles,
+					hostname, hostname_len);
 	else
-		cached = nsm_lookup_addr(sap);
+		cached = nsm_lookup_addr(&ln->nsm_handles, sap);
 
 	if (cached != NULL) {
 		atomic_inc(&cached->sm_count);
@@ -397,7 +402,7 @@ retry:
 	}
 
 	if (new != NULL) {
-		list_add(&new->sm_link, &nsm_handles);
+		list_add(&new->sm_link, &ln->nsm_handles);
 		spin_unlock(&nsm_lock);
 		dprintk("lockd: created nsm_handle for %s (%s)\n",
 				new->sm_name, new->sm_addrbuf);
@@ -414,19 +419,22 @@ retry:
 
 /**
  * nsm_reboot_lookup - match NLMPROC_SM_NOTIFY arguments to an nsm_handle
+ * @net:  network namespace
  * @info: pointer to NLMPROC_SM_NOTIFY arguments
  *
  * Returns a matching nsm_handle if found in the nsm cache. The returned
  * nsm_handle's reference count is bumped. Otherwise returns NULL if some
  * error occurred.
  */
-struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info)
+struct nsm_handle *nsm_reboot_lookup(const struct net *net,
+				const struct nlm_reboot *info)
 {
 	struct nsm_handle *cached;
+	struct lockd_net *ln = net_generic(net, lockd_net_id);
 
 	spin_lock(&nsm_lock);
 
-	cached = nsm_lookup_priv(&info->priv);
+	cached = nsm_lookup_priv(&ln->nsm_handles, &info->priv);
 	if (unlikely(cached == NULL)) {
 		spin_unlock(&nsm_lock);
 		dprintk("lockd: never saw rebooted peer '%.*s' before\n",
diff --git a/fs/lockd/netns.h b/fs/lockd/netns.h
index 5010b55628b4..414da99744e9 100644
--- a/fs/lockd/netns.h
+++ b/fs/lockd/netns.h
@@ -16,6 +16,7 @@ struct lockd_net {
 	spinlock_t nsm_clnt_lock;
 	unsigned int nsm_users;
 	struct rpc_clnt *nsm_clnt;
+	struct list_head nsm_handles;
 };
 
 extern int lockd_net_id;
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 3f5a7248e771..e9e47aad47f9 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -583,6 +583,7 @@ static int lockd_init_net(struct net *net)
 	INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender);
 	INIT_LIST_HEAD(&ln->grace_list);
 	spin_lock_init(&ln->nsm_clnt_lock);
+	INIT_LIST_HEAD(&ln->nsm_handles);
 	return 0;
 }
 
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index b147d1ae71fd..09c576f26c7b 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -421,7 +421,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 		return rpc_system_err;
 	}
 
-	nlm_host_rebooted(argp);
+	nlm_host_rebooted(SVC_NET(rqstp), argp);
 	return rpc_success;
 }
 
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 21171f0c6477..fb26b9f522e7 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -464,7 +464,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
 		return rpc_system_err;
 	}
 
-	nlm_host_rebooted(argp);
+	nlm_host_rebooted(SVC_NET(rqstp), argp);
 	return rpc_success;
 }
 
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 219d79627c05..294e23c243c6 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -236,7 +236,8 @@ void		  nlm_rebind_host(struct nlm_host *);
 struct nlm_host * nlm_get_host(struct nlm_host *);
 void		  nlm_shutdown_hosts(void);
 void		  nlm_shutdown_hosts_net(struct net *net);
-void		  nlm_host_rebooted(const struct nlm_reboot *);
+void		  nlm_host_rebooted(const struct net *net,
+					const struct nlm_reboot *);
 
 /*
  * Host monitoring
@@ -244,11 +245,13 @@ void		  nlm_host_rebooted(const struct nlm_reboot *);
 int		  nsm_monitor(const struct nlm_host *host);
 void		  nsm_unmonitor(const struct nlm_host *host);
 
-struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
+struct nsm_handle *nsm_get_handle(const struct net *net,
+					const struct sockaddr *sap,
 					const size_t salen,
 					const char *hostname,
 					const size_t hostname_len);
-struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info);
+struct nsm_handle *nsm_reboot_lookup(const struct net *net,
+					const struct nlm_reboot *info);
 void		  nsm_release(struct nsm_handle *nsm);
 
 /*

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

* [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering"
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (22 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 023/126] lockd: create NSM handles per net namespace Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-12  4:37   ` Ben Hutchings
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 025/126] Btrfs: fix file corruption and data loss after cloning inline extents Luis Henriques
                   ` (101 subsequent siblings)
  125 siblings, 1 reply; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yinghai Lu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8346aa765e14348b7b436825b3c4740895a2fe1a upstream.

This reverts commit 7568fb63f57ac8672f8bf2018171255441238882 as it's
already in Linus's tree through a different patch.

Reported-by: Tony Luck <tony.luck@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/base/node.c | 31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)

diff --git a/drivers/base/node.c b/drivers/base/node.c
index 7334e47996bc..5777d10d1e25 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -397,18 +397,7 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
 	sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
 	sect_end_pfn += PAGES_PER_SECTION - 1;
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
-		int page_nid, scn_nr;
-
-		/*
-		 * memory block could have several absent sections from start.
-		 * skip pfn range from absent section
-		 */
-		scn_nr = pfn_to_section_nr(pfn);
-		if (!present_section_nr(scn_nr)) {
-			pfn = round_down(pfn + PAGES_PER_SECTION,
-					 PAGES_PER_SECTION) - 1;
-			continue;
-		}
+		int page_nid;
 
 		/*
 		 * memory block could have several absent sections from start.
@@ -454,22 +443,10 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
 		return -ENOMEM;
 	nodes_clear(*unlinked_nodes);
 
-	sect_start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
-	sect_end_pfn = section_nr_to_pfn(mem_blk->end_section_nr);
-	sect_end_pfn += PAGES_PER_SECTION - 1;
+	sect_start_pfn = section_nr_to_pfn(phys_index);
+	sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
 	for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
-		int nid, scn_nr;
-
-		/*
-		 * memory block could have several absent sections from start.
-		 * skip pfn range from absent section
-		 */
-		scn_nr = pfn_to_section_nr(pfn);
-		if (!present_section_nr(scn_nr)) {
-			pfn = round_down(pfn + PAGES_PER_SECTION,
-					 PAGES_PER_SECTION) - 1;
-			continue;
-		}
+		int nid;
 
 		nid = get_nid_for_pfn(pfn);
 		if (nid < 0)

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

* [PATCH 3.16.y-ckt 025/126] Btrfs: fix file corruption and data loss after cloning inline extents
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (23 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering" Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 026/126] ARM: common: edma: Fix channel parameter for irq callbacks Luis Henriques
                   ` (100 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit 8039d87d9e473aeb740d4fdbd59b9d2f89b2ced9 upstream.

Currently the clone ioctl allows to clone an inline extent from one file
to another that already has other (non-inlined) extents. This is a problem
because btrfs is not designed to deal with files having inline and regular
extents, if a file has an inline extent then it must be the only extent
in the file and must start at file offset 0. Having a file with an inline
extent followed by regular extents results in EIO errors when doing reads
or writes against the first 4K of the file.

Also, the clone ioctl allows one to lose data if the source file consists
of a single inline extent, with a size of N bytes, and the destination
file consists of a single inline extent with a size of M bytes, where we
have M > N. In this case the clone operation removes the inline extent
from the destination file and then copies the inline extent from the
source file into the destination file - we lose the M - N bytes from the
destination file, a read operation will get the value 0x00 for any bytes
in the the range [N, M] (the destination inode's i_size remained as M,
that's why we can read past N bytes).

So fix this by not allowing such destructive operations to happen and
return errno EOPNOTSUPP to user space.

Currently the fstest btrfs/035 tests the data loss case but it totally
ignores this - i.e. expects the operation to succeed and does not check
the we got data loss.

The following test case for fstests exercises all these cases that result
in file corruption and data loss:

  seq=`basename $0`
  seqres=$RESULT_DIR/$seq
  echo "QA output created by $seq"
  tmp=/tmp/$$
  status=1	# failure is the default!
  trap "_cleanup; exit \$status" 0 1 2 3 15

  _cleanup()
  {
      rm -f $tmp.*
  }

  # get standard environment, filters and checks
  . ./common/rc
  . ./common/filter

  # real QA test starts here
  _need_to_be_root
  _supported_fs btrfs
  _supported_os Linux
  _require_scratch
  _require_cloner
  _require_btrfs_fs_feature "no_holes"
  _require_btrfs_mkfs_feature "no-holes"

  rm -f $seqres.full

  test_cloning_inline_extents()
  {
      local mkfs_opts=$1
      local mount_opts=$2

      _scratch_mkfs $mkfs_opts >>$seqres.full 2>&1
      _scratch_mount $mount_opts

      # File bar, the source for all the following clone operations, consists
      # of a single inline extent (50 bytes).
      $XFS_IO_PROG -f -c "pwrite -S 0xbb 0 50" $SCRATCH_MNT/bar \
          | _filter_xfs_io

      # Test cloning into a file with an extent (non-inlined) where the
      # destination offset overlaps that extent. It should not be possible to
      # clone the inline extent from file bar into this file.
      $XFS_IO_PROG -f -c "pwrite -S 0xaa 0K 16K" $SCRATCH_MNT/foo \
          | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo

      # Doing IO against any range in the first 4K of the file should work.
      # Due to a past clone ioctl bug which allowed cloning the inline extent,
      # these operations resulted in EIO errors.
      echo "File foo data after clone operation:"
      # All bytes should have the value 0xaa (clone operation failed and did
      # not modify our file).
      od -t x1 $SCRATCH_MNT/foo
      $XFS_IO_PROG -c "pwrite -S 0xcc 0 100" $SCRATCH_MNT/foo | _filter_xfs_io

      # Test cloning the inline extent against a file which has a hole in its
      # first 4K followed by a non-inlined extent. It should not be possible
      # as well to clone the inline extent from file bar into this file.
      $XFS_IO_PROG -f -c "pwrite -S 0xdd 4K 12K" $SCRATCH_MNT/foo2 \
          | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo2

      # Doing IO against any range in the first 4K of the file should work.
      # Due to a past clone ioctl bug which allowed cloning the inline extent,
      # these operations resulted in EIO errors.
      echo "File foo2 data after clone operation:"
      # All bytes should have the value 0x00 (clone operation failed and did
      # not modify our file).
      od -t x1 $SCRATCH_MNT/foo2
      $XFS_IO_PROG -c "pwrite -S 0xee 0 90" $SCRATCH_MNT/foo2 | _filter_xfs_io

      # Test cloning the inline extent against a file which has a size of zero
      # but has a prealloc extent. It should not be possible as well to clone
      # the inline extent from file bar into this file.
      $XFS_IO_PROG -f -c "falloc -k 0 1M" $SCRATCH_MNT/foo3 | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo3

      # Doing IO against any range in the first 4K of the file should work.
      # Due to a past clone ioctl bug which allowed cloning the inline extent,
      # these operations resulted in EIO errors.
      echo "First 50 bytes of foo3 after clone operation:"
      # Should not be able to read any bytes, file has 0 bytes i_size (the
      # clone operation failed and did not modify our file).
      od -t x1 $SCRATCH_MNT/foo3
      $XFS_IO_PROG -c "pwrite -S 0xff 0 90" $SCRATCH_MNT/foo3 | _filter_xfs_io

      # Test cloning the inline extent against a file which consists of a
      # single inline extent that has a size not greater than the size of
      # bar's inline extent (40 < 50).
      # It should be possible to do the extent cloning from bar to this file.
      $XFS_IO_PROG -f -c "pwrite -S 0x01 0 40" $SCRATCH_MNT/foo4 \
          | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo4

      # Doing IO against any range in the first 4K of the file should work.
      echo "File foo4 data after clone operation:"
      # Must match file bar's content.
      od -t x1 $SCRATCH_MNT/foo4
      $XFS_IO_PROG -c "pwrite -S 0x02 0 90" $SCRATCH_MNT/foo4 | _filter_xfs_io

      # Test cloning the inline extent against a file which consists of a
      # single inline extent that has a size greater than the size of bar's
      # inline extent (60 > 50).
      # It should not be possible to clone the inline extent from file bar
      # into this file.
      $XFS_IO_PROG -f -c "pwrite -S 0x03 0 60" $SCRATCH_MNT/foo5 \
          | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo5

      # Reading the file should not fail.
      echo "File foo5 data after clone operation:"
      # Must have a size of 60 bytes, with all bytes having a value of 0x03
      # (the clone operation failed and did not modify our file).
      od -t x1 $SCRATCH_MNT/foo5

      # Test cloning the inline extent against a file which has no extents but
      # has a size greater than bar's inline extent (16K > 50).
      # It should not be possible to clone the inline extent from file bar
      # into this file.
      $XFS_IO_PROG -f -c "truncate 16K" $SCRATCH_MNT/foo6 | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo6

      # Reading the file should not fail.
      echo "File foo6 data after clone operation:"
      # Must have a size of 16K, with all bytes having a value of 0x00 (the
      # clone operation failed and did not modify our file).
      od -t x1 $SCRATCH_MNT/foo6

      # Test cloning the inline extent against a file which has no extents but
      # has a size not greater than bar's inline extent (30 < 50).
      # It should be possible to clone the inline extent from file bar into
      # this file.
      $XFS_IO_PROG -f -c "truncate 30" $SCRATCH_MNT/foo7 | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo7

      # Reading the file should not fail.
      echo "File foo7 data after clone operation:"
      # Must have a size of 50 bytes, with all bytes having a value of 0xbb.
      od -t x1 $SCRATCH_MNT/foo7

      # Test cloning the inline extent against a file which has a size not
      # greater than the size of bar's inline extent (20 < 50) but has
      # a prealloc extent that goes beyond the file's size. It should not be
      # possible to clone the inline extent from bar into this file.
      $XFS_IO_PROG -f -c "falloc -k 0 1M" \
                      -c "pwrite -S 0x88 0 20" \
                      $SCRATCH_MNT/foo8 | _filter_xfs_io
      $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/bar $SCRATCH_MNT/foo8

      echo "File foo8 data after clone operation:"
      # Must have a size of 20 bytes, with all bytes having a value of 0x88
      # (the clone operation did not modify our file).
      od -t x1 $SCRATCH_MNT/foo8

      _scratch_unmount
  }

  echo -e "\nTesting without compression and without the no-holes feature...\n"
  test_cloning_inline_extents

  echo -e "\nTesting with compression and without the no-holes feature...\n"
  test_cloning_inline_extents "" "-o compress"

  echo -e "\nTesting without compression and with the no-holes feature...\n"
  test_cloning_inline_extents "-O no-holes" ""

  echo -e "\nTesting with compression and with the no-holes feature...\n"
  test_cloning_inline_extents "-O no-holes" "-o compress"

  status=0
  exit

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/ioctl.c | 195 +++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 152 insertions(+), 43 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 0b5f9183362c..d0733078e5c5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3205,6 +3205,150 @@ static void clone_update_extent_map(struct inode *inode,
 			&BTRFS_I(inode)->runtime_flags);
 }
 
+/*
+ * Make sure we do not end up inserting an inline extent into a file that has
+ * already other (non-inline) extents. If a file has an inline extent it can
+ * not have any other extents and the (single) inline extent must start at the
+ * file offset 0. Failing to respect these rules will lead to file corruption,
+ * resulting in EIO errors on read/write operations, hitting BUG_ON's in mm, etc
+ *
+ * We can have extents that have been already written to disk or we can have
+ * dirty ranges still in delalloc, in which case the extent maps and items are
+ * created only when we run delalloc, and the delalloc ranges might fall outside
+ * the range we are currently locking in the inode's io tree. So we check the
+ * inode's i_size because of that (i_size updates are done while holding the
+ * i_mutex, which we are holding here).
+ * We also check to see if the inode has a size not greater than "datal" but has
+ * extents beyond it, due to an fallocate with FALLOC_FL_KEEP_SIZE (and we are
+ * protected against such concurrent fallocate calls by the i_mutex).
+ *
+ * If the file has no extents but a size greater than datal, do not allow the
+ * copy because we would need turn the inline extent into a non-inline one (even
+ * with NO_HOLES enabled). If we find our destination inode only has one inline
+ * extent, just overwrite it with the source inline extent if its size is less
+ * than the source extent's size, or we could copy the source inline extent's
+ * data into the destination inode's inline extent if the later is greater then
+ * the former.
+ */
+static int clone_copy_inline_extent(struct inode *src,
+				    struct inode *dst,
+				    struct btrfs_trans_handle *trans,
+				    struct btrfs_path *path,
+				    struct btrfs_key *new_key,
+				    const u64 drop_start,
+				    const u64 datal,
+				    const u64 skip,
+				    const u64 size,
+				    char *inline_data)
+{
+	struct btrfs_root *root = BTRFS_I(dst)->root;
+	const u64 aligned_end = ALIGN(new_key->offset + datal,
+				      root->sectorsize);
+	int ret;
+	struct btrfs_key key;
+
+	if (new_key->offset > 0)
+		return -EOPNOTSUPP;
+
+	key.objectid = btrfs_ino(dst);
+	key.type = BTRFS_EXTENT_DATA_KEY;
+	key.offset = 0;
+	ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
+	if (ret < 0) {
+		return ret;
+	} else if (ret > 0) {
+		if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) {
+			ret = btrfs_next_leaf(root, path);
+			if (ret < 0)
+				return ret;
+			else if (ret > 0)
+				goto copy_inline_extent;
+		}
+		btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
+		if (key.objectid == btrfs_ino(dst) &&
+		    key.type == BTRFS_EXTENT_DATA_KEY) {
+			ASSERT(key.offset > 0);
+			return -EOPNOTSUPP;
+		}
+	} else if (i_size_read(dst) <= datal) {
+		struct btrfs_file_extent_item *ei;
+		u64 ext_len;
+
+		/*
+		 * If the file size is <= datal, make sure there are no other
+		 * extents following (can happen do to an fallocate call with
+		 * the flag FALLOC_FL_KEEP_SIZE).
+		 */
+		ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
+				    struct btrfs_file_extent_item);
+		/*
+		 * If it's an inline extent, it can not have other extents
+		 * following it.
+		 */
+		if (btrfs_file_extent_type(path->nodes[0], ei) ==
+		    BTRFS_FILE_EXTENT_INLINE)
+			goto copy_inline_extent;
+
+		ext_len = btrfs_file_extent_num_bytes(path->nodes[0], ei);
+		if (ext_len > aligned_end)
+			return -EOPNOTSUPP;
+
+		ret = btrfs_next_item(root, path);
+		if (ret < 0) {
+			return ret;
+		} else if (ret == 0) {
+			btrfs_item_key_to_cpu(path->nodes[0], &key,
+					      path->slots[0]);
+			if (key.objectid == btrfs_ino(dst) &&
+			    key.type == BTRFS_EXTENT_DATA_KEY)
+				return -EOPNOTSUPP;
+		}
+	}
+
+copy_inline_extent:
+	/*
+	 * We have no extent items, or we have an extent at offset 0 which may
+	 * or may not be inlined. All these cases are dealt the same way.
+	 */
+	if (i_size_read(dst) > datal) {
+		/*
+		 * If the destination inode has an inline extent...
+		 * This would require copying the data from the source inline
+		 * extent into the beginning of the destination's inline extent.
+		 * But this is really complex, both extents can be compressed
+		 * or just one of them, which would require decompressing and
+		 * re-compressing data (which could increase the new compressed
+		 * size, not allowing the compressed data to fit anymore in an
+		 * inline extent).
+		 * So just don't support this case for now (it should be rare,
+		 * we are not really saving space when cloning inline extents).
+		 */
+		return -EOPNOTSUPP;
+	}
+
+	btrfs_release_path(path);
+	ret = btrfs_drop_extents(trans, root, dst, drop_start, aligned_end, 1);
+	if (ret)
+		return ret;
+	ret = btrfs_insert_empty_item(trans, root, path, new_key, size);
+	if (ret)
+		return ret;
+
+	if (skip) {
+		const u32 start = btrfs_file_extent_calc_inline_size(0);
+
+		memmove(inline_data + start, inline_data + start + skip, datal);
+	}
+
+	write_extent_buffer(path->nodes[0], inline_data,
+			    btrfs_item_ptr_offset(path->nodes[0],
+						  path->slots[0]),
+			    size);
+	inode_add_bytes(dst, datal);
+
+	return 0;
+}
+
 /**
  * btrfs_clone() - clone a range from inode file to another
  *
@@ -3469,21 +3613,6 @@ process_slot:
 			} else if (type == BTRFS_FILE_EXTENT_INLINE) {
 				u64 skip = 0;
 				u64 trim = 0;
-				u64 aligned_end = 0;
-
-				/*
-				 * Don't copy an inline extent into an offset
-				 * greater than zero. Having an inline extent
-				 * at such an offset results in chaos as btrfs
-				 * isn't prepared for such cases. Just skip
-				 * this case for the same reasons as commented
-				 * at btrfs_ioctl_clone().
-				 */
-				if (last_dest_end > 0) {
-					ret = -EOPNOTSUPP;
-					btrfs_end_transaction(trans, root);
-					goto out;
-				}
 
 				if (off > key.offset) {
 					skip = off - key.offset;
@@ -3501,42 +3630,22 @@ process_slot:
 				size -= skip + trim;
 				datal -= skip + trim;
 
-				aligned_end = ALIGN(new_key.offset + datal,
-						    root->sectorsize);
-				ret = btrfs_drop_extents(trans, root, inode,
-							 drop_start,
-							 aligned_end,
-							 1);
+				ret = clone_copy_inline_extent(src, inode,
+							       trans, path,
+							       &new_key,
+							       drop_start,
+							       datal,
+							       skip, size, buf);
 				if (ret) {
 					if (ret != -EOPNOTSUPP)
 						btrfs_abort_transaction(trans,
-							root, ret);
-					btrfs_end_transaction(trans, root);
-					goto out;
-				}
-
-				ret = btrfs_insert_empty_item(trans, root, path,
-							      &new_key, size);
-				if (ret) {
-					btrfs_abort_transaction(trans, root,
-								ret);
+									root,
+									ret);
 					btrfs_end_transaction(trans, root);
 					goto out;
 				}
-
-				if (skip) {
-					u32 start =
-					  btrfs_file_extent_calc_inline_size(0);
-					memmove(buf+start, buf+start+skip,
-						datal);
-				}
-
 				leaf = path->nodes[0];
 				slot = path->slots[0];
-				write_extent_buffer(leaf, buf,
-					    btrfs_item_ptr_offset(leaf, slot),
-					    size);
-				inode_add_bytes(inode, datal);
 			}
 
 			/* If we have an implicit hole (NO_HOLES feature). */

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

* [PATCH 3.16.y-ckt 026/126] ARM: common: edma: Fix channel parameter for irq callbacks
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (24 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 025/126] Btrfs: fix file corruption and data loss after cloning inline extents Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 027/126] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints Luis Henriques
                   ` (99 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Ujfalusi, Vinod Koul, Luis Henriques

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

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

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

commit 696d8b70c09dd421c4d037fab04341e5b30585cf upstream.

In case when the interrupt happened for the second eDMA the channel
number was incorrectly passed to the client driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/common/edma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index ea97e14e1f0b..7b12ed692373 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -403,7 +403,8 @@ static irqreturn_t dma_irq_handler(int irq, void *data)
 					BIT(slot));
 			if (edma_cc[ctlr]->intr_data[channel].callback)
 				edma_cc[ctlr]->intr_data[channel].callback(
-					channel, EDMA_DMA_COMPLETE,
+					EDMA_CTLR_CHAN(ctlr, channel),
+					EDMA_DMA_COMPLETE,
 					edma_cc[ctlr]->intr_data[channel].data);
 		}
 	} while (sh_ipr);
@@ -457,7 +458,8 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data)
 					if (edma_cc[ctlr]->intr_data[k].
 								callback) {
 						edma_cc[ctlr]->intr_data[k].
-						callback(k,
+						callback(
+						EDMA_CTLR_CHAN(ctlr, k),
 						EDMA_DMA_CC_ERROR,
 						edma_cc[ctlr]->intr_data
 						[k].data);

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

* [PATCH 3.16.y-ckt 027/126] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (25 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 026/126] ARM: common: edma: Fix channel parameter for irq callbacks Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 028/126] Btrfs: fix truncation of compressed and inlined extents Luis Henriques
                   ` (98 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David Woodhouse, Luis Henriques

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

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

From: David Woodhouse <David.Woodhouse@intel.com>

commit d14053b3c714178525f22660e6aaf41263d00056 upstream.

The VT-d specification says that "Software must enable ATS on endpoint
devices behind a Root Port only if the Root Port is reported as
supporting ATS transactions."

We walk up the tree to find a Root Port, but for integrated devices we
don't find one — we get to the host bridge. In that case we *should*
allow ATS. Currently we don't, which means that we are incorrectly
failing to use ATS for the integrated graphics. Fix that.

We should never break out of this loop "naturally" with bus==NULL,
since we'll always find bridge==NULL in that case (and now return 1).

So remove the check for (!bridge) after the loop, since it can never
happen. If it did, it would be worthy of a BUG_ON(!bridge). But since
it'll oops anyway in that case, that'll do just as well.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/iommu/intel-iommu.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index baffab3948d7..544f968a440a 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3798,14 +3798,17 @@ int dmar_find_matched_atsr_unit(struct pci_dev *dev)
 	dev = pci_physfn(dev);
 	for (bus = dev->bus; bus; bus = bus->parent) {
 		bridge = bus->self;
-		if (!bridge || !pci_is_pcie(bridge) ||
+		/* If it's an integrated device, allow ATS */
+		if (!bridge)
+			return 1;
+		/* Connected via non-PCIe: no ATS */
+		if (!pci_is_pcie(bridge) ||
 		    pci_pcie_type(bridge) == PCI_EXP_TYPE_PCI_BRIDGE)
 			return 0;
+		/* If we found the root port, look it up in the ATSR */
 		if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT)
 			break;
 	}
-	if (!bridge)
-		return 0;
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(atsru, &dmar_atsr_units, list) {

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

* [PATCH 3.16.y-ckt 028/126] Btrfs: fix truncation of compressed and inlined extents
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (26 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 027/126] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 029/126] ext4: fix potential use after free in __ext4_journal_stop Luis Henriques
                   ` (97 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit 0305cd5f7fca85dae392b9ba85b116896eb7c1c7 upstream.

When truncating a file to a smaller size which consists of an inline
extent that is compressed, we did not discard (or made unusable) the
data between the new file size and the old file size, wasting metadata
space and allowing for the truncated data to be leaked and the data
corruption/loss mentioned below.
We were also not correctly decrementing the number of bytes used by the
inode, we were setting it to zero, giving a wrong report for callers of
the stat(2) syscall. The fsck tool also reported an error about a mismatch
between the nbytes of the file versus the real space used by the file.

Now because we weren't discarding the truncated region of the file, it
was possible for a caller of the clone ioctl to actually read the data
that was truncated, allowing for a security breach without requiring root
access to the system, using only standard filesystem operations. The
scenario is the following:

   1) User A creates a file which consists of an inline and compressed
      extent with a size of 2000 bytes - the file is not accessible to
      any other users (no read, write or execution permission for anyone
      else);

   2) The user truncates the file to a size of 1000 bytes;

   3) User A makes the file world readable;

   4) User B creates a file consisting of an inline extent of 2000 bytes;

   5) User B issues a clone operation from user A's file into its own
      file (using a length argument of 0, clone the whole range);

   6) User B now gets to see the 1000 bytes that user A truncated from
      its file before it made its file world readbale. User B also lost
      the bytes in the range [1000, 2000[ bytes from its own file, but
      that might be ok if his/her intention was reading stale data from
      user A that was never supposed to be public.

Note that this contrasts with the case where we truncate a file from 2000
bytes to 1000 bytes and then truncate it back from 1000 to 2000 bytes. In
this case reading any byte from the range [1000, 2000[ will return a value
of 0x00, instead of the original data.

This problem exists since the clone ioctl was added and happens both with
and without my recent data loss and file corruption fixes for the clone
ioctl (patch "Btrfs: fix file corruption and data loss after cloning
inline extents").

So fix this by truncating the compressed inline extents as we do for the
non-compressed case, which involves decompressing, if the data isn't already
in the page cache, compressing the truncated version of the extent, writing
the compressed content into the inline extent and then truncate it.

The following test case for fstests reproduces the problem. In order for
the test to pass both this fix and my previous fix for the clone ioctl
that forbids cloning a smaller inline extent into a larger one,
which is titled "Btrfs: fix file corruption and data loss after cloning
inline extents", are needed. Without that other fix the test fails in a
different way that does not leak the truncated data, instead part of
destination file gets replaced with zeroes (because the destination file
has a larger inline extent than the source).

  seq=`basename $0`
  seqres=$RESULT_DIR/$seq
  echo "QA output created by $seq"
  tmp=/tmp/$$
  status=1	# failure is the default!
  trap "_cleanup; exit \$status" 0 1 2 3 15

  _cleanup()
  {
      rm -f $tmp.*
  }

  # get standard environment, filters and checks
  . ./common/rc
  . ./common/filter

  # real QA test starts here
  _need_to_be_root
  _supported_fs btrfs
  _supported_os Linux
  _require_scratch
  _require_cloner

  rm -f $seqres.full

  _scratch_mkfs >>$seqres.full 2>&1
  _scratch_mount "-o compress"

  # Create our test files. File foo is going to be the source of a clone operation
  # and consists of a single inline extent with an uncompressed size of 512 bytes,
  # while file bar consists of a single inline extent with an uncompressed size of
  # 256 bytes. For our test's purpose, it's important that file bar has an inline
  # extent with a size smaller than foo's inline extent.
  $XFS_IO_PROG -f -c "pwrite -S 0xa1 0 128"   \
          -c "pwrite -S 0x2a 128 384" \
          $SCRATCH_MNT/foo | _filter_xfs_io
  $XFS_IO_PROG -f -c "pwrite -S 0xbb 0 256" $SCRATCH_MNT/bar | _filter_xfs_io

  # Now durably persist all metadata and data. We do this to make sure that we get
  # on disk an inline extent with a size of 512 bytes for file foo.
  sync

  # Now truncate our file foo to a smaller size. Because it consists of a
  # compressed and inline extent, btrfs did not shrink the inline extent to the
  # new size (if the extent was not compressed, btrfs would shrink it to 128
  # bytes), it only updates the inode's i_size to 128 bytes.
  $XFS_IO_PROG -c "truncate 128" $SCRATCH_MNT/foo

  # Now clone foo's inline extent into bar.
  # This clone operation should fail with errno EOPNOTSUPP because the source
  # file consists only of an inline extent and the file's size is smaller than
  # the inline extent of the destination (128 bytes < 256 bytes). However the
  # clone ioctl was not prepared to deal with a file that has a size smaller
  # than the size of its inline extent (something that happens only for compressed
  # inline extents), resulting in copying the full inline extent from the source
  # file into the destination file.
  #
  # Note that btrfs' clone operation for inline extents consists of removing the
  # inline extent from the destination inode and copy the inline extent from the
  # source inode into the destination inode, meaning that if the destination
  # inode's inline extent is larger (N bytes) than the source inode's inline
  # extent (M bytes), some bytes (N - M bytes) will be lost from the destination
  # file. Btrfs could copy the source inline extent's data into the destination's
  # inline extent so that we would not lose any data, but that's currently not
  # done due to the complexity that would be needed to deal with such cases
  # (specially when one or both extents are compressed), returning EOPNOTSUPP, as
  # it's normally not a very common case to clone very small files (only case
  # where we get inline extents) and copying inline extents does not save any
  # space (unlike for normal, non-inlined extents).
  $CLONER_PROG -s 0 -d 0 -l 0 $SCRATCH_MNT/foo $SCRATCH_MNT/bar

  # Now because the above clone operation used to succeed, and due to foo's inline
  # extent not being shinked by the truncate operation, our file bar got the whole
  # inline extent copied from foo, making us lose the last 128 bytes from bar
  # which got replaced by the bytes in range [128, 256[ from foo before foo was
  # truncated - in other words, data loss from bar and being able to read old and
  # stale data from foo that should not be possible to read anymore through normal
  # filesystem operations. Contrast with the case where we truncate a file from a
  # size N to a smaller size M, truncate it back to size N and then read the range
  # [M, N[, we should always get the value 0x00 for all the bytes in that range.

  # We expected the clone operation to fail with errno EOPNOTSUPP and therefore
  # not modify our file's bar data/metadata. So its content should be 256 bytes
  # long with all bytes having the value 0xbb.
  #
  # Without the btrfs bug fix, the clone operation succeeded and resulted in
  # leaking truncated data from foo, the bytes that belonged to its range
  # [128, 256[, and losing data from bar in that same range. So reading the
  # file gave us the following content:
  #
  # 0000000 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1
  # *
  # 0000200 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a
  # *
  # 0000400
  echo "File bar's content after the clone operation:"
  od -t x1 $SCRATCH_MNT/bar

  # Also because the foo's inline extent was not shrunk by the truncate
  # operation, btrfs' fsck, which is run by the fstests framework everytime a
  # test completes, failed reporting the following error:
  #
  #  root 5 inode 257 errors 400, nbytes wrong

  status=0
  exit

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/inode.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 68 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 89c876aabe24..af4bb28c9ba5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3993,6 +3993,47 @@ out:
 	return err;
 }
 
+static int truncate_inline_extent(struct inode *inode,
+				  struct btrfs_path *path,
+				  struct btrfs_key *found_key,
+				  const u64 item_end,
+				  const u64 new_size)
+{
+	struct extent_buffer *leaf = path->nodes[0];
+	int slot = path->slots[0];
+	struct btrfs_file_extent_item *fi;
+	u32 size = (u32)(new_size - found_key->offset);
+	struct btrfs_root *root = BTRFS_I(inode)->root;
+
+	fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
+
+	if (btrfs_file_extent_compression(leaf, fi) != BTRFS_COMPRESS_NONE) {
+		loff_t offset = new_size;
+		loff_t page_end = ALIGN(offset, PAGE_CACHE_SIZE);
+
+		/*
+		 * Zero out the remaining of the last page of our inline extent,
+		 * instead of directly truncating our inline extent here - that
+		 * would be much more complex (decompressing all the data, then
+		 * compressing the truncated data, which might be bigger than
+		 * the size of the inline extent, resize the extent, etc).
+		 * We release the path because to get the page we might need to
+		 * read the extent item from disk (data not in the page cache).
+		 */
+		btrfs_release_path(path);
+		return btrfs_truncate_page(inode, offset, page_end - offset, 0);
+	}
+
+	btrfs_set_file_extent_ram_bytes(leaf, fi, size);
+	size = btrfs_file_extent_calc_inline_size(size);
+	btrfs_truncate_item(root, path, size, 1);
+
+	if (test_bit(BTRFS_ROOT_REF_COWS, &root->state))
+		inode_sub_bytes(inode, item_end + 1 - new_size);
+
+	return 0;
+}
+
 /*
  * this can truncate away extent items, csum items and directory items.
  * It starts at a high offset and removes keys until it can't find
@@ -4162,27 +4203,40 @@ search_again:
 			 * special encodings
 			 */
 			if (!del_item &&
-			    btrfs_file_extent_compression(leaf, fi) == 0 &&
 			    btrfs_file_extent_encryption(leaf, fi) == 0 &&
 			    btrfs_file_extent_other_encoding(leaf, fi) == 0) {
-				u32 size = new_size - found_key.offset;
-
-				if (test_bit(BTRFS_ROOT_REF_COWS, &root->state))
-					inode_sub_bytes(inode, item_end + 1 -
-							new_size);
 
 				/*
-				 * update the ram bytes to properly reflect
-				 * the new size of our item
+				 * Need to release path in order to truncate a
+				 * compressed extent. So delete any accumulated
+				 * extent items so far.
 				 */
-				btrfs_set_file_extent_ram_bytes(leaf, fi, size);
-				size =
-				    btrfs_file_extent_calc_inline_size(size);
-				btrfs_truncate_item(root, path, size, 1);
+				if (btrfs_file_extent_compression(leaf, fi) !=
+				    BTRFS_COMPRESS_NONE && pending_del_nr) {
+					err = btrfs_del_items(trans, root, path,
+							      pending_del_slot,
+							      pending_del_nr);
+					if (err) {
+						btrfs_abort_transaction(trans,
+									root,
+									err);
+						goto error;
+					}
+					pending_del_nr = 0;
+				}
+
+				err = truncate_inline_extent(inode, path,
+							     &found_key,
+							     item_end,
+							     new_size);
+				if (err) {
+					btrfs_abort_transaction(trans,
+								root, err);
+					goto error;
+				}
 			} else if (test_bit(BTRFS_ROOT_REF_COWS,
 					    &root->state)) {
-				inode_sub_bytes(inode, item_end + 1 -
-						found_key.offset);
+				inode_sub_bytes(inode, item_end + 1 - new_size);
 			}
 		}
 delete:

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

* [PATCH 3.16.y-ckt 029/126] ext4: fix potential use after free in __ext4_journal_stop
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (27 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 028/126] Btrfs: fix truncation of compressed and inlined extents Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 030/126] [PATCH] fix calculation of meta_bg descriptor backups Luis Henriques
                   ` (96 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Lukas Czerner, Luis Henriques

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

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

From: Lukas Czerner <lczerner@redhat.com>

commit 6934da9238da947628be83635e365df41064b09b upstream.

There is a use-after-free possibility in __ext4_journal_stop() in the
case that we free the handle in the first jbd2_journal_stop() because
we're referencing handle->h_err afterwards. This was introduced in
9705acd63b125dee8b15c705216d7186daea4625 and it is wrong. Fix it by
storing the handle->h_err value beforehand and avoid referencing
potentially freed handle.

Fixes: 9705acd63b125dee8b15c705216d7186daea4625
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/ext4_jbd2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 44c89188c62c..23349f00e77c 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -88,13 +88,13 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)
 		return 0;
 	}
 
+	err = handle->h_err;
 	if (!handle->h_transaction) {
-		err = jbd2_journal_stop(handle);
-		return handle->h_err ? handle->h_err : err;
+		rc = jbd2_journal_stop(handle);
+		return err ? err : rc;
 	}
 
 	sb = handle->h_transaction->t_journal->j_private;
-	err = handle->h_err;
 	rc = jbd2_journal_stop(handle);
 
 	if (!err)

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

* [PATCH 3.16.y-ckt 030/126] [PATCH] fix calculation of meta_bg descriptor backups
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (28 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 029/126] ext4: fix potential use after free in __ext4_journal_stop Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 031/126] ext4, jbd2: ensure entering into panic after recording an error in superblock Luis Henriques
                   ` (95 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Leiserson, Theodore Ts'o, Luis Henriques

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

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

From: Andy Leiserson <andy@leiserson.org>

commit 904dad4742d211b7a8910e92695c0fa957483836 upstream.

"group" is the group where the backup will be placed, and is
initialized to zero in the declaration. This meant that backups for
meta_bg descriptors were erroneously written to the backup block group
descriptors in groups 1 and (desc_per_block-1).

Reproduction information:
  mke2fs -Fq -t ext4 -b 1024 -O ^resize_inode /tmp/foo.img 16G
  truncate -s 24G /tmp/foo.img
  losetup /dev/loop0 /tmp/foo.img
  mount /dev/loop0 /mnt
  resize2fs /dev/loop0
  umount /dev/loop0
  dd if=/dev/zero of=/dev/loop0 bs=1024 count=2
  e2fsck -fy /dev/loop0
  losetup -d /dev/loop0

Signed-off-by: Andy Leiserson <andy@leiserson.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/resize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index ca4588388fc3..dd4f37e2f18f 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1040,7 +1040,7 @@ exit_free:
  * do not copy the full number of backups at this time.  The resize
  * which changed s_groups_count will backup again.
  */
-static void update_backups(struct super_block *sb, int blk_off, char *data,
+static void update_backups(struct super_block *sb, sector_t blk_off, char *data,
 			   int size, int meta_bg)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
@@ -1065,7 +1065,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data,
 		group = ext4_list_backups(sb, &three, &five, &seven);
 		last = sbi->s_groups_count;
 	} else {
-		group = ext4_meta_bg_first_group(sb, group) + 1;
+		group = ext4_get_group_number(sb, blk_off) + 1;
 		last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2);
 	}
 

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

* [PATCH 3.16.y-ckt 031/126] ext4, jbd2: ensure entering into panic after recording an error in superblock
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (29 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 030/126] [PATCH] fix calculation of meta_bg descriptor backups Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 032/126] vTPM: fix memory allocation flag for rtce buffer at kernel boot Luis Henriques
                   ` (94 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daeho Jeong, Theodore Ts'o, Luis Henriques

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

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

From: Daeho Jeong <daeho.jeong@samsung.com>

commit 4327ba52afd03fc4b5afa0ee1d774c9c5b0e85c5 upstream.

If a EXT4 filesystem utilizes JBD2 journaling and an error occurs, the
journaling will be aborted first and the error number will be recorded
into JBD2 superblock and, finally, the system will enter into the
panic state in "errors=panic" option.  But, in the rare case, this
sequence is little twisted like the below figure and it will happen
that the system enters into panic state, which means the system reset
in mobile environment, before completion of recording an error in the
journal superblock. In this case, e2fsck cannot recognize that the
filesystem failure occurred in the previous run and the corruption
wouldn't be fixed.

Task A                        Task B
ext4_handle_error()
-> jbd2_journal_abort()
  -> __journal_abort_soft()
    -> __jbd2_journal_abort_hard()
    | -> journal->j_flags |= JBD2_ABORT;
    |
    |                         __ext4_abort()
    |                         -> jbd2_journal_abort()
    |                         | -> __journal_abort_soft()
    |                         |   -> if (journal->j_flags & JBD2_ABORT)
    |                         |           return;
    |                         -> panic()
    |
    -> jbd2_journal_update_sb_errno()

Tested-by: Hobin Woo <hobin.woo@samsung.com>
Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/super.c      | 12 ++++++++++--
 fs/jbd2/journal.c    |  6 +++++-
 include/linux/jbd2.h |  1 +
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a8f6f6a358ce..9b9168705e16 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -405,9 +405,13 @@ static void ext4_handle_error(struct super_block *sb)
 		smp_wmb();
 		sb->s_flags |= MS_RDONLY;
 	}
-	if (test_opt(sb, ERRORS_PANIC))
+	if (test_opt(sb, ERRORS_PANIC)) {
+		if (EXT4_SB(sb)->s_journal &&
+		  !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR))
+			return;
 		panic("EXT4-fs (device %s): panic forced after error\n",
 			sb->s_id);
+	}
 }
 
 #define ext4_error_ratelimit(sb)					\
@@ -596,8 +600,12 @@ void __ext4_abort(struct super_block *sb, const char *function,
 			jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
 		save_error_info(sb, function, line);
 	}
-	if (test_opt(sb, ERRORS_PANIC))
+	if (test_opt(sb, ERRORS_PANIC)) {
+		if (EXT4_SB(sb)->s_journal &&
+		  !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR))
+			return;
 		panic("EXT4-fs panic from previous error\n");
+	}
 }
 
 void __ext4_msg(struct super_block *sb,
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 8c649c3f0a80..39c3c2c64740 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2088,8 +2088,12 @@ static void __journal_abort_soft (journal_t *journal, int errno)
 
 	__jbd2_journal_abort_hard(journal);
 
-	if (errno)
+	if (errno) {
 		jbd2_journal_update_sb_errno(journal);
+		write_lock(&journal->j_state_lock);
+		journal->j_flags |= JBD2_REC_ERR;
+		write_unlock(&journal->j_state_lock);
+	}
 }
 
 /**
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 385593d748f6..e137e962834b 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1007,6 +1007,7 @@ struct journal_s
 #define JBD2_ABORT_ON_SYNCDATA_ERR	0x040	/* Abort the journal on file
 						 * data write error in ordered
 						 * mode */
+#define JBD2_REC_ERR	0x080	/* The errno in the sb has been recorded */
 
 /*
  * Function declarations for the journaling transaction and buffer

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

* [PATCH 3.16.y-ckt 032/126] vTPM: fix memory allocation flag for rtce buffer at kernel boot
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (30 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 031/126] ext4, jbd2: ensure entering into panic after recording an error in superblock Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 033/126] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Luis Henriques
                   ` (93 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hon Ching(Vicky) Lo, Peter Huewe, Luis Henriques

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

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

From: "Hon Ching \\\\(Vicky\\\\) Lo" <honclo@linux.vnet.ibm.com>

commit 60ecd86c4d985750efa0ea3d8610972b09951715 upstream.

At ibm vtpm initialzation, tpm_ibmvtpm_probe() registers its interrupt
handler, ibmvtpm_interrupt, which calls ibmvtpm_crq_process to allocate
memory for rtce buffer.  The current code uses 'GFP_KERNEL' as the
type of kernel memory allocation, which resulted a warning at
kernel/lockdep.c.  This patch uses 'GFP_ATOMIC' instead so that the
allocation is high-priority and does not sleep.

Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 643bba7d6f81..9eab751efeea 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -490,7 +490,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
 			}
 			ibmvtpm->rtce_size = be16_to_cpu(crq->len);
 			ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size,
-						    GFP_KERNEL);
+						    GFP_ATOMIC);
 			if (!ibmvtpm->rtce_buf) {
 				dev_err(ibmvtpm->dev, "Failed to allocate memory for rtce buffer\n");
 				return;

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

* [PATCH 3.16.y-ckt 033/126] spi: dw: explicitly free IRQ handler in dw_spi_remove_host()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (31 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 032/126] vTPM: fix memory allocation flag for rtce buffer at kernel boot Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 034/126] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish Luis Henriques
                   ` (92 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Shevchenko, Mark Brown, Luis Henriques

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

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

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit 02f20387e1bca550639c37b1945f20cd32ddfcce upstream.

The following warning occurs when DW SPI is compiled as a module and it's a PCI
device. On the removal stage pcibios_free_irq() is called earlier than
free_irq() due to the latter is called at managed resources free strage.

------------[ cut here ]------------
WARNING: CPU: 1 PID: 1003 at /home/andy/prj/linux/fs/proc/generic.c:575 remove_proc_entry+0x118/0x150()
remove_proc_entry: removing non-empty directory 'irq/38', leaking at least 'dw_spi1'
Modules linked in: spi_dw_midpci(-) spi_dw [last unloaded: dw_dmac_core]
CPU: 1 PID: 1003 Comm: modprobe Not tainted 4.3.0-rc5-next-20151013+ #32
 00000000 00000000 f5535d70 c12dc220 f5535db0 f5535da0 c104e912 c198a6bc
 f5535dcc 000003eb c198a638 0000023f c11b4098 c11b4098 f54f1ec8 f54f1ea0
 f642ba20 f5535db8 c104e96e 00000009 f5535db0 c198a6bc f5535dcc f5535df0
Call Trace:
 [<c12dc220>] dump_stack+0x41/0x61
 [<c104e912>] warn_slowpath_common+0x82/0xb0
 [<c11b4098>] ? remove_proc_entry+0x118/0x150
 [<c11b4098>] ? remove_proc_entry+0x118/0x150
 [<c104e96e>] warn_slowpath_fmt+0x2e/0x30
 [<c11b4098>] remove_proc_entry+0x118/0x150
 [<c109b96a>] unregister_irq_proc+0xaa/0xc0
 [<c109575e>] free_desc+0x1e/0x60
 [<c10957d2>] irq_free_descs+0x32/0x70
 [<c109b1a0>] irq_domain_free_irqs+0x120/0x150
 [<c1039e8c>] mp_unmap_irq+0x5c/0x60
 [<c16277b0>] intel_mid_pci_irq_disable+0x20/0x40
 [<c1627c7f>] pcibios_free_irq+0xf/0x20
 [<c13189f2>] pci_device_remove+0x52/0xb0
 [<c13f6367>] __device_release_driver+0x77/0x100
 [<c13f6da7>] driver_detach+0x87/0x90
 [<c13f5eaa>] bus_remove_driver+0x4a/0xc0
 [<c128bf0d>] ? selinux_capable+0xd/0x10
 [<c13f7483>] driver_unregister+0x23/0x60
 [<c10bad8a>] ? find_module_all+0x5a/0x80
 [<c1317413>] pci_unregister_driver+0x13/0x60
 [<f80ac654>] dw_spi_driver_exit+0xd/0xf [spi_dw_midpci]
 [<c10bce9a>] SyS_delete_module+0x17a/0x210

Explicitly call free_irq() at removal stage of the DW SPI driver.

Fixes: 04f421e7b0b1 (spi: dw: use managed resources)
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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 4fc4c20893e1..66e9e5196c8c 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -652,8 +652,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
 	snprintf(dws->name, sizeof(dws->name), "dw_spi%d",
 			dws->bus_num);
 
-	ret = devm_request_irq(dev, dws->irq, dw_spi_irq, IRQF_SHARED,
-			dws->name, dws);
+	ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, dws->name, dws);
 	if (ret < 0) {
 		dev_err(&master->dev, "can not get IRQ\n");
 		goto err_free_master;
@@ -695,6 +694,7 @@ err_dma_exit:
 	if (dws->dma_ops && dws->dma_ops->dma_exit)
 		dws->dma_ops->dma_exit(dws);
 	spi_enable_chip(dws, 0);
+	free_irq(dws->irq, master);
 err_free_master:
 	spi_master_put(master);
 	return ret;
@@ -712,6 +712,8 @@ void dw_spi_remove_host(struct dw_spi *dws)
 	spi_enable_chip(dws, 0);
 	/* Disable clk */
 	spi_set_clk(dws, 0);
+
+	free_irq(dws->irq, dws->master);
 }
 EXPORT_SYMBOL_GPL(dw_spi_remove_host);
 

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

* [PATCH 3.16.y-ckt 034/126] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (32 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 033/126] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 035/126] Bluetooth: hidp: fix device disconnect on idle timeout Luis Henriques
                   ` (91 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tiffany Lin, Sakari Ailus, Mauro Carvalho Chehab, Luis Henriques

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

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

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

commit d9a985883fa32453d099d6293188c11d75cef1fa upstream.

In videobuf2 dma-contig memory type the prepare and finish ops, instead of
passing the number of entries in the original scatterlist as the "nents"
parameter to dma_sync_sg_for_device() and dma_sync_sg_for_cpu(), the value
returned by dma_map_sg() was used. Albeit this has been suggested in
comments of some implementations (which have since been corrected), this
is wrong.

Fixes: 199d101efdba ("v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator")

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index 880be0782dd9..9c838cd58761 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -117,7 +117,8 @@ static void vb2_dc_prepare(void *buf_priv)
 	if (!sgt || buf->db_attach)
 		return;
 
-	dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
+	dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents,
+			       buf->dma_dir);
 }
 
 static void vb2_dc_finish(void *buf_priv)
@@ -129,7 +130,7 @@ static void vb2_dc_finish(void *buf_priv)
 	if (!sgt || buf->db_attach)
 		return;
 
-	dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
+	dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir);
 }
 
 /*********************************************/

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

* [PATCH 3.16.y-ckt 035/126] Bluetooth: hidp: fix device disconnect on idle timeout
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (33 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 034/126] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 036/126] Bluetooth: ath3k: Add new AR3012 0930:021c id Luis Henriques
                   ` (90 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Herrmann, Marcel Holtmann, Luis Henriques

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

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

From: David Herrmann <dh.herrmann@gmail.com>

commit 660f0fc07d21114549c1862e67e78b1cf0c90c29 upstream.

The HIDP specs define an idle-timeout which automatically disconnects a
device. This has always been implemented in the HIDP layer and forced a
synchronous shutdown of the hidp-scheduler. This works just fine, but
lacks a forced disconnect on the underlying l2cap channels. This has been
broken since:

    commit 5205185d461d5902325e457ca80bd421127b7308
    Author: David Herrmann <dh.herrmann@gmail.com>
    Date:   Sat Apr 6 20:28:47 2013 +0200

        Bluetooth: hidp: remove old session-management

The old session-management always forced an l2cap error on the ctrl/intr
channels when shutting down. The new session-management skips this, as we
don't want to enforce channel policy on the caller. In other words, if
user-space removes an HIDP device, the underlying channels (which are
*owned* and *referenced* by user-space) are still left active. User-space
needs to call shutdown(2) or close(2) to release them.

Unfortunately, this does not work with idle-timeouts. There is no way to
signal user-space that the HIDP layer has been stopped. The API simply
does not support any event-passing except for poll(2). Hence, we restore
old behavior and force EUNATCH on the sockets if the HIDP layer is
disconnected due to idle-timeouts (behavior of explicit disconnects
remains unmodified). User-space can still call

    getsockopt(..., SO_ERROR, ...)

..to retrieve the EUNATCH error and clear sk_err. Hence, the channels can
still be re-used (which nobody does so far, though). Therefore, the API
still supports the new behavior, but with this patch it's also compatible
to the old implicit channel shutdown.

Reported-by: Mark Haun <haunma@keteu.org>
Reported-by: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/bluetooth/hidp/core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 8181ea4bc2f2..3b45cfee3743 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -400,6 +400,20 @@ static void hidp_idle_timeout(unsigned long arg)
 {
 	struct hidp_session *session = (struct hidp_session *) arg;
 
+	/* The HIDP user-space API only contains calls to add and remove
+	 * devices. There is no way to forward events of any kind. Therefore,
+	 * we have to forcefully disconnect a device on idle-timeouts. This is
+	 * unfortunate and weird API design, but it is spec-compliant and
+	 * required for backwards-compatibility. Hence, on idle-timeout, we
+	 * signal driver-detach events, so poll() will be woken up with an
+	 * error-condition on both sockets.
+	 */
+
+	session->intr_sock->sk->sk_err = EUNATCH;
+	session->ctrl_sock->sk->sk_err = EUNATCH;
+	wake_up_interruptible(sk_sleep(session->intr_sock->sk));
+	wake_up_interruptible(sk_sleep(session->ctrl_sock->sk));
+
 	hidp_session_terminate(session);
 }
 

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

* [PATCH 3.16.y-ckt 036/126] Bluetooth: ath3k: Add new AR3012 0930:021c id
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (34 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 035/126] Bluetooth: hidp: fix device disconnect on idle timeout Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 037/126] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Luis Henriques
                   ` (89 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Luis Henriques

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

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

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit cd355ff071cd37e7197eccf9216770b2b29369f7 upstream.

This adapter works with the existing linux-firmware.

T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0930 ProdID=021c Rev=00.01
C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

BugLink: https://bugs.launchpad.net/bugs/1502781

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index af9959e0d3a1..090dace927f2 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -93,6 +93,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x04CA, 0x300f) },
 	{ USB_DEVICE(0x04CA, 0x3010) },
 	{ USB_DEVICE(0x0930, 0x0219) },
+	{ USB_DEVICE(0x0930, 0x021c) },
 	{ USB_DEVICE(0x0930, 0x0220) },
 	{ USB_DEVICE(0x0930, 0x0227) },
 	{ USB_DEVICE(0x0b05, 0x17d0) },
@@ -153,6 +154,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 0ff80ad6464b..8b8acf1fd9d0 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -183,6 +183,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },

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

* [PATCH 3.16.y-ckt 037/126] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (35 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 036/126] Bluetooth: ath3k: Add new AR3012 0930:021c id Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 038/126] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word Luis Henriques
                   ` (88 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Luis Henriques

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

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

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit 18e0afab8ce3f1230ce3fef52b2e73374fd9c0e7 upstream.

T: Bus=04 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0cf3 ProdID=817b Rev=00.02
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

BugLink: https://bugs.launchpad.net/bugs/1506615

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 090dace927f2..715b1597ee61 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -105,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x0CF3, 0x311F) },
 	{ USB_DEVICE(0x0cf3, 0x3121) },
 	{ USB_DEVICE(0x0CF3, 0x817a) },
+	{ USB_DEVICE(0x0CF3, 0x817b) },
 	{ USB_DEVICE(0x0cf3, 0xe003) },
 	{ USB_DEVICE(0x0CF3, 0xE004) },
 	{ USB_DEVICE(0x0CF3, 0xE005) },
@@ -166,6 +167,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x0cf3, 0x311F), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0CF3, 0x817b), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8b8acf1fd9d0..78e20eb1b920 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -195,6 +195,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x0cf3, 0x311f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0cf3, 0x817b), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },

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

* [PATCH 3.16.y-ckt 038/126] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (36 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 037/126] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 039/126] USB: qcserial: add Sierra Wireless MC74xx/EM74xx Luis Henriques
                   ` (87 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Mosberger, Nicolas Ferre, Mark Brown, Luis Henriques

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

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

From: David Mosberger-Tang <davidm@egauge.net>

commit 06515f83908d038d9e12ffa3dcca27a1b67f2de0 upstream.

The DMA-slave configuration depends on the whether <= 8 or > 8 bits
are transferred per word, so we need to call
atmel_spi_dma_slave_config() with the correct value.

Signed-off-by: David Mosberger <davidm@egauge.net>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/spi/spi-atmel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index a65823bddf01..bbf7c5e79b95 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -593,7 +593,8 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master,
 
 	*plen = len;
 
-	if (atmel_spi_dma_slave_config(as, &slave_config, 8))
+	if (atmel_spi_dma_slave_config(as, &slave_config,
+				       xfer->bits_per_word))
 		goto err_exit;
 
 	/* Send both scatterlists */

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

* [PATCH 3.16.y-ckt 039/126] USB: qcserial: add Sierra Wireless MC74xx/EM74xx
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (37 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 038/126] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 040/126] staging: rtl8712: Add device ID for Sitecom WLA2100 Luis Henriques
                   ` (86 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Greg Kroah-Hartman, Luis Henriques

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

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

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit f504ab1888026d15b5be8f9c262bf4ae9cacd177 upstream.

New device IDs shamelessly lifted from the vendor driver.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-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/qcserial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index ebcec8cda858..f49d262e926b 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -153,6 +153,8 @@ static const struct usb_device_id id_table[] = {
 	{DEVICE_SWI(0x1199, 0x9056)},	/* Sierra Wireless Modem */
 	{DEVICE_SWI(0x1199, 0x9060)},	/* Sierra Wireless Modem */
 	{DEVICE_SWI(0x1199, 0x9061)},	/* Sierra Wireless Modem */
+	{DEVICE_SWI(0x1199, 0x9070)},	/* Sierra Wireless MC74xx/EM74xx */
+	{DEVICE_SWI(0x1199, 0x9071)},	/* Sierra Wireless MC74xx/EM74xx */
 	{DEVICE_SWI(0x413c, 0x81a2)},	/* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
 	{DEVICE_SWI(0x413c, 0x81a3)},	/* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
 	{DEVICE_SWI(0x413c, 0x81a4)},	/* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */

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

* [PATCH 3.16.y-ckt 040/126] staging: rtl8712: Add device ID for Sitecom WLA2100
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (38 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 039/126] USB: qcserial: add Sierra Wireless MC74xx/EM74xx Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 041/126] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler Luis Henriques
                   ` (85 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, Frans van de Wiel, Greg Kroah-Hartman,
	Luis Henriques

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

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

From: Larry Finger <Larry.Finger@lwfinger.net>

commit 1e6e63283691a2a9048a35d9c6c59cf0abd342e4 upstream.

This adds the USB ID for the Sitecom WLA2100. The Windows 10 inf file
was checked to verify that the addition is correct.

Reported-by: Frans van de Wiel <fvdw@fvdw.eu>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Frans van de Wiel <fvdw@fvdw.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/rtl8712/usb_intf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index ba743542babc..22a28becf275 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -144,6 +144,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
 	{USB_DEVICE(0x0DF6, 0x0058)},
 	{USB_DEVICE(0x0DF6, 0x0049)},
 	{USB_DEVICE(0x0DF6, 0x004C)},
+	{USB_DEVICE(0x0DF6, 0x006C)},
 	{USB_DEVICE(0x0DF6, 0x0064)},
 	/* Skyworth */
 	{USB_DEVICE(0x14b2, 0x3300)},

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

* [PATCH 3.16.y-ckt 041/126] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (39 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 040/126] staging: rtl8712: Add device ID for Sitecom WLA2100 Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 042/126] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back Luis Henriques
                   ` (84 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Yu, Rafael J. Wysocki, Luis Henriques

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

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

From: Chen Yu <yu.c.chen@intel.com>

commit 49e4b84333f338d4f183f28f1f3c1131b9fb2b5a upstream.

Currently when the system is trying to uninstall the ACPI interrupt
handler, it uses acpi_gbl_FADT.sci_interrupt as the IRQ number.
However, the IRQ number that the ACPI interrupt handled is installed
for comes from acpi_gsi_to_irq() and that is the number that should
be used for the handler removal.

Fix this problem by using the mapped IRQ returned from acpi_gsi_to_irq()
as appropriate.

Acked-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/osl.c   | 9 ++++++---
 include/linux/acpi.h | 6 ++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 5e240a479b71..9fb0e4fd6ac0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -83,6 +83,7 @@ static void *acpi_irq_context;
 static struct workqueue_struct *kacpid_wq;
 static struct workqueue_struct *kacpi_notify_wq;
 static struct workqueue_struct *kacpi_hotplug_wq;
+unsigned int acpi_sci_irq = INVALID_ACPI_IRQ;
 
 /*
  * This list of permanent mappings is for memory that may be accessed from
@@ -828,17 +829,19 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
 		acpi_irq_handler = NULL;
 		return AE_NOT_ACQUIRED;
 	}
+	acpi_sci_irq = irq;
 
 	return AE_OK;
 }
 
-acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
+acpi_status acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler handler)
 {
-	if (irq != acpi_gbl_FADT.sci_interrupt)
+	if (gsi != acpi_gbl_FADT.sci_interrupt || !acpi_sci_irq_valid())
 		return AE_BAD_PARAMETER;
 
-	free_irq(irq, acpi_irq);
+	free_irq(acpi_sci_irq, acpi_irq);
 	acpi_irq_handler = NULL;
+	acpi_sci_irq = INVALID_ACPI_IRQ;
 
 	return AE_OK;
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3b18cb3d5307..7e52e670d6ad 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -151,6 +151,12 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
 void acpi_irq_stats_init(void);
 extern u32 acpi_irq_handled;
 extern u32 acpi_irq_not_handled;
+extern unsigned int acpi_sci_irq;
+#define INVALID_ACPI_IRQ	((unsigned)-1)
+static inline bool acpi_sci_irq_valid(void)
+{
+	return acpi_sci_irq != INVALID_ACPI_IRQ;
+}
 
 extern int sbf_port;
 extern unsigned long acpi_realmode_flags;

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

* [PATCH 3.16.y-ckt 042/126] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (40 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 041/126] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 043/126] MAINTAINERS: Add public mailing list for ARC Luis Henriques
                   ` (83 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kailang Yang, Takashi Iwai, Luis Henriques

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

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

From: Kailang Yang <kailang@realtek.com>

commit 6ed1131fe196ad7ffc13acc1a1eadc08a1db0303 upstream.

This machine had I2S codec for speaker output.
It need to refill the I2S codec initial verb after resume back.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Reported-and-tested-by: George Gugulea <gugulea@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ba5bebbe859d..a68209c245e2 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4317,6 +4317,7 @@ enum {
 	ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
 	ALC292_FIXUP_TPT440_DOCK,
 	ALC292_FIXUP_TPT440_DOCK2,
+	ALC275_FIXUP_DELL_XPS,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -4769,6 +4770,17 @@ static const struct hda_fixup alc269_fixups[] = {
 		.chained = true,
 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
 	},
+	[ALC275_FIXUP_DELL_XPS] = {
+		.type = HDA_FIXUP_VERBS,
+		.v.verbs = (const struct hda_verb[]) {
+			/* Enables internal speaker */
+			{0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
+			{0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
+			{0x20, AC_VERB_SET_COEF_INDEX, 0x30},
+			{0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
+			{}
+		}
+	},
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4783,6 +4795,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
 	SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
+	SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
 	SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x05c4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),

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

* [PATCH 3.16.y-ckt 043/126] MAINTAINERS: Add public mailing list for ARC
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (41 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 042/126] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 044/126] megaraid_sas: Do not use PAGE_SIZE for max_sectors Luis Henriques
                   ` (82 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Luis Henriques

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

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

From: Vineet Gupta <vgupta@synopsys.com>

commit 9acdc911b55569145034b01075adf658891afbd2 upstream.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c2066f4c3286..e0b2f7c7f744 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8752,6 +8752,7 @@ F:	include/linux/swiotlb.h
 
 SYNOPSYS ARC ARCHITECTURE
 M:	Vineet Gupta <vgupta@synopsys.com>
+L:	linux-snps-arc@lists.infraded.org
 S:	Supported
 F:	arch/arc/
 F:	Documentation/devicetree/bindings/arc/

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

* [PATCH 3.16.y-ckt 044/126] megaraid_sas: Do not use PAGE_SIZE for max_sectors
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (42 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 043/126] MAINTAINERS: Add public mailing list for ARC Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 045/126] KVM: s390: SCA must not cross page boundaries Luis Henriques
                   ` (81 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Kashyap Desai, Martin K. Petersen, Luis Henriques

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

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

From: "sumit.saxena@avagotech.com" <sumit.saxena@avagotech.com>

commit 357ae967ad66e357f78b5cfb5ab6ca07fb4a7758 upstream.

Do not use PAGE_SIZE marco to calculate max_sectors per I/O
request. Driver code assumes PAGE_SIZE will be always 4096 which can
lead to wrongly calculated value if PAGE_SIZE is not 4096. This issue
was reported in Ubuntu Bugzilla Bug #1475166.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas.h      | 2 ++
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 32166c2c7854..293a396b64ad 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -335,6 +335,8 @@ enum MR_EVT_ARGS {
 	MR_EVT_ARGS_GENERIC,
 };
 
+
+#define SGE_BUFFER_SIZE	4096
 /*
  * define constants for device list query options
  */
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 8677fa0deb2d..9f5f61c00b61 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4213,7 +4213,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 		}
 	}
 	instance->max_sectors_per_req = instance->max_num_sge *
-						PAGE_SIZE / 512;
+						SGE_BUFFER_SIZE / 512;
 	if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors))
 		instance->max_sectors_per_req = tmp_sectors;
 

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

* [PATCH 3.16.y-ckt 045/126] KVM: s390: SCA must not cross page boundaries
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (43 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 044/126] megaraid_sas: Do not use PAGE_SIZE for max_sectors Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 046/126] arm64: Fix compat register mappings Luis Henriques
                   ` (80 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Hildenbrand, Christian Borntraeger, Luis Henriques

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

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

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

commit c5c2c393468576bad6d10b2b5fefff8cd25df3f4 upstream.

We seemed to have missed a few corner cases in commit f6c137ff00a4
("KVM: s390: randomize sca address").

The SCA has a maximum size of 2112 bytes. By setting the sca_offset to
some unlucky numbers, we exceed the page.

0x7c0 (1984) -> Fits exactly
0x7d0 (2000) -> 16 bytes out
0x7e0 (2016) -> 32 bytes out
0x7f0 (2032) -> 48 bytes out

One VCPU entry is 32 bytes long.

For the last two cases, we actually write data to the other page.
1. The address of the VCPU.
2. Injection/delivery/clearing of SIGP externall calls via SIGP IF.

Especially the 2. happens regularly. So this could produce two problems:
1. The guest losing/getting external calls.
2. Random memory overwrites in the host.

So this problem happens on every 127 + 128 created VM with 64 VCPUs.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/s390/kvm/kvm-s390.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 5e9217d96cfe..fd8a8373c275 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -429,7 +429,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	if (!kvm->arch.sca)
 		goto out_err;
 	spin_lock(&kvm_lock);
-	sca_offset = (sca_offset + 16) & 0x7f0;
+	sca_offset += 16;
+	if (sca_offset + sizeof(struct sca_block) > PAGE_SIZE)
+		sca_offset = 0;
 	kvm->arch.sca = (struct sca_block *) ((char *) kvm->arch.sca + sca_offset);
 	spin_unlock(&kvm_lock);
 

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

* [PATCH 3.16.y-ckt 046/126] arm64: Fix compat register mappings
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (44 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 045/126] KVM: s390: SCA must not cross page boundaries Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36   ` Luis Henriques
                   ` (79 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Robin Murphy, Catalin Marinas, Luis Henriques

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

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

From: Robin Murphy <robin.murphy@arm.com>

commit 5accd17d0eb523350c9ef754d655e379c9bb93b3 upstream.

For reasons not entirely apparent, but now enshrined in history, the
architectural mapping of AArch32 banked registers to AArch64 registers
actually orders SP_<mode> and LR_<mode> backwards compared to the
intuitive r13/r14 order, for all modes except FIQ.

Fix the compat_<reg>_<mode> macros accordingly, in the hope of avoiding
subtle bugs with KVM and AArch32 guests.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm64/include/asm/ptrace.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 41ed9e13795e..88d6e2436808 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -76,14 +76,14 @@
 #define compat_sp	regs[13]
 #define compat_lr	regs[14]
 #define compat_sp_hyp	regs[15]
-#define compat_sp_irq	regs[16]
-#define compat_lr_irq	regs[17]
-#define compat_sp_svc	regs[18]
-#define compat_lr_svc	regs[19]
-#define compat_sp_abt	regs[20]
-#define compat_lr_abt	regs[21]
-#define compat_sp_und	regs[22]
-#define compat_lr_und	regs[23]
+#define compat_lr_irq	regs[16]
+#define compat_sp_irq	regs[17]
+#define compat_lr_svc	regs[18]
+#define compat_sp_svc	regs[19]
+#define compat_lr_abt	regs[20]
+#define compat_sp_abt	regs[21]
+#define compat_lr_und	regs[22]
+#define compat_sp_und	regs[23]
 #define compat_r8_fiq	regs[24]
 #define compat_r9_fiq	regs[25]
 #define compat_r10_fiq	regs[26]

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

* [PATCH 3.16.y-ckt 047/126] can: Use correct type in sizeof() in nla_put()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
@ 2015-12-09  9:36   ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Luis Henriques
                     ` (124 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Vasut, Wolfgang Grandegger, netdev, Marc Kleine-Budde,
	Luis Henriques

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

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

From: Marek Vasut <marex@denx.de>

commit 562b103a21974c2f9cd67514d110f918bb3e1796 upstream.

The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index c543c3aaee4d..5635c6e7af57 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -835,7 +835,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	     nla_put(skb, IFLA_CAN_BITTIMING_CONST,
 		     sizeof(*priv->bittiming_const), priv->bittiming_const)) ||
 
-	    nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) ||
+	    nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) ||
 	    nla_put_u32(skb, IFLA_CAN_STATE, state) ||
 	    nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) ||
 	    nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||

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

* [PATCH 3.16.y-ckt 047/126] can: Use correct type in sizeof() in nla_put()
@ 2015-12-09  9:36   ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Vasut, netdev, Marc Kleine-Budde, Wolfgang Grandegger

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

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

From: Marek Vasut <marex@denx.de>

commit 562b103a21974c2f9cd67514d110f918bb3e1796 upstream.

The sizeof() is invoked on an incorrect variable, likely due to some
copy-paste error, and this might result in memory corruption. Fix this.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/can/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index c543c3aaee4d..5635c6e7af57 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -835,7 +835,7 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	     nla_put(skb, IFLA_CAN_BITTIMING_CONST,
 		     sizeof(*priv->bittiming_const), priv->bittiming_const)) ||
 
-	    nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) ||
+	    nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) ||
 	    nla_put_u32(skb, IFLA_CAN_STATE, state) ||
 	    nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) ||
 	    nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||

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

* [PATCH 3.16.y-ckt 048/126] mtd: blkdevs: fix potential deadlock + lockdep warnings
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (46 preceding siblings ...)
  2015-12-09  9:36   ` Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 049/126] Revert "dm mpath: fix stalls when handling invalid ioctls" Luis Henriques
                   ` (77 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Brian Norris, Luis Henriques

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

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

From: Brian Norris <computersforpeace@gmail.com>

commit f3c63795e90f0c6238306883b6c72f14d5355721 upstream.

Commit 073db4a51ee4 ("mtd: fix: avoid race condition when accessing
mtd->usecount") fixed a race condition but due to poor ordering of the
mutex acquisition, introduced a potential deadlock.

The deadlock can occur, for example, when rmmod'ing the m25p80 module, which
will delete one or more MTDs, along with any corresponding mtdblock
devices. This could potentially race with an acquisition of the block
device as follows.

 -> blktrans_open()
    ->  mutex_lock(&dev->lock);
    ->  mutex_lock(&mtd_table_mutex);

 -> del_mtd_device()
    ->  mutex_lock(&mtd_table_mutex);
    ->  blktrans_notify_remove() -> del_mtd_blktrans_dev()
       ->  mutex_lock(&dev->lock);

This is a classic (potential) ABBA deadlock, which can be fixed by
making the A->B ordering consistent everywhere. There was no real
purpose to the ordering in the original patch, AFAIR, so this shouldn't
be a problem. This ordering was actually already present in
del_mtd_blktrans_dev(), for one, where the function tried to ensure that
its caller already held mtd_table_mutex before it acquired &dev->lock:

        if (mutex_trylock(&mtd_table_mutex)) {
                mutex_unlock(&mtd_table_mutex);
                BUG();
        }

So, reverse the ordering of acquisition of &dev->lock and &mtd_table_mutex so
we always acquire mtd_table_mutex first.

Snippets of the lockdep output follow:

  # modprobe -r m25p80
  [   53.419251]
  [   53.420838] ======================================================
  [   53.427300] [ INFO: possible circular locking dependency detected ]
  [   53.433865] 4.3.0-rc6 #96 Not tainted
  [   53.437686] -------------------------------------------------------
  [   53.444220] modprobe/372 is trying to acquire lock:
  [   53.449320]  (&new->lock){+.+...}, at: [<c043fe4c>] del_mtd_blktrans_dev+0x80/0xdc
  [   53.457271]
  [   53.457271] but task is already holding lock:
  [   53.463372]  (mtd_table_mutex){+.+.+.}, at: [<c0439994>] del_mtd_device+0x18/0x100
  [   53.471321]
  [   53.471321] which lock already depends on the new lock.
  [   53.471321]
  [   53.479856]
  [   53.479856] the existing dependency chain (in reverse order) is:
  [   53.487660]
  -> #1 (mtd_table_mutex){+.+.+.}:
  [   53.492331]        [<c043fc5c>] blktrans_open+0x34/0x1a4
  [   53.497879]        [<c01afce0>] __blkdev_get+0xc4/0x3b0
  [   53.503364]        [<c01b0bb8>] blkdev_get+0x108/0x320
  [   53.508743]        [<c01713c0>] do_dentry_open+0x218/0x314
  [   53.514496]        [<c0180454>] path_openat+0x4c0/0xf9c
  [   53.519959]        [<c0182044>] do_filp_open+0x5c/0xc0
  [   53.525336]        [<c0172758>] do_sys_open+0xfc/0x1cc
  [   53.530716]        [<c000f740>] ret_fast_syscall+0x0/0x1c
  [   53.536375]
  -> #0 (&new->lock){+.+...}:
  [   53.540587]        [<c063f124>] mutex_lock_nested+0x38/0x3cc
  [   53.546504]        [<c043fe4c>] del_mtd_blktrans_dev+0x80/0xdc
  [   53.552606]        [<c043f164>] blktrans_notify_remove+0x7c/0x84
  [   53.558891]        [<c04399f0>] del_mtd_device+0x74/0x100
  [   53.564544]        [<c043c670>] del_mtd_partitions+0x80/0xc8
  [   53.570451]        [<c0439aa0>] mtd_device_unregister+0x24/0x48
  [   53.576637]        [<c046ce6c>] spi_drv_remove+0x1c/0x34
  [   53.582207]        [<c03de0f0>] __device_release_driver+0x88/0x114
  [   53.588663]        [<c03de19c>] device_release_driver+0x20/0x2c
  [   53.594843]        [<c03dd9e8>] bus_remove_device+0xd8/0x108
  [   53.600748]        [<c03dacc0>] device_del+0x10c/0x210
  [   53.606127]        [<c03dadd0>] device_unregister+0xc/0x20
  [   53.611849]        [<c046d878>] __unregister+0x10/0x20
  [   53.617211]        [<c03da868>] device_for_each_child+0x50/0x7c
  [   53.623387]        [<c046eae8>] spi_unregister_master+0x58/0x8c
  [   53.629578]        [<c03e12f0>] release_nodes+0x15c/0x1c8
  [   53.635223]        [<c03de0f8>] __device_release_driver+0x90/0x114
  [   53.641689]        [<c03de900>] driver_detach+0xb4/0xb8
  [   53.647147]        [<c03ddc78>] bus_remove_driver+0x4c/0xa0
  [   53.652970]        [<c00cab50>] SyS_delete_module+0x11c/0x1e4
  [   53.658976]        [<c000f740>] ret_fast_syscall+0x0/0x1c
  [   53.664621]
  [   53.664621] other info that might help us debug this:
  [   53.664621]
  [   53.672979]  Possible unsafe locking scenario:
  [   53.672979]
  [   53.679169]        CPU0                    CPU1
  [   53.683900]        ----                    ----
  [   53.688633]   lock(mtd_table_mutex);
  [   53.692383]                                lock(&new->lock);
  [   53.698306]                                lock(mtd_table_mutex);
  [   53.704658]   lock(&new->lock);
  [   53.707946]
  [   53.707946]  *** DEADLOCK ***

Fixes: 073db4a51ee4 ("mtd: fix: avoid race condition when accessing mtd->usecount")
Reported-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mtd/mtd_blkdevs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 7266a318628c..f2af5b91c0e3 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -199,8 +199,8 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
 	if (!dev)
 		return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/
 
-	mutex_lock(&dev->lock);
 	mutex_lock(&mtd_table_mutex);
+	mutex_lock(&dev->lock);
 
 	if (dev->open)
 		goto unlock;
@@ -224,8 +224,8 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
 
 unlock:
 	dev->open++;
-	mutex_unlock(&mtd_table_mutex);
 	mutex_unlock(&dev->lock);
+	mutex_unlock(&mtd_table_mutex);
 	blktrans_dev_put(dev);
 	return ret;
 
@@ -235,8 +235,8 @@ error_release:
 error_put:
 	module_put(dev->tr->owner);
 	kref_put(&dev->ref, blktrans_dev_release);
-	mutex_unlock(&mtd_table_mutex);
 	mutex_unlock(&dev->lock);
+	mutex_unlock(&mtd_table_mutex);
 	blktrans_dev_put(dev);
 	return ret;
 }
@@ -248,8 +248,8 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
 	if (!dev)
 		return;
 
-	mutex_lock(&dev->lock);
 	mutex_lock(&mtd_table_mutex);
+	mutex_lock(&dev->lock);
 
 	if (--dev->open)
 		goto unlock;
@@ -263,8 +263,8 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
 		__put_mtd_device(dev->mtd);
 	}
 unlock:
-	mutex_unlock(&mtd_table_mutex);
 	mutex_unlock(&dev->lock);
+	mutex_unlock(&mtd_table_mutex);
 	blktrans_dev_put(dev);
 }
 

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

* [PATCH 3.16.y-ckt 049/126] Revert "dm mpath: fix stalls when handling invalid ioctls"
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (47 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 048/126] mtd: blkdevs: fix potential deadlock + lockdep warnings Luis Henriques
@ 2015-12-09  9:36 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 050/126] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015) Luis Henriques
                   ` (76 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:36 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mauricio Faria de Oliveira, Mike Snitzer, Luis Henriques

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

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

From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

commit 47796938c46b943d157ac8a6f9ed4e3b98b83cf4 upstream.

This reverts commit a1989b330093578ea5470bea0a00f940c444c466.

That commit introduced a regression at least for the case of the SG_IO ioctl()
running without CAP_SYS_RAWIO capability (e.g., unprivileged users) when there
are no active paths: the ioctl() fails with the ENOTTY errno immediately rather
than blocking due to queue_if_no_path until a path becomes active, for example.

That case happens to be exercised by QEMU KVM guests with 'scsi-block' devices
(qemu "-device scsi-block" [1], libvirt "<disk type='block' device='lun'>" [2])
from multipath devices; which leads to SCSI/filesystem errors in such a guest.

More general scenarios can hit that regression too. The following demonstration
employs a SG_IO ioctl() with a standard SCSI INQUIRY command for this objective
(some output & user changes omitted for brevity and comments added for clarity).

Reverting that commit restores normal operation (queueing) in failing scenarios;
tested on linux-next (next-20151022).

1) Test-case is based on sg_simple0 [3] (just SG_IO; remove SG_GET_VERSION_NUM)

    $ cat sg_simple0.c
    ... see [3] ...
    $ sed '/SG_GET_VERSION_NUM/,/}/d' sg_simple0.c > sgio_inquiry.c
    $ gcc sgio_inquiry.c -o sgio_inquiry

2) The ioctl() works fine with active paths present.

    # multipath -l 85ag56
    85ag56 (...) dm-19 IBM     ,2145
    size=60G features='1 queue_if_no_path' hwhandler='0' wp=rw
    |-+- policy='service-time 0' prio=0 status=active
    | |- 8:0:11:0  sdz  65:144  active undef running
    | `- 9:0:9:0   sdbf 67:144  active undef running
    `-+- policy='service-time 0' prio=0 status=enabled
      |- 8:0:12:0  sdae 65:224  active undef running
      `- 9:0:12:0  sdbo 68:32   active undef running

    $ ./sgio_inquiry /dev/mapper/85ag56
    Some of the INQUIRY command's response:
        IBM       2145              0000
    INQUIRY duration=0 millisecs, resid=0

3) The ioctl() fails with ENOTTY errno with _no_ active paths present,
   for unprivileged users (rather than blocking due to queue_if_no_path).

    # for path in $(multipath -l 85ag56 | grep -o 'sd[a-z]\+'); \
          do multipathd -k"fail path $path"; done

    # multipath -l 85ag56
    85ag56 (...) dm-19 IBM     ,2145
    size=60G features='1 queue_if_no_path' hwhandler='0' wp=rw
    |-+- policy='service-time 0' prio=0 status=enabled
    | |- 8:0:11:0  sdz  65:144  failed undef running
    | `- 9:0:9:0   sdbf 67:144  failed undef running
    `-+- policy='service-time 0' prio=0 status=enabled
      |- 8:0:12:0  sdae 65:224  failed undef running
      `- 9:0:12:0  sdbo 68:32   failed undef running

    $ ./sgio_inquiry /dev/mapper/85ag56
    sg_simple0: Inquiry SG_IO ioctl error: Inappropriate ioctl for device

4) dmesg shows that scsi_verify_blk_ioctl() failed for SG_IO (0x2285);
   it returns -ENOIOCTLCMD, later replaced with -ENOTTY in vfs_ioctl().

    $ dmesg
    <...>
    [] device-mapper: multipath: Failing path 65:144.
    [] device-mapper: multipath: Failing path 67:144.
    [] device-mapper: multipath: Failing path 65:224.
    [] device-mapper: multipath: Failing path 68:32.
    [] sgio_inquiry: sending ioctl 2285 to a partition!

5) The ioctl() only works if the SYS_CAP_RAWIO capability is present
   (then queueing happens -- in this example, queue_if_no_path is set);
   this is due to a conditional check in scsi_verify_blk_ioctl().

    # capsh --drop=cap_sys_rawio -- -c './sgio_inquiry /dev/mapper/85ag56'
    sg_simple0: Inquiry SG_IO ioctl error: Inappropriate ioctl for device

    # ./sgio_inquiry /dev/mapper/85ag56 &
    [1] 72830

    # cat /proc/72830/stack
    [<c00000171c0df700>] 0xc00000171c0df700
    [<c000000000015934>] __switch_to+0x204/0x350
    [<c000000000152d4c>] msleep+0x5c/0x80
    [<c00000000077dfb0>] dm_blk_ioctl+0x70/0x170
    [<c000000000487c40>] blkdev_ioctl+0x2b0/0x9b0
    [<c0000000003128e4>] block_ioctl+0x64/0xd0
    [<c0000000002dd3b0>] do_vfs_ioctl+0x490/0x780
    [<c0000000002dd774>] SyS_ioctl+0xd4/0xf0
    [<c000000000009358>] system_call+0x38/0xd0

6) This is the function call chain exercised in this analysis:

SYSCALL_DEFINE3(ioctl, <...>) @ fs/ioctl.c
    -> do_vfs_ioctl()
        -> vfs_ioctl()
            ...
            error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
            ...
                -> dm_blk_ioctl() @ drivers/md/dm.c
                    -> multipath_ioctl() @ drivers/md/dm-mpath.c
                        ...
                        (bdev = NULL, due to no active paths)
                        ...
                        if (!bdev || <...>) {
                            int err = scsi_verify_blk_ioctl(NULL, cmd);
                            if (err)
                                r = err;
                        }
                        ...
                            -> scsi_verify_blk_ioctl() @ block/scsi_ioctl.c
                                ...
                                if (bd && bd == bd->bd_contains) // not taken (bd = NULL)
                                    return 0;
                                ...
                                if (capable(CAP_SYS_RAWIO)) // not taken (unprivileged user)
                                    return 0;
                                ...
                                printk_ratelimited(KERN_WARNING
                                           "%s: sending ioctl %x to a partition!\n" <...>);

                                return -ENOIOCTLCMD;
                            <-
                        ...
                        return r ? : <...>
                    <-
            ...
            if (error == -ENOIOCTLCMD)
                error = -ENOTTY;
             out:
                return error;
            ...

Links:
[1] http://git.qemu.org/?p=qemu.git;a=commit;h=336a6915bc7089fb20fea4ba99972ad9a97c5f52
[2] https://libvirt.org/formatdomain.html#elementsDisks (see 'disk' -> 'device')
[3] http://tldp.org/HOWTO/SCSI-Generic-HOWTO/pexample.html (Revision 1.2, 2002-05-03)

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/dm-mpath.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index f4167b013d99..43e2b498732f 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1545,11 +1545,8 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
 	/*
 	 * Only pass ioctls through if the device sizes match exactly.
 	 */
-	if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) {
-		int err = scsi_verify_blk_ioctl(NULL, cmd);
-		if (err)
-			r = err;
-	}
+	if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT)
+		r = scsi_verify_blk_ioctl(NULL, cmd);
 
 	if (r == -ENOTCONN && !fatal_signal_pending(current)) {
 		spin_lock_irqsave(&m->lock, flags);

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

* [PATCH 3.16.y-ckt 050/126] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015)
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (48 preceding siblings ...)
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 049/126] Revert "dm mpath: fix stalls when handling invalid ioctls" Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 051/126] crypto: algif_hash - Only export and import on sockets with data Luis Henriques
                   ` (75 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jani Nikula, Luis Henriques

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

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

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

commit 9be64eee3a87dc03218ca9a12834d1150a57b8a8 upstream.

Reported-by: Keith Webb <khwebb@gmail.com>
Suggested-by: Keith Webb <khwebb@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=106671
Reviewed-by: Clint Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1446209424-28801-1-git-send-email-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 535f11187dcc..c35353aadd02 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11711,6 +11711,9 @@ static struct intel_quirk intel_quirks[] = {
 
 	/* Dell Chromebook 11 */
 	{ 0x0a06, 0x1028, 0x0a35, quirk_backlight_present },
+
+	/* Dell Chromebook 11 (2015 version) */
+	{ 0x0a16, 0x1028, 0x0a35, quirk_backlight_present },
 };
 
 static void intel_init_quirks(struct drm_device *dev)

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

* [PATCH 3.16.y-ckt 051/126] crypto: algif_hash - Only export and import on sockets with data
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (49 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 050/126] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015) Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 052/126] xtensa: fixes for configs without loop option Luis Henriques
                   ` (74 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herbert Xu, Luis Henriques

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

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

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

commit 4afa5f9617927453ac04b24b584f6c718dfb4f45 upstream.

The hash_accept call fails to work on sockets that have not received
any data.  For some algorithm implementations it may cause crashes.

This patch fixes this by ensuring that we only export and import on
sockets that have received data.

Reported-by: Harsh Jain <harshjain.prof@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 crypto/algif_hash.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 850246206b12..a68b56a368a8 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -192,9 +192,14 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	struct sock *sk2;
 	struct alg_sock *ask2;
 	struct hash_ctx *ctx2;
+	bool more;
 	int err;
 
-	err = crypto_ahash_export(req, state);
+	lock_sock(sk);
+	more = ctx->more;
+	err = more ? crypto_ahash_export(req, state) : 0;
+	release_sock(sk);
+
 	if (err)
 		return err;
 
@@ -205,7 +210,10 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	sk2 = newsock->sk;
 	ask2 = alg_sk(sk2);
 	ctx2 = ask2->private;
-	ctx2->more = 1;
+	ctx2->more = more;
+
+	if (!more)
+		return err;
 
 	err = crypto_ahash_import(&ctx2->req, state);
 	if (err) {

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

* [PATCH 3.16.y-ckt 052/126] xtensa: fixes for configs without loop option
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (50 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 051/126] crypto: algif_hash - Only export and import on sockets with data Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 053/126] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Luis Henriques
                   ` (73 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Luis Henriques

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

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

From: Max Filippov <jcmvbkbc@gmail.com>

commit 5029615e25dc5040beb065f36743c127a8e51497 upstream.

Build-time fixes:
- make lbeg/lend/lcount save/restore conditional on kernel entry;
- don't clear lcount in platform_restart functions unconditionally.

Run-time fixes:
- use correct end of range register in __endla paired with __loopt, not
  the unused temporary register. This fixes .bss zero-initialization.
  Update comments in asmmacro.h;
- don't clobber a10 in the usercopy that leads to access to unmapped
  memory.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/xtensa/include/asm/asmmacro.h   | 7 ++++---
 arch/xtensa/kernel/entry.S           | 8 ++++++--
 arch/xtensa/kernel/head.S            | 2 +-
 arch/xtensa/lib/usercopy.S           | 6 +++---
 arch/xtensa/platforms/iss/setup.c    | 2 ++
 arch/xtensa/platforms/xt2000/setup.c | 2 ++
 arch/xtensa/platforms/xtfpga/setup.c | 2 ++
 7 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/arch/xtensa/include/asm/asmmacro.h b/arch/xtensa/include/asm/asmmacro.h
index 755320f6e0bc..746dcc8b5abc 100644
--- a/arch/xtensa/include/asm/asmmacro.h
+++ b/arch/xtensa/include/asm/asmmacro.h
@@ -35,9 +35,10 @@
  * __loop  as
  *	   restart loop. 'as' register must not have been modified!
  *
- * __endla ar, at, incr
+ * __endla ar, as, incr
  *	   ar	start address (modified)
- *	   as	scratch register used by macro
+ *	   as	scratch register used by __loops/__loopi macros or
+ *		end address used by __loopt macro
  *	   inc	increment
  */
 
@@ -97,7 +98,7 @@
 	.endm
 
 /*
- * loop from ar to ax
+ * loop from ar to as
  */
 
 	.macro	__loopt	ar, as, at, incr_log2
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index cf8a354fa628..232dbf41df34 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -335,8 +335,10 @@ common_exception:
 	s32i	a2, a1, PT_SYSCALL
 	movi	a2, 0
 	s32i	a3, a1, PT_EXCVADDR
+#if XCHAL_HAVE_LOOPS
 	xsr	a2, lcount
 	s32i	a2, a1, PT_LCOUNT
+#endif
 
 	/* It is now save to restore the EXC_TABLE_FIXUP variable. */
 
@@ -368,11 +370,12 @@ common_exception:
 	s32i	a3, a1, PT_PS		# save ps
 
 	/* Save lbeg, lend */
-
+#if XCHAL_HAVE_LOOPS
 	rsr	a2, lbeg
 	rsr	a3, lend
 	s32i	a2, a1, PT_LBEG
 	s32i	a3, a1, PT_LEND
+#endif
 
 	/* Save SCOMPARE1 */
 
@@ -664,13 +667,14 @@ common_exception_exit:
 	wsr	a3, sar
 
 	/* Restore LBEG, LEND, LCOUNT */
-
+#if XCHAL_HAVE_LOOPS
 	l32i	a2, a1, PT_LBEG
 	l32i	a3, a1, PT_LEND
 	wsr	a2, lbeg
 	l32i	a2, a1, PT_LCOUNT
 	wsr	a3, lend
 	wsr	a2, lcount
+#endif
 
 	/* We control single stepping through the ICOUNTLEVEL register. */
 
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index aeeb3cc8a410..384a497d8566 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -244,7 +244,7 @@ ENTRY(_startup)
 
 	__loopt	a2, a3, a4, 2
 	s32i	a0, a2, 0
-	__endla	a2, a4, 4
+	__endla	a2, a3, 4
 
 #if XCHAL_DCACHE_IS_WRITEBACK
 
diff --git a/arch/xtensa/lib/usercopy.S b/arch/xtensa/lib/usercopy.S
index ace1892a875e..7ea4dd68893e 100644
--- a/arch/xtensa/lib/usercopy.S
+++ b/arch/xtensa/lib/usercopy.S
@@ -222,8 +222,8 @@ __xtensa_copy_user:
 	loopnez	a7, .Loop2done
 #else /* !XCHAL_HAVE_LOOPS */
 	beqz	a7, .Loop2done
-	slli	a10, a7, 4
-	add	a10, a10, a3	# a10 = end of last 16B source chunk
+	slli	a12, a7, 4
+	add	a12, a12, a3	# a12 = end of last 16B source chunk
 #endif /* !XCHAL_HAVE_LOOPS */
 .Loop2:
 	EX(l32i, a7, a3,  4, l_fixup)
@@ -241,7 +241,7 @@ __xtensa_copy_user:
 	EX(s32i, a9, a5, 12, s_fixup)
 	addi	a5, a5, 16
 #if !XCHAL_HAVE_LOOPS
-	blt	a3, a10, .Loop2
+	blt	a3, a12, .Loop2
 #endif /* !XCHAL_HAVE_LOOPS */
 .Loop2done:
 	bbci.l	a4, 3, .L12
diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c
index da7d18240866..391820539f0a 100644
--- a/arch/xtensa/platforms/iss/setup.c
+++ b/arch/xtensa/platforms/iss/setup.c
@@ -61,7 +61,9 @@ void platform_restart(void)
 #if XCHAL_NUM_IBREAK > 0
 			     "wsr	a2, ibreakenable\n\t"
 #endif
+#if XCHAL_HAVE_LOOPS
 			     "wsr	a2, lcount\n\t"
+#endif
 			     "movi	a2, 0x1f\n\t"
 			     "wsr	a2, ps\n\t"
 			     "isync\n\t"
diff --git a/arch/xtensa/platforms/xt2000/setup.c b/arch/xtensa/platforms/xt2000/setup.c
index b90555cb8089..87678961a8c8 100644
--- a/arch/xtensa/platforms/xt2000/setup.c
+++ b/arch/xtensa/platforms/xt2000/setup.c
@@ -72,7 +72,9 @@ void platform_restart(void)
 #if XCHAL_NUM_IBREAK > 0
 			      "wsr	a2, ibreakenable\n\t"
 #endif
+#if XCHAL_HAVE_LOOPS
 			      "wsr	a2, lcount\n\t"
+#endif
 			      "movi	a2, 0x1f\n\t"
 			      "wsr	a2, ps\n\t"
 			      "isync\n\t"
diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c
index 57fd08b36f51..32c955e58e3d 100644
--- a/arch/xtensa/platforms/xtfpga/setup.c
+++ b/arch/xtensa/platforms/xtfpga/setup.c
@@ -63,7 +63,9 @@ void platform_restart(void)
 #if XCHAL_NUM_IBREAK > 0
 			      "wsr	a2, ibreakenable\n\t"
 #endif
+#if XCHAL_HAVE_LOOPS
 			      "wsr	a2, lcount\n\t"
+#endif
 			      "movi	a2, 0x1f\n\t"
 			      "wsr	a2, ps\n\t"
 			      "isync\n\t"

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

* [PATCH 3.16.y-ckt 053/126] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (51 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 052/126] xtensa: fixes for configs without loop option Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 054/126] mac80211: fix divide by zero when NOA update Luis Henriques
                   ` (72 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Kashyap Desai, Martin K. Petersen, Luis Henriques

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

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

From: "sumit.saxena@avagotech.com" <sumit.saxena@avagotech.com>

commit 323c4a02c631d00851d8edc4213c4d184ef83647 upstream.

This is an issue on SMAP enabled CPUs and 32 bit apps running on 64 bit
OS. Do not access user memory from kernel code. The SMAP bit restricts
accessing user memory from kernel code.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 9f5f61c00b61..acecd7de4ea1 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5812,6 +5812,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
 	int i;
 	int error = 0;
 	compat_uptr_t ptr;
+	unsigned long local_raw_ptr;
+	u32 local_sense_off;
+	u32 local_sense_len;
 
 	if (clear_user(ioc, sizeof(*ioc)))
 		return -EFAULT;
@@ -5829,9 +5832,15 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
 	 * sense_len is not null, so prepare the 64bit value under
 	 * the same condition.
 	 */
-	if (ioc->sense_len) {
+	if (get_user(local_raw_ptr, ioc->frame.raw) ||
+		get_user(local_sense_off, &ioc->sense_off) ||
+		get_user(local_sense_len, &ioc->sense_len))
+		return -EFAULT;
+
+
+	if (local_sense_len) {
 		void __user **sense_ioc_ptr =
-			(void __user **)(ioc->frame.raw + ioc->sense_off);
+			(void __user **)((u8*)local_raw_ptr + local_sense_off);
 		compat_uptr_t *sense_cioc_ptr =
 			(compat_uptr_t *)(cioc->frame.raw + cioc->sense_off);
 		if (get_user(ptr, sense_cioc_ptr) ||

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

* [PATCH 3.16.y-ckt 054/126] mac80211: fix divide by zero when NOA update
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (52 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 053/126] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 055/126] mac80211: allow null chandef in tracing Luis Henriques
                   ` (71 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Janusz Dziedzic, Johannes Berg, Luis Henriques

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

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

From: "Janusz.Dziedzic@tieto.com" <Janusz.Dziedzic@tieto.com>

commit 519ee6918b91abdc4bc9720deae17599a109eb40 upstream.

In case of one shot NOA the interval can be 0, catch that
instead of potentially (depending on the driver) crashing
like this:

divide error: 0000 [#1] SMP
[...]
Call Trace:
<IRQ>
[<ffffffffc08e891c>] ieee80211_extend_absent_time+0x6c/0xb0 [mac80211]
[<ffffffffc08e8a17>] ieee80211_update_p2p_noa+0xb7/0xe0 [mac80211]
[<ffffffffc069cc30>] ath9k_p2p_ps_timer+0x170/0x190 [ath9k]
[<ffffffffc070adf8>] ath_gen_timer_isr+0xc8/0xf0 [ath9k_hw]
[<ffffffffc0691156>] ath9k_tasklet+0x296/0x2f0 [ath9k]
[<ffffffff8107ad65>] tasklet_action+0xe5/0xf0
[...]

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/util.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 01fe82e9d1b0..c68e6cf4367e 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2664,6 +2664,13 @@ ieee80211_extend_noa_desc(struct ieee80211_noa_data *data, u32 tsf, int i)
 	if (end > 0)
 		return false;
 
+	/* One shot NOA  */
+	if (data->count[i] == 1)
+		return false;
+
+	if (data->desc[i].interval == 0)
+		return false;
+
 	/* End time is in the past, check for repetitions */
 	skip = DIV_ROUND_UP(-end, data->desc[i].interval);
 	if (data->count[i] < 255) {

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

* [PATCH 3.16.y-ckt 055/126] mac80211: allow null chandef in tracing
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (53 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 054/126] mac80211: fix divide by zero when NOA update Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 056/126] xtensa: fix secondary core boot in SMP Luis Henriques
                   ` (70 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arik Nemtsov, Emmanuel Grumbach, Johannes Berg, Luis Henriques

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

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

From: Arik Nemtsov <arik@wizery.com>

commit 254d3dfe445f94a764e399ca12e04365ac9413ed upstream.

In TDLS channel-switch operations the chandef can sometimes be NULL.
Avoid an oops in the trace code for these cases and just print a
chandef full of zeros.

Fixes: a7a6bdd0670fe ("mac80211: introduce TDLS channel switch ops")
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/trace.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index cfe1a0688b5c..569332bdb10f 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -32,11 +32,11 @@
 			__field(u32, chan_width)					\
 			__field(u32, center_freq1)					\
 			__field(u32, center_freq2)
-#define CHANDEF_ASSIGN(c)								\
-			__entry->control_freq = (c)->chan ? (c)->chan->center_freq : 0;	\
-			__entry->chan_width = (c)->width;				\
-			__entry->center_freq1 = (c)->center_freq1;			\
-			__entry->center_freq2 = (c)->center_freq2;
+#define CHANDEF_ASSIGN(c)							\
+			__entry->control_freq = (c) ? ((c)->chan ? (c)->chan->center_freq : 0) : 0;	\
+			__entry->chan_width = (c) ? (c)->width : 0;			\
+			__entry->center_freq1 = (c) ? (c)->center_freq1 : 0;		\
+			__entry->center_freq2 = (c) ? (c)->center_freq2 : 0;
 #define CHANDEF_PR_FMT	" control:%d MHz width:%d center: %d/%d MHz"
 #define CHANDEF_PR_ARG	__entry->control_freq, __entry->chan_width,			\
 			__entry->center_freq1, __entry->center_freq2

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

* [PATCH 3.16.y-ckt 056/126] xtensa: fix secondary core boot in SMP
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (54 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 055/126] mac80211: allow null chandef in tracing Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 057/126] recordmcount: Fix endianness handling bug for nop_mcount Luis Henriques
                   ` (69 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Luis Henriques

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

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

From: Max Filippov <jcmvbkbc@gmail.com>

commit ab45fb145096799dabd18afc58bb5f97171017cd upstream.

There are multiple factors adding to the issue in different
configurations:

- commit 17290231df16eeee ("xtensa: add fixup for double exception raised
  in window overflow") added function window_overflow_restore_a0_fixup to
  double exception vector overlapping reset vector location of secondary
  processor cores.
- on MMUv2 cores RESET_VECTOR1_VADDR may point to uncached kernel memory
  making code overlapping depend on cache type and size, so that without
  cache or with WT cache reset vector code overwrites double exception
  code, making issue even harder to detect.
- on MMUv3 cores RESET_VECTOR1_VADDR may point to unmapped area, as
  MMUv3 cores change virtual address map to match MMUv2 layout, but
  reset vector virtual address is given for the original MMUv3 mapping.
- physical memory region of the secondary reset vector is not reserved
  in the physical memory map, and thus may be allocated and overwritten
  at arbitrary moment.

Fix it as follows:

- move window_overflow_restore_a0_fixup code to .text section.
- define RESET_VECTOR1_VADDR so that it points to reset vector in the
  cacheable MMUv2 map for cores with MMU.
- reserve reset vector region in the physical memory map. Drop separate
  literal section and build mxhead.S with text section literals.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/xtensa/include/asm/vectors.h |  9 +++++----
 arch/xtensa/kernel/Makefile       |  1 +
 arch/xtensa/kernel/setup.c        |  9 ++++++++-
 arch/xtensa/kernel/vectors.S      |  4 +++-
 arch/xtensa/kernel/vmlinux.lds.S  | 12 ++----------
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/xtensa/include/asm/vectors.h b/arch/xtensa/include/asm/vectors.h
index f74ddfbb92ef..29804fa6a7a3 100644
--- a/arch/xtensa/include/asm/vectors.h
+++ b/arch/xtensa/include/asm/vectors.h
@@ -47,6 +47,9 @@
   #define LOAD_MEMORY_ADDRESS		0xD0003000
 #endif
 
+#define RESET_VECTOR1_VADDR		(VIRTUAL_MEMORY_ADDRESS + \
+					 XCHAL_RESET_VECTOR1_PADDR)
+
 #else /* !defined(CONFIG_MMU) */
   /* MMU Not being used - Virtual == Physical */
 
@@ -59,6 +62,8 @@
   /* Loaded just above possibly live vectors */
   #define LOAD_MEMORY_ADDRESS		0x00003000
 
+#define RESET_VECTOR1_VADDR		(XCHAL_RESET_VECTOR1_VADDR)
+
 #endif /* CONFIG_MMU */
 
 #define XC_VADDR(offset)		(VIRTUAL_MEMORY_ADDRESS  + offset)
@@ -70,10 +75,6 @@
 						VECBASE_RESET_VADDR)
 #define RESET_VECTOR_VADDR		XC_VADDR(RESET_VECTOR_VECOFS)
 
-#define RESET_VECTOR1_VECOFS		(XCHAL_RESET_VECTOR1_VADDR - \
-						VECBASE_RESET_VADDR)
-#define RESET_VECTOR1_VADDR		XC_VADDR(RESET_VECTOR1_VECOFS)
-
 #if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
 
 #define USER_VECTOR_VADDR		XC_VADDR(XCHAL_USER_VECOFS)
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index 18d962a8c0c2..093be9122ee7 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
 obj-$(CONFIG_SMP) += smp.o mxhead.o
 
 AFLAGS_head.o += -mtext-section-literals
+AFLAGS_mxhead.o += -mtext-section-literals
 
 # In the Xtensa architecture, assembly generates literals which must always
 # precede the L32R instruction with a relative offset less than 256 kB.
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 06370ccea9e9..ed5b8b9b8d96 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -334,7 +334,10 @@ extern char _Level5InterruptVector_text_end;
 extern char _Level6InterruptVector_text_start;
 extern char _Level6InterruptVector_text_end;
 #endif
-
+#ifdef CONFIG_SMP
+extern char _SecondaryResetVector_text_start;
+extern char _SecondaryResetVector_text_end;
+#endif
 
 
 #ifdef CONFIG_S32C1I_SELFTEST
@@ -506,6 +509,10 @@ void __init setup_arch(char **cmdline_p)
 		    __pa(&_Level6InterruptVector_text_end), 0);
 #endif
 
+#ifdef CONFIG_SMP
+	mem_reserve(__pa(&_SecondaryResetVector_text_start),
+		    __pa(&_SecondaryResetVector_text_end), 0);
+#endif
 	parse_early_param();
 	bootmem_init();
 
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S
index 8453e6e39895..7a1ff5e553b7 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -472,6 +472,9 @@ _DoubleExceptionVector_handle_exception:
 
 ENDPROC(_DoubleExceptionVector)
 
+	.end literal_prefix
+
+	.text
 /*
  * Fixup handler for TLB miss in double exception handler for window owerflow.
  * We get here with windowbase set to the window that was being spilled and
@@ -581,7 +584,6 @@ ENTRY(window_overflow_restore_a0_fixup)
 
 ENDPROC(window_overflow_restore_a0_fixup)
 
-	.end literal_prefix
 /*
  * Debug interrupt vector
  *
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index d16db6df86f8..126de5b30b9f 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -166,8 +166,6 @@ SECTIONS
     RELOCATE_ENTRY(_DebugInterruptVector_text,
 		   .DebugInterruptVector.text);
 #if defined(CONFIG_SMP)
-    RELOCATE_ENTRY(_SecondaryResetVector_literal,
-		   .SecondaryResetVector.literal);
     RELOCATE_ENTRY(_SecondaryResetVector_text,
 		   .SecondaryResetVector.text);
 #endif
@@ -282,17 +280,11 @@ SECTIONS
 
 #if defined(CONFIG_SMP)
 
-  SECTION_VECTOR (_SecondaryResetVector_literal,
-		  .SecondaryResetVector.literal,
-		  RESET_VECTOR1_VADDR - 4,
-		  SIZEOF(.DoubleExceptionVector.text),
-		  .DoubleExceptionVector.text)
-
   SECTION_VECTOR (_SecondaryResetVector_text,
 		  .SecondaryResetVector.text,
 		  RESET_VECTOR1_VADDR,
-		  4,
-		  .SecondaryResetVector.literal)
+		  SIZEOF(.DoubleExceptionVector.text),
+		  .DoubleExceptionVector.text)
 
   . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
 

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

* [PATCH 3.16.y-ckt 057/126] recordmcount: Fix endianness handling bug for nop_mcount
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (55 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 056/126] xtensa: fix secondary core boot in SMP Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 058/126] KVM: VMX: fix SMEP and SMAP without EPT Luis Henriques
                   ` (68 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Li Bin, Steven Rostedt, Luis Henriques

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

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

From: libin <huawei.libin@huawei.com>

commit c84da8b9ad3761eef43811181c7e896e9834b26b upstream.

In nop_mcount, shdr->sh_offset and welp->r_offset should handle
endianness properly, otherwise it will trigger Segmentation fault
if the recordmcount main and file.o have different endianness.

Link: http://lkml.kernel.org/r/563806C7.7070606@huawei.com

Signed-off-by: Li Bin <huawei.libin@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 scripts/recordmcount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 49b582a225b0..b9897e2be404 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
 
 		if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
 			if (make_nop)
-				ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
+				ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
 			if (warn_on_notrace_sect && !once) {
 				printf("Section %s has mcount callers being ignored\n",
 				       txtname);

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

* [PATCH 3.16.y-ckt 058/126] KVM: VMX: fix SMEP and SMAP without EPT
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (56 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 057/126] recordmcount: Fix endianness handling bug for nop_mcount Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure Luis Henriques
                   ` (67 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Paolo Bonzini, Luis Henriques

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

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

From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@redhat.com>

commit 656ec4a4928a3db7d16e5cb9bce351a478cfd3d5 upstream.

The comment in code had it mostly right, but we enable paging for
emulated real mode regardless of EPT.

Without EPT (which implies emulated real mode), secondary VCPUs won't
start unless we disable SM[AE]P when the guest doesn't use paging.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/vmx.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index aa6bd8cc914c..0502753be5f0 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3523,20 +3523,21 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
 		if (!is_paging(vcpu)) {
 			hw_cr4 &= ~X86_CR4_PAE;
 			hw_cr4 |= X86_CR4_PSE;
-			/*
-			 * SMEP/SMAP is disabled if CPU is in non-paging mode
-			 * in hardware. However KVM always uses paging mode to
-			 * emulate guest non-paging mode with TDP.
-			 * To emulate this behavior, SMEP/SMAP needs to be
-			 * manually disabled when guest switches to non-paging
-			 * mode.
-			 */
-			hw_cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP);
 		} else if (!(cr4 & X86_CR4_PAE)) {
 			hw_cr4 &= ~X86_CR4_PAE;
 		}
 	}
 
+	if (!enable_unrestricted_guest && !is_paging(vcpu))
+		/*
+		 * SMEP/SMAP is disabled if CPU is in non-paging mode in
+		 * hardware.  However KVM always uses paging mode without
+		 * unrestricted guest.
+		 * To emulate this behavior, SMEP/SMAP needs to be manually
+		 * disabled when guest switches to non-paging mode.
+		 */
+		hw_cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP);
+
 	vmcs_writel(CR4_READ_SHADOW, cr4);
 	vmcs_writel(GUEST_CR4, hw_cr4);
 	return 0;

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

* [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (57 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 058/126] KVM: VMX: fix SMEP and SMAP without EPT Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09 13:22   ` Krzysztof Kozlowski
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 060/126] ALSA: hda - Apply pin fixup for HP ProBook 6550b Luis Henriques
                   ` (66 subsequent siblings)
  125 siblings, 1 reply; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Eduardo Valentin, Luis Henriques

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

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

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit 824ead03b78403a21449cb7eb153a4344cd3b4c8 upstream.

During probe if the regulator could not be enabled, the error exit path
would still disable it. This could lead to unbalanced counter of
regulator enable/disable.

The patch moves code for getting and enabling the regulator from
exynos_map_dt_data() to probe function because it is really not a part
of getting Device Tree properties.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index efed4eedf47f..bd3ba217386e 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -558,27 +558,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)
 	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
 	struct exynos_tmu_platform_data *pdata;
 	struct resource res;
-	int ret;
 
 	if (!data || !pdev->dev.of_node)
 		return -ENODEV;
 
-	/*
-	 * Try enabling the regulator if found
-	 * TODO: Add regulator as an SOC feature, so that regulator enable
-	 * is a compulsory call.
-	 */
-	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
-	if (!IS_ERR(data->regulator)) {
-		ret = regulator_enable(data->regulator);
-		if (ret) {
-			dev_err(&pdev->dev, "failed to enable vtmu\n");
-			return ret;
-		}
-	} else {
-		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
-	}
-
 	data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl");
 	if (data->id < 0)
 		data->id = 0;
@@ -643,6 +626,22 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, data);
 	mutex_init(&data->lock);
 
+	/*
+	 * Try enabling the regulator if found
+	 * TODO: Add regulator as an SOC feature, so that regulator enable
+	 * is a compulsory call.
+	 */
+	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
+	if (!IS_ERR(data->regulator)) {
+		ret = regulator_enable(data->regulator);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to enable vtmu\n");
+			return ret;
+		}
+	} else {
+		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
+	}
+
 	ret = exynos_map_dt_data(pdev);
 	if (ret)
 		return ret;

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

* [PATCH 3.16.y-ckt 060/126] ALSA: hda - Apply pin fixup for HP ProBook 6550b
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (58 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 061/126] ALSA: hda - Add Intel Lewisburg device IDs Audio Luis Henriques
                   ` (65 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit c932b98c1e47312822d911c1bb76e81ef50e389c upstream.

HP ProBook 6550b needs the same pin fixup applied to other HP B-series
laptops with docks for making its headphone and dock headphone jacks
working properly.  We just need to add the codec SSID to the list.

Bugzilla: https://bugzilla.kernel.org/attachment.cgi?id=191971
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/patch_sigmatel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 78e0c83993d5..28c9f20c2f63 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -732,6 +732,7 @@ static bool hp_bnb2011_with_dock(struct hda_codec *codec)
 static bool hp_blike_system(u32 subsystem_id)
 {
 	switch (subsystem_id) {
+	case 0x103c1473: /* HP ProBook 6550b */
 	case 0x103c1520:
 	case 0x103c1521:
 	case 0x103c1523:

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

* [PATCH 3.16.y-ckt 061/126] ALSA: hda - Add Intel Lewisburg device IDs Audio
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (59 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 060/126] ALSA: hda - Apply pin fixup for HP ProBook 6550b Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 062/126] firewire: ohci: fix JMicron JMB38x IT context discovery Luis Henriques
                   ` (64 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexandra Yates, Takashi Iwai, Luis Henriques

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

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

From: Alexandra Yates <alexandra.yates@linux.intel.com>

commit 5cf92c8b3dc5da59e05dc81bdc069cedf6f38313 upstream.

Adding Intel codename Lewisburg platform device IDs for audio.

[rearranged the position by tiwai]

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_intel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 89dfe344ee75..e91c93dc08c6 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1791,6 +1791,11 @@ static const struct pci_device_id azx_ids[] = {
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
 	{ PCI_DEVICE(0x8086, 0x8d21),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
+	/* Lewisburg */
+	{ PCI_DEVICE(0x8086, 0xa1f0),
+	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
+	{ PCI_DEVICE(0x8086, 0xa270),
+	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
 	/* Lynx Point-LP */
 	{ PCI_DEVICE(0x8086, 0x9c20),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },

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

* [PATCH 3.16.y-ckt 062/126] firewire: ohci: fix JMicron JMB38x IT context discovery
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (60 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 061/126] ALSA: hda - Add Intel Lewisburg device IDs Audio Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 063/126] scsi: restart list search after unlock in scsi_remove_target Luis Henriques
                   ` (63 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Stefan Richter, Luis Henriques

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

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

From: Stefan Richter <stefanr@s5r6.in-berlin.de>

commit 100ceb66d5c40cc0c7018e06a9474302470be73c upstream.

Reported by Clifford and Craig for JMicron OHCI-1394 + SDHCI combo
controllers:  Often or even most of the time, the controller is
initialized with the message "added OHCI v1.10 device as card 0, 4 IR +
0 IT contexts, quirks 0x10".  With 0 isochronous transmit DMA contexts
(IT contexts), applications like audio output are impossible.

However, OHCI-1394 demands that at least 4 IT contexts are implemented
by the link layer controller, and indeed JMicron JMB38x do implement
four of them.  Only their IsoXmitIntMask register is unreliable at early
access.

With my own JMB381 single function controller I found:
  - I can reproduce the problem with a lower probability than Craig's.
  - If I put a loop around the section which clears and reads
    IsoXmitIntMask, then either the first or the second attempt will
    return the correct initial mask of 0x0000000f.  I never encountered
    a case of needing more than a second attempt.
  - Consequently, if I put a dummy reg_read(...IsoXmitIntMaskSet)
    before the first write, the subsequent read will return the correct
    result.
  - If I merely ignore a wrong read result and force the known real
    result, later isochronous transmit DMA usage works just fine.

So let's just fix this chip bug up by the latter method.  Tested with
JMB381 on kernel 3.13 and 4.3.

Since OHCI-1394 generally requires 4 IT contexts at a minium, this
workaround is simply applied whenever the initial read of IsoXmitIntMask
returns 0, regardless whether it's a JMicron chip or not.  I never heard
of this issue together with any other chip though.

I am not 100% sure that this fix works on the OHCI-1394 part of JMB380
and JMB388 combo controllers exactly the same as on the JMB381 single-
function controller, but so far I haven't had a chance to let an owner
of a combo chip run a patched kernel.

Strangely enough, IsoRecvIntMask is always reported correctly, even
though it is probed right before IsoXmitIntMask.

Reported-by: Clifford Dunn
Reported-by: Craig Moore <craig.moore@qenos.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/firewire/ohci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index a66a3217f1d9..f047d7c2b643 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3682,6 +3682,11 @@ static int pci_probe(struct pci_dev *dev,
 
 	reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0);
 	ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
+	/* JMicron JMB38x often shows 0 at first read, just ignore it */
+	if (!ohci->it_context_support) {
+		ohci_notice(ohci, "overriding IsoXmitIntMask\n");
+		ohci->it_context_support = 0xf;
+	}
 	reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
 	ohci->it_context_mask = ohci->it_context_support;
 	ohci->n_it = hweight32(ohci->it_context_mask);

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

* [PATCH 3.16.y-ckt 063/126] scsi: restart list search after unlock in scsi_remove_target
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (61 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 062/126] firewire: ohci: fix JMicron JMB38x IT context discovery Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 064/126] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE Luis Henriques
                   ` (62 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christoph Hellwig, James Bottomley, Luis Henriques

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

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

From: Christoph Hellwig <hch@lst.de>

commit 40998193560dab6c3ce8d25f4fa58a23e252ef38 upstream.

When dropping a lock while iterating a list we must restart the search
as other threads could have manipulated the list under us.  Without this
we can get stuck in an endless loop.  This bug was introduced by

commit bc3f02a795d3b4faa99d37390174be2a75d091bd
Author: Dan Williams <djbw@fb.com>
Date:   Tue Aug 28 22:12:10 2012 -0700

    [SCSI] scsi_remove_target: fix softlockup regression on hot remove

Which was itself trying to fix a reported soft lockup issue

http://thread.gmane.org/gmane.linux.kernel/1348679

However, we believe even with this revert of the original patch, the soft
lockup problem has been fixed by

commit f2495e228fce9f9cec84367547813cbb0d6db15a
Author: James Bottomley <JBottomley@Parallels.com>
Date:   Tue Jan 21 07:01:41 2014 -0800

    [SCSI] dual scan thread bug fix

Thanks go to Dan Williams <dan.j.williams@intel.com> for tracking all this
prior history down.

Reported-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Fixes: bc3f02a795d3b4faa99d37390174be2a75d091bd
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/scsi_sysfs.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 074e8cc30955..fee7d1aebc3e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1148,31 +1148,23 @@ static void __scsi_remove_target(struct scsi_target *starget)
 void scsi_remove_target(struct device *dev)
 {
 	struct Scsi_Host *shost = dev_to_shost(dev->parent);
-	struct scsi_target *starget, *last = NULL;
+	struct scsi_target *starget;
 	unsigned long flags;
 
-	/* remove targets being careful to lookup next entry before
-	 * deleting the last
-	 */
+restart:
 	spin_lock_irqsave(shost->host_lock, flags);
 	list_for_each_entry(starget, &shost->__targets, siblings) {
 		if (starget->state == STARGET_DEL)
 			continue;
 		if (starget->dev.parent == dev || &starget->dev == dev) {
-			/* assuming new targets arrive at the end */
 			kref_get(&starget->reap_ref);
 			spin_unlock_irqrestore(shost->host_lock, flags);
-			if (last)
-				scsi_target_reap(last);
-			last = starget;
 			__scsi_remove_target(starget);
-			spin_lock_irqsave(shost->host_lock, flags);
+			scsi_target_reap(starget);
+			goto restart;
 		}
 	}
 	spin_unlock_irqrestore(shost->host_lock, flags);
-
-	if (last)
-		scsi_target_reap(last);
 }
 EXPORT_SYMBOL(scsi_remove_target);
 

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

* [PATCH 3.16.y-ckt 064/126] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (62 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 063/126] scsi: restart list search after unlock in scsi_remove_target Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 065/126] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled Luis Henriques
                   ` (61 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Catalin Marinas, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Linus Torvalds, Luis Henriques

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

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

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

commit d4322d88f5fdf92729dd40f923013414fbb2184d upstream.

On systems with a KMALLOC_MIN_SIZE of 128 (arm64, some mips and powerpc
configurations defining ARCH_DMA_MINALIGN to 128), the first
kmalloc_caches[] entry to be initialised after slab_early_init = 0 is
"kmalloc-128" with index 7.  Depending on the debug kernel configuration,
sizeof(struct kmem_cache) can be larger than 128 resulting in an
INDEX_NODE of 8.

Commit 8fc9cf420b36 ("slab: make more slab management structure off the
slab") enables off-slab management objects for sizes starting with
PAGE_SIZE >> 5 (128 bytes for a 4KB page configuration) and the creation
of the "kmalloc-128" cache would try to place the management objects
off-slab.  However, since KMALLOC_MIN_SIZE is already 128 and
freelist_size == 32 in __kmem_cache_create(), kmalloc_slab(freelist_size)
returns NULL (kmalloc_caches[7] not populated yet).  This triggers the
following bug on arm64:

  kernel BUG at /work/Linux/linux-2.6-aarch64/mm/slab.c:2283!
  Internal error: Oops - BUG: 0 [#1] SMP
  Modules linked in:
  CPU: 0 PID: 0 Comm: swapper Not tainted 4.3.0-rc4+ #540
  Hardware name: Juno (DT)
  PC is at __kmem_cache_create+0x21c/0x280
  LR is at __kmem_cache_create+0x210/0x280
  [...]
  Call trace:
    __kmem_cache_create+0x21c/0x280
    create_boot_cache+0x48/0x80
    create_kmalloc_cache+0x50/0x88
    create_kmalloc_caches+0x4c/0xf4
    kmem_cache_init+0x100/0x118
    start_kernel+0x214/0x33c

This patch introduces an OFF_SLAB_MIN_SIZE definition to avoid off-slab
management objects for sizes equal to or smaller than KMALLOC_MIN_SIZE.

Fixes: 8fc9cf420b36 ("slab: make more slab management structure off the slab")
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
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>
---
 mm/slab.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 9a8dc5470e5e..084985404fec 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -279,6 +279,7 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent)
 
 #define CFLGS_OFF_SLAB		(0x80000000UL)
 #define	OFF_SLAB(x)	((x)->flags & CFLGS_OFF_SLAB)
+#define OFF_SLAB_MIN_SIZE (max_t(size_t, PAGE_SIZE >> 5, KMALLOC_MIN_SIZE + 1))
 
 #define BATCHREFILL_LIMIT	16
 /*
@@ -2328,7 +2329,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
 	 * it too early on. Always use on-slab management when
 	 * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak)
 	 */
-	if ((size >= (PAGE_SIZE >> 5)) && !slab_early_init &&
+	if (size >= OFF_SLAB_MIN_SIZE && !slab_early_init &&
 	    !(flags & SLAB_NOLEAKTRACE))
 		/*
 		 * Size is large, assume best to place the slab management obj
@@ -2392,7 +2393,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
 		/*
 		 * This is a possibility for one of the kmalloc_{dma,}_caches.
 		 * But since we go off slab only for object size greater than
-		 * PAGE_SIZE/8, and kmalloc_{dma,}_caches get created
+		 * OFF_SLAB_MIN_SIZE, and kmalloc_{dma,}_caches get created
 		 * in ascending order,this should not happen at all.
 		 * But leave a BUG_ON for some lucky dude.
 		 */

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

* [PATCH 3.16.y-ckt 065/126] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (63 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 064/126] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 066/126] proc: actually make proc_fd_permission() thread-friendly Luis Henriques
                   ` (60 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Dmitry Torokhov, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 60603950f836ef4e88daddf61a273b91e671db2d upstream.

Another Lifebook machine that needs the same quirk as other similar
models to make the driver working.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=883192
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/elantech.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b8e9df5e5da5..f6f44bc78a75 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1402,6 +1402,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"),
 		},
 	},
+	{
+		/* Fujitsu LIFEBOOK U745 does not work with crc_enabled == 0 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"),
+		},
+	},
 #endif
 	{ }
 };

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

* [PATCH 3.16.y-ckt 066/126] proc: actually make proc_fd_permission() thread-friendly
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (64 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 065/126] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 067/126] x86/setup: Extend low identity map to cover whole kernel range Luis Henriques
                   ` (59 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Eric W. Biederman, Andrew Morton, Linus Torvalds,
	Luis Henriques

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit 54708d2858e79a2bdda10bf8a20c80eb96c20613 upstream.

The commit 96d0df79f264 ("proc: make proc_fd_permission() thread-friendly")
fixed the access to /proc/self/fd from sub-threads, but introduced another
problem: a sub-thread can't access /proc/<tid>/fd/ or /proc/thread-self/fd
if generic_permission() fails.

Change proc_fd_permission() to check same_thread_group(pid_task(), current).

Fixes: 96d0df79f264 ("proc: make proc_fd_permission() thread-friendly")
Reported-by: "Jin, Yihua" <yihua.jin@intel.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
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/proc/fd.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 0788d093f5d8..f1073ea64b41 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -285,11 +285,19 @@ static struct dentry *proc_lookupfd(struct inode *dir, struct dentry *dentry,
  */
 int proc_fd_permission(struct inode *inode, int mask)
 {
-	int rv = generic_permission(inode, mask);
+	struct task_struct *p;
+	int rv;
+
+	rv = generic_permission(inode, mask);
 	if (rv == 0)
-		return 0;
-	if (task_tgid(current) == proc_pid(inode))
+		return rv;
+
+	rcu_read_lock();
+	p = pid_task(proc_pid(inode), PIDTYPE_PID);
+	if (p && same_thread_group(p, current))
 		rv = 0;
+	rcu_read_unlock();
+
 	return rv;
 }
 

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

* [PATCH 3.16.y-ckt 067/126] x86/setup: Extend low identity map to cover whole kernel range
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (65 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 066/126] proc: actually make proc_fd_permission() thread-friendly Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 068/126] x86/setup: Fix low identity map for >= 2GB " Luis Henriques
                   ` (58 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paolo Bonzini, Borislav Petkov, H. Peter Anvin, Thomas Gleixner,
	Ingo Molnar, Andy Lutomirski, Matt Fleming, Luis Henriques

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

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

From: Paolo Bonzini <pbonzini@redhat.com>

commit f5f3497cad8c8416a74b9aaceb127908755d020a upstream.

On 32-bit systems, the initial_page_table is reused by
efi_call_phys_prolog as an identity map to call
SetVirtualAddressMap.  efi_call_phys_prolog takes care of
converting the current CPU's GDT to a physical address too.

For PAE kernels the identity mapping is achieved by aliasing the
first PDPE for the kernel memory mapping into the first PDPE
of initial_page_table.  This makes the EFI stub's trick "just work".

However, for non-PAE kernels there is no guarantee that the identity
mapping in the initial_page_table extends as far as the GDT; in this
case, accesses to the GDT will cause a page fault (which quickly becomes
a triple fault).  Fix this by copying the kernel mappings from
swapper_pg_dir to initial_page_table twice, both at PAGE_OFFSET and at
identity mapping.

For some reason, this is only reproducible with QEMU's dynamic translation
mode, and not for example with KVM.  However, even under KVM one can clearly
see that the page table is bogus:

    $ qemu-system-i386 -pflash OVMF.fd -M q35 vmlinuz0 -s -S -daemonize
    $ gdb
    (gdb) target remote localhost:1234
    (gdb) hb *0x02858f6f
    Hardware assisted breakpoint 1 at 0x2858f6f
    (gdb) c
    Continuing.

    Breakpoint 1, 0x02858f6f in ?? ()
    (gdb) monitor info registers
    ...
    GDT=     0724e000 000000ff
    IDT=     fffbb000 000007ff
    CR0=0005003b CR2=ff896000 CR3=032b7000 CR4=00000690
    ...

The page directory is sane:

    (gdb) x/4wx 0x32b7000
    0x32b7000:	0x03398063	0x03399063	0x0339a063	0x0339b063
    (gdb) x/4wx 0x3398000
    0x3398000:	0x00000163	0x00001163	0x00002163	0x00003163
    (gdb) x/4wx 0x3399000
    0x3399000:	0x00400003	0x00401003	0x00402003	0x00403003

but our particular page directory entry is empty:

    (gdb) x/1wx 0x32b7000 + (0x724e000 >> 22) * 4
    0x32b7070:	0x00000000

[ It appears that you can skate past this issue if you don't receive
  any interrupts while the bogus GDT pointer is loaded, or if you avoid
  reloading the segment registers in general.

  Andy Lutomirski provides some additional insight:

   "AFAICT it's entirely permissible for the GDTR and/or LDT
    descriptor to point to unmapped memory.  Any attempt to use them
    (segment loads, interrupts, IRET, etc) will try to access that memory
    as if the access came from CPL 0 and, if the access fails, will
    generate a valid page fault with CR2 pointing into the GDT or
    LDT."

  Up until commit 23a0d4e8fa6d ("efi: Disable interrupts around EFI
  calls, not in the epilog/prolog calls") interrupts were disabled
  around the prolog and epilog calls, and the functional GDT was
  re-installed before interrupts were re-enabled.

  Which explains why no one has hit this issue until now. ]

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ Updated changelog. ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/setup.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 78a0e6298922..56788204d85e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1177,6 +1177,14 @@ void __init setup_arch(char **cmdline_p)
 	clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
 			swapper_pg_dir     + KERNEL_PGD_BOUNDARY,
 			KERNEL_PGD_PTRS);
+
+	/*
+	 * sync back low identity map too.  It is used for example
+	 * in the 32-bit EFI stub.
+	 */
+	clone_pgd_range(initial_page_table,
+			swapper_pg_dir     + KERNEL_PGD_BOUNDARY,
+			KERNEL_PGD_PTRS);
 #endif
 
 	tboot_probe();

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

* [PATCH 3.16.y-ckt 068/126] x86/setup: Fix low identity map for >= 2GB kernel range
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (66 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 067/126] x86/setup: Extend low identity map to cover whole kernel range Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 069/126] x86/cpu: Call verify_cpu() after having entered long mode too Luis Henriques
                   ` (57 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Mazur, Andy Lutomirski, Borislav Petkov, Laszlo Ersek,
	Matt Fleming, Paolo Bonzini, Thomas Gleixner, Luis Henriques

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

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

From: Krzysztof Mazur <krzysiek@podlesie.net>

commit 68accac392d859d24adcf1be3a90e41f978bd54c upstream.

The commit f5f3497cad8c extended the low identity mapping. However, if
the kernel uses more than 2 GB (VMSPLIT_2G_OPT or VMSPLIT_1G memory
split), the normal memory mapping is overwritten by the low identity
mapping causing a crash. To avoid overwritting, limit the low identity
map to cover only memory before kernel range (PAGE_OFFSET).

Fixes: f5f3497cad8c "x86/setup: Extend low identity map to cover whole kernel range
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Link: http://lkml.kernel.org/r/1446815916-22105-1-git-send-email-krzysiek@podlesie.net
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 56788204d85e..b1077b8ee7af 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1184,7 +1184,7 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	clone_pgd_range(initial_page_table,
 			swapper_pg_dir     + KERNEL_PGD_BOUNDARY,
-			KERNEL_PGD_PTRS);
+			min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
 #endif
 
 	tboot_probe();

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

* [PATCH 3.16.y-ckt 069/126] x86/cpu: Call verify_cpu() after having entered long mode too
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (67 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 068/126] x86/setup: Fix low identity map for >= 2GB " Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 070/126] Btrfs: fix race leading to incorrect item deletion when dropping extents Luis Henriques
                   ` (56 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Borislav Petkov, Matt Fleming, Peter Zijlstra, Thomas Gleixner,
	Luis Henriques

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

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

From: Borislav Petkov <bp@suse.de>

commit 04633df0c43d710e5f696b06539c100898678235 upstream.

When we get loaded by a 64-bit bootloader, kernel entry point is
startup_64 in head_64.S. We don't trust any and all bootloaders because
some will fiddle with CPU configuration so we go ahead and massage each
CPU into sanity again.

For example, some dell BIOSes have this XD disable feature which set
IA32_MISC_ENABLE[34] and disable NX. This might be some dumb workaround
for other OSes but Linux sure doesn't need it.

A similar thing is present in the Surface 3 firmware - see
https://bugzilla.kernel.org/show_bug.cgi?id=106051 - which sets this bit
only on the BSP:

  # rdmsr -a 0x1a0
  400850089
  850089
  850089
  850089

I know, right?!

There's not even an off switch in there.

So fix all those cases by sanitizing the 64-bit entry point too. For
that, make verify_cpu() callable in 64-bit mode also.

Requested-and-debugged-by: "H. Peter Anvin" <hpa@zytor.com>
Reported-and-tested-by: Bastien Nocera <bugzilla@hadess.net>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1446739076-21303-1-git-send-email-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/head_64.S    |  8 ++++++++
 arch/x86/kernel/verify_cpu.S | 12 +++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index a2dc0add72ed..761fd69df6d9 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -65,6 +65,9 @@ startup_64:
 	 * tables and then reload them.
 	 */
 
+	/* Sanitize CPU configuration */
+	call verify_cpu
+
 	/*
 	 * Compute the delta between the address I am compiled to run at and the
 	 * address I am actually running at.
@@ -174,6 +177,9 @@ ENTRY(secondary_startup_64)
 	 * after the boot processor executes this code.
 	 */
 
+	/* Sanitize CPU configuration */
+	call verify_cpu
+
 	movq	$(init_level4_pgt - __START_KERNEL_map), %rax
 1:
 
@@ -288,6 +294,8 @@ ENTRY(secondary_startup_64)
 	pushq	%rax		# target address in negative space
 	lretq
 
+#include "verify_cpu.S"
+
 #ifdef CONFIG_HOTPLUG_CPU
 /*
  * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
diff --git a/arch/x86/kernel/verify_cpu.S b/arch/x86/kernel/verify_cpu.S
index b9242bacbe59..4cf401f581e7 100644
--- a/arch/x86/kernel/verify_cpu.S
+++ b/arch/x86/kernel/verify_cpu.S
@@ -34,10 +34,11 @@
 #include <asm/msr-index.h>
 
 verify_cpu:
-	pushfl				# Save caller passed flags
-	pushl	$0			# Kill any dangerous flags
-	popfl
+	pushf				# Save caller passed flags
+	push	$0			# Kill any dangerous flags
+	popf
 
+#ifndef __x86_64__
 	pushfl				# standard way to check for cpuid
 	popl	%eax
 	movl	%eax,%ebx
@@ -48,6 +49,7 @@ verify_cpu:
 	popl	%eax
 	cmpl	%eax,%ebx
 	jz	verify_cpu_no_longmode	# cpu has no cpuid
+#endif
 
 	movl	$0x0,%eax		# See if cpuid 1 is implemented
 	cpuid
@@ -130,10 +132,10 @@ verify_cpu_sse_test:
 	jmp	verify_cpu_sse_test	# try again
 
 verify_cpu_no_longmode:
-	popfl				# Restore caller passed flags
+	popf				# Restore caller passed flags
 	movl $1,%eax
 	ret
 verify_cpu_sse_ok:
-	popfl				# Restore caller passed flags
+	popf				# Restore caller passed flags
 	xorl %eax, %eax
 	ret

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

* [PATCH 3.16.y-ckt 070/126] Btrfs: fix race leading to incorrect item deletion when dropping extents
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (68 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 069/126] x86/cpu: Call verify_cpu() after having entered long mode too Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 071/126] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow Luis Henriques
                   ` (55 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit aeafbf8486c9e2bd53f5cc3c10c0b7fd7149d69c upstream.

While running a stress test I got the following warning triggered:

  [191627.672810] ------------[ cut here ]------------
  [191627.673949] WARNING: CPU: 8 PID: 8447 at fs/btrfs/file.c:779 __btrfs_drop_extents+0x391/0xa50 [btrfs]()
  (...)
  [191627.701485] Call Trace:
  [191627.702037]  [<ffffffff8145f077>] dump_stack+0x4f/0x7b
  [191627.702992]  [<ffffffff81095de5>] ? console_unlock+0x356/0x3a2
  [191627.704091]  [<ffffffff8104b3b0>] warn_slowpath_common+0xa1/0xbb
  [191627.705380]  [<ffffffffa0664499>] ? __btrfs_drop_extents+0x391/0xa50 [btrfs]
  [191627.706637]  [<ffffffff8104b46d>] warn_slowpath_null+0x1a/0x1c
  [191627.707789]  [<ffffffffa0664499>] __btrfs_drop_extents+0x391/0xa50 [btrfs]
  [191627.709155]  [<ffffffff8115663c>] ? cache_alloc_debugcheck_after.isra.32+0x171/0x1d0
  [191627.712444]  [<ffffffff81155007>] ? kmemleak_alloc_recursive.constprop.40+0x16/0x18
  [191627.714162]  [<ffffffffa06570c9>] insert_reserved_file_extent.constprop.40+0x83/0x24e [btrfs]
  [191627.715887]  [<ffffffffa065422b>] ? start_transaction+0x3bb/0x610 [btrfs]
  [191627.717287]  [<ffffffffa065b604>] btrfs_finish_ordered_io+0x273/0x4e2 [btrfs]
  [191627.728865]  [<ffffffffa065b888>] finish_ordered_fn+0x15/0x17 [btrfs]
  [191627.730045]  [<ffffffffa067d688>] normal_work_helper+0x14c/0x32c [btrfs]
  [191627.731256]  [<ffffffffa067d96a>] btrfs_endio_write_helper+0x12/0x14 [btrfs]
  [191627.732661]  [<ffffffff81061119>] process_one_work+0x24c/0x4ae
  [191627.733822]  [<ffffffff810615b0>] worker_thread+0x206/0x2c2
  [191627.734857]  [<ffffffff810613aa>] ? process_scheduled_works+0x2f/0x2f
  [191627.736052]  [<ffffffff810613aa>] ? process_scheduled_works+0x2f/0x2f
  [191627.737349]  [<ffffffff810669a6>] kthread+0xef/0xf7
  [191627.738267]  [<ffffffff810f3b3a>] ? time_hardirqs_on+0x15/0x28
  [191627.739330]  [<ffffffff810668b7>] ? __kthread_parkme+0xad/0xad
  [191627.741976]  [<ffffffff81465592>] ret_from_fork+0x42/0x70
  [191627.743080]  [<ffffffff810668b7>] ? __kthread_parkme+0xad/0xad
  [191627.744206] ---[ end trace bbfddacb7aaada8d ]---

  $ cat -n fs/btrfs/file.c
  691  int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
  (...)
  758                  btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
  759                  if (key.objectid > ino ||
  760                      key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
  761                          break;
  762
  763                  fi = btrfs_item_ptr(leaf, path->slots[0],
  764                                      struct btrfs_file_extent_item);
  765                  extent_type = btrfs_file_extent_type(leaf, fi);
  766
  767                  if (extent_type == BTRFS_FILE_EXTENT_REG ||
  768                      extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
  (...)
  774                  } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
  (...)
  778                  } else {
  779                          WARN_ON(1);
  780                          extent_end = search_start;
  781                  }
  (...)

This happened because the item we were processing did not match a file
extent item (its key type != BTRFS_EXTENT_DATA_KEY), and even on this
case we cast the item to a struct btrfs_file_extent_item pointer and
then find a type field value that does not match any of the expected
values (BTRFS_FILE_EXTENT_[REG|PREALLOC|INLINE]). This scenario happens
due to a tiny time window where a race can happen as exemplified below.
For example, consider the following scenario where we're using the
NO_HOLES feature and we have the following two neighbour leafs:

               Leaf X (has N items)                    Leaf Y

[ ... (257 INODE_ITEM 0) (257 INODE_REF 256) ]  [ (257 EXTENT_DATA 8192), ... ]
          slot N - 2         slot N - 1              slot 0

Our inode 257 has an implicit hole in the range [0, 8K[ (implicit rather
than explicit because NO_HOLES is enabled). Now if our inode has an
ordered extent for the range [4K, 8K[ that is finishing, the following
can happen:

          CPU 1                                       CPU 2

  btrfs_finish_ordered_io()
    insert_reserved_file_extent()
      __btrfs_drop_extents()
         Searches for the key
          (257 EXTENT_DATA 4096) through
          btrfs_lookup_file_extent()

         Key not found and we get a path where
         path->nodes[0] == leaf X and
         path->slots[0] == N

         Because path->slots[0] is >=
         btrfs_header_nritems(leaf X), we call
         btrfs_next_leaf()

         btrfs_next_leaf() releases the path

                                                  inserts key
                                                  (257 INODE_REF 4096)
                                                  at the end of leaf X,
                                                  leaf X now has N + 1 keys,
                                                  and the new key is at
                                                  slot N

         btrfs_next_leaf() searches for
         key (257 INODE_REF 256), with
         path->keep_locks set to 1,
         because it was the last key it
         saw in leaf X

           finds it in leaf X again and
           notices it's no longer the last
           key of the leaf, so it returns 0
           with path->nodes[0] == leaf X and
           path->slots[0] == N (which is now
           < btrfs_header_nritems(leaf X)),
           pointing to the new key
           (257 INODE_REF 4096)

         __btrfs_drop_extents() casts the
         item at path->nodes[0], slot
         path->slots[0], to a struct
         btrfs_file_extent_item - it does
         not skip keys for the target
         inode with a type less than
         BTRFS_EXTENT_DATA_KEY
         (BTRFS_INODE_REF_KEY < BTRFS_EXTENT_DATA_KEY)

         sees a bogus value for the type
         field triggering the WARN_ON in
         the trace shown above, and sets
         extent_end = search_start (4096)

         does the if-then-else logic to
         fixup 0 length extent items created
         by a past bug from hole punching:

           if (extent_end == key.offset &&
               extent_end >= search_start)
               goto delete_extent_item;

         that evaluates to true and it ends
         up deleting the key pointed to by
         path->slots[0], (257 INODE_REF 4096),
         from leaf X

The same could happen for example for a xattr that ends up having a key
with an offset value that matches search_start (very unlikely but not
impossible).

So fix this by ensuring that keys smaller than BTRFS_EXTENT_DATA_KEY are
skipped, never casted to struct btrfs_file_extent_item and never deleted
by accident. Also protect against the unexpected case of getting a key
for a lower inode number by skipping that key and issuing a warning.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/file.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 39aa46612541..7a71c7885835 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -760,8 +760,16 @@ next_slot:
 		}
 
 		btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
-		if (key.objectid > ino ||
-		    key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
+
+		if (key.objectid > ino)
+			break;
+		if (WARN_ON_ONCE(key.objectid < ino) ||
+		    key.type < BTRFS_EXTENT_DATA_KEY) {
+			ASSERT(del_nr == 0);
+			path->slots[0]++;
+			goto next_slot;
+		}
+		if (key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
 			break;
 
 		fi = btrfs_item_ptr(leaf, path->slots[0],
@@ -780,8 +788,8 @@ next_slot:
 				btrfs_file_extent_inline_len(leaf,
 						     path->slots[0], fi);
 		} else {
-			WARN_ON(1);
-			extent_end = search_start;
+			/* can't happen */
+			BUG();
 		}
 
 		/*

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

* [PATCH 3.16.y-ckt 071/126] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (69 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 070/126] Btrfs: fix race leading to incorrect item deletion when dropping extents Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 072/126] perf: Fix inherited events vs. tracepoint filters Luis Henriques
                   ` (54 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit 1d512cb77bdbda80f0dd0620a3b260d697fd581d upstream.

If we are using the NO_HOLES feature, we have a tiny time window when
running delalloc for a nodatacow inode where we can race with a concurrent
link or xattr add operation leading to a BUG_ON.

This happens because at run_delalloc_nocow() we end up casting a leaf item
of type BTRFS_INODE_[REF|EXTREF]_KEY or of type BTRFS_XATTR_ITEM_KEY to a
file extent item (struct btrfs_file_extent_item) and then analyse its
extent type field, which won't match any of the expected extent types
(values BTRFS_FILE_EXTENT_[REG|PREALLOC|INLINE]) and therefore trigger an
explicit BUG_ON(1).

The following sequence diagram shows how the race happens when running a
no-cow dellaloc range [4K, 8K[ for inode 257 and we have the following
neighbour leafs:

             Leaf X (has N items)                    Leaf Y

 [ ... (257 INODE_ITEM 0) (257 INODE_REF 256) ]  [ (257 EXTENT_DATA 8192), ... ]
              slot N - 2         slot N - 1              slot 0

 (Note the implicit hole for inode 257 regarding the [0, 8K[ range)

       CPU 1                                         CPU 2

 run_dealloc_nocow()
   btrfs_lookup_file_extent()
     --> searches for a key with value
         (257 EXTENT_DATA 4096) in the
         fs/subvol tree
     --> returns us a path with
         path->nodes[0] == leaf X and
         path->slots[0] == N

   because path->slots[0] is >=
   btrfs_header_nritems(leaf X), it
   calls btrfs_next_leaf()

   btrfs_next_leaf()
     --> releases the path

                                              hard link added to our inode,
                                              with key (257 INODE_REF 500)
                                              added to the end of leaf X,
                                              so leaf X now has N + 1 keys

     --> searches for the key
         (257 INODE_REF 256), because
         it was the last key in leaf X
         before it released the path,
         with path->keep_locks set to 1

     --> ends up at leaf X again and
         it verifies that the key
         (257 INODE_REF 256) is no longer
         the last key in the leaf, so it
         returns with path->nodes[0] ==
         leaf X and path->slots[0] == N,
         pointing to the new item with
         key (257 INODE_REF 500)

   the loop iteration of run_dealloc_nocow()
   does not break out the loop and continues
   because the key referenced in the path
   at path->nodes[0] and path->slots[0] is
   for inode 257, its type is < BTRFS_EXTENT_DATA_KEY
   and its offset (500) is less then our delalloc
   range's end (8192)

   the item pointed by the path, an inode reference item,
   is (incorrectly) interpreted as a file extent item and
   we get an invalid extent type, leading to the BUG_ON(1):

   if (extent_type == BTRFS_FILE_EXTENT_REG ||
      extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
       (...)
   } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
       (...)
   } else {
       BUG_ON(1)
   }

The same can happen if a xattr is added concurrently and ends up having
a key with an offset smaller then the delalloc's range end.

So fix this by skipping keys with a type smaller than
BTRFS_EXTENT_DATA_KEY.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/inode.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index af4bb28c9ba5..ba556d752858 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1247,8 +1247,14 @@ next_slot:
 		num_bytes = 0;
 		btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
 
-		if (found_key.objectid > ino ||
-		    found_key.type > BTRFS_EXTENT_DATA_KEY ||
+		if (found_key.objectid > ino)
+			break;
+		if (WARN_ON_ONCE(found_key.objectid < ino) ||
+		    found_key.type < BTRFS_EXTENT_DATA_KEY) {
+			path->slots[0]++;
+			goto next_slot;
+		}
+		if (found_key.type > BTRFS_EXTENT_DATA_KEY ||
 		    found_key.offset > end)
 			break;
 

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

* [PATCH 3.16.y-ckt 072/126] perf: Fix inherited events vs. tracepoint filters
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (70 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 071/126] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 073/126] scsi_sysfs: Fix queue_ramp_up_period return code Luis Henriques
                   ` (53 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Zijlstra (Intel), Adrian Hunter, Arnaldo Carvalho de Melo,
	David Ahern, Frédéric Weisbecker, Jiri Olsa, Jiri Olsa,
	Linus Torvalds, Steven Rostedt, Thomas Gleixner, Wang Nan,
	Ingo Molnar, Luis Henriques

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

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

From: Peter Zijlstra <peterz@infradead.org>

commit b71b437eedaed985062492565d9d421d975ae845 upstream.

Arnaldo reported that tracepoint filters seem to misbehave (ie. not
apply) on inherited events.

The fix is obvious; filters are only set on the actual (parent)
event, use the normal pattern of using this parent event for filters.
This is safe because each child event has a reference to it.

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20151102095051.GN17308@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/events/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index b9305281ede8..259b9fdb6ba4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6032,6 +6032,10 @@ static int perf_tp_filter_match(struct perf_event *event,
 {
 	void *record = data->raw->data;
 
+	/* only top level events have filters set */
+	if (event->parent)
+		event = event->parent;
+
 	if (likely(!event->filter) || filter_match_preds(event->filter, record))
 		return 1;
 	return 0;

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

* [PATCH 3.16.y-ckt 073/126] scsi_sysfs: Fix queue_ramp_up_period return code
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (71 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 072/126] perf: Fix inherited events vs. tracepoint filters Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 074/126] Btrfs: fix race when listing an inode's xattrs Luis Henriques
                   ` (52 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Oberparleiter, Martin K. Petersen, Luis Henriques

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

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

From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>

commit 863e02d0e173bb9d8cea6861be22820b25c076cc upstream.

Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period
returns the value of that number instead of the number of bytes written.
This behavior can confuse programs expecting POSIX write() semantics.
Fix this by returning the number of bytes written instead.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/scsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index fee7d1aebc3e..7e78015d6ab7 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -891,7 +891,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,
 		return -EINVAL;
 
 	sdev->queue_ramp_up_period = msecs_to_jiffies(period);
-	return period;
+	return count;
 }
 
 static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,

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

* [PATCH 3.16.y-ckt 074/126] Btrfs: fix race when listing an inode's xattrs
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (72 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 073/126] scsi_sysfs: Fix queue_ramp_up_period return code Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 075/126] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list Luis Henriques
                   ` (51 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Luis Henriques

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

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

From: Filipe Manana <fdmanana@suse.com>

commit f1cd1f0b7d1b5d4aaa5711e8f4e4898b0045cb6d upstream.

When listing a inode's xattrs we have a time window where we race against
a concurrent operation for adding a new hard link for our inode that makes
us not return any xattr to user space. In order for this to happen, the
first xattr of our inode needs to be at slot 0 of a leaf and the previous
leaf must still have room for an inode ref (or extref) item, and this can
happen because an inode's listxattrs callback does not lock the inode's
i_mutex (nor does the VFS does it for us), but adding a hard link to an
inode makes the VFS lock the inode's i_mutex before calling the inode's
link callback.

If we have the following leafs:

               Leaf X (has N items)                    Leaf Y

 [ ... (257 INODE_ITEM 0) (257 INODE_REF 256) ]  [ (257 XATTR_ITEM 12345), ... ]
           slot N - 2         slot N - 1              slot 0

The race illustrated by the following sequence diagram is possible:

       CPU 1                                               CPU 2

  btrfs_listxattr()

    searches for key (257 XATTR_ITEM 0)

    gets path with path->nodes[0] == leaf X
    and path->slots[0] == N

    because path->slots[0] is >=
    btrfs_header_nritems(leaf X), it calls
    btrfs_next_leaf()

    btrfs_next_leaf()
      releases the path

                                                   adds key (257 INODE_REF 666)
                                                   to the end of leaf X (slot N),
                                                   and leaf X now has N + 1 items

      searches for the key (257 INODE_REF 256),
      with path->keep_locks == 1, because that
      is the last key it saw in leaf X before
      releasing the path

      ends up at leaf X again and it verifies
      that the key (257 INODE_REF 256) is no
      longer the last key in leaf X, so it
      returns with path->nodes[0] == leaf X
      and path->slots[0] == N, pointing to
      the new item with key (257 INODE_REF 666)

    btrfs_listxattr's loop iteration sees that
    the type of the key pointed by the path is
    different from the type BTRFS_XATTR_ITEM_KEY
    and so it breaks the loop and stops looking
    for more xattr items
      --> the application doesn't get any xattr
          listed for our inode

So fix this by breaking the loop only if the key's type is greater than
BTRFS_XATTR_ITEM_KEY and skip the current key if its type is smaller.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
[ luis: backported to 3.16:
  - drop btrfs_key_type(), which was dropped upstream by
    962a298f3511 ("btrfs: kill the key type accessor helpers") ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/btrfs/xattr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 618e86ceede7..ef136a553e6f 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -309,8 +309,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
 		/* check to make sure this item is what we want */
 		if (found_key.objectid != key.objectid)
 			break;
-		if (btrfs_key_type(&found_key) != BTRFS_XATTR_ITEM_KEY)
+		if (found_key.type > BTRFS_XATTR_ITEM_KEY)
 			break;
+		if (found_key.type < BTRFS_XATTR_ITEM_KEY)
+			goto next;
 
 		di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item);
 		if (verify_dir_item(root, leaf, di))

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

* [PATCH 3.16.y-ckt 075/126] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (73 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 074/126] Btrfs: fix race when listing an inode's xattrs Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 076/126] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag Luis Henriques
                   ` (50 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Darren Hart, Luis Henriques

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

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

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

commit f71c882dd4cfe4aa88ea07b1402ddd43605d4aef upstream.

Like some of the other Yoga models the Lenovo Yoga 900 does not have a
hw rfkill switch, and trying to read the hw rfkill switch through the
ideapad module causes it to always reported blocking breaking wifi.

This commit adds the Lenovo Yoga 900 to the no_hw_rfkill dmi list, fixing
the wifi breakage.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1275490
Reported-and-tested-by: Kevin Fenzi <kevin@scrye.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/platform/x86/ideapad-laptop.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index cfc93618ebf1..964f83cc00c6 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -859,6 +859,13 @@ static struct dmi_system_id no_hw_rfkill_list[] = {
 			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 3 Pro-1370"),
 		},
 	},
+	{
+		.ident = "Lenovo Yoga 900",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 900"),
+		},
+	},
 	{}
 };
 

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

* [PATCH 3.16.y-ckt 076/126] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (74 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 075/126] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 077/126] KVM: x86: Defining missing x86 vectors Luis Henriques
                   ` (49 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, James Bottomley, Luis Henriques

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

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

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit 8cf308e1225f5f93575f03cc4dbef24516fa81c9 upstream.

Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag since we are not specifying
tags.  Without this, the qlogic driver doesn't work properly with storvsc.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/storvsc_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 3bb6646bb406..f9da66fa850b 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1610,8 +1610,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
 	vm_srb->win8_extension.time_out_value = 60;
 
 	vm_srb->win8_extension.srb_flags |=
-		(SRB_FLAGS_QUEUE_ACTION_ENABLE |
-		SRB_FLAGS_DISABLE_SYNCH_TRANSFER);
+		SRB_FLAGS_DISABLE_SYNCH_TRANSFER;
 
 	/* Build the SRB */
 	switch (scmnd->sc_data_direction) {

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

* [PATCH 3.16.y-ckt 077/126] KVM: x86: Defining missing x86 vectors
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (75 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 076/126] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 078/126] KVM: x86: work around infinite loop in microcode when #AC is delivered Luis Henriques
                   ` (48 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nadav Amit, Paolo Bonzini, Luis Henriques

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

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

From: Nadav Amit <namit@cs.technion.ac.il>

commit c9cdd085bb75226879fd468b88e2e7eb467325b7 upstream.

Defining XE, XM and VE vector numbers.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/uapi/asm/kvm.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index d3a87780c70b..d7dcef58aefa 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -23,7 +23,10 @@
 #define GP_VECTOR 13
 #define PF_VECTOR 14
 #define MF_VECTOR 16
+#define AC_VECTOR 17
 #define MC_VECTOR 18
+#define XM_VECTOR 19
+#define VE_VECTOR 20
 
 /* Select x86 specific features in <linux/kvm.h> */
 #define __KVM_HAVE_PIT

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

* [PATCH 3.16.y-ckt 078/126] KVM: x86: work around infinite loop in microcode when #AC is delivered
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (76 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 077/126] KVM: x86: Defining missing x86 vectors Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 079/126] KVM: svm: unconditionally intercept #DB Luis Henriques
                   ` (47 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Northup, Paolo Bonzini, Luis Henriques

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

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

From: Eric Northup <digitaleric@google.com>

commit 54a20552e1eae07aa240fa370a0293e006b5faed upstream.

It was found that a guest can DoS a host by triggering an infinite
stream of "alignment check" (#AC) exceptions.  This causes the
microcode to enter an infinite loop where the core never receives
another interrupt.  The host kernel panics pretty quickly due to the
effects (CVE-2015-5307).

Signed-off-by: Eric Northup <digitaleric@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/uapi/asm/svm.h | 1 +
 arch/x86/kvm/svm.c              | 8 ++++++++
 arch/x86/kvm/vmx.c              | 5 ++++-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/uapi/asm/svm.h b/arch/x86/include/uapi/asm/svm.h
index b5d7640abc5d..8a4add8e4639 100644
--- a/arch/x86/include/uapi/asm/svm.h
+++ b/arch/x86/include/uapi/asm/svm.h
@@ -100,6 +100,7 @@
 	{ SVM_EXIT_EXCP_BASE + UD_VECTOR,       "UD excp" }, \
 	{ SVM_EXIT_EXCP_BASE + PF_VECTOR,       "PF excp" }, \
 	{ SVM_EXIT_EXCP_BASE + NM_VECTOR,       "NM excp" }, \
+	{ SVM_EXIT_EXCP_BASE + AC_VECTOR,       "AC excp" }, \
 	{ SVM_EXIT_EXCP_BASE + MC_VECTOR,       "MC excp" }, \
 	{ SVM_EXIT_INTR,        "interrupt" }, \
 	{ SVM_EXIT_NMI,         "nmi" }, \
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 539f233965f1..9e59e2d6ba7f 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1103,6 +1103,7 @@ static void init_vmcb(struct vcpu_svm *svm)
 	set_exception_intercept(svm, PF_VECTOR);
 	set_exception_intercept(svm, UD_VECTOR);
 	set_exception_intercept(svm, MC_VECTOR);
+	set_exception_intercept(svm, AC_VECTOR);
 
 	set_intercept(svm, INTERCEPT_INTR);
 	set_intercept(svm, INTERCEPT_NMI);
@@ -1787,6 +1788,12 @@ static int ud_interception(struct vcpu_svm *svm)
 	return 1;
 }
 
+static int ac_interception(struct vcpu_svm *svm)
+{
+	kvm_queue_exception_e(&svm->vcpu, AC_VECTOR, 0);
+	return 1;
+}
+
 static void svm_fpu_activate(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
@@ -3327,6 +3334,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = {
 	[SVM_EXIT_EXCP_BASE + PF_VECTOR]	= pf_interception,
 	[SVM_EXIT_EXCP_BASE + NM_VECTOR]	= nm_interception,
 	[SVM_EXIT_EXCP_BASE + MC_VECTOR]	= mc_interception,
+	[SVM_EXIT_EXCP_BASE + AC_VECTOR]	= ac_interception,
 	[SVM_EXIT_INTR]				= intr_interception,
 	[SVM_EXIT_NMI]				= nmi_interception,
 	[SVM_EXIT_SMI]				= nop_on_interception,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0502753be5f0..d1d7086f0e9b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1467,7 +1467,7 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
 	u32 eb;
 
 	eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) |
-	     (1u << NM_VECTOR) | (1u << DB_VECTOR);
+	     (1u << NM_VECTOR) | (1u << DB_VECTOR) | (1u << AC_VECTOR);
 	if ((vcpu->guest_debug &
 	     (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) ==
 	    (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP))
@@ -4881,6 +4881,9 @@ static int handle_exception(struct kvm_vcpu *vcpu)
 		return handle_rmode_exception(vcpu, ex_no, error_code);
 
 	switch (ex_no) {
+	case AC_VECTOR:
+		kvm_queue_exception_e(vcpu, AC_VECTOR, error_code);
+		return 1;
 	case DB_VECTOR:
 		dr6 = vmcs_readl(EXIT_QUALIFICATION);
 		if (!(vcpu->guest_debug &

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

* [PATCH 3.16.y-ckt 079/126] KVM: svm: unconditionally intercept #DB
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (77 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 078/126] KVM: x86: work around infinite loop in microcode when #AC is delivered Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 080/126] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Luis Henriques
                   ` (46 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Luis Henriques

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

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

From: Paolo Bonzini <pbonzini@redhat.com>

commit cbdb967af3d54993f5814f1cee0ed311a055377d upstream.

This is needed to avoid the possibility that the guest triggers
an infinite stream of #DB exceptions (CVE-2015-8104).

VMX is not affected: because it does not save DR6 in the VMCS,
it already intercepts #DB unconditionally.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kvm/svm.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 9e59e2d6ba7f..d09bc3e7882c 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1104,6 +1104,7 @@ static void init_vmcb(struct vcpu_svm *svm)
 	set_exception_intercept(svm, UD_VECTOR);
 	set_exception_intercept(svm, MC_VECTOR);
 	set_exception_intercept(svm, AC_VECTOR);
+	set_exception_intercept(svm, DB_VECTOR);
 
 	set_intercept(svm, INTERCEPT_INTR);
 	set_intercept(svm, INTERCEPT_NMI);
@@ -1634,20 +1635,13 @@ static void svm_set_segment(struct kvm_vcpu *vcpu,
 	mark_dirty(svm->vmcb, VMCB_SEG);
 }
 
-static void update_db_bp_intercept(struct kvm_vcpu *vcpu)
+static void update_bp_intercept(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
-	clr_exception_intercept(svm, DB_VECTOR);
 	clr_exception_intercept(svm, BP_VECTOR);
 
-	if (svm->nmi_singlestep)
-		set_exception_intercept(svm, DB_VECTOR);
-
 	if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
-		if (vcpu->guest_debug &
-		    (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))
-			set_exception_intercept(svm, DB_VECTOR);
 		if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP)
 			set_exception_intercept(svm, BP_VECTOR);
 	} else
@@ -1753,7 +1747,6 @@ static int db_interception(struct vcpu_svm *svm)
 		if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP))
 			svm->vmcb->save.rflags &=
 				~(X86_EFLAGS_TF | X86_EFLAGS_RF);
-		update_db_bp_intercept(&svm->vcpu);
 	}
 
 	if (svm->vcpu.guest_debug &
@@ -3722,7 +3715,6 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
 	 */
 	svm->nmi_singlestep = true;
 	svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF);
-	update_db_bp_intercept(vcpu);
 }
 
 static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr)
@@ -4328,7 +4320,7 @@ static struct kvm_x86_ops svm_x86_ops = {
 	.vcpu_load = svm_vcpu_load,
 	.vcpu_put = svm_vcpu_put,
 
-	.update_db_bp_intercept = update_db_bp_intercept,
+	.update_db_bp_intercept = update_bp_intercept,
 	.get_msr = svm_get_msr,
 	.set_msr = svm_set_msr,
 	.get_segment_base = svm_get_segment_base,

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

* [PATCH 3.16.y-ckt 080/126] drivers: of: of_reserved_mem: fixup the alignment with CMA setup
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (78 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 079/126] KVM: svm: unconditionally intercept #DB Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 081/126] drm/ast: Initialized data needed to map fbdev memory Luis Henriques
                   ` (45 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jason Liu, Grant Likely, Rob Herring, Rob Herring, Luis Henriques

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

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

From: Jason Liu <r64343@freescale.com>

commit 1cc8e3458b5110253c8f5aaf1890d5ffea9bb7b7 upstream.

There is an alignment mismatch issue between the of_reserved_mem and
the CMA setup requirement. The of_reserved_mem will try to get the
alignment value from the DTS and pass it to __memblock_alloc_base to
do the memory block base allocation, but the alignment value specified
in the DTS may not satisfy the CAM setup requirement since CMA setup
required the alignment as the following in the code:

align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);

The sanity check in the function of rmem_cma_setup will fail if the
alignment does not setup correctly and thus CMA will fail to setup.

This patch is to fixup the alignment to meet the CMA setup required.

Mailing-list-thread: https://lkml.org/lkml/2015/11/9/138
Signed-off-by: Jason Liu <r64343@freescale.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/of/of_reserved_mem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 632aae861375..86f284f0960e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -123,6 +123,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
 		align = dt_mem_next_cell(dt_root_addr_cells, &prop);
 	}
 
+	/* Need adjust the alignment to satisfy the CMA requirement */
+	if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))
+		align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
+
 	prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
 	if (prop) {
 

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

* [PATCH 3.16.y-ckt 081/126] drm/ast: Initialized data needed to map fbdev memory
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (79 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 080/126] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 082/126] FS-Cache: Increase reference of parent after registering, netfs success Luis Henriques
                   ` (44 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Egbert Eich, Dave Airlie, Luis Henriques

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

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

From: Egbert Eich <eich@suse.de>

commit 28fb4cb7fa6f63dc2fbdb5f2564dcbead8e3eee0 upstream.

Due to a missing initialization there was no way to map fbdev memory.
Thus for example using the Xserver with the fbdev driver failed.
This fix adds initialization for fix.smem_start and fix.smem_len
in the fb_info structure, which fixes this problem.

Requested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Egbert Eich <eich@suse.de>
[pulled from SuSE tree by me - airlied]
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/ast/ast_drv.h  | 1 +
 drivers/gpu/drm/ast/ast_fb.c   | 7 +++++++
 drivers/gpu/drm/ast/ast_main.c | 1 +
 drivers/gpu/drm/ast/ast_mode.c | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 5d6a87573c33..7a49bd9fdacc 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -310,6 +310,7 @@ int ast_framebuffer_init(struct drm_device *dev,
 int ast_fbdev_init(struct drm_device *dev);
 void ast_fbdev_fini(struct drm_device *dev);
 void ast_fbdev_set_suspend(struct drm_device *dev, int state);
+void ast_fbdev_set_base(struct ast_private *ast, unsigned long gpu_addr);
 
 struct ast_bo {
 	struct ttm_buffer_object bo;
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index a28640f47c27..b55b6b1c9fe2 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -367,3 +367,10 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state)
 
 	fb_set_suspend(ast->fbdev->helper.fbdev, state);
 }
+
+void ast_fbdev_set_base(struct ast_private *ast, unsigned long gpu_addr)
+{
+	ast->fbdev->helper.fbdev->fix.smem_start =
+		ast->fbdev->helper.fbdev->apertures->ranges[0].base + gpu_addr;
+	ast->fbdev->helper.fbdev->fix.smem_len = ast->vram_size - gpu_addr;
+}
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index b792194e0d9c..0dfefbf929a3 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -385,6 +385,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)
 	dev->mode_config.min_height = 0;
 	dev->mode_config.preferred_depth = 24;
 	dev->mode_config.prefer_shadow = 1;
+	dev->mode_config.fb_base = pci_resource_start(ast->dev->pdev, 0);
 
 	if (ast->chip == AST2100 ||
 	    ast->chip == AST2200 ||
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 1550d80ea2bc..d7e615282d38 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -522,6 +522,8 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
 		ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
 		if (ret)
 			DRM_ERROR("failed to kmap fbcon\n");
+		else
+			ast_fbdev_set_base(ast, gpu_addr);
 	}
 	ast_bo_unreserve(bo);
 

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

* [PATCH 3.16.y-ckt 082/126] FS-Cache: Increase reference of parent after registering, netfs success
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (80 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 081/126] drm/ast: Initialized data needed to map fbdev memory Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 083/126] FS-Cache: Don't override netfs's primary_index if registering failed Luis Henriques
                   ` (43 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kinglong Mee, David Howells, Al Viro, Luis Henriques

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

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

From: Kinglong Mee <kinglongmee@gmail.com>

commit 86108c2e34a26e4bec3c6ddb23390bf8cedcf391 upstream.

If netfs exist, fscache should not increase the reference of parent's
usage and n_children, otherwise, never be decreased.

v2: thanks David's suggest,
 move increasing reference of parent if success
 use kmem_cache_free() freeing primary_index directly

v3: don't move "netfs->primary_index->parent = &fscache_fsdef_index;"

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/fscache/netfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/fscache/netfs.c b/fs/fscache/netfs.c
index 6d941f56faf4..458cc968d9a0 100644
--- a/fs/fscache/netfs.c
+++ b/fs/fscache/netfs.c
@@ -47,9 +47,6 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 	netfs->primary_index->netfs_data	= netfs;
 	netfs->primary_index->flags		= 1 << FSCACHE_COOKIE_ENABLED;
 
-	atomic_inc(&netfs->primary_index->parent->usage);
-	atomic_inc(&netfs->primary_index->parent->n_children);
-
 	spin_lock_init(&netfs->primary_index->lock);
 	INIT_HLIST_HEAD(&netfs->primary_index->backing_objects);
 
@@ -62,6 +59,9 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 			goto already_registered;
 	}
 
+	atomic_inc(&netfs->primary_index->parent->usage);
+	atomic_inc(&netfs->primary_index->parent->n_children);
+
 	list_add(&netfs->link, &fscache_netfs_list);
 	ret = 0;
 
@@ -71,8 +71,7 @@ already_registered:
 	up_write(&fscache_addremove_sem);
 
 	if (ret < 0) {
-		netfs->primary_index->parent = NULL;
-		__fscache_cookie_put(netfs->primary_index);
+		kmem_cache_free(fscache_cookie_jar, netfs->primary_index);
 		netfs->primary_index = NULL;
 	}
 

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

* [PATCH 3.16.y-ckt 083/126] FS-Cache: Don't override netfs's primary_index if registering failed
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (81 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 082/126] FS-Cache: Increase reference of parent after registering, netfs success Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 084/126] binfmt_elf: Don't clobber passed executable's file header Luis Henriques
                   ` (42 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kinglong Mee, David Howells, Al Viro, Luis Henriques

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

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

From: Kinglong Mee <kinglongmee@gmail.com>

commit b130ed5998e62879a66bad08931a2b5e832da95c upstream.

Only override netfs->primary_index when registering success.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/fscache/netfs.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/fs/fscache/netfs.c b/fs/fscache/netfs.c
index 458cc968d9a0..9b28649df3a1 100644
--- a/fs/fscache/netfs.c
+++ b/fs/fscache/netfs.c
@@ -22,6 +22,7 @@ static LIST_HEAD(fscache_netfs_list);
 int __fscache_register_netfs(struct fscache_netfs *netfs)
 {
 	struct fscache_netfs *ptr;
+	struct fscache_cookie *cookie;
 	int ret;
 
 	_enter("{%s}", netfs->name);
@@ -29,26 +30,25 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 	INIT_LIST_HEAD(&netfs->link);
 
 	/* allocate a cookie for the primary index */
-	netfs->primary_index =
-		kmem_cache_zalloc(fscache_cookie_jar, GFP_KERNEL);
+	cookie = kmem_cache_zalloc(fscache_cookie_jar, GFP_KERNEL);
 
-	if (!netfs->primary_index) {
+	if (!cookie) {
 		_leave(" = -ENOMEM");
 		return -ENOMEM;
 	}
 
 	/* initialise the primary index cookie */
-	atomic_set(&netfs->primary_index->usage, 1);
-	atomic_set(&netfs->primary_index->n_children, 0);
-	atomic_set(&netfs->primary_index->n_active, 1);
+	atomic_set(&cookie->usage, 1);
+	atomic_set(&cookie->n_children, 0);
+	atomic_set(&cookie->n_active, 1);
 
-	netfs->primary_index->def		= &fscache_fsdef_netfs_def;
-	netfs->primary_index->parent		= &fscache_fsdef_index;
-	netfs->primary_index->netfs_data	= netfs;
-	netfs->primary_index->flags		= 1 << FSCACHE_COOKIE_ENABLED;
+	cookie->def		= &fscache_fsdef_netfs_def;
+	cookie->parent		= &fscache_fsdef_index;
+	cookie->netfs_data	= netfs;
+	cookie->flags		= 1 << FSCACHE_COOKIE_ENABLED;
 
-	spin_lock_init(&netfs->primary_index->lock);
-	INIT_HLIST_HEAD(&netfs->primary_index->backing_objects);
+	spin_lock_init(&cookie->lock);
+	INIT_HLIST_HEAD(&cookie->backing_objects);
 
 	/* check the netfs type is not already present */
 	down_write(&fscache_addremove_sem);
@@ -59,9 +59,10 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 			goto already_registered;
 	}
 
-	atomic_inc(&netfs->primary_index->parent->usage);
-	atomic_inc(&netfs->primary_index->parent->n_children);
+	atomic_inc(&cookie->parent->usage);
+	atomic_inc(&cookie->parent->n_children);
 
+	netfs->primary_index = cookie;
 	list_add(&netfs->link, &fscache_netfs_list);
 	ret = 0;
 
@@ -70,10 +71,8 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 already_registered:
 	up_write(&fscache_addremove_sem);
 
-	if (ret < 0) {
-		kmem_cache_free(fscache_cookie_jar, netfs->primary_index);
-		netfs->primary_index = NULL;
-	}
+	if (ret < 0)
+		kmem_cache_free(fscache_cookie_jar, cookie);
 
 	_leave(" = %d", ret);
 	return ret;

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

* [PATCH 3.16.y-ckt 084/126] binfmt_elf: Don't clobber passed executable's file header
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (82 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 083/126] FS-Cache: Don't override netfs's primary_index if registering failed Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 085/126] fs/pipe.c: return error code rather than 0 in pipe_write() Luis Henriques
                   ` (41 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maciej W. Rozycki, Al Viro, Luis Henriques

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

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

From: "Maciej W. Rozycki" <macro@imgtec.com>

commit b582ef5c53040c5feef4c96a8f9585b6831e2441 upstream.

Do not clobber the buffer space passed from `search_binary_handler' and
originally preloaded by `prepare_binprm' with the executable's file
header by overwriting it with its interpreter's file header.  Instead
keep the buffer space intact and directly use the data structure locally
allocated for the interpreter's file header, fixing a bug introduced in
2.1.14 with loadable module support (linux-mips.org commit beb11695
[Import of Linux/MIPS 2.1.14], predating kernel.org repo's history).
Adjust the amount of data read from the interpreter's file accordingly.

This was not an issue before loadable module support, because back then
`load_elf_binary' was executed only once for a given ELF executable,
whether the function succeeded or failed.

With loadable module support supported and enabled, upon a failure of
`load_elf_binary' -- which may for example be caused by architecture
code rejecting an executable due to a missing hardware feature requested
in the file header -- a module load is attempted and then the function
reexecuted by `search_binary_handler'.  With the executable's file
header replaced with its interpreter's file header the executable can
then be erroneously accepted in this subsequent attempt.

Signed-off-by: Maciej W. Rozycki <macro@imgtec.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/binfmt_elf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index c13a138c1016..57464b34d153 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -683,16 +683,16 @@ static int load_elf_binary(struct linux_binprm *bprm)
 			 */
 			would_dump(bprm, interpreter);
 
-			retval = kernel_read(interpreter, 0, bprm->buf,
-					     BINPRM_BUF_SIZE);
-			if (retval != BINPRM_BUF_SIZE) {
+			/* Get the exec headers */
+			retval = kernel_read(interpreter, 0,
+					     (void *)&loc->interp_elf_ex,
+					     sizeof(loc->interp_elf_ex));
+			if (retval != sizeof(loc->interp_elf_ex)) {
 				if (retval >= 0)
 					retval = -EIO;
 				goto out_free_dentry;
 			}
 
-			/* Get the exec headers */
-			loc->interp_elf_ex = *((struct elfhdr *)bprm->buf);
 			break;
 		}
 		elf_ppnt++;

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

* [PATCH 3.16.y-ckt 085/126] fs/pipe.c: return error code rather than 0 in pipe_write()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (83 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 084/126] binfmt_elf: Don't clobber passed executable's file header Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 086/126] splice: sendfile() at once fails for big files Luis Henriques
                   ` (40 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric Biggers, Al Viro, Luis Henriques

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

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

From: Eric Biggers <ebiggers3@gmail.com>

commit 6ae08069939f17422835448acae76bda8d96b16a upstream.

pipe_write() would return 0 if it failed to merge the beginning of the
data to write with the last, partially filled pipe buffer.  It should
return an error code instead.  Userspace programs could be confused by
write() returning 0 when called with a nonzero 'count'.

The EFAULT error case was a regression from f0d1bec9d5 ("new helper:
copy_page_from_iter()"), while the ops->confirm() error case was a much
older bug.

Test program:

	#include <assert.h>
	#include <errno.h>
	#include <unistd.h>

	int main(void)
	{
		int fd[2];
		char data[1] = {0};

		assert(0 == pipe(fd));
		assert(1 == write(fd[1], data, 1));

		/* prior to this patch, write() returned 0 here  */
		assert(-1 == write(fd[1], NULL, 1));
		assert(errno == EFAULT);
	}

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/pipe.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/pipe.c b/fs/pipe.c
index 21981e58e2a6..6c856a155530 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -367,18 +367,17 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
 		int offset = buf->offset + buf->len;
 
 		if (ops->can_merge && offset + chars <= PAGE_SIZE) {
-			int error = ops->confirm(pipe, buf);
-			if (error)
+			ret = ops->confirm(pipe, buf);
+			if (ret)
 				goto out;
 
 			ret = copy_page_from_iter(buf->page, offset, chars, from);
 			if (unlikely(ret < chars)) {
-				error = -EFAULT;
+				ret = -EFAULT;
 				goto out;
 			}
 			do_wakeup = 1;
-			buf->len += chars;
-			ret = chars;
+			buf->len += ret;
 			if (!iov_iter_count(from))
 				goto out;
 		}

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

* [PATCH 3.16.y-ckt 086/126] splice: sendfile() at once fails for big files
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (84 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 085/126] fs/pipe.c: return error code rather than 0 in pipe_write() Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 087/126] mac80211: fix driver RSSI event calculations Luis Henriques
                   ` (39 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christophe Leroy, Jens Axboe, Ben Hutchings, Luis Henriques

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

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

From: Christophe Leroy <christophe.leroy@c-s.fr>

commit 0ff28d9f4674d781e492bcff6f32f0fe48cf0fed upstream.

Using sendfile with below small program to get MD5 sums of some files,
it appear that big files (over 64kbytes with 4k pages system) get a
wrong MD5 sum while small files get the correct sum.
This program uses sendfile() to send a file to an AF_ALG socket
for hashing.

/* md5sum2.c */

int main(int argc, char **argv)
{
	int sk = socket(AF_ALG, SOCK_SEQPACKET, 0);
	struct stat st;
	struct sockaddr_alg sa = {
		.salg_family = AF_ALG,
		.salg_type = "hash",
		.salg_name = "md5",
	};
	int n;

	bind(sk, (struct sockaddr*)&sa, sizeof(sa));

	for (n = 1; n < argc; n++) {
		int size;
		int offset = 0;
		char buf[4096];
		int fd;
		int sko;
		int i;

		fd = open(argv[n], O_RDONLY);
		sko = accept(sk, NULL, 0);
		fstat(fd, &st);
		size = st.st_size;
		sendfile(sko, fd, &offset, size);
		size = read(sko, buf, sizeof(buf));
		for (i = 0; i < size; i++)
			printf("%2.2x", buf[i]);
		printf("  %s\n", argv[n]);
		close(fd);
		close(sko);
	}
	exit(0);
}

Test below is done using official linux patch files. First result is
with a software based md5sum. Second result is with the program above.

root@vgoip:~# ls -l patch-3.6.*
-rw-r--r--    1 root     root         64011 Aug 24 12:01 patch-3.6.2.gz
-rw-r--r--    1 root     root         94131 Aug 24 12:01 patch-3.6.3.gz

root@vgoip:~# md5sum patch-3.6.*
b3ffb9848196846f31b2ff133d2d6443  patch-3.6.2.gz
c5e8f687878457db77cb7158c38a7e43  patch-3.6.3.gz

root@vgoip:~# ./md5sum2 patch-3.6.*
b3ffb9848196846f31b2ff133d2d6443  patch-3.6.2.gz
5fd77b24e68bb24dcc72d6e57c64790e  patch-3.6.3.gz

After investivation, it appears that sendfile() sends the files by blocks
of 64kbytes (16 times PAGE_SIZE). The problem is that at the end of each
block, the SPLICE_F_MORE flag is missing, therefore the hashing operation
is reset as if it was the end of the file.

This patch adds SPLICE_F_MORE to the flags when more data is pending.

With the patch applied, we get the correct sums:

root@vgoip:~# md5sum patch-3.6.*
b3ffb9848196846f31b2ff133d2d6443  patch-3.6.2.gz
c5e8f687878457db77cb7158c38a7e43  patch-3.6.3.gz

root@vgoip:~# ./md5sum2 patch-3.6.*
b3ffb9848196846f31b2ff133d2d6443  patch-3.6.2.gz
c5e8f687878457db77cb7158c38a7e43  patch-3.6.3.gz

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Jens Axboe <axboe@fb.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/splice.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/splice.c b/fs/splice.c
index f5cb9ba84510..92acf7074d45 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1174,7 +1174,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 	long ret, bytes;
 	umode_t i_mode;
 	size_t len;
-	int i, flags;
+	int i, flags, more;
 
 	/*
 	 * We require the input being a regular file, as we don't want to
@@ -1217,6 +1217,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 	 * Don't block on output, we have to drain the direct pipe.
 	 */
 	sd->flags &= ~SPLICE_F_NONBLOCK;
+	more = sd->flags & SPLICE_F_MORE;
 
 	while (len) {
 		size_t read_len;
@@ -1230,6 +1231,15 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 		sd->total_len = read_len;
 
 		/*
+		 * If more data is pending, set SPLICE_F_MORE
+		 * If this is the last data and SPLICE_F_MORE was not set
+		 * initially, clears it.
+		 */
+		if (read_len < len)
+			sd->flags |= SPLICE_F_MORE;
+		else if (!more)
+			sd->flags &= ~SPLICE_F_MORE;
+		/*
 		 * NOTE: nonblocking mode only applies to the input. We
 		 * must not do the output in nonblocking mode as then we
 		 * could get stuck data in the internal pipe:

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

* [PATCH 3.16.y-ckt 087/126] mac80211: fix driver RSSI event calculations
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (85 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 086/126] splice: sendfile() at once fails for big files Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 088/126] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Luis Henriques
                   ` (38 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Luis Henriques

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

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

From: Johannes Berg <johannes.berg@intel.com>

commit 8ec6d97871f37e4743678ea4a455bd59580aa0f4 upstream.

The ifmgd->ave_beacon_signal value cannot be taken as is for
comparisons, it must be divided by since it's represented
like that for better accuracy of the EWMA calculations. This
would lead to invalid driver RSSI events. Fix the used value.

Fixes: 615f7b9bb1f8 ("mac80211: add driver RSSI threshold events")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/mac80211/mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a59a78b6923d..db469ec12387 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2978,7 +2978,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 
 	if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold &&
 	    ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) {
-		int sig = ifmgd->ave_beacon_signal;
+		int sig = ifmgd->ave_beacon_signal / 16;
 		int last_sig = ifmgd->last_ave_beacon_signal;
 
 		/*

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

* [PATCH 3.16.y-ckt 088/126] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (86 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 087/126] mac80211: fix driver RSSI event calculations Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 089/126] mwifiex: fix mwifiex_rdeeprom_read() Luis Henriques
                   ` (37 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Valentin Rothberg, Sebastian Reichel, Luis Henriques

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

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

From: Valentin Rothberg <valentinrothberg@gmail.com>

commit 90adf98d9530054b8e665ba5a928de4307231d84 upstream.

Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.

scripts/coccinelle/misc/irqf_oneshot.cocci detected this issue.

Fixes: b5874f33bbaf ("wm831x_power: Use genirq")
Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/power/wm831x_power.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c
index 3bed2f55cf7d..3ccadf631d45 100644
--- a/drivers/power/wm831x_power.c
+++ b/drivers/power/wm831x_power.c
@@ -567,7 +567,7 @@ static int wm831x_power_probe(struct platform_device *pdev)
 
 	irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO"));
 	ret = request_threaded_irq(irq, NULL, wm831x_syslo_irq,
-				   IRQF_TRIGGER_RISING, "System power low",
+				   IRQF_TRIGGER_RISING | IRQF_ONESHOT, "System power low",
 				   power);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "Failed to request SYSLO IRQ %d: %d\n",
@@ -577,7 +577,7 @@ static int wm831x_power_probe(struct platform_device *pdev)
 
 	irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC"));
 	ret = request_threaded_irq(irq, NULL, wm831x_pwr_src_irq,
-				   IRQF_TRIGGER_RISING, "Power source",
+				   IRQF_TRIGGER_RISING | IRQF_ONESHOT, "Power source",
 				   power);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "Failed to request PWR SRC IRQ %d: %d\n",
@@ -590,7 +590,7 @@ static int wm831x_power_probe(struct platform_device *pdev)
 				 platform_get_irq_byname(pdev,
 							 wm831x_bat_irqs[i]));
 		ret = request_threaded_irq(irq, NULL, wm831x_bat_irq,
-					   IRQF_TRIGGER_RISING,
+					   IRQF_TRIGGER_RISING | IRQF_ONESHOT,
 					   wm831x_bat_irqs[i],
 					   power);
 		if (ret != 0) {

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

* [PATCH 3.16.y-ckt 089/126] mwifiex: fix mwifiex_rdeeprom_read()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (87 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 088/126] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 090/126] dmaengine: dw: convert to __ffs() Luis Henriques
                   ` (36 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Kalle Valo, Luis Henriques

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

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

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

commit 1f9c6e1bc1ba5f8a10fcd6e99d170954d7c6d382 upstream.

There were several bugs here.

1)  The done label was in the wrong place so we didn't copy any
    information out when there was no command given.

2)  We were using PAGE_SIZE as the size of the buffer instead of
    "PAGE_SIZE - pos".

3)  snprintf() returns the number of characters that would have been
    printed if there were enough space.  If there was not enough space
    (and we had fixed the memory corruption bug #2) then it would result
    in an information leak when we do simple_read_from_buffer().  I've
    changed it to use scnprintf() instead.

I also removed the initialization at the start of the function, because
I thought it made the code a little more clear.

Fixes: 5e6e3a92b9a4 ('wireless: mwifiex: initial commit for Marvell mwifiex driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/mwifiex/debugfs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
index 7b419bbcd544..147250696181 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -660,7 +660,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
 		(struct mwifiex_private *) file->private_data;
 	unsigned long addr = get_zeroed_page(GFP_KERNEL);
 	char *buf = (char *) addr;
-	int pos = 0, ret = 0, i;
+	int pos, ret, i;
 	u8 value[MAX_EEPROM_DATA];
 
 	if (!buf)
@@ -668,7 +668,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
 
 	if (saved_offset == -1) {
 		/* No command has been given */
-		pos += snprintf(buf, PAGE_SIZE, "0");
+		pos = snprintf(buf, PAGE_SIZE, "0");
 		goto done;
 	}
 
@@ -677,17 +677,17 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
 				  (u16) saved_bytes, value);
 	if (ret) {
 		ret = -EINVAL;
-		goto done;
+		goto out_free;
 	}
 
-	pos += snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes);
+	pos = snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes);
 
 	for (i = 0; i < saved_bytes; i++)
-		pos += snprintf(buf + strlen(buf), PAGE_SIZE, "%d ", value[i]);
-
-	ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
+		pos += scnprintf(buf + pos, PAGE_SIZE - pos, "%d ", value[i]);
 
 done:
+	ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
+out_free:
 	free_page(addr);
 	return ret;
 }

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

* [PATCH 3.16.y-ckt 090/126] dmaengine: dw: convert to __ffs()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (88 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 089/126] mwifiex: fix mwifiex_rdeeprom_read() Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 091/126] usb: ehci-orion: fix probe for !GENERIC_PHY Luis Henriques
                   ` (35 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Shevchenko, Vinod Koul, Luis Henriques

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

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

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit 39416677b95bf1ab8bbfa229ec7e511c96ad5d0c upstream.

We replace __fls() by __ffs() since we have to find a *minimum* data width that
satisfies both source and destination.

While here, rename dwc_fast_fls() to dwc_fast_ffs() which it really is.

Fixes: 4c2d56c574db (dw_dmac: introduce dwc_fast_fls())
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/dma/dw/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index a1315dd54514..b37d58f4cc93 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -176,7 +176,7 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
 
 /*----------------------------------------------------------------------*/
 
-static inline unsigned int dwc_fast_fls(unsigned long long v)
+static inline unsigned int dwc_fast_ffs(unsigned long long v)
 {
 	/*
 	 * We can be a lot more clever here, but this should take care
@@ -720,7 +720,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 			   dw->data_width[dwc->dst_master]);
 
 	src_width = dst_width = min_t(unsigned int, data_width,
-				      dwc_fast_fls(src | dest | len));
+				      dwc_fast_ffs(src | dest | len));
 
 	ctllo = DWC_DEFAULT_CTLLO(chan)
 			| DWC_CTLL_DST_WIDTH(dst_width)
@@ -799,7 +799,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 
 	switch (direction) {
 	case DMA_MEM_TO_DEV:
-		reg_width = __fls(sconfig->dst_addr_width);
+		reg_width = __ffs(sconfig->dst_addr_width);
 		reg = sconfig->dst_addr;
 		ctllo = (DWC_DEFAULT_CTLLO(chan)
 				| DWC_CTLL_DST_WIDTH(reg_width)
@@ -819,7 +819,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 			len = sg_dma_len(sg);
 
 			mem_width = min_t(unsigned int,
-					  data_width, dwc_fast_fls(mem | len));
+					  data_width, dwc_fast_ffs(mem | len));
 
 slave_sg_todev_fill_desc:
 			desc = dwc_desc_get(dwc);
@@ -859,7 +859,7 @@ slave_sg_todev_fill_desc:
 		}
 		break;
 	case DMA_DEV_TO_MEM:
-		reg_width = __fls(sconfig->src_addr_width);
+		reg_width = __ffs(sconfig->src_addr_width);
 		reg = sconfig->src_addr;
 		ctllo = (DWC_DEFAULT_CTLLO(chan)
 				| DWC_CTLL_SRC_WIDTH(reg_width)
@@ -879,7 +879,7 @@ slave_sg_todev_fill_desc:
 			len = sg_dma_len(sg);
 
 			mem_width = min_t(unsigned int,
-					  data_width, dwc_fast_fls(mem | len));
+					  data_width, dwc_fast_ffs(mem | len));
 
 slave_sg_fromdev_fill_desc:
 			desc = dwc_desc_get(dwc);

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

* [PATCH 3.16.y-ckt 091/126] usb: ehci-orion: fix probe for !GENERIC_PHY
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (89 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 090/126] dmaengine: dw: convert to __ffs() Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 092/126] devres: fix a for loop bounds check Luis Henriques
                   ` (34 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jonas Gorski, Greg Kroah-Hartman, Luis Henriques

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

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

From: Jonas Gorski <jogo@openwrt.org>

commit db1319e166c5e872c4be54eac4e47454133708cf upstream.

Commit d445913ce0ab7f ("usb: ehci-orion: add optional PHY support")
added support for optional phys, but devm_phy_optional_get returns
-ENOSYS if GENERIC_PHY is not enabled.

This causes probe failures, even when there are no phys specified:

[    1.443365] orion-ehci f1058000.usb: init f1058000.usb fail, -38
[    1.449403] orion-ehci: probe of f1058000.usb failed with error -38

Similar to dwc3, treat -ENOSYS as no phy.

Fixes: d445913ce0ab7f ("usb: ehci-orion: add optional PHY support")

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/ehci-orion.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 22e15cab8ea5..8de069abd15e 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -226,7 +226,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
 	priv->phy = devm_phy_optional_get(&pdev->dev, "usb");
 	if (IS_ERR(priv->phy)) {
 		err = PTR_ERR(priv->phy);
-		goto err_phy_get;
+		if (err != -ENOSYS)
+			goto err_phy_get;
 	} else {
 		err = phy_init(priv->phy);
 		if (err)

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

* [PATCH 3.16.y-ckt 092/126] devres: fix a for loop bounds check
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (90 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 091/126] usb: ehci-orion: fix probe for !GENERIC_PHY Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 093/126] netfilter: remove dead code Luis Henriques
                   ` (33 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit 1f35d04a02a652f14566f875aef3a6f2af4cb77b upstream.

The iomap[] array has PCIM_IOMAP_MAX (6) elements and not
DEVICE_COUNT_RESOURCE (16).  This bug was found using a static checker.
It may be that the "if (!(mask & (1 << i)))" check means we never
actually go past the end of the array in real life.

Fixes: ec04b075843d ('iomap: implement pcim_iounmap_regions()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 lib/devres.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/devres.c b/lib/devres.c
index f562bf6ff71d..eaa04de41e42 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -425,7 +425,7 @@ void pcim_iounmap_regions(struct pci_dev *pdev, int mask)
 	if (!iomap)
 		return;
 
-	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
+	for (i = 0; i < PCIM_IOMAP_MAX; i++) {
 		if (!(mask & (1 << i)))
 			continue;
 

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

* [PATCH 3.16.y-ckt 093/126] netfilter: remove dead code
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (91 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 092/126] devres: fix a for loop bounds check Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 094/126] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk Luis Henriques
                   ` (32 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Flavio Leitner, Pablo Neira Ayuso, Luis Henriques

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

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

From: Flavio Leitner <fbl@sysclose.org>

commit 0647e708344f4bf8b9e3f1855361c597f93d084d upstream.

Remove __nf_conntrack_find() from headers.

Fixes: dcd93ed4cd1 ("netfilter: nf_conntrack: remove dead code")
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/net/netfilter/nf_conntrack.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 37252f71a380..5c53572b5f0d 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -181,10 +181,6 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
 
 void nf_ct_free_hashtable(void *hash, unsigned int size);
 
-struct nf_conntrack_tuple_hash *
-__nf_conntrack_find(struct net *net, u16 zone,
-		    const struct nf_conntrack_tuple *tuple);
-
 int nf_conntrack_hash_check_insert(struct nf_conn *ct);
 bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report);
 

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

* [PATCH 3.16.y-ckt 094/126] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (92 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 093/126] netfilter: remove dead code Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 095/126] packet: fix match_fanout_group() Luis Henriques
                   ` (31 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Luis Henriques

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

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

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 850dcc4d4dd7d5da5c1b2a780c5e649c3b649545 upstream.

After a packet has been encapsulated by a tunnel we should use the
tunnel sockets local multicast loopback flag to control if the
encapsulated packet should be locally loopback back.

Pass sk into ip_local_out_sk so that in the rare case we are dealing
with a tunneled packet whose tunnel destination address is a multicast
address the kernel properly decides to loopback this packet.

In practice I don't think this matters as ip_queue_xmit is used by
tcp, l2tp and sctp none of which I am aware of uses ip level
multicasting as they are all point to point communications protocols.
Let's fix this before someone uses ip_queue_xmit for a tunnel protocol
that does use multicast.

Fixes: aad88724c9d5 ("ipv4: add a sock pointer to dst->output() path.")
Fixes: b0270e91014d ("ipv4: add a sock pointer to ip_queue_xmit()")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/ip_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index fead914b09f6..d91fda8257bc 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -436,7 +436,7 @@ packet_routed:
 	skb->priority = sk->sk_priority;
 	skb->mark = sk->sk_mark;
 
-	res = ip_local_out(skb);
+	res = ip_local_out_sk(sk, skb);
 	rcu_read_unlock();
 	return res;
 

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

* [PATCH 3.16.y-ckt 095/126] packet: fix match_fanout_group()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (93 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 094/126] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 096/126] hsi: fix double kfree Luis Henriques
                   ` (30 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Willem de Bruijn, Eric Leblond, David S. Miller,
	Luis Henriques

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

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

From: Eric Dumazet <edumazet@google.com>

commit 161642e24fee40fba2c5bc2ceacc00d118a22d65 upstream.

Recent TCP listener patches exposed a prior af_packet bug :
match_fanout_group() blindly assumes it is always safe
to cast sk to a packet socket to compare fanout with af_packet_priv

But SYNACK packets can be sent while attached to request_sock, which
are smaller than a "struct sock".

We can read non existent memory and crash.

Fixes: c0de08d04215 ("af_packet: don't emit packet on orig fanout group")
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Eric Leblond <eric@regit.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/packet/af_packet.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e6bd6df9e2a2..1f618bbce0ac 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1412,10 +1412,10 @@ static void __fanout_unlink(struct sock *sk, struct packet_sock *po)
 
 static bool match_fanout_group(struct packet_type *ptype, struct sock *sk)
 {
-	if (ptype->af_packet_priv == (void *)((struct packet_sock *)sk)->fanout)
-		return true;
+	if (sk->sk_family != PF_PACKET)
+		return false;
 
-	return false;
+	return ptype->af_packet_priv == pkt_sk(sk)->fanout;
 }
 
 static int fanout_add(struct sock *sk, u16 id, u16 type_flags)

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

* [PATCH 3.16.y-ckt 096/126] hsi: fix double kfree
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (94 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 095/126] packet: fix match_fanout_group() Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 097/126] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined Luis Henriques
                   ` (29 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Geliang Tang, Sebastian Reichel, Luis Henriques

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

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

From: Geliang Tang <geliangtang@163.com>

commit f098a045350ecd6045f2f2d5a50fecf2a98962d7 upstream.

When device_register() fails, kfree() is called in hsi_client_release(),
hence there is no need to call kfree in err3 again.

Fixes: a2aa24734d9db ("HSI: Add common DT binding for HSI client devices")
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hsi/hsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c
index fe9371271ce2..35d631e91908 100644
--- a/drivers/hsi/hsi.c
+++ b/drivers/hsi/hsi.c
@@ -300,7 +300,6 @@ static void hsi_add_client_from_dt(struct hsi_port *port,
 	if (device_register(&cl->device) < 0) {
 		pr_err("hsi: failed to register client: %s\n", name);
 		put_device(&cl->device);
-		goto err3;
 	}
 
 	return;

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

* [PATCH 3.16.y-ckt 097/126] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined.
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (95 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 096/126] hsi: fix double kfree Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 098/126] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode Luis Henriques
                   ` (28 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roger Quadros, Sebastian Reichel, Luis Henriques

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

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

From: Roger Quadros <rogerq@ti.com>

commit e74eba049356fdad6713ab66322d9aeb0e85608b upstream.

The error handling path is broken as cawake_gpio was defined as
unsigned integer causing the following warnings on boards that don't
use SSI port and so don't have cawake_gpio defined. e.g. beagleboard C4.

[   30.094635] WARNING: CPU: 0 PID: 322 at drivers/gpio/gpiolib.c:86 gpio_to_desc+0xa4/0xb8()
[   30.103363] invalid GPIO -2
[   30.106292] Modules linked in: omap_ssi_port(+) cpufreq_dt cfbfillrect cfbimgblt leds_gpio cfbcopyarea thermal_sys led_class hwmon gpio_keys encoder_tfp410 connector_analog_tv connector_dvi omap_hdq snd phy_i
[   30.145477] CPU: 0 PID: 322 Comm: modprobe Not tainted 4.3.0-rc4-00030-gca978c0-dirty #335
[   30.154174] Hardware name: Generic OMAP3-GP (Flattened Device Tree)
[   30.160827] [<c0016ef4>] (unwind_backtrace) from [<c00131f4>] (show_stack+0x10/0x14)
[   30.168975] [<c00131f4>] (show_stack) from [<c033cf08>] (dump_stack+0x80/0x9c)
[   30.176635] [<c033cf08>] (dump_stack) from [<c003e920>] (warn_slowpath_common+0x7c/0xb8)
[   30.185180] [<c003e920>] (warn_slowpath_common) from [<c003e9f0>] (warn_slowpath_fmt+0x30/0x40)
[   30.194366] [<c003e9f0>] (warn_slowpath_fmt) from [<c0376314>] (gpio_to_desc+0xa4/0xb8)
[   30.202819] [<c0376314>] (gpio_to_desc) from [<c0376ac8>] (gpio_request_one+0x14/0x11c)
[   30.211273] [<c0376ac8>] (gpio_request_one) from [<c037370c>] (devm_gpio_request_one+0x3c/0x78)
[   30.220458] [<c037370c>] (devm_gpio_request_one) from [<bf184210>] (ssi_port_probe+0x118/0x504 [omap_ssi_port])
[   30.231170] [<bf184210>] (ssi_port_probe [omap_ssi_port]) from [<c03d4cfc>] (platform_drv_probe+0x48/0xa4)
[   30.241424] [<c03d4cfc>] (platform_drv_probe) from [<c03d3678>] (driver_probe_device+0x1dc/0x2a0)
[   30.250793] [<c03d3678>] (driver_probe_device) from [<c03d37d0>] (__driver_attach+0x94/0x98)
[   30.259643] [<c03d37d0>] (__driver_attach) from [<c03d1d60>] (bus_for_each_dev+0x54/0x88)
[   30.268249] [<c03d1d60>] (bus_for_each_dev) from [<c03d2d50>] (bus_add_driver+0xe8/0x1f8)
[   30.276916] [<c03d2d50>] (bus_add_driver) from [<c03d4118>] (driver_register+0x78/0xf4)
[   30.285369] [<c03d4118>] (driver_register) from [<c03d5380>] (__platform_driver_probe+0x34/0xd8)
[   30.294647] [<c03d5380>] (__platform_driver_probe) from [<c00097e4>] (do_one_initcall+0x80/0x1d8)
[   30.303985] [<c00097e4>] (do_one_initcall) from [<c011617c>] (do_init_module+0x5c/0x1cc)
[   30.312561] [<c011617c>] (do_init_module) from [<c00c7a68>] (load_module+0x18c8/0x1f0c)
[   30.320983] [<c00c7a68>] (load_module) from [<c00c8188>] (SyS_init_module+0xdc/0x150)
[   30.329223] [<c00c8188>] (SyS_init_module) from [<c000f7e0>] (ret_fast_syscall+0x0/0x1c)

Fixes: b209e047bc743 ("HSI: Introduce OMAP SSI driver")
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hsi/controllers/omap_ssi_port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c
index 29aea0b93360..1c4d101c2844 100644
--- a/drivers/hsi/controllers/omap_ssi_port.c
+++ b/drivers/hsi/controllers/omap_ssi_port.c
@@ -1110,7 +1110,7 @@ static int __init ssi_port_probe(struct platform_device *pd)
 	struct omap_ssi_port *omap_port;
 	struct hsi_controller *ssi = dev_get_drvdata(pd->dev.parent);
 	struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
-	u32 cawake_gpio = 0;
+	int cawake_gpio = 0;
 	u32 port_id;
 	int err;
 

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

* [PATCH 3.16.y-ckt 098/126] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (96 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 097/126] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 099/126] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in Luis Henriques
                   ` (27 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Robert Jarzmik, Luis Henriques

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 54c09889bff6d99c8733eed4a26c9391b177c88b upstream.

The z2 machine calls pxa27x_set_pwrmode() in order to power off
the machine, but this function gets discarded early at boot because
it is marked __init, as pointed out by kbuild:

WARNING: vmlinux.o(.text+0x145c4): Section mismatch in reference from the function z2_power_off() to the function .init.text:pxa27x_set_pwrmode()
The function z2_power_off() references
the function __init pxa27x_set_pwrmode().
This is often because z2_power_off lacks a __init
annotation or the annotation of pxa27x_set_pwrmode is wrong.

This removes the __init section modifier to fix rebooting and the
build error.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ba4a90a6d86a ("ARM: pxa/z2: fix building error of pxa27x_cpu_suspend() no longer available")
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/mach-pxa/include/mach/pxa27x.h | 2 +-
 arch/arm/mach-pxa/pxa27x.c              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h
index 7cff640582b8..66c4cbfc7f36 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa27x.h
@@ -21,7 +21,7 @@
 
 extern void __init pxa27x_map_io(void);
 extern void __init pxa27x_init_irq(void);
-extern int __init pxa27x_set_pwrmode(unsigned int mode);
+extern int pxa27x_set_pwrmode(unsigned int mode);
 extern void pxa27x_cpu_pm_enter(suspend_state_t state);
 
 #define pxa27x_handle_irq	ichp_handle_irq
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 301471a07a10..4fc7c57ec495 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -251,7 +251,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
  */
 static unsigned int pwrmode = PWRMODE_SLEEP;
 
-int __init pxa27x_set_pwrmode(unsigned int mode)
+int pxa27x_set_pwrmode(unsigned int mode)
 {
 	switch (mode) {
 	case PWRMODE_SLEEP:

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

* [PATCH 3.16.y-ckt 099/126] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (97 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 098/126] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 100/126] drm: Fix return value of drm_framebuffer_init() Luis Henriques
                   ` (26 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Luis Henriques

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

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

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit df4833886f91eea0d20e6e97066adab308625ef8 upstream.

When committed to upstream, these four modules had wrong entries for
Makefile. This forces them to be loadable modules even if they're set
as built-in.

This commit fixes this bug.

Fixes: b5b04336015e('ALSA: fireworks: Add skelton for Fireworks based devices')
Fixes: fd6f4b0dc167('ALSA: bebob: Add skelton for BeBoB based devices')
Fixes: 1a4e39c2e5ca('ALSA: oxfw: Move to its own directory')
Fixes: 14ff6a094815('ALSA: dice: Move file to its own directory')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ luis: backported to 3.16:
  - dropped changes to oxfw and dice modules as they do not exist in
    the 3.16 kernel ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/firewire/bebob/Makefile     | 2 +-
 sound/firewire/fireworks/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/firewire/bebob/Makefile b/sound/firewire/bebob/Makefile
index 6cf470c80d1f..af7ed6643266 100644
--- a/sound/firewire/bebob/Makefile
+++ b/sound/firewire/bebob/Makefile
@@ -1,4 +1,4 @@
 snd-bebob-objs := bebob_command.o bebob_stream.o bebob_proc.o bebob_midi.o \
 		  bebob_pcm.o bebob_hwdep.o bebob_terratec.o bebob_yamaha.o \
 		  bebob_focusrite.o bebob_maudio.o bebob.o
-obj-m += snd-bebob.o
+obj-$(CONFIG_SND_BEBOB) += snd-bebob.o
diff --git a/sound/firewire/fireworks/Makefile b/sound/firewire/fireworks/Makefile
index 0c7440826db8..15ef7f75a8ef 100644
--- a/sound/firewire/fireworks/Makefile
+++ b/sound/firewire/fireworks/Makefile
@@ -1,4 +1,4 @@
 snd-fireworks-objs := fireworks_transaction.o fireworks_command.o \
 		      fireworks_stream.o fireworks_proc.o fireworks_midi.o \
 		      fireworks_pcm.o fireworks_hwdep.o fireworks.o
-obj-m += snd-fireworks.o
+obj-$(CONFIG_SND_FIREWORKS) += snd-fireworks.o

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

* [PATCH 3.16.y-ckt 100/126] drm: Fix return value of drm_framebuffer_init()
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (98 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 099/126] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 101/126] ALSA: fireworks: use u32 type for be32_to_cpup() macro Luis Henriques
                   ` (25 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Vetter, Lukas Wunner, Luis Henriques

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

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

From: Lukas Wunner <lukas@wunner.de>

commit 3c67d839b30c7d6d6ab5c6fddac0f58ec8095d50 upstream.

In its original version, drm_framebuffer_init() returned a negative int
if drm_mode_object_get() failed (f453ba046074, "DRM: add mode setting
support").

This was accidentally disabled by commit 4b096ac10da0 ("drm: revamp
locking around fb creation/destruction"). Thus, drm_framebuffer_init()
pretends success if drm_mode_object_get() failed.

Reinstate the original behaviour. Also fix erroneous kernel-doc of
drm_mode_object_get().

Fixes: 4b096ac10da0 ("drm: revamp locking around fb creation/
    destruction")
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/drm_crtc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index ee96912e0824..0dd2c26c55ab 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -369,8 +369,7 @@ EXPORT_SYMBOL(drm_get_format_name);
  * reference counted modeset objects like framebuffers.
  *
  * Returns:
- * New unique (relative to other objects in @dev) integer identifier for the
- * object.
+ * Zero on success, error code on failure.
  */
 int drm_mode_object_get(struct drm_device *dev,
 			struct drm_mode_object *obj, uint32_t obj_type)
@@ -492,7 +491,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
 out:
 	mutex_unlock(&dev->mode_config.fb_lock);
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL(drm_framebuffer_init);
 

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

* [PATCH 3.16.y-ckt 101/126] ALSA: fireworks: use u32 type for be32_to_cpup() macro
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (99 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 100/126] drm: Fix return value of drm_framebuffer_init() Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 102/126] ALSA: bebob: use correct type for __be32 data Luis Henriques
                   ` (24 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Luis Henriques

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

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

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit 463543ac2effaeb2b524f0a0a92f2413c23998ca upstream.

In former commit, snd_efw_command_get_phys_meters() was added to handle
metering data. The given buffer is used to save transaction result and to
convert between endianness. But this causes sparse warnings.

fireworks_command.c:269:25: warning: incorrect type in argument 1 (different base types)
fireworks_command.c:269:25:    expected unsigned int [usertype] *p
fireworks_command.c:269:25:    got restricted __be32 [usertype] *

This commit fixes this bug.

Fixes: bde8a8f23bbe('ALSA: fireworks: Add transaction and some commands')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/firewire/fireworks/fireworks_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/firewire/fireworks/fireworks_command.c b/sound/firewire/fireworks/fireworks_command.c
index 166f80584c2a..94bab0476a65 100644
--- a/sound/firewire/fireworks/fireworks_command.c
+++ b/sound/firewire/fireworks/fireworks_command.c
@@ -257,7 +257,7 @@ int snd_efw_command_get_phys_meters(struct snd_efw *efw,
 				    struct snd_efw_phys_meters *meters,
 				    unsigned int len)
 {
-	__be32 *buf = (__be32 *)meters;
+	u32 *buf = (u32 *)meters;
 	unsigned int i;
 	int err;
 

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

* [PATCH 3.16.y-ckt 102/126] ALSA: bebob: use correct type for __be32 data
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (100 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 101/126] ALSA: fireworks: use u32 type for be32_to_cpup() macro Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 103/126] tcp: apply Kern's check on RTTs used for congestion control Luis Henriques
                   ` (23 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Luis Henriques

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

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

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit fef586d58960bc867c1fa8126ee5d7364a5a89ac upstream.

In former commit, metering is supported for BeBoB based models
customized by M-Audio. The data in transaction is aligned to
big-endianness, while in the driver code u16 typed variable is assigned
to the data. This causes sparse warnings.

bebob_maudio.c:651:31: warning: cast to restricted __be16
bebob_maudio.c:651:31: warning: cast to restricted __be16
bebob_maudio.c:651:31: warning: cast to restricted __be16
bebob_maudio.c:651:31: warning: cast to restricted __be16

This commit fixes this bug by using __be16 variable for the data.

Fixes: 3149ac489ff8('ALSA: bebob: Add support for M-Audio special Firewire series')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/firewire/bebob/bebob_maudio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
index 0215a9194d88..96f770024c3b 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -644,7 +644,7 @@ static char *const special_meter_labels[] = {
 static int
 special_meter_get(struct snd_bebob *bebob, u32 *target, unsigned int size)
 {
-	u16 *buf;
+	__be16 *buf;
 	unsigned int i, c, channels;
 	int err;
 

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

* [PATCH 3.16.y-ckt 103/126] tcp: apply Kern's check on RTTs used for congestion control
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (101 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 102/126] ALSA: bebob: use correct type for __be32 data Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 104/126] clk: versatile-icst: fix memory leak Luis Henriques
                   ` (22 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yuchung Cheng, Neal Cardwell, Eric Dumazet, David S. Miller,
	Luis Henriques

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

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

From: Yuchung Cheng <ycheng@google.com>

commit 9e45a3e36b363cc4c79c70f2b4f994e66543a219 upstream.

Currently ca_seq_rtt_us does not use Kern's check. Fix that by
checking if any packet acked is a retransmit, for both RTT used
for RTT estimation and congestion control.

Fixes: 5b08e47ca ("tcp: prefer packet timing to TS-ECR for RTT")
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.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/ipv4/tcp_input.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0cdaa633059b..e3d40a303b8f 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2891,9 +2891,6 @@ static inline bool tcp_ack_update_rtt(struct sock *sk, const int flag,
 	 * Karn's algorithm forbids taking RTT if some retransmitted data
 	 * is acked (RFC6298).
 	 */
-	if (flag & FLAG_RETRANS_DATA_ACKED)
-		seq_rtt_us = -1L;
-
 	if (seq_rtt_us < 0)
 		seq_rtt_us = sack_rtt_us;
 
@@ -3115,7 +3112,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 		flag |= FLAG_SACK_RENEGING;
 
 	skb_mstamp_get(&now);
-	if (first_ackt.v64) {
+	if (first_ackt.v64 && !(flag & FLAG_RETRANS_DATA_ACKED)) {
 		seq_rtt_us = skb_mstamp_us_delta(&now, &first_ackt);
 		ca_seq_rtt_us = skb_mstamp_us_delta(&now, &last_ackt);
 	}

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

* [PATCH 3.16.y-ckt 104/126] clk: versatile-icst: fix memory leak
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (102 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 103/126] tcp: apply Kern's check on RTTs used for congestion control Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 105/126] MIPS: atomic: Fix comment describing atomic64_add_unless's return value Luis Henriques
                   ` (21 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Linus Walleij, Stephen Boyd, Luis Henriques

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

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

From: Linus Walleij <linus.walleij@linaro.org>

commit 7bdccef34fc67d3fce6778a018601dd41e43c5ce upstream.

A static code checker found a memory leak in the Versatile
ICST code. Fix it.

Fixes: a183da637c52 "clk: versatile: respect parent rate in ICST clock"
Reported-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clk/versatile/clk-icst.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index bc96f103bd7c..9064636a867f 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -156,8 +156,10 @@ struct clk *icst_clk_register(struct device *dev,
 	icst->lockreg = base + desc->lock_offset;
 
 	clk = clk_register(dev, &icst->hw);
-	if (IS_ERR(clk))
+	if (IS_ERR(clk)) {
+		kfree(pclone);
 		kfree(icst);
+	}
 
 	return clk;
 }

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

* [PATCH 3.16.y-ckt 105/126] MIPS: atomic: Fix comment describing atomic64_add_unless's return value.
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (103 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 104/126] clk: versatile-icst: fix memory leak Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 106/126] mfd: twl6040: Fix deferred probe handling for clk32k Luis Henriques
                   ` (20 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ralf Baechle, Luis Henriques

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

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

From: Ralf Baechle <ralf@linux-mips.org>

commit f25319d2cb439249a6859f53ad42ffa332b0acba upstream.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Fixes: f24219b4e90cf70ec4a211b17fbabc725a0ddf3c
(cherry picked from commit f0a232cde7be18a207fd057dd79bbac8a0a45dec)
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/mips/include/asm/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 37b2befe651a..9bf39457d574 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -673,7 +673,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
  * @u: ...unless v is equal to u.
  *
  * Atomically adds @a to @v, so long as it was not @u.
- * Returns the old value of @v.
+ * Returns true iff @v was not @u.
  */
 static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
 {

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

* [PATCH 3.16.y-ckt 106/126] mfd: twl6040: Fix deferred probe handling for clk32k
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (104 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 105/126] MIPS: atomic: Fix comment describing atomic64_add_unless's return value Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 107/126] of/fdt: fix error checking for earlycon address Luis Henriques
                   ` (19 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tony Lindgren, Lee Jones, Luis Henriques

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

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

From: Tony Lindgren <tony@atomide.com>

commit 75c08f17ec87c2d742487bb87408d6feebc526bd upstream.

Commit 68bab8662f49 ("mfd: twl6040: Optional clk32k clock handling")
added clock handling for the 32k clock from palmas-clk. However, that
patch did not consider a typical situation where twl6040 is built-in,
and palmas-clk is a loadable module like we have in omap2plus_defconfig.

If palmas-clk is not loaded before twl6040 probes, we will get a
"clk32k is not handled" warning during booting. This means that any
drivers relying on this clock will mysteriously fail, including
omap5-uevm WLAN and audio.

Note that for WLAN, we probably should also eventually get
the clk32kgaudio for MMC3 directly as that's shared between
audio and WLAN SDIO at least for omap5-uevm. It seems the
WLAN chip cannot get it as otherwise MMC3 won't get properly
probed.

Fixes: 68bab8662f49 ("mfd: twl6040: Optional clk32k clock handling")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/mfd/twl6040.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index ae26d84b3a59..9e41d799a144 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -647,6 +647,8 @@ static int twl6040_probe(struct i2c_client *client,
 
 	twl6040->clk32k = devm_clk_get(&client->dev, "clk32k");
 	if (IS_ERR(twl6040->clk32k)) {
+		if (PTR_ERR(twl6040->clk32k) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
 		dev_info(&client->dev, "clk32k is not handled\n");
 		twl6040->clk32k = NULL;
 	}

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

* [PATCH 3.16.y-ckt 107/126] of/fdt: fix error checking for earlycon address
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (105 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 106/126] mfd: twl6040: Fix deferred probe handling for clk32k Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 108/126] netfilter: nfnetlink: don't probe module if it exists Luis Henriques
                   ` (18 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Masahiro Yamada, Rob Herring, Luis Henriques

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

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

From: Masahiro Yamada <yamada.masahiro@socionext.com>

commit 3f5ceec96470050d20d7281d49985e3b1cfc3995 upstream.

fdt_translate_address() returns OF_BAD_ADDR on error.  It is defined as
a u64 value, so the variable "addr" should be defined as u64 as well.

Fixes: fb11ffe74c79 ("of/fdt: add FDT serial scanning for earlycon")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/of/fdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 5c437ca532b3..24ad55129194 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -774,14 +774,15 @@ int __init early_init_dt_scan_chosen_serial(void)
 		return -ENODEV;
 
 	while (match->compatible[0]) {
-		unsigned long addr;
+		u64 addr;
+
 		if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
 			match++;
 			continue;
 		}
 
 		addr = fdt_translate_address(fdt, offset);
-		if (!addr)
+		if (addr == OF_BAD_ADDR)
 			return -ENXIO;
 
 		of_setup_earlycon(addr, match->data);

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

* [PATCH 3.16.y-ckt 108/126] netfilter: nfnetlink: don't probe module if it exists
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (106 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 107/126] of/fdt: fix error checking for earlycon address Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 109/126] xprtrdma: Re-arm after missed events Luis Henriques
                   ` (17 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Westphal, Pablo Neira Ayuso, Luis Henriques

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

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

From: Florian Westphal <fw@strlen.de>

commit dbc3617f4c1f9fcbe63612048cb9583fea1e11ab upstream.

nfnetlink_bind request_module()s all the time as nfnetlink_get_subsys()
shifts the argument by 8 to obtain the subsys id.

So using type instead of type << 8 always returns NULL.

Fixes: 03292745b02d11 ("netlink: add nlk->netlink_bind hook for module auto-loading")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nfnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 6ae88ace21cb..cddab2101569 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -406,7 +406,7 @@ static int nfnetlink_bind(int group)
 	int type = nfnl_group2type[group];
 
 	rcu_read_lock();
-	ss = nfnetlink_get_subsys(type);
+	ss = nfnetlink_get_subsys(type << 8);
 	rcu_read_unlock();
 	if (!ss)
 		request_module("nfnetlink-subsys-%d", type);

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

* [PATCH 3.16.y-ckt 109/126] xprtrdma: Re-arm after missed events
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (107 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 108/126] netfilter: nfnetlink: don't probe module if it exists Luis Henriques
@ 2015-12-09  9:37 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 110/126] ceph: fix message length computation Luis Henriques
                   ` (16 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:37 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chuck Lever, Anna Schumaker, Luis Henriques

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

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

From: Chuck Lever <chuck.lever@oracle.com>

commit 7b3d770c67bc07db5035999e4f864c5f2ff7b10e upstream.

ib_req_notify_cq(IB_CQ_REPORT_MISSED_EVENTS) returns a positive
value if WCs were added to a CQ after the last completion upcall
but before the CQ has been re-armed.

Commit 7f23f6f6e388 ("xprtrmda: Reduce lock contention in
completion handlers") assumed that when ib_req_notify_cq() returned
a positive RC, the CQ had also been successfully re-armed, making
it safe to return control to the provider without losing any
completion signals. That is an invalid assumption.

Change both completion handlers to continue polling while
ib_req_notify_cq() returns a positive value.

Fixes: 7f23f6f6e388 ("xprtrmda: Reduce lock contention in ...")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Devesh Sharma <devesh.sharma@avagotech.com>
Tested-By: Devesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/sunrpc/xprtrdma/verbs.c | 66 +++++++--------------------------------------
 1 file changed, 10 insertions(+), 56 deletions(-)

diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 8467373e2ace..b456c8f09b60 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -182,38 +182,17 @@ rpcrdma_sendcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
 	return 0;
 }
 
-/*
- * Handle send, fast_reg_mr, and local_inv completions.
- *
- * Send events are typically suppressed and thus do not result
- * in an upcall. Occasionally one is signaled, however. This
- * prevents the provider's completion queue from wrapping and
- * losing a completion.
+/* Handle provider send completion upcalls.
  */
 static void
 rpcrdma_sendcq_upcall(struct ib_cq *cq, void *cq_context)
 {
 	struct rpcrdma_ep *ep = (struct rpcrdma_ep *)cq_context;
-	int rc;
-
-	rc = rpcrdma_sendcq_poll(cq, ep);
-	if (rc) {
-		dprintk("RPC:       %s: ib_poll_cq failed: %i\n",
-			__func__, rc);
-		return;
-	}
 
-	rc = ib_req_notify_cq(cq,
-			IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS);
-	if (rc == 0)
-		return;
-	if (rc < 0) {
-		dprintk("RPC:       %s: ib_req_notify_cq failed: %i\n",
-			__func__, rc);
-		return;
-	}
-
-	rpcrdma_sendcq_poll(cq, ep);
+	do {
+		rpcrdma_sendcq_poll(cq, ep);
+	} while (ib_req_notify_cq(cq, IB_CQ_NEXT_COMP |
+				  IB_CQ_REPORT_MISSED_EVENTS) > 0);
 }
 
 static void
@@ -272,42 +251,17 @@ rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
 	return 0;
 }
 
-/*
- * Handle receive completions.
- *
- * It is reentrant but processes single events in order to maintain
- * ordering of receives to keep server credits.
- *
- * It is the responsibility of the scheduled tasklet to return
- * recv buffers to the pool. NOTE: this affects synchronization of
- * connection shutdown. That is, the structures required for
- * the completion of the reply handler must remain intact until
- * all memory has been reclaimed.
+/* Handle provider receive completion upcalls.
  */
 static void
 rpcrdma_recvcq_upcall(struct ib_cq *cq, void *cq_context)
 {
 	struct rpcrdma_ep *ep = (struct rpcrdma_ep *)cq_context;
-	int rc;
-
-	rc = rpcrdma_recvcq_poll(cq, ep);
-	if (rc) {
-		dprintk("RPC:       %s: ib_poll_cq failed: %i\n",
-			__func__, rc);
-		return;
-	}
 
-	rc = ib_req_notify_cq(cq,
-			IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS);
-	if (rc == 0)
-		return;
-	if (rc < 0) {
-		dprintk("RPC:       %s: ib_req_notify_cq failed: %i\n",
-			__func__, rc);
-		return;
-	}
-
-	rpcrdma_recvcq_poll(cq, ep);
+	do {
+		rpcrdma_recvcq_poll(cq, ep);
+	} while (ib_req_notify_cq(cq, IB_CQ_NEXT_COMP |
+				  IB_CQ_REPORT_MISSED_EVENTS) > 0);
 }
 
 #ifdef RPC_DEBUG

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

* [PATCH 3.16.y-ckt 110/126] ceph: fix message length computation
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (108 preceding siblings ...)
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 109/126] xprtrdma: Re-arm after missed events Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 111/126] ipv6: fix tunnel error handling Luis Henriques
                   ` (15 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Yan, Zheng, Luis Henriques

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 777d738a5e58ba3b6f3932ab1543ce93703f4873 upstream.

create_request_message() computes the maximum length of a message,
but uses the wrong type for the time stamp: sizeof(struct timespec)
may be 8 or 16 depending on the architecture, while sizeof(struct
ceph_timespec) is always 8, and that is what gets put into the
message.

Found while auditing the uses of timespec for y2038 problems.

Fixes: b8e69066d8af ("ceph: include time stamp in every MDS request")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ceph/mds_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 92a2548278fc..63f2bc82f4af 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1786,7 +1786,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
 
 	len = sizeof(*head) +
 		pathlen1 + pathlen2 + 2*(1 + sizeof(u32) + sizeof(u64)) +
-		sizeof(struct timespec);
+		sizeof(struct ceph_timespec);
 
 	/* calculate (max) length for cap releases */
 	len += sizeof(struct ceph_mds_request_release) *

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

* [PATCH 3.16.y-ckt 111/126] ipv6: fix tunnel error handling
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (109 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 110/126] ceph: fix message length computation Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 112/126] perf trace: Fix documentation for -i Luis Henriques
                   ` (14 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, David S. Miller, Luis Henriques

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

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

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

commit ebac62fe3d24c0ce22dd83afa7b07d1a2aaef44d upstream.

Both tunnel6_protocol and tunnel46_protocol share the same error
handler, tunnel6_err(), which traverses through tunnel6_handlers list.
For ipip6 tunnels, we need to traverse tunnel46_handlers as we do e.g.
in tunnel46_rcv(). Current code can generate an ICMPv6 error message
with an IPv4 packet embedded in it.

Fixes: 73d605d1abbd ("[IPSEC]: changing API of xfrm6_tunnel_register")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/tunnel6.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/tunnel6.c b/net/ipv6/tunnel6.c
index 2c4e4c5c7614..e1e4811a1e82 100644
--- a/net/ipv6/tunnel6.c
+++ b/net/ipv6/tunnel6.c
@@ -146,6 +146,16 @@ static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 			break;
 }
 
+static void tunnel46_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+			 u8 type, u8 code, int offset, __be32 info)
+{
+	struct xfrm6_tunnel *handler;
+
+	for_each_tunnel_rcu(tunnel46_handlers, handler)
+		if (!handler->err_handler(skb, opt, type, code, offset, info))
+			break;
+}
+
 static const struct inet6_protocol tunnel6_protocol = {
 	.handler	= tunnel6_rcv,
 	.err_handler	= tunnel6_err,
@@ -154,7 +164,7 @@ static const struct inet6_protocol tunnel6_protocol = {
 
 static const struct inet6_protocol tunnel46_protocol = {
 	.handler	= tunnel46_rcv,
-	.err_handler	= tunnel6_err,
+	.err_handler	= tunnel46_err,
 	.flags          = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
 };
 

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

* [PATCH 3.16.y-ckt 112/126] perf trace: Fix documentation for -i
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (110 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 111/126] ipv6: fix tunnel error handling Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 113/126] bonding: fix panic on non-ARPHRD_ETHER enslave failure Luis Henriques
                   ` (13 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Feiner, David Ahern, Arnaldo Carvalho de Melo,
	Luis Henriques

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

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

From: Peter Feiner <pfeiner@google.com>

commit 956959f6b7a982b2e789a7a8fa1de437074a5eb9 upstream.

The -i flag was incorrectly listed as a short flag for --no-inherit.  It
should have only been listed as a short flag for --input.

This documentation error has existed since the --input flag was
introduced in 6810fc915f7a89d8134edb3996dbbf8eac386c26 (perf trace: Add
option to analyze events in a file versus live).

Signed-off-by: Peter Feiner <pfeiner@google.com>
Cc: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/1446657706-14518-1-git-send-email-pfeiner@google.com
Fixes: 6810fc915f7a ("perf trace: Add option to analyze events in a file versus live")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 tools/perf/Documentation/perf-trace.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
index fae38d9a44a4..65d6a7a88c53 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -59,7 +59,6 @@ OPTIONS
 --verbose=::
         Verbosity level.
 
--i::
 --no-inherit::
 	Child tasks do not inherit counters.
 

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

* [PATCH 3.16.y-ckt 113/126] bonding: fix panic on non-ARPHRD_ETHER enslave failure
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (111 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 112/126] perf trace: Fix documentation for -i Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 114/126] rtc: ds1307: Fix alarm programming for mcp794xx Luis Henriques
                   ` (12 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nikolay Aleksandrov, Jay Vosburgh, David S. Miller,
	Luis Henriques

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

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

From: Jay Vosburgh <jay.vosburgh@canonical.com>

commit 40baec225765c54eefa870530dd613bad9829bb7 upstream.

Since commit 7d5cd2ce529b, when bond_enslave fails on devices that
are not ARPHRD_ETHER, if needed, it resets the bonding device back to
ARPHRD_ETHER by calling ether_setup.

	Unfortunately, ether_setup clobbers dev->flags, clearing IFF_UP
if the bond device is up, leaving it in a quasi-down state without
having actually gone through dev_close.  For bonding, if any periodic
work queue items are active (miimon, arp_interval, etc), those will
remain running, as they are stopped by bond_close.  At this point, if
the bonding module is unloaded or the bond is deleted, the system will
panic when the work function is called.

	This panic is resolved by calling dev_close on the bond itself
prior to calling ether_setup.

Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Fixes: 7d5cd2ce5292 ("bonding: correctly handle bonding type change on enslave failure")
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ddb2e2564470..8fe94f711f39 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1667,6 +1667,7 @@ err_undo_flags:
 					    slave_dev->dev_addr))
 			eth_hw_addr_random(bond_dev);
 		if (bond_dev->type != ARPHRD_ETHER) {
+			dev_close(bond_dev);
 			ether_setup(bond_dev);
 			bond_dev->flags |= IFF_MASTER;
 			bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;

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

* [PATCH 3.16.y-ckt 114/126] rtc: ds1307: Fix alarm programming for mcp794xx
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (112 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 113/126] bonding: fix panic on non-ARPHRD_ETHER enslave failure Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 115/126] TPM: Avoid reference to potentially freed memory Luis Henriques
                   ` (11 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tero Kristo, Alexandre Belloni, Luis Henriques

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

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

From: Tero Kristo <t-kristo@ti.com>

commit 62c8c20af92ea312ecb22cec4e83082e5843076b upstream.

mcp794xx alarm registers must be written in BCD format. However, the
alarm programming logic neglected this by adding one to the value
after bin2bcd conversion has been already done, writing bad values
to month register in case the alarm being set is in October. In this
case, the alarm month value becomes 0x0a instead of the expected 0x10.

Fix by moving the +1 addition within the bin2bcd call also.

Fixes: 1d1945d261a2 ("drivers/rtc/rtc-ds1307.c: add alarm support for mcp7941x chips")

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/rtc/rtc-ds1307.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index f03d5ba96db1..f182dae3a4b7 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -727,9 +727,9 @@ static int mcp7941x_set_alarm(struct device *dev, struct rtc_wkalrm *t)
 	regs[3] = bin2bcd(t->time.tm_sec);
 	regs[4] = bin2bcd(t->time.tm_min);
 	regs[5] = bin2bcd(t->time.tm_hour);
-	regs[6] = bin2bcd(t->time.tm_wday) + 1;
+	regs[6] = bin2bcd(t->time.tm_wday + 1);
 	regs[7] = bin2bcd(t->time.tm_mday);
-	regs[8] = bin2bcd(t->time.tm_mon) + 1;
+	regs[8] = bin2bcd(t->time.tm_mon + 1);
 
 	/* Clear the alarm 0 interrupt flag. */
 	regs[6] &= ~MCP7941X_BIT_ALMX_IF;

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

* [PATCH 3.16.y-ckt 115/126] TPM: Avoid reference to potentially freed memory
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (113 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 114/126] rtc: ds1307: Fix alarm programming for mcp794xx Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 116/126] xtensa: nommu: provide _PAGE_CHG_MASK definition Luis Henriques
                   ` (10 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christophe JAILLET, Jarkko Sakkinen, Luis Henriques

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

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

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

commit eb8ed1eb9a158c460d10205eaff71fd4ac67c160 upstream.

Reference to the 'np' node is dropped before dereferencing the 'sizep' and
'basep' pointers, which could by then point to junk if the node has been
freed.

Refactor code to call 'of_node_put' later.

Fixes: c5df39262dd5 ("drivers/char/tpm: Add securityfs support for event log")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Acked-by: Peter Huewe <PeterHuewe@gmx.de>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/char/tpm/tpm_of.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c
index 98ba2bd1a355..565a0b39ae4e 100644
--- a/drivers/char/tpm/tpm_of.c
+++ b/drivers/char/tpm/tpm_of.c
@@ -53,17 +53,18 @@ int read_log(struct tpm_bios_log *log)
 		goto cleanup_eio;
 	}
 
-	of_node_put(np);
 	log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
 	if (!log->bios_event_log) {
 		pr_err("%s: ERROR - Not enough memory for BIOS measurements\n",
 		       __func__);
+		of_node_put(np);
 		return -ENOMEM;
 	}
 
 	log->bios_event_log_end = log->bios_event_log + *sizep;
 
 	memcpy(log->bios_event_log, __va(be64_to_cpup(basep)), *sizep);
+	of_node_put(np);
 
 	return 0;
 

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

* [PATCH 3.16.y-ckt 116/126] xtensa: nommu: provide _PAGE_CHG_MASK definition
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (114 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 115/126] TPM: Avoid reference to potentially freed memory Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 117/126] md/raid0: update queue parameter in a safer location Luis Henriques
                   ` (9 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Luis Henriques

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

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

From: Max Filippov <jcmvbkbc@gmail.com>

commit 972c55bf70c04b3deeecec022c8ca64136350655 upstream.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/xtensa/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index b2173e5da601..cd1c00fc744f 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -178,6 +178,7 @@
 
 #else /* no mmu */
 
+# define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
 # define PAGE_NONE       __pgprot(0)
 # define PAGE_SHARED     __pgprot(0)
 # define PAGE_COPY       __pgprot(0)

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

* [PATCH 3.16.y-ckt 117/126] md/raid0: update queue parameter in a safer location.
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (115 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 116/126] xtensa: nommu: provide _PAGE_CHG_MASK definition Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 118/126] md/raid0: apply base queue limits *before* disk_stack_limits Luis Henriques
                   ` (8 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Luis Henriques

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

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

From: NeilBrown <neilb@suse.com>

commit 199dc6ed5179251fa6158a461499c24bdd99c836 upstream.

When a (e.g.) RAID5 array is reshaped to RAID0, the updating
of queue parameters (e.g. max number of sectors per bio) is
done in the wrong place.
It should be part of ->run, but it is actually part of ->takeover.
This means it happens before level_store() calls:

	blk_set_stacking_limits(&mddev->queue->limits);

and so it ineffective.  This can lead to errors from underlying
devices.

So move all the relevant settings out of create_stripe_zones()
and into raid0_run().

As this can lead to a bug-on it is suitable for any -stable
kernel which supports reshape to RAID0.  So 2.6.35 or later.
As the bug has been present for five years there is no urgency,
so no need to rush into -stable.

Fixes: 9af204cf720c ("md: Add support for Raid5->Raid0 and Raid10->Raid0 takeover")
Reported-by: Yi Zhang <yizhan@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>
[ luis: backported to 3.16:
  - raid0 isn't accessed from dm-raid so no conditional mddev->queue accesses
    (done with commit 753f2856cda2 "md raid0: access mddev->queue (request
    queue member) conditionally because it is not set when accessed from
    dm-raid")
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/raid0.c | 66 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 9afd00b45f83..3d6b97b6dc6f 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -88,7 +88,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 	char b[BDEVNAME_SIZE];
 	char b2[BDEVNAME_SIZE];
 	struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
-	bool discard_supported = false;
+	unsigned short blksize = 512;
 
 	if (!conf)
 		return -ENOMEM;
@@ -103,6 +103,9 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 		sector_div(sectors, mddev->chunk_sectors);
 		rdev1->sectors = sectors * mddev->chunk_sectors;
 
+		blksize = max(blksize, queue_logical_block_size(
+				      rdev1->bdev->bd_disk->queue));
+
 		rdev_for_each(rdev2, mddev) {
 			pr_debug("md/raid0:%s:   comparing %s(%llu)"
 				 " with %s(%llu)\n",
@@ -139,6 +142,18 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 	}
 	pr_debug("md/raid0:%s: FINAL %d zones\n",
 		 mdname(mddev), conf->nr_strip_zones);
+	/*
+	 * now since we have the hard sector sizes, we can make sure
+	 * chunk size is a multiple of that sector size
+	 */
+	if ((mddev->chunk_sectors << 9) % blksize) {
+		printk(KERN_ERR "md/raid0:%s: chunk_size of %d not multiple of block size %d\n",
+		       mdname(mddev),
+		       mddev->chunk_sectors << 9, blksize);
+		err = -EINVAL;
+		goto abort;
+	}
+
 	err = -ENOMEM;
 	conf->strip_zone = kzalloc(sizeof(struct strip_zone)*
 				conf->nr_strip_zones, GFP_KERNEL);
@@ -193,18 +208,12 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 		}
 		dev[j] = rdev1;
 
-		disk_stack_limits(mddev->gendisk, rdev1->bdev,
-				  rdev1->data_offset << 9);
-
 		if (rdev1->bdev->bd_disk->queue->merge_bvec_fn)
 			conf->has_merge_bvec = 1;
 
 		if (!smallest || (rdev1->sectors < smallest->sectors))
 			smallest = rdev1;
 		cnt++;
-
-		if (blk_queue_discard(bdev_get_queue(rdev1->bdev)))
-			discard_supported = true;
 	}
 	if (cnt != mddev->raid_disks) {
 		printk(KERN_ERR "md/raid0:%s: too few disks (%d of %d) - "
@@ -267,26 +276,6 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
 	mddev->queue->backing_dev_info.congested_fn = raid0_congested;
 	mddev->queue->backing_dev_info.congested_data = mddev;
 
-	/*
-	 * now since we have the hard sector sizes, we can make sure
-	 * chunk size is a multiple of that sector size
-	 */
-	if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) {
-		printk(KERN_ERR "md/raid0:%s: chunk_size of %d not valid\n",
-		       mdname(mddev),
-		       mddev->chunk_sectors << 9);
-		goto abort;
-	}
-
-	blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
-	blk_queue_io_opt(mddev->queue,
-			 (mddev->chunk_sectors << 9) * mddev->raid_disks);
-
-	if (!discard_supported)
-		queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
-	else
-		queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
-
 	pr_debug("md/raid0:%s: done.\n", mdname(mddev));
 	*private_conf = conf;
 
@@ -429,6 +418,8 @@ static int raid0_run(struct mddev *mddev)
 {
 	struct r0conf *conf;
 	int ret;
+	struct md_rdev *rdev;
+	bool discard_supported = false;
 
 	if (mddev->chunk_sectors == 0) {
 		printk(KERN_ERR "md/raid0:%s: chunk size must be set.\n",
@@ -437,9 +428,6 @@ static int raid0_run(struct mddev *mddev)
 	}
 	if (md_check_no_bitmap(mddev))
 		return -EINVAL;
-	blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
-	blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
-	blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
 
 	/* if private is not null, we are here after takeover */
 	if (mddev->private == NULL) {
@@ -449,6 +437,24 @@ static int raid0_run(struct mddev *mddev)
 		mddev->private = conf;
 	}
 	conf = mddev->private;
+	rdev_for_each(rdev, mddev) {
+		disk_stack_limits(mddev->gendisk, rdev->bdev,
+				  rdev->data_offset << 9);
+		if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
+			discard_supported = true;
+	}
+	blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
+	blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
+	blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
+
+	blk_queue_io_min(mddev->queue, mddev->chunk_sectors << 9);
+	blk_queue_io_opt(mddev->queue,
+			 (mddev->chunk_sectors << 9) * mddev->raid_disks);
+
+	if (!discard_supported)
+		queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
+	else
+		queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
 
 	/* calculate array device size */
 	md_set_array_sectors(mddev, raid0_size(mddev, 0, 0));

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

* [PATCH 3.16.y-ckt 118/126] md/raid0: apply base queue limits *before* disk_stack_limits
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (116 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 117/126] md/raid0: update queue parameter in a safer location Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 119/126] drm/radeon: add quirk for MSI R7 370 Luis Henriques
                   ` (7 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Luis Henriques

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

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

From: NeilBrown <neilb@suse.com>

commit 66eefe5de11db1e0d8f2edc3880d50e7c36a9d43 upstream.

Calling e.g. blk_queue_max_hw_sectors() after calls to
disk_stack_limits() discards the settings determined by
disk_stack_limits().
So we need to make those calls first.

Fixes: 199dc6ed5179 ("md/raid0: update queue parameter in a safer location.")
Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/raid0.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 3d6b97b6dc6f..8f7dfc58f965 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -437,12 +437,6 @@ static int raid0_run(struct mddev *mddev)
 		mddev->private = conf;
 	}
 	conf = mddev->private;
-	rdev_for_each(rdev, mddev) {
-		disk_stack_limits(mddev->gendisk, rdev->bdev,
-				  rdev->data_offset << 9);
-		if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
-			discard_supported = true;
-	}
 	blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors);
 	blk_queue_max_write_same_sectors(mddev->queue, mddev->chunk_sectors);
 	blk_queue_max_discard_sectors(mddev->queue, mddev->chunk_sectors);
@@ -451,6 +445,13 @@ static int raid0_run(struct mddev *mddev)
 	blk_queue_io_opt(mddev->queue,
 			 (mddev->chunk_sectors << 9) * mddev->raid_disks);
 
+	rdev_for_each(rdev, mddev) {
+		disk_stack_limits(mddev->gendisk, rdev->bdev,
+				  rdev->data_offset << 9);
+		if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
+			discard_supported = true;
+	}
+
 	if (!discard_supported)
 		queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
 	else

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

* [PATCH 3.16.y-ckt 119/126] drm/radeon: add quirk for MSI R7 370
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (117 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 118/126] md/raid0: apply base queue limits *before* disk_stack_limits Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 120/126] drm/radeon: add quirk for ASUS " Luis Henriques
                   ` (6 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxim Sheviakov, Alex Deucher, Luis Henriques

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

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

From: Maxim Sheviakov <mrader3940@yandex.ru>

commit e78654799135a788a941bacad3452fbd7083e518 upstream.

Just adds the quirk for MSI R7 370 Armor 2X
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=91294

Signed-off-by: Maxim Sheviakov <mrader3940@yandex.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/gpu/drm/radeon/si_dpm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 46c945740b85..cdafcf0b633e 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2922,6 +2922,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
 	{ PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
 	{ PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
 	{ PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
+	{ PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 },
 	{ 0, 0, 0, 0 },
 };
 

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

* [PATCH 3.16.y-ckt 120/126] drm/radeon: add quirk for ASUS R7 370
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (118 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 119/126] drm/radeon: add quirk for MSI R7 370 Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 121/126] drm/radeon: fix quirk for MSI R7 370 Armor 2X Luis Henriques
                   ` (5 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Luis Henriques

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

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

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

commit 2b02ec79004388a8c65e227bc289ed891b5ac8c6 upstream.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=92260

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

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index cdafcf0b633e..1040c3638c26 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2923,6 +2923,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
 	{ PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
 	{ PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
 	{ PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 },
+	{ PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
 	{ 0, 0, 0, 0 },
 };
 

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

* [PATCH 3.16.y-ckt 121/126] drm/radeon: fix quirk for MSI R7 370 Armor 2X
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (119 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 120/126] drm/radeon: add quirk for ASUS " Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 122/126] tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c Luis Henriques
                   ` (4 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxim Sheviakov, Alex Deucher, Luis Henriques

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

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

From: Maxim Sheviakov <mrader3940@yandex.ru>

commit 515c752dabee9945c1e8686c87f7cdeb3935eea4 upstream.

There was a typo in the original.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=92865

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

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 1040c3638c26..95aec32186c0 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2922,7 +2922,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
 	{ PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
 	{ PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
 	{ PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
-	{ PCI_VENDOR_ID_ATI, 0x6811, 0x1762, 0x2015, 0, 120000 },
+	{ PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 },
 	{ PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
 	{ 0, 0, 0, 0 },
 };

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

* [PATCH 3.16.y-ckt 122/126] tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (120 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 121/126] drm/radeon: fix quirk for MSI R7 370 Armor 2X Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 123/126] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Luis Henriques
                   ` (3 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kosuke Tatsukawa, Greg Kroah-Hartman, Luis Henriques

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

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

From: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>

commit e81107d4c6bd098878af9796b24edc8d4a9524fd upstream.

My colleague ran into a program stall on a x86_64 server, where
n_tty_read() was waiting for data even if there was data in the buffer
in the pty.  kernel stack for the stuck process looks like below.
 #0 [ffff88303d107b58] __schedule at ffffffff815c4b20
 #1 [ffff88303d107bd0] schedule at ffffffff815c513e
 #2 [ffff88303d107bf0] schedule_timeout at ffffffff815c7818
 #3 [ffff88303d107ca0] wait_woken at ffffffff81096bd2
 #4 [ffff88303d107ce0] n_tty_read at ffffffff8136fa23
 #5 [ffff88303d107dd0] tty_read at ffffffff81368013
 #6 [ffff88303d107e20] __vfs_read at ffffffff811a3704
 #7 [ffff88303d107ec0] vfs_read at ffffffff811a3a57
 #8 [ffff88303d107f00] sys_read at ffffffff811a4306
 #9 [ffff88303d107f50] entry_SYSCALL_64_fastpath at ffffffff815c86d7

There seems to be two problems causing this issue.

First, in drivers/tty/n_tty.c, __receive_buf() stores the data and
updates ldata->commit_head using smp_store_release() and then checks
the wait queue using waitqueue_active().  However, since there is no
memory barrier, __receive_buf() could return without calling
wake_up_interactive_poll(), and at the same time, n_tty_read() could
start to wait in wait_woken() as in the following chart.

        __receive_buf()                         n_tty_read()
------------------------------------------------------------------------
if (waitqueue_active(&tty->read_wait))
/* Memory operations issued after the
   RELEASE may be completed before the
   RELEASE operation has completed */
                                        add_wait_queue(&tty->read_wait, &wait);
                                        ...
                                        if (!input_available_p(tty, 0)) {
smp_store_release(&ldata->commit_head,
                  ldata->read_head);
                                        ...
                                        timeout = wait_woken(&wait,
                                          TASK_INTERRUPTIBLE, timeout);
------------------------------------------------------------------------

The second problem is that n_tty_read() also lacks a memory barrier
call and could also cause __receive_buf() to return without calling
wake_up_interactive_poll(), and n_tty_read() to wait in wait_woken()
as in the chart below.

        __receive_buf()                         n_tty_read()
------------------------------------------------------------------------
                                        spin_lock_irqsave(&q->lock, flags);
                                        /* from add_wait_queue() */
                                        ...
                                        if (!input_available_p(tty, 0)) {
                                        /* Memory operations issued after the
                                           RELEASE may be completed before the
                                           RELEASE operation has completed */
smp_store_release(&ldata->commit_head,
                  ldata->read_head);
if (waitqueue_active(&tty->read_wait))
                                        __add_wait_queue(q, wait);
                                        spin_unlock_irqrestore(&q->lock,flags);
                                        /* from add_wait_queue() */
                                        ...
                                        timeout = wait_woken(&wait,
                                          TASK_INTERRUPTIBLE, timeout);
------------------------------------------------------------------------

There are also other places in drivers/tty/n_tty.c which have similar
calls to waitqueue_active(), so instead of adding many memory barrier
calls, this patch simply removes the call to waitqueue_active(),
leaving just wake_up*() behind.

This fixes both problems because, even though the memory access before
or after the spinlocks in both wake_up*() and add_wait_queue() can
sneak into the critical section, it cannot go past it and the critical
section assures that they will be serialized (please see "INTER-CPU
ACQUIRING BARRIER EFFECTS" in Documentation/memory-barriers.txt for a
better explanation).  Moreover, the resulting code is much simpler.

Latency measurement using a ping-pong test over a pty doesn't show any
visible performance drop.

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16:
  - always use wake_up_interruptible() instead of wake_up_interruptible_poll()
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/n_tty.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 39ec99fbb135..29de4bfe5c70 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -364,8 +364,7 @@ static void n_tty_packet_mode_flush(struct tty_struct *tty)
 	spin_lock_irqsave(&tty->ctrl_lock, flags);
 	if (tty->link->packet) {
 		tty->ctrl_status |= TIOCPKT_FLUSHREAD;
-		if (waitqueue_active(&tty->link->read_wait))
-			wake_up_interruptible(&tty->link->read_wait);
+		wake_up_interruptible(&tty->link->read_wait);
 	}
 	spin_unlock_irqrestore(&tty->ctrl_lock, flags);
 }
@@ -1387,8 +1386,7 @@ handle_newline:
 			put_tty_queue(c, ldata);
 			ldata->canon_head = ldata->read_head;
 			kill_fasync(&tty->fasync, SIGIO, POLL_IN);
-			if (waitqueue_active(&tty->read_wait))
-				wake_up_interruptible(&tty->read_wait);
+			wake_up_interruptible(&tty->read_wait);
 			return 0;
 		}
 	}
@@ -1671,8 +1669,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
 	if ((!ldata->icanon && (read_cnt(ldata) >= ldata->minimum_to_wake)) ||
 		L_EXTPROC(tty)) {
 		kill_fasync(&tty->fasync, SIGIO, POLL_IN);
-		if (waitqueue_active(&tty->read_wait))
-			wake_up_interruptible(&tty->read_wait);
+		wake_up_interruptible(&tty->read_wait);
 	}
 }
 
@@ -1891,10 +1888,8 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 	}
 
 	/* The termios change make the tty ready for I/O */
-	if (waitqueue_active(&tty->write_wait))
-		wake_up_interruptible(&tty->write_wait);
-	if (waitqueue_active(&tty->read_wait))
-		wake_up_interruptible(&tty->read_wait);
+	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->read_wait);
 }
 
 /**

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

* [PATCH 3.16.y-ckt 123/126] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (121 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 122/126] tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 124/126] ALSA: hda - Disable 64bit address for Creative HDA controllers Luis Henriques
                   ` (2 subsequent siblings)
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Al Viro, Alexander Potapenko, Andrey Konovalov, Andrey Ryabinin,
	Andy Lutomirski, Andy Lutomirski, Borislav Petkov, Denys Vlasenko,
	Dmitry Vyukov, Kostya Serebryany, Mike Galbraith, Peter Zijlstra,
	Peter Zijlstra, Sasha Levin, kasan-dev, Ingo Molnar,
	Kamal Mostafa, Luis Henriques

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

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

From: Ingo Molnar <mingo@kernel.org>

commit b2f73922d119686323f14fbbe46587f863852328 upstream.

So the /proc/PID/stat 'wchan' field (the 30th field, which contains
the absolute kernel address of the kernel function a task is blocked in)
leaks absolute kernel addresses to unprivileged user-space:

        seq_put_decimal_ull(m, ' ', wchan);

The absolute address might also leak via /proc/PID/wchan as well, if
KALLSYMS is turned off or if the symbol lookup fails for some reason:

static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
                          struct pid *pid, struct task_struct *task)
{
        unsigned long wchan;
        char symname[KSYM_NAME_LEN];

        wchan = get_wchan(task);

        if (lookup_symbol_name(wchan, symname) < 0) {
                if (!ptrace_may_access(task, PTRACE_MODE_READ))
                        return 0;
                seq_printf(m, "%lu", wchan);
        } else {
                seq_printf(m, "%s", symname);
        }

        return 0;
}

This isn't ideal, because for example it trivially leaks the KASLR offset
to any local attacker:

  fomalhaut:~> printf "%016lx\n" $(cat /proc/$$/stat | cut -d' ' -f35)
  ffffffff8123b380

Most real-life uses of wchan are symbolic:

  ps -eo pid:10,tid:10,wchan:30,comm

and procps uses /proc/PID/wchan, not the absolute address in /proc/PID/stat:

  triton:~/tip> strace -f ps -eo pid:10,tid:10,wchan:30,comm 2>&1 | grep wchan | tail -1
  open("/proc/30833/wchan", O_RDONLY)     = 6

There's one compatibility quirk here: procps relies on whether the
absolute value is non-zero - and we can provide that functionality
by outputing "0" or "1" depending on whether the task is blocked
(whether there's a wchan address).

These days there appears to be very little legitimate reason
user-space would be interested in  the absolute address. The
absolute address is mostly historic: from the days when we
didn't have kallsyms and user-space procps had to do the
decoding itself via the System.map.

So this patch sets all numeric output to "0" or "1" and keeps only
symbolic output, in /proc/PID/wchan.

( The absolute sleep address can generally still be profiled via
  perf, by tasks with sufficient privileges. )

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: kasan-dev <kasan-dev@googlegroups.com>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/20150930135917.GA3285@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ kamal: backport to 3.16-stable: proc_pid_wchan context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 Documentation/filesystems/proc.txt |  5 +++--
 fs/proc/array.c                    | 16 ++++++++++++++--
 fs/proc/base.c                     |  9 +++------
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index ddc531a74d04..225ae3ba74b3 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -139,7 +139,8 @@ Table 1-1: Process specific entries in /proc
  stat		Process status
  statm		Process memory status information
  status		Process status in human readable form
- wchan		If CONFIG_KALLSYMS is set, a pre-decoded wchan
+ wchan		Present with CONFIG_KALLSYMS=y: it shows the kernel function
+		symbol the task is blocked in - or "0" if not blocked.
  pagemap	Page table
  stack		Report full stack trace, enable via CONFIG_STACKTRACE
  smaps		a extension based on maps, showing the memory consumption of
@@ -301,7 +302,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7)
   blocked       bitmap of blocked signals
   sigign        bitmap of ignored signals
   sigcatch      bitmap of caught signals
-  wchan         address where process went to sleep
+  0		(place holder, used to be the wchan address, use /proc/PID/wchan instead)
   0             (place holder)
   0             (place holder)
   exit_signal   signal to send to parent thread on exit
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 3e1290b0492e..98f368b7c857 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -371,7 +371,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
 static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 			struct pid *pid, struct task_struct *task, int whole)
 {
-	unsigned long vsize, eip, esp, wchan = ~0UL;
+	unsigned long vsize, eip, esp, wchan = 0;
 	int priority, nice;
 	int tty_pgrp = -1, tty_nr = 0;
 	sigset_t sigign, sigcatch;
@@ -508,7 +508,19 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 	seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL);
 	seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL);
 	seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL);
-	seq_put_decimal_ull(m, ' ', wchan);
+
+	/*
+	 * We used to output the absolute kernel address, but that's an
+	 * information leak - so instead we show a 0/1 flag here, to signal
+	 * to user-space whether there's a wchan field in /proc/PID/wchan.
+	 *
+	 * This works with older implementations of procps as well.
+	 */
+	if (wchan)
+		seq_puts(m, " 1");
+	else
+		seq_puts(m, " 0");
+
 	seq_put_decimal_ull(m, ' ', 0);
 	seq_put_decimal_ull(m, ' ', 0);
 	seq_put_decimal_ll(m, ' ', task->exit_signal);
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 71d855747fe8..2d038a7e16a1 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -236,13 +236,10 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer)
 
 	wchan = get_wchan(task);
 
-	if (lookup_symbol_name(wchan, symname) < 0)
-		if (!ptrace_may_access(task, PTRACE_MODE_READ))
-			return 0;
-		else
-			return sprintf(buffer, "%lu", wchan);
-	else
+	if (wchan && ptrace_may_access(task, PTRACE_MODE_READ) && !lookup_symbol_name(wchan, symname))
 		return sprintf(buffer, "%s", symname);
+	else
+		return sprintf(buffer, "0");
 }
 #endif /* CONFIG_KALLSYMS */
 

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

* [PATCH 3.16.y-ckt 124/126] ALSA: hda - Disable 64bit address for Creative HDA controllers
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (122 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 123/126] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 125/126] printk: prevent userland from spoofing kernel messages Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 126/126] FS-Cache: Handle a write to the page immediately beyond the EOF marker Luis Henriques
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Kamal Mostafa, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit cadd16ea33a938d49aee99edd4758cc76048b399 upstream.

We've had many reports that some Creative sound cards with CA0132
don't work well.  Some reported that it starts working after reloading
the module, while some reported it starts working when a 32bit kernel
is used.  All these facts seem implying that the chip fails to
communicate when the buffer is located in 64bit address.

This patch addresses these issues by just adding AZX_DCAPS_NO_64BIT
flag to the corresponding PCI entries.  I casually had a chance to
test an SB Recon3D board, and indeed this seems helping.

Although this hasn't been tested on all Creative devices, it's safer
to assume that this restriction applies to the rest of them, too.  So
the flag is applied to all Creative entries.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/pci/hda/hda_intel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e91c93dc08c6..d4268a2bbca7 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -262,7 +262,8 @@ enum {
 	 AZX_DCAPS_CORBRP_SELF_CLEAR)
 
 #define AZX_DCAPS_PRESET_CTHDA \
-	(AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_4K_BDLE_BOUNDARY)
+	(AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_4K_BDLE_BOUNDARY |\
+	 AZX_DCAPS_NO_64BIT)
 
 /*
  * VGA-switcher support
@@ -1963,11 +1964,13 @@ static const struct pci_device_id azx_ids[] = {
 	  .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
 	  .class_mask = 0xffffff,
 	  .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND |
+	  AZX_DCAPS_NO_64BIT |
 	  AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB },
 #else
 	/* this entry seems still valid -- i.e. without emu20kx chip */
 	{ PCI_DEVICE(0x1102, 0x0009),
 	  .driver_data = AZX_DRIVER_CTX | AZX_DCAPS_CTX_WORKAROUND |
+	  AZX_DCAPS_NO_64BIT |
 	  AZX_DCAPS_RIRB_PRE_DELAY | AZX_DCAPS_POSFIX_LPIB },
 #endif
 	/* Vortex86MX */

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

* [PATCH 3.16.y-ckt 125/126] printk: prevent userland from spoofing kernel messages
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (123 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 124/126] ALSA: hda - Disable 64bit address for Creative HDA controllers Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 126/126] FS-Cache: Handle a write to the page immediately beyond the EOF marker Luis Henriques
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mathias Krause, Greg Kroah-Hartman, Petr Mladek, Alex Elder,
	Joe Perches, Kay Sievers, Andrew Morton, Linus Torvalds,
	Kamal Mostafa, Luis Henriques

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

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

From: Mathias Krause <minipli@googlemail.com>

commit 3824657c522f19f85a76bd932821174a5557a382 upstream.

The following statement of ABI/testing/dev-kmsg is not quite right:

   It is not possible to inject messages from userspace with the
   facility number LOG_KERN (0), to make sure that the origin of the
   messages can always be reliably determined.

Userland actually can inject messages with a facility of 0 by abusing the
fact that the facility is stored in a u8 data type.  By using a facility
which is a multiple of 256 the assignment of msg->facility in log_store()
implicitly truncates it to 0, i.e.  LOG_KERN, allowing users of /dev/kmsg
to spoof kernel messages as shown below:

The following call...
   # printf '<%d>Kernel panic - not syncing: beer empty\n' 0 >/dev/kmsg
...leads to the following log entry (dmesg -x | tail -n 1):
   user  :emerg : [   66.137758] Kernel panic - not syncing: beer empty

However, this call...
   # printf '<%d>Kernel panic - not syncing: beer empty\n' 0x800 >/dev/kmsg
...leads to the slightly different log entry (note the kernel facility):
   kern  :emerg : [   74.177343] Kernel panic - not syncing: beer empty

Fix that by limiting the user provided facility to 8 bit right from the
beginning and catch the truncation early.

Fixes: 7ff9554bb578 ("printk: convert byte-buffer to variable-length...")
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Petr Mladek <pmladek@suse.cz>
Cc: Alex Elder <elder@linaro.org>
Cc: Joe Perches <joe@perches.com>
Cc: Kay Sievers <kay@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ kamal: backport to 3.13-stable: retain local 'int i' ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/printk/printk.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f7f6f7e5ff8a..5fa3f3b3b338 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -259,6 +259,9 @@ static u32 clear_idx;
 #define PREFIX_MAX		32
 #define LOG_LINE_MAX		1024 - PREFIX_MAX
 
+#define LOG_LEVEL(v)		((v) & 0x07)
+#define LOG_FACILITY(v)		((v) >> 3 & 0xff)
+
 /* record buffer */
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
 #define LOG_ALIGN 4
@@ -547,12 +550,13 @@ static ssize_t devkmsg_writev(struct kiocb *iocb, const struct iovec *iv,
 	line = buf;
 	if (line[0] == '<') {
 		char *endp = NULL;
+		unsigned int u;
 
-		i = simple_strtoul(line+1, &endp, 10);
+		u = simple_strtoul(line + 1, &endp, 10);
 		if (endp && endp[0] == '>') {
-			level = i & 7;
-			if (i >> 3)
-				facility = i >> 3;
+			level = LOG_LEVEL(u);
+			if (LOG_FACILITY(u) != 0)
+				facility = LOG_FACILITY(u);
 			endp++;
 			len -= endp - line;
 			line = endp;

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

* [PATCH 3.16.y-ckt 126/126] FS-Cache: Handle a write to the page immediately beyond the EOF marker
  2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
                   ` (124 preceding siblings ...)
  2015-12-09  9:38 ` [PATCH 3.16.y-ckt 125/126] printk: prevent userland from spoofing kernel messages Luis Henriques
@ 2015-12-09  9:38 ` Luis Henriques
  125 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09  9:38 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Howells, Al Viro, Kamal Mostafa, Luis Henriques

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

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

From: David Howells <dhowells@redhat.com>

commit 102f4d900c9c8f5ed89ae4746d493fe3ebd7ba64 upstream.

Handle a write being requested to the page immediately beyond the EOF
marker on a cache object.  Currently this gets an assertion failure in
CacheFiles because the EOF marker is used there to encode information about
a partial page at the EOF - which could lead to an unknown blank spot in
the file if we extend the file over it.

The problem is actually in fscache where we check the index of the page
being written against store_limit.  store_limit is set to the number of
pages that we're allowed to store by fscache_set_store_limit() - which
means it's one more than the index of the last page we're allowed to store.
The problem is that we permit writing to a page with an index _equal_ to
the store limit - when we should reject that case.

Whilst we're at it, change the triggered assertion in CacheFiles to just
return -ENOBUFS instead.

The assertion failure looks something like this:

CacheFiles: Assertion failed
1000 < 7b1 is false
------------[ cut here ]------------
kernel BUG at fs/cachefiles/rdwr.c:962!
...
RIP: 0010:[<ffffffffa02c9e83>]  [<ffffffffa02c9e83>] cachefiles_write_page+0x273/0x2d0 [cachefiles]

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[ kamal: backport to 3.13-stable: no __kernel_write(); thanks Ben H. ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/cachefiles/rdwr.c | 79 +++++++++++++++++++++++++++-------------------------
 fs/fscache/page.c    |  2 +-
 2 files changed, 42 insertions(+), 39 deletions(-)

diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 4b1fb5ca65b8..88483abe08d3 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -912,6 +912,15 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
 	cache = container_of(object->fscache.cache,
 			     struct cachefiles_cache, cache);
 
+	pos = (loff_t)page->index << PAGE_SHIFT;
+
+	/* We mustn't write more data than we have, so we have to beware of a
+	 * partial page at EOF.
+	 */
+	eof = object->fscache.store_limit_l;
+	if (pos >= eof)
+		goto error;
+
 	/* write the page to the backing filesystem and let it store it in its
 	 * own time */
 	path.mnt = cache->mnt;
@@ -919,49 +928,43 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
 	file = dentry_open(&path, O_RDWR | O_LARGEFILE, cache->cache_cred);
 	if (IS_ERR(file)) {
 		ret = PTR_ERR(file);
-	} else {
-		ret = -EIO;
-		if (file->f_op->write) {
-			pos = (loff_t) page->index << PAGE_SHIFT;
-
-			/* we mustn't write more data than we have, so we have
-			 * to beware of a partial page at EOF */
-			eof = object->fscache.store_limit_l;
-			len = PAGE_SIZE;
-			if (eof & ~PAGE_MASK) {
-				ASSERTCMP(pos, <, eof);
-				if (eof - pos < PAGE_SIZE) {
-					_debug("cut short %llx to %llx",
-					       pos, eof);
-					len = eof - pos;
-					ASSERTCMP(pos + len, ==, eof);
-				}
-			}
+		goto error_2;
+	}
 
-			data = kmap(page);
-			file_start_write(file);
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			ret = file->f_op->write(
-				file, (const void __user *) data, len, &pos);
-			set_fs(old_fs);
-			kunmap(page);
-			file_end_write(file);
-			if (ret != len)
-				ret = -EIO;
+	len = PAGE_SIZE;
+	if (eof & ~PAGE_MASK) {
+		if (eof - pos < PAGE_SIZE) {
+			_debug("cut short %llx to %llx",
+			       pos, eof);
+			len = eof - pos;
+			ASSERTCMP(pos + len, ==, eof);
 		}
-		fput(file);
 	}
 
-	if (ret < 0) {
-		if (ret == -EIO)
-			cachefiles_io_error_obj(
-				object, "Write page to backing file failed");
-		ret = -ENOBUFS;
-	}
+	data = kmap(page);
+	file_start_write(file);
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	ret = file->f_op->write(
+		file, (const void __user *) data, len, &pos);
+	set_fs(old_fs);
+	kunmap(page);
+	fput(file);
+	if (ret != len)
+		goto error_eio;
+
+	_leave(" = 0");
+	return 0;
 
-	_leave(" = %d", ret);
-	return ret;
+error_eio:
+	ret = -EIO;
+error_2:
+	if (ret == -EIO)
+		cachefiles_io_error_obj(object,
+					"Write page to backing file failed");
+error:
+	_leave(" = -ENOBUFS [%d]", ret);
+	return -ENOBUFS;
 }
 
 /*
diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index ed70714503fa..e387cc646868 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -801,7 +801,7 @@ static void fscache_write_op(struct fscache_operation *_op)
 		goto superseded;
 	page = results[0];
 	_debug("gang %d [%lx]", n, page->index);
-	if (page->index > op->store_limit) {
+	if (page->index >= op->store_limit) {
 		fscache_stat(&fscache_n_store_pages_over_limit);
 		goto superseded;
 	}

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

* Re: [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Luis Henriques
@ 2015-12-09 11:27   ` Bjørn Mork
  2015-12-09 11:44       ` Luis Henriques
  0 siblings, 1 reply; 154+ messages in thread
From: Bjørn Mork @ 2015-12-09 11:27 UTC (permalink / raw)
  To: Luis Henriques; +Cc: linux-kernel, stable, kernel-team, David S. Miller

Luis Henriques <luis.henriques@canonical.com> writes:

> 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
>
> ------------------
>
> From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
>
> commit 0db65fcfcded76fe4f74e3ca9f4e2baf67b683ef upstream.
>
> New device IDs shamelessly lifted from the vendor driver.
>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> ---
>  drivers/net/usb/qmi_wwan.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
> index b8a82b86f909..f5a0e1034de9 100644
> --- a/drivers/net/usb/qmi_wwan.c
> +++ b/drivers/net/usb/qmi_wwan.c
> @@ -760,6 +760,10 @@ static const struct usb_device_id products[] = {
>  	{QMI_FIXED_INTF(0x1199, 0x9056, 8)},	/* Sierra Wireless Modem */
>  	{QMI_FIXED_INTF(0x1199, 0x9057, 8)},
>  	{QMI_FIXED_INTF(0x1199, 0x9061, 8)},	/* Sierra Wireless Modem */
> +	{QMI_FIXED_INTF(0x1199, 0x9070, 8)},	/* Sierra Wireless MC74xx/EM74xx */
> +	{QMI_FIXED_INTF(0x1199, 0x9070, 10)},	/* Sierra Wireless MC74xx/EM74xx */
> +	{QMI_FIXED_INTF(0x1199, 0x9071, 8)},	/* Sierra Wireless MC74xx/EM74xx */
> +	{QMI_FIXED_INTF(0x1199, 0x9071, 10)},	/* Sierra Wireless MC74xx/EM74xx */
>  	{QMI_FIXED_INTF(0x1bbb, 0x011e, 4)},	/* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
>  	{QMI_FIXED_INTF(0x1bbb, 0x0203, 2)},	/* Alcatel L800MA */
>  	{QMI_FIXED_INTF(0x2357, 0x0201, 4)},	/* TP-LINK HSUPA Modem MA180 */


Please drop this patch.  More substantial changes were needed to support
this modem.


Bjørn

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

* Re: [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx
  2015-12-09 11:27   ` Bjørn Mork
@ 2015-12-09 11:44       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09 11:44 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: linux-kernel, stable, kernel-team, David S. Miller

On Wed, Dec 09, 2015 at 12:27:42PM +0100, Bjørn Mork wrote:
> Luis Henriques <luis.henriques@canonical.com> writes:
> 
> > 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> >
> > ------------------
> >
> > From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
> >
> > commit 0db65fcfcded76fe4f74e3ca9f4e2baf67b683ef upstream.
> >
> > New device IDs shamelessly lifted from the vendor driver.
> >
> > Signed-off-by: Bjørn Mork <bjorn@mork.no>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> > ---
> >  drivers/net/usb/qmi_wwan.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
> > index b8a82b86f909..f5a0e1034de9 100644
> > --- a/drivers/net/usb/qmi_wwan.c
> > +++ b/drivers/net/usb/qmi_wwan.c
> > @@ -760,6 +760,10 @@ static const struct usb_device_id products[] = {
> >  	{QMI_FIXED_INTF(0x1199, 0x9056, 8)},	/* Sierra Wireless Modem */
> >  	{QMI_FIXED_INTF(0x1199, 0x9057, 8)},
> >  	{QMI_FIXED_INTF(0x1199, 0x9061, 8)},	/* Sierra Wireless Modem */
> > +	{QMI_FIXED_INTF(0x1199, 0x9070, 8)},	/* Sierra Wireless MC74xx/EM74xx */
> > +	{QMI_FIXED_INTF(0x1199, 0x9070, 10)},	/* Sierra Wireless MC74xx/EM74xx */
> > +	{QMI_FIXED_INTF(0x1199, 0x9071, 8)},	/* Sierra Wireless MC74xx/EM74xx */
> > +	{QMI_FIXED_INTF(0x1199, 0x9071, 10)},	/* Sierra Wireless MC74xx/EM74xx */
> >  	{QMI_FIXED_INTF(0x1bbb, 0x011e, 4)},	/* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
> >  	{QMI_FIXED_INTF(0x1bbb, 0x0203, 2)},	/* Alcatel L800MA */
> >  	{QMI_FIXED_INTF(0x2357, 0x0201, 4)},	/* TP-LINK HSUPA Modem MA180 */
> 
> 
> Please drop this patch.  More substantial changes were needed to support
> this modem.
> 
> 
> Bjørn

Thank you, I've dropped it from the 3.16 queue.

Cheers,
--
Luís

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

* Re: [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx
@ 2015-12-09 11:44       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09 11:44 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: linux-kernel, stable, kernel-team, David S. Miller

On Wed, Dec 09, 2015 at 12:27:42PM +0100, Bj�rn Mork wrote:
> Luis Henriques <luis.henriques@canonical.com> writes:
> 
> > 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> >
> > ------------------
> >
> > From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
> >
> > commit 0db65fcfcded76fe4f74e3ca9f4e2baf67b683ef upstream.
> >
> > New device IDs shamelessly lifted from the vendor driver.
> >
> > Signed-off-by: Bj�rn Mork <bjorn@mork.no>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> > ---
> >  drivers/net/usb/qmi_wwan.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
> > index b8a82b86f909..f5a0e1034de9 100644
> > --- a/drivers/net/usb/qmi_wwan.c
> > +++ b/drivers/net/usb/qmi_wwan.c
> > @@ -760,6 +760,10 @@ static const struct usb_device_id products[] = {
> >  	{QMI_FIXED_INTF(0x1199, 0x9056, 8)},	/* Sierra Wireless Modem */
> >  	{QMI_FIXED_INTF(0x1199, 0x9057, 8)},
> >  	{QMI_FIXED_INTF(0x1199, 0x9061, 8)},	/* Sierra Wireless Modem */
> > +	{QMI_FIXED_INTF(0x1199, 0x9070, 8)},	/* Sierra Wireless MC74xx/EM74xx */
> > +	{QMI_FIXED_INTF(0x1199, 0x9070, 10)},	/* Sierra Wireless MC74xx/EM74xx */
> > +	{QMI_FIXED_INTF(0x1199, 0x9071, 8)},	/* Sierra Wireless MC74xx/EM74xx */
> > +	{QMI_FIXED_INTF(0x1199, 0x9071, 10)},	/* Sierra Wireless MC74xx/EM74xx */
> >  	{QMI_FIXED_INTF(0x1bbb, 0x011e, 4)},	/* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
> >  	{QMI_FIXED_INTF(0x1bbb, 0x0203, 2)},	/* Alcatel L800MA */
> >  	{QMI_FIXED_INTF(0x2357, 0x0201, 4)},	/* TP-LINK HSUPA Modem MA180 */
> 
> 
> Please drop this patch.  More substantial changes were needed to support
> this modem.
> 
> 
> Bj�rn

Thank you, I've dropped it from the 3.16 queue.

Cheers,
--
Lu�s

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

* Re: [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-09  9:37 ` [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure Luis Henriques
@ 2015-12-09 13:22   ` Krzysztof Kozlowski
  2015-12-09 13:59       ` Luis Henriques
  0 siblings, 1 reply; 154+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-09 13:22 UTC (permalink / raw)
  To: Luis Henriques, linux-kernel, stable, kernel-team
  Cc: k.kozlowski.k, Eduardo Valentin

W dniu 09.12.2015 o 18:37, Luis Henriques pisze:
> 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 
> commit 824ead03b78403a21449cb7eb153a4344cd3b4c8 upstream.
> 
> During probe if the regulator could not be enabled, the error exit path
> would still disable it. This could lead to unbalanced counter of
> regulator enable/disable.
> 
> The patch moves code for getting and enabling the regulator from
> exynos_map_dt_data() to probe function because it is really not a part
> of getting Device Tree properties.
> 
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> [ luis: backported to 3.16: adjusted context ]
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>

This patch shouldn't be backported before 4.2. It fixes a bug introduced
in 4.2: 5f09a5cbd14a.

For kernels <4.2 this bug does not exist but fortunately the patch looks
harmless. Anyway still for <4.2 I think it shouldn't be ported.

Best regards,
Krzysztof

> ---
>  drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index efed4eedf47f..bd3ba217386e 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -558,27 +558,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)
>  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
>  	struct exynos_tmu_platform_data *pdata;
>  	struct resource res;
> -	int ret;
>  
>  	if (!data || !pdev->dev.of_node)
>  		return -ENODEV;
>  
> -	/*
> -	 * Try enabling the regulator if found
> -	 * TODO: Add regulator as an SOC feature, so that regulator enable
> -	 * is a compulsory call.
> -	 */
> -	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
> -	if (!IS_ERR(data->regulator)) {
> -		ret = regulator_enable(data->regulator);
> -		if (ret) {
> -			dev_err(&pdev->dev, "failed to enable vtmu\n");
> -			return ret;
> -		}
> -	} else {
> -		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
> -	}
> -
>  	data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl");
>  	if (data->id < 0)
>  		data->id = 0;
> @@ -643,6 +626,22 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, data);
>  	mutex_init(&data->lock);
>  
> +	/*
> +	 * Try enabling the regulator if found
> +	 * TODO: Add regulator as an SOC feature, so that regulator enable
> +	 * is a compulsory call.
> +	 */
> +	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
> +	if (!IS_ERR(data->regulator)) {
> +		ret = regulator_enable(data->regulator);
> +		if (ret) {
> +			dev_err(&pdev->dev, "failed to enable vtmu\n");
> +			return ret;
> +		}
> +	} else {
> +		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
> +	}
> +
>  	ret = exynos_map_dt_data(pdev);
>  	if (ret)
>  		return ret;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


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

* Re: [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-09 13:22   ` Krzysztof Kozlowski
@ 2015-12-09 13:59       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09 13:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, stable, kernel-team, k.kozlowski.k,
	Eduardo Valentin

On Wed, Dec 09, 2015 at 10:22:37PM +0900, Krzysztof Kozlowski wrote:
> W dniu 09.12.2015 o 18:37, Luis Henriques pisze:
> > 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > 
> > commit 824ead03b78403a21449cb7eb153a4344cd3b4c8 upstream.
> > 
> > During probe if the regulator could not be enabled, the error exit path
> > would still disable it. This could lead to unbalanced counter of
> > regulator enable/disable.
> > 
> > The patch moves code for getting and enabling the regulator from
> > exynos_map_dt_data() to probe function because it is really not a part
> > of getting Device Tree properties.
> > 
> > Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> > Tested-by: Lukasz Majewski <l.majewski@samsung.com>
> > Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > [ luis: backported to 3.16: adjusted context ]
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> 
> This patch shouldn't be backported before 4.2. It fixes a bug introduced
> in 4.2: 5f09a5cbd14a.
> 
> For kernels <4.2 this bug does not exist but fortunately the patch looks
> harmless. Anyway still for <4.2 I think it shouldn't be ported.
> 
> Best regards,
> Krzysztof
>

Thank you Krzysztof.

I understand that this fixes an issue with commit 5f09a5cbd14a ("thermal:
exynos: Disable the regulator on probe failure"), which was included in
4.2.  However, since this commit was also tagged for stable, it has also
been backported to some stable kernels (at least 3.16.y-ckt and
3.19.y-ckt).

Would you agree that, for this reason, this patch is in fact applicable to
the 3.16 (and 3.19) kernel?

Cheers,
--
Luís


> > ---
> >  drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
> >  1 file changed, 16 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index efed4eedf47f..bd3ba217386e 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -558,27 +558,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)
> >  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> >  	struct exynos_tmu_platform_data *pdata;
> >  	struct resource res;
> > -	int ret;
> >  
> >  	if (!data || !pdev->dev.of_node)
> >  		return -ENODEV;
> >  
> > -	/*
> > -	 * Try enabling the regulator if found
> > -	 * TODO: Add regulator as an SOC feature, so that regulator enable
> > -	 * is a compulsory call.
> > -	 */
> > -	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
> > -	if (!IS_ERR(data->regulator)) {
> > -		ret = regulator_enable(data->regulator);
> > -		if (ret) {
> > -			dev_err(&pdev->dev, "failed to enable vtmu\n");
> > -			return ret;
> > -		}
> > -	} else {
> > -		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
> > -	}
> > -
> >  	data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl");
> >  	if (data->id < 0)
> >  		data->id = 0;
> > @@ -643,6 +626,22 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, data);
> >  	mutex_init(&data->lock);
> >  
> > +	/*
> > +	 * Try enabling the regulator if found
> > +	 * TODO: Add regulator as an SOC feature, so that regulator enable
> > +	 * is a compulsory call.
> > +	 */
> > +	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
> > +	if (!IS_ERR(data->regulator)) {
> > +		ret = regulator_enable(data->regulator);
> > +		if (ret) {
> > +			dev_err(&pdev->dev, "failed to enable vtmu\n");
> > +			return ret;
> > +		}
> > +	} else {
> > +		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
> > +	}
> > +
> >  	ret = exynos_map_dt_data(pdev);
> >  	if (ret)
> >  		return ret;
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> > 
> 

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

* Re: [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure
@ 2015-12-09 13:59       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-09 13:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, stable, kernel-team, k.kozlowski.k,
	Eduardo Valentin

On Wed, Dec 09, 2015 at 10:22:37PM +0900, Krzysztof Kozlowski wrote:
> W dniu 09.12.2015 o 18:37, Luis Henriques pisze:
> > 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > 
> > commit 824ead03b78403a21449cb7eb153a4344cd3b4c8 upstream.
> > 
> > During probe if the regulator could not be enabled, the error exit path
> > would still disable it. This could lead to unbalanced counter of
> > regulator enable/disable.
> > 
> > The patch moves code for getting and enabling the regulator from
> > exynos_map_dt_data() to probe function because it is really not a part
> > of getting Device Tree properties.
> > 
> > Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> > Tested-by: Lukasz Majewski <l.majewski@samsung.com>
> > Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > [ luis: backported to 3.16: adjusted context ]
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> 
> This patch shouldn't be backported before 4.2. It fixes a bug introduced
> in 4.2: 5f09a5cbd14a.
> 
> For kernels <4.2 this bug does not exist but fortunately the patch looks
> harmless. Anyway still for <4.2 I think it shouldn't be ported.
> 
> Best regards,
> Krzysztof
>

Thank you Krzysztof.

I understand that this fixes an issue with commit 5f09a5cbd14a ("thermal:
exynos: Disable the regulator on probe failure"), which was included in
4.2.  However, since this commit was also tagged for stable, it has also
been backported to some stable kernels (at least 3.16.y-ckt and
3.19.y-ckt).

Would you agree that, for this reason, this patch is in fact applicable to
the 3.16 (and 3.19) kernel?

Cheers,
--
Lu�s


> > ---
> >  drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
> >  1 file changed, 16 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index efed4eedf47f..bd3ba217386e 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -558,27 +558,10 @@ static int exynos_map_dt_data(struct platform_device *pdev)
> >  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> >  	struct exynos_tmu_platform_data *pdata;
> >  	struct resource res;
> > -	int ret;
> >  
> >  	if (!data || !pdev->dev.of_node)
> >  		return -ENODEV;
> >  
> > -	/*
> > -	 * Try enabling the regulator if found
> > -	 * TODO: Add regulator as an SOC feature, so that regulator enable
> > -	 * is a compulsory call.
> > -	 */
> > -	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
> > -	if (!IS_ERR(data->regulator)) {
> > -		ret = regulator_enable(data->regulator);
> > -		if (ret) {
> > -			dev_err(&pdev->dev, "failed to enable vtmu\n");
> > -			return ret;
> > -		}
> > -	} else {
> > -		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
> > -	}
> > -
> >  	data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl");
> >  	if (data->id < 0)
> >  		data->id = 0;
> > @@ -643,6 +626,22 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, data);
> >  	mutex_init(&data->lock);
> >  
> > +	/*
> > +	 * Try enabling the regulator if found
> > +	 * TODO: Add regulator as an SOC feature, so that regulator enable
> > +	 * is a compulsory call.
> > +	 */
> > +	data->regulator = devm_regulator_get(&pdev->dev, "vtmu");
> > +	if (!IS_ERR(data->regulator)) {
> > +		ret = regulator_enable(data->regulator);
> > +		if (ret) {
> > +			dev_err(&pdev->dev, "failed to enable vtmu\n");
> > +			return ret;
> > +		}
> > +	} else {
> > +		dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
> > +	}
> > +
> >  	ret = exynos_map_dt_data(pdev);
> >  	if (ret)
> >  		return ret;
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> > 
> 

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

* Re: [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-09 13:59       ` Luis Henriques
  (?)
@ 2015-12-10  0:48       ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 154+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-10  0:48 UTC (permalink / raw)
  To: Luis Henriques
  Cc: linux-kernel, stable, kernel-team, k.kozlowski.k,
	Eduardo Valentin

On 09.12.2015 22:59, Luis Henriques wrote:
> On Wed, Dec 09, 2015 at 10:22:37PM +0900, Krzysztof Kozlowski wrote:
>> W dniu 09.12.2015 o 18:37, Luis Henriques pisze:
>>> 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
>>>
>>> ------------------
>>>
>>> From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>>
>>> commit 824ead03b78403a21449cb7eb153a4344cd3b4c8 upstream.
>>>
>>> During probe if the regulator could not be enabled, the error exit path
>>> would still disable it. This could lead to unbalanced counter of
>>> regulator enable/disable.
>>>
>>> The patch moves code for getting and enabling the regulator from
>>> exynos_map_dt_data() to probe function because it is really not a part
>>> of getting Device Tree properties.
>>>
>>> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
>>> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
>>> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
>>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>> Fixes: 5f09a5cbd14a ("thermal: exynos: Disable the regulator on probe failure")
>>> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
>>> [ luis: backported to 3.16: adjusted context ]
>>> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
>>
>> This patch shouldn't be backported before 4.2. It fixes a bug introduced
>> in 4.2: 5f09a5cbd14a.
>>
>> For kernels <4.2 this bug does not exist but fortunately the patch looks
>> harmless. Anyway still for <4.2 I think it shouldn't be ported.
>>
>> Best regards,
>> Krzysztof
>>
> 
> Thank you Krzysztof.
> 
> I understand that this fixes an issue with commit 5f09a5cbd14a ("thermal:
> exynos: Disable the regulator on probe failure"), which was included in
> 4.2.  However, since this commit was also tagged for stable, it has also
> been backported to some stable kernels (at least 3.16.y-ckt and
> 3.19.y-ckt).
> 
> Would you agree that, for this reason, this patch is in fact applicable to
> the 3.16 (and 3.19) kernel?

Ahh, you are right! The 5f09a5cbd14a was backported so this applies to
backporting as well.

Sorry for the noise.

Best regards,
Krzysztof

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations Luis Henriques
@ 2015-12-12  4:18   ` Ben Hutchings
  2015-12-13 18:54       ` Luis Henriques
  0 siblings, 1 reply; 154+ messages in thread
From: Ben Hutchings @ 2015-12-12  4:18 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Steffen Klassert, David S. Miller, Luis Henriques, linux-kernel,
	stable, kernel-team

[-- Attachment #1: Type: text/plain, Size: 982 bytes --]

On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> please let me know.
> 
> ------------------
> 
> From: Eric Dumazet <edumazet@google.com>
> 
> commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> 
> sit0 device allocates its percpu storage twice :
> - One time in ipip6_tunnel_init()
> - One time in ipip6_fb_tunnel_init()
> 
> Thus we leak 48 bytes per possible cpu per network namespace
> dismantle.
> 
> ipip6_fb_tunnel_init() can be much simpler and does not
> return an error, and should be called after register_netdev()
[...]

Doesn't this introduce a race condition when sit is a module?  There
seems to be nothing to prevent access to the partially initialised
device after calling register_netdev(), if sit_init_net() is called
during module loading rather than during namespace creation.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering"
  2015-12-09  9:36 ` [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering" Luis Henriques
@ 2015-12-12  4:37   ` Ben Hutchings
  2015-12-13 18:57       ` Luis Henriques
  0 siblings, 1 reply; 154+ messages in thread
From: Ben Hutchings @ 2015-12-12  4:37 UTC (permalink / raw)
  To: Luis Henriques, linux-kernel, stable, kernel-team
  Cc: Yinghai Lu, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 814 bytes --]

On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> commit 8346aa765e14348b7b436825b3c4740895a2fe1a upstream.
> 
> This reverts commit 7568fb63f57ac8672f8bf2018171255441238882 as it's
> already in Linus's tree through a different patch.
> 
> Reported-by: Tony Luck <tony.luck@intel.com>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
[...]

The reverted commit is patch 021/126 in this series, so you can drop
both of these.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-12  4:18   ` Ben Hutchings
@ 2015-12-13 18:54       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 18:54 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Eric Dumazet, Steffen Klassert, David S. Miller, linux-kernel,
	stable, kernel-team

On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> > please let me know.
> > 
> > ------------------
> > 
> > From: Eric Dumazet <edumazet@google.com>
> > 
> > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > 
> > sit0 device allocates its percpu storage twice :
> > - One time in ipip6_tunnel_init()
> > - One time in ipip6_fb_tunnel_init()
> > 
> > Thus we leak 48 bytes per possible cpu per network namespace
> > dismantle.
> > 
> > ipip6_fb_tunnel_init() can be much simpler and does not
> > return an error, and should be called after register_netdev()
> [...]
> 
> Doesn't this introduce a race condition when sit is a module?  There
> seems to be nothing to prevent access to the partially initialised
> device after calling register_netdev(), if sit_init_net() is called
> during module loading rather than during namespace creation.
> 

This seems to be an upstream issue, not specific to the 3.16.y-ckt
stable kernel.  If that is the case, I guess I'll just keep this patch
and later apply the fix.  Or do you think this race is really likely
to be a worst problem than then issue the patch is trying to fix?

Cheers,
--
Luís

> Ben.
> 
> -- 
> Ben Hutchings
> Knowledge is power.  France is bacon.


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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
@ 2015-12-13 18:54       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 18:54 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Eric Dumazet, Steffen Klassert, David S. Miller, linux-kernel,
	stable, kernel-team

On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > 3.16.7-ckt21 -stable review patch.��If anyone has any objections,
> > please let me know.
> > 
> > ------------------
> > 
> > From: Eric Dumazet <edumazet@google.com>
> > 
> > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > 
> > sit0 device allocates its percpu storage twice :
> > - One time in ipip6_tunnel_init()
> > - One time in ipip6_fb_tunnel_init()
> > 
> > Thus we leak 48 bytes per possible cpu per network namespace
> > dismantle.
> > 
> > ipip6_fb_tunnel_init() can be much simpler and does not
> > return an error, and should be called after register_netdev()
> [...]
> 
> Doesn't this introduce a race condition when sit is a module? �There
> seems to be nothing to prevent access to the partially initialised
> device after calling register_netdev(), if sit_init_net() is called
> during module loading rather than during namespace creation.
> 

This seems to be an upstream issue, not specific to the 3.16.y-ckt
stable kernel.  If that is the case, I guess I'll just keep this patch
and later apply the fix.  Or do you think this race is really likely
to be a worst problem than then issue the patch is trying to fix?

Cheers,
--
Lu�s

> Ben.
> 
> -- 
> Ben Hutchings
> Knowledge is power.  France is bacon.


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

* Re: [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering"
  2015-12-12  4:37   ` Ben Hutchings
@ 2015-12-13 18:57       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 18:57 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, kernel-team, Yinghai Lu, Greg Kroah-Hartman

On Sat, Dec 12, 2015 at 04:37:10AM +0000, Ben Hutchings wrote:
> On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > 3.16.7-ckt21 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > commit 8346aa765e14348b7b436825b3c4740895a2fe1a upstream.
> > 
> > This reverts commit 7568fb63f57ac8672f8bf2018171255441238882 as it's
> > already in Linus's tree through a different patch.
> > 
> > Reported-by: Tony Luck <tony.luck@intel.com>
> > Cc: Yinghai Lu <yinghai@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> [...]
> 
> The reverted commit is patch 021/126 in this series, so you can drop
> both of these.
> 

This is a bit embarrassing... :-)
(In fact, I saw this and forgot to drop the patches, which makes it
even more embarrassing.)

Anyway, both patches have now been dropped.  Thanks Ben.

Cheers,
--
Luís

> Ben.
> 
> -- 
> Ben Hutchings
> Knowledge is power.  France is bacon.


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

* Re: [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering"
@ 2015-12-13 18:57       ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 18:57 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, kernel-team, Yinghai Lu, Greg Kroah-Hartman

On Sat, Dec 12, 2015 at 04:37:10AM +0000, Ben Hutchings wrote:
> On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > 3.16.7-ckt21 -stable review patch.��If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > commit 8346aa765e14348b7b436825b3c4740895a2fe1a upstream.
> > 
> > This reverts commit 7568fb63f57ac8672f8bf2018171255441238882 as it's
> > already in Linus's tree through a different patch.
> > 
> > Reported-by: Tony Luck <tony.luck@intel.com>
> > Cc: Yinghai Lu <yinghai@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> [...]
> 
> The reverted commit is patch 021/126 in this series, so you can drop
> both of these.
> 

This is a bit embarrassing... :-)
(In fact, I saw this and forgot to drop the patches, which makes it
even more embarrassing.)

Anyway, both patches have now been dropped.  Thanks Ben.

Cheers,
--
Lu�s

> Ben.
> 
> -- 
> Ben Hutchings
> Knowledge is power.  France is bacon.


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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 18:54       ` Luis Henriques
  (?)
@ 2015-12-13 20:20       ` Ben Hutchings
  2015-12-13 20:43         ` Eric Dumazet
  -1 siblings, 1 reply; 154+ messages in thread
From: Ben Hutchings @ 2015-12-13 20:20 UTC (permalink / raw)
  To: Luis Henriques
  Cc: Eric Dumazet, Steffen Klassert, David S. Miller, linux-kernel,
	stable, kernel-team

[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]

On Sun, 2015-12-13 at 18:54 +0000, Luis Henriques wrote:
> On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> > On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > > 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> > > please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Eric Dumazet <edumazet@google.com>
> > > 
> > > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > > 
> > > sit0 device allocates its percpu storage twice :
> > > - One time in ipip6_tunnel_init()
> > > - One time in ipip6_fb_tunnel_init()
> > > 
> > > Thus we leak 48 bytes per possible cpu per network namespace
> > > dismantle.
> > > 
> > > ipip6_fb_tunnel_init() can be much simpler and does not
> > > return an error, and should be called after register_netdev()
> > [...]
> > 
> > Doesn't this introduce a race condition when sit is a module?  There
> > seems to be nothing to prevent access to the partially initialised
> > device after calling register_netdev(), if sit_init_net() is called
> > during module loading rather than during namespace creation.
> > 
> 
> This seems to be an upstream issue, not specific to the 3.16.y-ckt
> stable kernel.  If that is the case, I guess I'll just keep this patch
> and later apply the fix.  Or do you think this race is really likely
> to be a worst problem than then issue the patch is trying to fix?

It seems worse than the problem being fixed.

Ben.

-- 
Ben Hutchings
Life would be so much easier if we could look at the source code.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 20:20       ` Ben Hutchings
@ 2015-12-13 20:43         ` Eric Dumazet
  2015-12-13 21:22           ` Ben Hutchings
                             ` (2 more replies)
  0 siblings, 3 replies; 154+ messages in thread
From: Eric Dumazet @ 2015-12-13 20:43 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Luis Henriques, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

On Sun, 2015-12-13 at 20:20 +0000, Ben Hutchings wrote:
> On Sun, 2015-12-13 at 18:54 +0000, Luis Henriques wrote:
> > On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> > > On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > > > 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> > > > please let me know.
> > > > 
> > > > ------------------
> > > > 
> > > > From: Eric Dumazet <edumazet@google.com>
> > > > 
> > > > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > > > 
> > > > sit0 device allocates its percpu storage twice :
> > > > - One time in ipip6_tunnel_init()
> > > > - One time in ipip6_fb_tunnel_init()
> > > > 
> > > > Thus we leak 48 bytes per possible cpu per network namespace
> > > > dismantle.
> > > > 
> > > > ipip6_fb_tunnel_init() can be much simpler and does not
> > > > return an error, and should be called after register_netdev()
> > > [...]
> > > 
> > > Doesn't this introduce a race condition when sit is a module?  There
> > > seems to be nothing to prevent access to the partially initialised
> > > device after calling register_netdev(), if sit_init_net() is called
> > > during module loading rather than during namespace creation.
> > > 
> > 
> > This seems to be an upstream issue, not specific to the 3.16.y-ckt
> > stable kernel.  If that is the case, I guess I'll just keep this patch
> > and later apply the fix.  Or do you think this race is really likely
> > to be a worst problem than then issue the patch is trying to fix?
> 
> It seems worse than the problem being fixed.

1) Sorry Ben, I do not understand the problem you mention.
   What is a partially initialized device exactly ?

2) I have no idea why this patch is even backported to 3.16,
 since it is fixing a problem added in 3.18 :

# git describe --contains ebe084aafb7e
v3.18-rc5~22^2~42^2~1

If your 3.16 kernel survives this loop without consuming memory like
crazy, then the backport is not needed.

modprobe sit
while :
do
 ip netns add ns1
 ip netns delete ns1
done





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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 20:43         ` Eric Dumazet
@ 2015-12-13 21:22           ` Ben Hutchings
  2015-12-13 21:44             ` Eric Dumazet
  2015-12-13 21:32             ` Luis Henriques
  2015-12-13 22:14           ` David Miller
  2 siblings, 1 reply; 154+ messages in thread
From: Ben Hutchings @ 2015-12-13 21:22 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Luis Henriques, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

[-- Attachment #1: Type: text/plain, Size: 2506 bytes --]

On Sun, 2015-12-13 at 12:43 -0800, Eric Dumazet wrote:
> On Sun, 2015-12-13 at 20:20 +0000, Ben Hutchings wrote:
> > On Sun, 2015-12-13 at 18:54 +0000, Luis Henriques wrote:
> > > On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> > > > On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > > > > 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> > > > > please let me know.
> > > > > 
> > > > > ------------------
> > > > > 
> > > > > From: Eric Dumazet <edumazet@google.com>
> > > > > 
> > > > > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > > > > 
> > > > > sit0 device allocates its percpu storage twice :
> > > > > - One time in ipip6_tunnel_init()
> > > > > - One time in ipip6_fb_tunnel_init()
> > > > > 
> > > > > Thus we leak 48 bytes per possible cpu per network namespace
> > > > > dismantle.
> > > > > 
> > > > > ipip6_fb_tunnel_init() can be much simpler and does not
> > > > > return an error, and should be called after register_netdev()
> > > > [...]
> > > > 
> > > > Doesn't this introduce a race condition when sit is a module?  There
> > > > seems to be nothing to prevent access to the partially initialised
> > > > device after calling register_netdev(), if sit_init_net() is called
> > > > during module loading rather than during namespace creation.
> > > > 
> > > 
> > > This seems to be an upstream issue, not specific to the 3.16.y-ckt
> > > stable kernel.  If that is the case, I guess I'll just keep this patch
> > > and later apply the fix.  Or do you think this race is really likely
> > > to be a worst problem than then issue the patch is trying to fix?
> > 
> > It seems worse than the problem being fixed.
> 
> 1) Sorry Ben, I do not understand the problem you mention.
>    What is a partially initialized device exactly ?

A tunnel device which is registered but hasn't had its private
structure fully initialised yet.

> 2) I have no idea why this patch is even backported to 3.16,
>  since it is fixing a problem added in 3.18 :
> 
> # git describe --contains ebe084aafb7e
> v3.18-rc5~22^2~42^2~1
> 
> If your 3.16 kernel survives this loop without consuming memory like
> crazy, then the backport is not needed.
> 
> modprobe sit
> while :
> do
>  ip netns add ns1
>  ip netns delete ns1
> done

I can't detect a memory leak when doing this.

Ben.

-- 
Ben Hutchings
Life would be so much easier if we could look at the source code.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 20:43         ` Eric Dumazet
@ 2015-12-13 21:32             ` Luis Henriques
  2015-12-13 21:32             ` Luis Henriques
  2015-12-13 22:14           ` David Miller
  2 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 21:32 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ben Hutchings, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

On Sun, Dec 13, 2015 at 12:43:10PM -0800, Eric Dumazet wrote:
> On Sun, 2015-12-13 at 20:20 +0000, Ben Hutchings wrote:
> > On Sun, 2015-12-13 at 18:54 +0000, Luis Henriques wrote:
> > > On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> > > > On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > > > > 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> > > > > please let me know.
> > > > > 
> > > > > ------------------
> > > > > 
> > > > > From: Eric Dumazet <edumazet@google.com>
> > > > > 
> > > > > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > > > > 
> > > > > sit0 device allocates its percpu storage twice :
> > > > > - One time in ipip6_tunnel_init()
> > > > > - One time in ipip6_fb_tunnel_init()
> > > > > 
> > > > > Thus we leak 48 bytes per possible cpu per network namespace
> > > > > dismantle.
> > > > > 
> > > > > ipip6_fb_tunnel_init() can be much simpler and does not
> > > > > return an error, and should be called after register_netdev()
> > > > [...]
> > > > 
> > > > Doesn't this introduce a race condition when sit is a module?  There
> > > > seems to be nothing to prevent access to the partially initialised
> > > > device after calling register_netdev(), if sit_init_net() is called
> > > > during module loading rather than during namespace creation.
> > > > 
> > > 
> > > This seems to be an upstream issue, not specific to the 3.16.y-ckt
> > > stable kernel.  If that is the case, I guess I'll just keep this patch
> > > and later apply the fix.  Or do you think this race is really likely
> > > to be a worst problem than then issue the patch is trying to fix?
> > 
> > It seems worse than the problem being fixed.
> 
> 1) Sorry Ben, I do not understand the problem you mention.
>    What is a partially initialized device exactly ?
> 
> 2) I have no idea why this patch is even backported to 3.16,
>  since it is fixing a problem added in 3.18 :
> 
> # git describe --contains ebe084aafb7e
> v3.18-rc5~22^2~42^2~1
>

Right, but this commit has been included in several stable git trees
(I can see it at least in 3.14, 3.13 and 3.10, but it's probably in
some more).

Cheers,
--
Luís


> If your 3.16 kernel survives this loop without consuming memory like
> crazy, then the backport is not needed.
> 
> modprobe sit
> while :
> do
>  ip netns add ns1
>  ip netns delete ns1
> done
> 
> 
> 
> 

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
@ 2015-12-13 21:32             ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 21:32 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Ben Hutchings, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

On Sun, Dec 13, 2015 at 12:43:10PM -0800, Eric Dumazet wrote:
> On Sun, 2015-12-13 at 20:20 +0000, Ben Hutchings wrote:
> > On Sun, 2015-12-13 at 18:54 +0000, Luis Henriques wrote:
> > > On Sat, Dec 12, 2015 at 04:18:26AM +0000, Ben Hutchings wrote:
> > > > On Wed, 2015-12-09 at 09:36 +0000, Luis Henriques wrote:
> > > > > 3.16.7-ckt21 -stable review patch.  If anyone has any objections,
> > > > > please let me know.
> > > > > 
> > > > > ------------------
> > > > > 
> > > > > From: Eric Dumazet <edumazet@google.com>
> > > > > 
> > > > > commit 4ece9009774596ee3df0acba65a324b7ea79387c upstream.
> > > > > 
> > > > > sit0 device allocates its percpu storage twice :
> > > > > - One time in ipip6_tunnel_init()
> > > > > - One time in ipip6_fb_tunnel_init()
> > > > > 
> > > > > Thus we leak 48 bytes per possible cpu per network namespace
> > > > > dismantle.
> > > > > 
> > > > > ipip6_fb_tunnel_init() can be much simpler and does not
> > > > > return an error, and should be called after register_netdev()
> > > > [...]
> > > > 
> > > > Doesn't this introduce a race condition when sit is a module?  There
> > > > seems to be nothing to prevent access to the partially initialised
> > > > device after calling register_netdev(), if sit_init_net() is called
> > > > during module loading rather than during namespace creation.
> > > > 
> > > 
> > > This seems to be an upstream issue, not specific to the 3.16.y-ckt
> > > stable kernel.  If that is the case, I guess I'll just keep this patch
> > > and later apply the fix.  Or do you think this race is really likely
> > > to be a worst problem than then issue the patch is trying to fix?
> > 
> > It seems worse than the problem being fixed.
> 
> 1) Sorry Ben, I do not understand the problem you mention.
>    What is a partially initialized device exactly ?
> 
> 2) I have no idea why this patch is even backported to 3.16,
>  since it is fixing a problem added in 3.18 :
> 
> # git describe --contains ebe084aafb7e
> v3.18-rc5~22^2~42^2~1
>

Right, but this commit has been included in several stable git trees
(I can see it at least in 3.14, 3.13 and 3.10, but it's probably in
some more).

Cheers,
--
Lu�s


> If your 3.16 kernel survives this loop without consuming memory like
> crazy, then the backport is not needed.
> 
> modprobe sit
> while :
> do
>  ip netns add ns1
>  ip netns delete ns1
> done
> 
> 
> 
> 

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 21:22           ` Ben Hutchings
@ 2015-12-13 21:44             ` Eric Dumazet
  2015-12-13 21:49               ` Ben Hutchings
  0 siblings, 1 reply; 154+ messages in thread
From: Eric Dumazet @ 2015-12-13 21:44 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Luis Henriques, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

On Sun, 2015-12-13 at 21:22 +0000, Ben Hutchings wrote:
> On Sun, 2015-12-13 at 12:43 -0800, Eric Dumazet wrote:

> > 1) Sorry Ben, I do not understand the problem you mention.
> >    What is a partially initialized device exactly ?
> 
> A tunnel device which is registered but hasn't had its private
> structure fully initialised yet.

And you see this happening after my patch ? I am blind.

I am referring to current linux kernel, not to a backport to pre 3.18
kernels, that was not considered when I wrote this patch.

By the time ipip6_fb_tunnel_init() is called, dev->tstats had been
already allocated in ipip6_tunnel_init(), so what is missing ?

Thanks.



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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 21:44             ` Eric Dumazet
@ 2015-12-13 21:49               ` Ben Hutchings
  2015-12-13 22:45                 ` Eric Dumazet
  0 siblings, 1 reply; 154+ messages in thread
From: Ben Hutchings @ 2015-12-13 21:49 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Luis Henriques, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

On Sun, 2015-12-13 at 13:44 -0800, Eric Dumazet wrote:
> On Sun, 2015-12-13 at 21:22 +0000, Ben Hutchings wrote:
> > On Sun, 2015-12-13 at 12:43 -0800, Eric Dumazet wrote:
> 
> > > 1) Sorry Ben, I do not understand the problem you mention.
> > >    What is a partially initialized device exactly ?
> > 
> > A tunnel device which is registered but hasn't had its private
> > structure fully initialised yet.
> 
> And you see this happening after my patch ? I am blind.
> 
> I am referring to current linux kernel, not to a backport to pre 3.18
> kernels, that was not considered when I wrote this patch.
> 
> By the time ipip6_fb_tunnel_init() is called, dev->tstats had been
> already allocated in ipip6_tunnel_init(), so what is missing ?

You moved this initialisation below the registration:

> 	ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
> 	ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);

Ben.

-- 
Ben Hutchings
Life would be so much easier if we could look at the source code.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 20:43         ` Eric Dumazet
  2015-12-13 21:22           ` Ben Hutchings
  2015-12-13 21:32             ` Luis Henriques
@ 2015-12-13 22:14           ` David Miller
  2015-12-13 22:22               ` Luis Henriques
  2 siblings, 1 reply; 154+ messages in thread
From: David Miller @ 2015-12-13 22:14 UTC (permalink / raw)
  To: eric.dumazet
  Cc: ben, luis.henriques, edumazet, steffen.klassert, linux-kernel,
	stable, kernel-team

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 13 Dec 2015 12:43:10 -0800

> 2) I have no idea why this patch is even backported to 3.16,
>  since it is fixing a problem added in 3.18 :

Because someone on the path to some of the -stable trees aren't even
checking the Fixes: tag in the patches they are backporting.

And that's really bad...

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 22:14           ` David Miller
@ 2015-12-13 22:22               ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 22:22 UTC (permalink / raw)
  To: David Miller
  Cc: eric.dumazet, ben, edumazet, steffen.klassert, linux-kernel,
	stable, kernel-team

On Sun, Dec 13, 2015 at 05:14:06PM -0500, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Sun, 13 Dec 2015 12:43:10 -0800
> 
> > 2) I have no idea why this patch is even backported to 3.16,
> >  since it is fixing a problem added in 3.18 :
> 
> Because someone on the path to some of the -stable trees aren't even
> checking the Fixes: tag in the patches they are backporting.
> 
> And that's really bad...

As I already said before, this patch has been included in 3.16 because
the SHA1 in the "Fixes:" *is* in 3.16 (as it is in other even older
stable trees such as 3.12 and 3.14).

Cheers,
--
Luís

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
@ 2015-12-13 22:22               ` Luis Henriques
  0 siblings, 0 replies; 154+ messages in thread
From: Luis Henriques @ 2015-12-13 22:22 UTC (permalink / raw)
  To: David Miller
  Cc: eric.dumazet, ben, edumazet, steffen.klassert, linux-kernel,
	stable, kernel-team

On Sun, Dec 13, 2015 at 05:14:06PM -0500, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Sun, 13 Dec 2015 12:43:10 -0800
> 
> > 2) I have no idea why this patch is even backported to 3.16,
> >  since it is fixing a problem added in 3.18 :
> 
> Because someone on the path to some of the -stable trees aren't even
> checking the Fixes: tag in the patches they are backporting.
> 
> And that's really bad...

As I already said before, this patch has been included in 3.16 because
the SHA1 in the "Fixes:" *is* in 3.16 (as it is in other even older
stable trees such as 3.12 and 3.14).

Cheers,
--
Lu�s

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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 21:49               ` Ben Hutchings
@ 2015-12-13 22:45                 ` Eric Dumazet
  2015-12-13 23:03                   ` Ben Hutchings
  0 siblings, 1 reply; 154+ messages in thread
From: Eric Dumazet @ 2015-12-13 22:45 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Luis Henriques, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

On Sun, 2015-12-13 at 21:49 +0000, Ben Hutchings wrote:
> On Sun, 2015-12-13 at 13:44 -0800, Eric Dumazet wrote:
> > On Sun, 2015-12-13 at 21:22 +0000, Ben Hutchings wrote:
> > > On Sun, 2015-12-13 at 12:43 -0800, Eric Dumazet wrote:
> > 
> > > > 1) Sorry Ben, I do not understand the problem you mention.
> > > >    What is a partially initialized device exactly ?
> > > 
> > > A tunnel device which is registered but hasn't had its private
> > > structure fully initialised yet.
> > 
> > And you see this happening after my patch ? I am blind.
> > 
> > I am referring to current linux kernel, not to a backport to pre 3.18
> > kernels, that was not considered when I wrote this patch.
> > 
> > By the time ipip6_fb_tunnel_init() is called, dev->tstats had been
> > already allocated in ipip6_tunnel_init(), so what is missing ?
> 
> You moved this initialisation below the registration:
> 
> > 	ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
> > 	ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);

Okay, so what is the exact problem you are seeing Ben ?

ipip6_tunnel_clone_6rd() looks to not contain a fatal race or mem leak.

Note that ipip6_tunnel_clone_6rd() can be called later from ioctl()
path.

ipip6_fb_tunnel_init() must be done once device is ready, as it
publishes state for packet processing.

rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);

Looks like a rather correct way to register a device : init all fields,
then publish the RCU protected pointer for packets to catch it.

Really, I do not see a problem, please elaborate.




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

* Re: [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations
  2015-12-13 22:45                 ` Eric Dumazet
@ 2015-12-13 23:03                   ` Ben Hutchings
  0 siblings, 0 replies; 154+ messages in thread
From: Ben Hutchings @ 2015-12-13 23:03 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Luis Henriques, Eric Dumazet, Steffen Klassert, David S. Miller,
	linux-kernel, stable, kernel-team

[-- Attachment #1: Type: text/plain, Size: 1896 bytes --]

On Sun, 2015-12-13 at 14:45 -0800, Eric Dumazet wrote:
> On Sun, 2015-12-13 at 21:49 +0000, Ben Hutchings wrote:
> > On Sun, 2015-12-13 at 13:44 -0800, Eric Dumazet wrote:
> > > On Sun, 2015-12-13 at 21:22 +0000, Ben Hutchings wrote:
> > > > On Sun, 2015-12-13 at 12:43 -0800, Eric Dumazet wrote:
> > > 
> > > > > 1) Sorry Ben, I do not understand the problem you mention.
> > > > >    What is a partially initialized device exactly ?
> > > > 
> > > > A tunnel device which is registered but hasn't had its private
> > > > structure fully initialised yet.
> > > 
> > > And you see this happening after my patch ? I am blind.
> > > 
> > > I am referring to current linux kernel, not to a backport to pre 3.18
> > > kernels, that was not considered when I wrote this patch.
> > > 
> > > By the time ipip6_fb_tunnel_init() is called, dev->tstats had been
> > > already allocated in ipip6_tunnel_init(), so what is missing ?
> > 
> > You moved this initialisation below the registration:
> > 
> > > 	ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
> > > 	ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
> 
> Okay, so what is the exact problem you are seeing Ben ?
> 
> ipip6_tunnel_clone_6rd() looks to not contain a fatal race or mem leak.
> 
> Note that ipip6_tunnel_clone_6rd() can be called later from ioctl()
> path.

That holds the rtnl_lock, though.

> ipip6_fb_tunnel_init() must be done once device is ready, as it
> publishes state for packet processing.

OK.

> rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
> 
> Looks like a rather correct way to register a device : init all fields,
> then publish the RCU protected pointer for packets to catch it.
> 
> Really, I do not see a problem, please elaborate.

Maybe there isn't one in this case.

Ben.

-- 
Ben Hutchings
Life would be so much easier if we could look at the source code.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

end of thread, other threads:[~2015-12-13 23:04 UTC | newest]

Thread overview: 154+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09  9:36 [3.16.y-ckt stable] Linux 3.16.7-ckt21 stable review Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 001/126] irda: precedence bug in irlmp_seq_hb_idx() Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 002/126] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Luis Henriques
2015-12-09 11:27   ` Bjørn Mork
2015-12-09 11:44     ` Luis Henriques
2015-12-09 11:44       ` Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 003/126] macvtap: unbreak receiving of gro skb with frag list Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 004/126] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 005/126] stmmac: Correctly report PTP capabilities Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 006/126] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 007/126] net: qmi_wwan: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 008/126] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ " Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 009/126] sit: fix sit0 percpu double allocations Luis Henriques
2015-12-12  4:18   ` Ben Hutchings
2015-12-13 18:54     ` Luis Henriques
2015-12-13 18:54       ` Luis Henriques
2015-12-13 20:20       ` Ben Hutchings
2015-12-13 20:43         ` Eric Dumazet
2015-12-13 21:22           ` Ben Hutchings
2015-12-13 21:44             ` Eric Dumazet
2015-12-13 21:49               ` Ben Hutchings
2015-12-13 22:45                 ` Eric Dumazet
2015-12-13 23:03                   ` Ben Hutchings
2015-12-13 21:32           ` Luis Henriques
2015-12-13 21:32             ` Luis Henriques
2015-12-13 22:14           ` David Miller
2015-12-13 22:22             ` Luis Henriques
2015-12-13 22:22               ` Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 010/126] packet: race condition in packet_bind Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 011/126] net: avoid NULL deref in inet_ctl_sock_destroy() Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 012/126] net: fix a race in dst_release() Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 013/126] Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 014/126] x86/xen: Do not clip xen_e820_map to xen_e820_map_entries when sanitizing map Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 015/126] HID: core: Avoid uninitialized buffer access Luis Henriques
2015-12-09  9:36   ` Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 016/126] [media] v4l2-compat-ioctl32: fix alignment for ARM64 Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 017/126] net: mvneta: Fix CPU_MAP registers initialisation Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 018/126] mtd: mtdpart: fix add_mtd_partitions error path Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 019/126] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 020/126] ARM: 8427/1: dma-mapping: add support for offset parameter " Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 021/126] mm: Check if section present during memory block (un)registering Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 022/126] spi: ti-qspi: Fix data corruption seen on r/w stress test Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 023/126] lockd: create NSM handles per net namespace Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 024/126] Revert "mm: Check if section present during memory block (un)registering" Luis Henriques
2015-12-12  4:37   ` Ben Hutchings
2015-12-13 18:57     ` Luis Henriques
2015-12-13 18:57       ` Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 025/126] Btrfs: fix file corruption and data loss after cloning inline extents Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 026/126] ARM: common: edma: Fix channel parameter for irq callbacks Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 027/126] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 028/126] Btrfs: fix truncation of compressed and inlined extents Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 029/126] ext4: fix potential use after free in __ext4_journal_stop Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 030/126] [PATCH] fix calculation of meta_bg descriptor backups Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 031/126] ext4, jbd2: ensure entering into panic after recording an error in superblock Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 032/126] vTPM: fix memory allocation flag for rtce buffer at kernel boot Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 033/126] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 034/126] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 035/126] Bluetooth: hidp: fix device disconnect on idle timeout Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 036/126] Bluetooth: ath3k: Add new AR3012 0930:021c id Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 037/126] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 038/126] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 039/126] USB: qcserial: add Sierra Wireless MC74xx/EM74xx Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 040/126] staging: rtl8712: Add device ID for Sitecom WLA2100 Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 041/126] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 042/126] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 043/126] MAINTAINERS: Add public mailing list for ARC Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 044/126] megaraid_sas: Do not use PAGE_SIZE for max_sectors Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 045/126] KVM: s390: SCA must not cross page boundaries Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 046/126] arm64: Fix compat register mappings Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 047/126] can: Use correct type in sizeof() in nla_put() Luis Henriques
2015-12-09  9:36   ` Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 048/126] mtd: blkdevs: fix potential deadlock + lockdep warnings Luis Henriques
2015-12-09  9:36 ` [PATCH 3.16.y-ckt 049/126] Revert "dm mpath: fix stalls when handling invalid ioctls" Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 050/126] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015) Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 051/126] crypto: algif_hash - Only export and import on sockets with data Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 052/126] xtensa: fixes for configs without loop option Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 053/126] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 054/126] mac80211: fix divide by zero when NOA update Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 055/126] mac80211: allow null chandef in tracing Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 056/126] xtensa: fix secondary core boot in SMP Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 057/126] recordmcount: Fix endianness handling bug for nop_mcount Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 058/126] KVM: VMX: fix SMEP and SMAP without EPT Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 059/126] thermal: exynos: Fix unbalanced regulator disable on probe failure Luis Henriques
2015-12-09 13:22   ` Krzysztof Kozlowski
2015-12-09 13:59     ` Luis Henriques
2015-12-09 13:59       ` Luis Henriques
2015-12-10  0:48       ` Krzysztof Kozlowski
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 060/126] ALSA: hda - Apply pin fixup for HP ProBook 6550b Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 061/126] ALSA: hda - Add Intel Lewisburg device IDs Audio Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 062/126] firewire: ohci: fix JMicron JMB38x IT context discovery Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 063/126] scsi: restart list search after unlock in scsi_remove_target Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 064/126] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 065/126] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 066/126] proc: actually make proc_fd_permission() thread-friendly Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 067/126] x86/setup: Extend low identity map to cover whole kernel range Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 068/126] x86/setup: Fix low identity map for >= 2GB " Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 069/126] x86/cpu: Call verify_cpu() after having entered long mode too Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 070/126] Btrfs: fix race leading to incorrect item deletion when dropping extents Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 071/126] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 072/126] perf: Fix inherited events vs. tracepoint filters Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 073/126] scsi_sysfs: Fix queue_ramp_up_period return code Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 074/126] Btrfs: fix race when listing an inode's xattrs Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 075/126] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 076/126] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 077/126] KVM: x86: Defining missing x86 vectors Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 078/126] KVM: x86: work around infinite loop in microcode when #AC is delivered Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 079/126] KVM: svm: unconditionally intercept #DB Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 080/126] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 081/126] drm/ast: Initialized data needed to map fbdev memory Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 082/126] FS-Cache: Increase reference of parent after registering, netfs success Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 083/126] FS-Cache: Don't override netfs's primary_index if registering failed Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 084/126] binfmt_elf: Don't clobber passed executable's file header Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 085/126] fs/pipe.c: return error code rather than 0 in pipe_write() Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 086/126] splice: sendfile() at once fails for big files Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 087/126] mac80211: fix driver RSSI event calculations Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 088/126] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 089/126] mwifiex: fix mwifiex_rdeeprom_read() Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 090/126] dmaengine: dw: convert to __ffs() Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 091/126] usb: ehci-orion: fix probe for !GENERIC_PHY Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 092/126] devres: fix a for loop bounds check Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 093/126] netfilter: remove dead code Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 094/126] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 095/126] packet: fix match_fanout_group() Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 096/126] hsi: fix double kfree Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 097/126] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 098/126] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 099/126] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 100/126] drm: Fix return value of drm_framebuffer_init() Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 101/126] ALSA: fireworks: use u32 type for be32_to_cpup() macro Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 102/126] ALSA: bebob: use correct type for __be32 data Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 103/126] tcp: apply Kern's check on RTTs used for congestion control Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 104/126] clk: versatile-icst: fix memory leak Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 105/126] MIPS: atomic: Fix comment describing atomic64_add_unless's return value Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 106/126] mfd: twl6040: Fix deferred probe handling for clk32k Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 107/126] of/fdt: fix error checking for earlycon address Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 108/126] netfilter: nfnetlink: don't probe module if it exists Luis Henriques
2015-12-09  9:37 ` [PATCH 3.16.y-ckt 109/126] xprtrdma: Re-arm after missed events Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 110/126] ceph: fix message length computation Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 111/126] ipv6: fix tunnel error handling Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 112/126] perf trace: Fix documentation for -i Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 113/126] bonding: fix panic on non-ARPHRD_ETHER enslave failure Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 114/126] rtc: ds1307: Fix alarm programming for mcp794xx Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 115/126] TPM: Avoid reference to potentially freed memory Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 116/126] xtensa: nommu: provide _PAGE_CHG_MASK definition Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 117/126] md/raid0: update queue parameter in a safer location Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 118/126] md/raid0: apply base queue limits *before* disk_stack_limits Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 119/126] drm/radeon: add quirk for MSI R7 370 Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 120/126] drm/radeon: add quirk for ASUS " Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 121/126] drm/radeon: fix quirk for MSI R7 370 Armor 2X Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 122/126] tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 123/126] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 124/126] ALSA: hda - Disable 64bit address for Creative HDA controllers Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 125/126] printk: prevent userland from spoofing kernel messages Luis Henriques
2015-12-09  9:38 ` [PATCH 3.16.y-ckt 126/126] FS-Cache: Handle a write to the page immediately beyond the EOF marker 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.