All of lore.kernel.org
 help / color / mirror / Atom feed
* [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review
@ 2015-12-02 16:57 Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 001/164] x86/setup: Extend low identity map to cover whole kernel range Kamal Mostafa
                   ` (163 more replies)
  0 siblings, 164 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Kamal Mostafa

This is the start of the review cycle for the Linux 3.19.8-ckt11 stable kernel.

This version contains 164 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.19.y-review

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

The review period for version 3.19.8-ckt11 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.19.y-ckt extended stable kernel version,
see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Kamal

--
 .../devicetree/bindings/mmc/renesas,mmcif.txt      |   4 +-
 Documentation/devicetree/bindings/usb/dwc3.txt     |   2 +
 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/mach-tegra/board-paz00.c                  |   4 +-
 arch/arm/mm/dma-mapping.c                          |   7 +
 arch/arm64/include/asm/ptrace.h                    |  16 +-
 arch/arm64/net/bpf_jit.h                           |   3 +-
 arch/arm64/net/bpf_jit_comp.c                      |  54 ++++--
 arch/mips/include/asm/atomic.h                     |   2 +-
 arch/parisc/include/asm/compat.h                   |   4 +-
 arch/parisc/include/uapi/asm/ipcbuf.h              |  19 +-
 arch/parisc/include/uapi/asm/msgbuf.h              |  10 +-
 arch/parisc/include/uapi/asm/posix_types.h         |   2 +
 arch/parisc/include/uapi/asm/sembuf.h              |   6 +-
 arch/parisc/include/uapi/asm/shmbuf.h              |   8 +-
 arch/parisc/mm/init.c                              |  16 ++
 arch/s390/kvm/kvm-s390.c                           |   4 +-
 arch/sparc/kernel/pci.c                            |   7 +-
 arch/sparc/kernel/pci_common.c                     |  17 +-
 arch/sparc/kernel/pci_impl.h                       |   1 +
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S          |   2 +-
 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/xtensa/include/asm/asmmacro.h                 |   7 +-
 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                                 |  13 +-
 drivers/acpi/sleep.c                               |   6 +-
 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/i2c/busses/i2c-img-scb.c                   |  71 +++++---
 drivers/input/mouse/elantech.c                     |   7 +
 drivers/iommu/intel-iommu.c                        |   9 +-
 drivers/md/dm-mpath.c                              |   7 +-
 drivers/media/platform/vivid/vivid-core.c          |   5 +-
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c      |   9 +-
 drivers/media/v4l2-core/v4l2-ctrls.c               |  12 +-
 drivers/media/v4l2-core/videobuf2-dma-contig.c     |   5 +-
 drivers/media/v4l2-core/videobuf2-dma-sg.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 +-
 drivers/net/ethernet/sfc/ef10.c                    |   4 +-
 drivers/net/ethernet/sfc/farch.c                   |   4 +-
 drivers/net/ethernet/sfc/net_driver.h              |   2 +
 drivers/net/ethernet/sfc/tx.c                      |  30 +++-
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |   7 +-
 drivers/net/macvtap.c                              |   2 +-
 drivers/net/usb/qmi_wwan.c                         |   9 +-
 drivers/net/wireless/mwifiex/debugfs.c             |  14 +-
 drivers/of/fdt.c                                   |   5 +-
 drivers/of/of_reserved_mem.c                       |   4 +
 drivers/pci/host/pcie-spear13xx.c                  |  26 +--
 drivers/platform/x86/ideapad-laptop.c              |   7 +
 drivers/power/wm831x_power.c                       |   6 +-
 drivers/regulator/arizona-ldo1.c                   |  18 +-
 drivers/rtc/rtc-ds1307.c                           |   4 +-
 drivers/scsi/megaraid/megaraid_sas.h               |   2 +
 drivers/scsi/megaraid/megaraid_sas_base.c          |  20 ++-
 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/usb/dwc3/core.c                            |  16 +-
 drivers/usb/dwc3/core.h                            |  22 +++
 drivers/usb/dwc3/dwc3-pci.c                        |  10 ++
 drivers/usb/dwc3/platform_data.h                   |   1 +
 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                               |  67 +++----
 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/checkpoint.c                               |   8 +-
 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/nfsd/nfs4state.c                                |  33 +++-
 fs/nfsd/state.h                                    |  17 +-
 fs/pipe.c                                          |   9 +-
 fs/proc/array.c                                    |  16 +-
 fs/proc/base.c                                     |  11 +-
 fs/proc/fd.c                                       |  14 +-
 fs/seq_file.c                                      |  11 +-
 include/linux/acpi.h                               |   6 +
 include/linux/jbd2.h                               |   1 +
 include/linux/lockd/lockd.h                        |   9 +-
 include/linux/tracepoint.h                         |   9 +-
 include/net/inet_common.h                          |   3 +-
 include/net/inet_frag.h                            |  15 +-
 include/net/netfilter/nf_conntrack.h               |   4 -
 kernel/events/core.c                               |   4 +
 kernel/printk/printk.c                             |  13 +-
 lib/devres.c                                       |   2 +-
 mm/memcontrol.c                                    |  11 +-
 mm/slab.c                                          |   5 +-
 net/bluetooth/hidp/core.c                          |  14 ++
 net/bluetooth/mgmt.c                               |  12 +-
 net/core/dst.c                                     |   2 +-
 net/core/fib_rules.c                               |   2 +-
 net/ieee802154/reassembly.c                        |  11 +-
 net/ipv4/inet_fragment.c                           |   6 -
 net/ipv4/ip_fragment.c                             |  12 +-
 net/ipv4/ip_output.c                               |   2 +-
 net/ipv4/ipmr.c                                    |   6 +-
 net/ipv4/sysctl_net_ipv4.c                         |   4 +-
 net/ipv4/tcp_input.c                               |   5 +-
 net/ipv4/tcp_ipv4.c                                |   2 +-
 net/ipv6/addrconf.c                                |   1 +
 net/ipv6/netfilter/nf_conntrack_reasm.c            |  12 +-
 net/ipv6/reassembly.c                              |  12 +-
 net/ipv6/sit.c                                     |  26 +--
 net/ipv6/tcp_ipv6.c                                |   2 +-
 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/nf_nat_redirect.c                    |   2 +-
 net/netfilter/nfnetlink.c                          |   2 +-
 net/packet/af_packet.c                             |  86 +++++----
 net/rds/tcp_recv.c                                 |  11 +-
 net/sunrpc/auth_gss/auth_gss.c                     |  13 +-
 net/sunrpc/xprtrdma/verbs.c                        |  66 ++-----
 net/tipc/msg.c                                     |  12 +-
 net/wireless/nl80211.c                             |  12 +-
 scripts/recordmcount.c                             |  24 ++-
 scripts/recordmcount.h                             |   2 +-
 security/integrity/digsig.c                        |   2 +-
 sound/firewire/bebob/Makefile                      |   2 +-
 sound/firewire/bebob/bebob_maudio.c                |   2 +-
 sound/firewire/dice/Makefile                       |   2 +-
 sound/firewire/dice/dice-stream.c                  |  12 +-
 sound/firewire/dice/dice.c                         |   3 +-
 sound/firewire/fireworks/Makefile                  |   2 +-
 sound/firewire/fireworks/fireworks_command.c       |   2 +-
 sound/firewire/oxfw/Makefile                       |   2 +-
 sound/pci/hda/hda_intel.c                          |   8 +
 sound/pci/hda/patch_hdmi.c                         |   3 +-
 sound/pci/hda/patch_realtek.c                      |  13 ++
 sound/pci/hda/patch_sigmatel.c                     |   1 +
 sound/usb/quirks.c                                 |   1 +
 tools/perf/Documentation/perf-trace.txt            |   1 -
 194 files changed, 1327 insertions(+), 695 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.

Antonio Ospite (1):
      [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL

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

Arnd Bergmann (3):
      ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
      sunrpc: avoid warning in gss_key_timeout
      ceph: fix message length computation

Benoit Parrot (1):
      [media] media: v4l2-ctrls: Fix 64bit support in get_ctrl()

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

Charles Keepax (1):
      regulator: arizona-ldo1: Fix handling of GPIO 0

Chen Yu (3):
      ACPI: Use correct IRQ when uninstalling ACPI interrupt handler
      ACPI: Using correct irq when waiting for events
      ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle

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

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

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 Woodhouse (1):
      iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints

Dmitry Kasatkin (1):
      integrity: prevent loading untrusted certificates on the IMA trusted keyring

Dmitry Osipenko (1):
      ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table

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 (6):
      sit: fix sit0 percpu double allocations
      net: avoid NULL deref in inet_ctl_sock_destroy()
      net: fix a race in dst_release()
      tcp: call sk_mark_napi_id() on the child, not the listener
      packet: fix match_fanout_group()
      net: fix percpu memory leaks

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

Ezequiel Garcia (1):
      vivid: Fix iteration in driver removal path

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

Gabriele Paoloni (1):
      PCI: spear: Fix dw_pcie_cfg_read/write() usage

Geliang Tang (1):
      hsi: fix double kfree

Greg Thelen (1):
      fs, seqfile: always allow oom killer

Hans Verkuil (1):
      [media] v4l2-ctrls: arrays are also considered compound controls

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

Helge Deller (1):
      parisc: Fixes and cleanups in kernel uapi header files

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

Jan Kara (1):
      jbd2: fix checkpoint list cleanup

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

Jeff Layton (1):
      nfsd: serialize state seqid morphing operations

Johan Hedberg (1):
      Bluetooth: Fix removing connection parameters when unpairing

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

John Youn (4):
      usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID
      usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1
      usb: dwc3: Support Synopsys USB 3.1 IP
      usb: dwc3: Add dis_enblslpm_quirk

Jon Paul Maloy (1):
      tipc: allow non-linear first fragment buffer

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

Jurgen Kramer (1):
      ALSA: usb: Add native DSD support for Aune X1S

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

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

Li Bin (1):
      recordmcount: arm64: Replace the ignored mcount call into nop

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

Lu, Han (1):
      ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec

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

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()

Martin Habets (1):
      sfc: push partner queue for skb->xmit_more

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

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

Mathieu Desnoyers (1):
      tracepoints: Fix documentation of RCU lockdep checks

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

Max Filippov (2):
      xtensa: fixes for configs without loop option
      xtensa: fix secondary core boot in SMP

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 Hocko (1):
      memcg: fix thresholds for 32b architectures.

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

Munehisa Kamata (1):
      netfilter: nf_nat_redirect: add missing NULL pointer check

Nicolas Iooss (1):
      crypto: crc32c-pclmul - use .rodata instead of .rotata

Ola Olsson (1):
      nl80211: Fix potential memory leak from parse_acl_data

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

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.

Roland Dreier (1):
      [3.19-stable only] fib_rules: Fix dump_rules() not to exit early

Sabrina Dubroca (1):
      ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev

Sergei Shtylyov (1):
      DT: mmc: sh_mmcif: fix "compatible" property text

Sifan Naeem (6):
      i2c: img-scb: enable fencing for all versions of the ip
      i2c: img-scb: do dummy writes before fifo access
      i2c: img-scb: use DIV_ROUND_UP to round divisor values
      i2c: img-scb: fix LOW and HIGH period values for the SCL clock
      i2c: img-scb: Clear line and interrupt status before starting a transfer
      i2c: img-scb: verify support for requested bit rate

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 - Disable 64bit address for Creative HDA controllers
      ALSA: hda - Apply pin fixup for HP ProBook 6550b
      Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled

Takashi Sakamoto (5):
      ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in
      ALSA: dice: correct variable types for __be32 data
      ALSA: dice: assign converted data to the same type of variable
      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 (2):
      [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish
      [media] media: vb2 dma-sg: 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

WANG Cong (1):
      ipv4: disable BH when changing ip local port range

Yinghai Lu (1):
      sparc/PCI: Add mem64 resource parsing for root bus

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

Zi Shen Lim (2):
      arm64: bpf: fix div-by-zero case
      arm64: bpf: fix mod-by-zero case

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

sumit.saxena@avagotech.com (3):
      megaraid_sas: Expose TAPE drives unconditionally
      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] 173+ messages in thread

* [PATCH 3.19.y-ckt 001/164] x86/setup: Extend low identity map to cover whole kernel range
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB " Kamal Mostafa
                   ` (162 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 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, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 ab4734e..5f660ca 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1188,6 +1188,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();
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB kernel range
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 001/164] x86/setup: Extend low identity map to cover whole kernel range Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 003/164] drm/radeon: add quirk for MSI R7 370 Kamal Mostafa
                   ` (161 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Mazur, Andy Lutomirski, Borislav Petkov, Laszlo Ersek,
	Matt Fleming, Paolo Bonzini, Thomas Gleixner, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 5f660ca..51a4b6b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1195,7 +1195,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();
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 003/164] drm/radeon: add quirk for MSI R7 370
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 001/164] x86/setup: Extend low identity map to cover whole kernel range Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB " Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 004/164] drm/radeon: add quirk for ASUS " Kamal Mostafa
                   ` (160 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxim Sheviakov, Alex Deucher, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 fe252b0..c884df8 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, 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 },
 };
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 004/164] drm/radeon: add quirk for ASUS R7 370
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (2 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 003/164] drm/radeon: add quirk for MSI R7 370 Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 005/164] drm/radeon: fix quirk for MSI R7 370 Armor 2X Kamal Mostafa
                   ` (159 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 c884df8..d67ce4c 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2924,6 +2924,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 },
 };
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 005/164] drm/radeon: fix quirk for MSI R7 370 Armor 2X
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (3 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 004/164] drm/radeon: add quirk for ASUS " Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 006/164] irda: precedence bug in irlmp_seq_hb_idx() Kamal Mostafa
                   ` (158 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxim Sheviakov, Alex Deucher, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 d67ce4c..bec1aba 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2923,7 +2923,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 },
 };
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 006/164] irda: precedence bug in irlmp_seq_hb_idx()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (4 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 005/164] drm/radeon: fix quirk for MSI R7 370 Armor 2X Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 007/164] tipc: allow non-linear first fragment buffer Kamal Mostafa
                   ` (157 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 50010c20597d14667eff0fdb628309986f195230 ]

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: Kamal Mostafa <kamal@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 a26c401..4396459 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -1839,7 +1839,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;
 		}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 007/164] tipc: allow non-linear first fragment buffer
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (5 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 006/164] irda: precedence bug in irlmp_seq_hb_idx() Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 008/164] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Kamal Mostafa
                   ` (156 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jon Maloy, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jon Paul Maloy <jon.maloy@ericsson.com>

[ Upstream commit 45c8b7b175ceb2d542e0fe15247377bf3bce29ec ]

The current code for message reassembly is erroneously assuming that
the the first arriving fragment buffer always is linear, and then goes
ahead resetting the fragment list of that buffer in anticipation of
more arriving fragments.

However, if the buffer already happens to be non-linear, we will
inadvertently drop the already attached fragment list, and later
on trig a BUG() in __pskb_pull_tail().

We see this happen when running fragmented TIPC multicast across UDP,
something made possible since
commit d0f91938bede ("tipc: add ip/udp media type")

We fix this by not resetting the fragment list when the buffer is non-
linear, and by initiatlizing our private fragment list tail pointer to
the tail of the existing fragment list.

Fixes: commit d0f91938bede ("tipc: add ip/udp media type")
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/tipc/msg.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index a687b30..2baa992 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -98,7 +98,7 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
 {
 	struct sk_buff *head = *headbuf;
 	struct sk_buff *frag = *buf;
-	struct sk_buff *tail;
+	struct sk_buff *tail = NULL;
 	struct tipc_msg *msg;
 	u32 fragid;
 	int delta;
@@ -118,9 +118,15 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
 		if (unlikely(skb_unclone(frag, GFP_ATOMIC)))
 			goto err;
 		head = *headbuf = frag;
-		skb_frag_list_init(head);
-		TIPC_SKB_CB(head)->tail = NULL;
 		*buf = NULL;
+		TIPC_SKB_CB(head)->tail = NULL;
+		if (skb_is_nonlinear(head)) {
+			skb_walk_frags(head, tail) {
+				TIPC_SKB_CB(head)->tail = tail;
+			}
+		} else {
+			skb_frag_list_init(head);
+		}
 		return 0;
 	}
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 008/164] qmi_wwan: add Sierra Wireless MC74xx/EM74xx
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (6 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 007/164] tipc: allow non-linear first fragment buffer Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 009/164] macvtap: unbreak receiving of gro skb with frag list Kamal Mostafa
                   ` (155 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 0db65fcfcded76fe4f74e3ca9f4e2baf67b683ef ]

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: Kamal Mostafa <kamal@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 602dc66..a33de7c 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -764,6 +764,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 */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 009/164] macvtap: unbreak receiving of gro skb with frag list
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (7 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 008/164] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 010/164] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Kamal Mostafa
                   ` (154 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vlad Yasevich, Michael S. Tsirkin, Jason Wang, David S. Miller,
	Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jason Wang <jasowang@redhat.com>

[ Upstream commit f23d538bc24a83c16127c2eb82c9cf1adc2b5149 ]

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: Kamal Mostafa <kamal@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 84e835e..73437568 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -82,7 +82,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)
 {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 010/164] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (8 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 009/164] macvtap: unbreak receiving of gro skb with frag list Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 011/164] stmmac: Correctly report PTP capabilities Kamal Mostafa
                   ` (153 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sowmini Varadhan, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 8ce675ff39b9958d1c10f86cf58e357efaafc856 ]

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: Kamal Mostafa <kamal@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 fbc5ef8..27a9921 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -214,8 +214,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 -> "
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 011/164] stmmac: Correctly report PTP capabilities.
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (9 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 010/164] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 012/164] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context Kamal Mostafa
                   ` (152 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Phil Reid, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit e6dbe1eb2db0d7a14991c06278dd3030c45fb825 ]

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: Kamal Mostafa <kamal@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 771cda2..2e51b81 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -721,10 +721,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)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 012/164] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context.
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (10 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 011/164] stmmac: Correctly report PTP capabilities Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 013/164] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module Kamal Mostafa
                   ` (151 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ani Sinha, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ani Sinha <ani@arista.com>

[ Upstream commit 44f49dd8b5a606870a1f21101522a0f9c4414784 ]

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: Kamal Mostafa <kamal@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 c803458..a1fc97a 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;
 	}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 013/164] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (11 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 012/164] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 014/164] sit: fix sit0 percpu double allocations Kamal Mostafa
                   ` (150 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 70910791731b5956171e1bfcad707766b8e18fee ]

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: Kamal Mostafa <kamal@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 a33de7c..75aa421 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -539,6 +539,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 */
@@ -788,7 +792,6 @@ 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, 0x581d, 4)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
 
 	/* 4. Gobi 1000 devices */
 	{QMI_GOBI1K_DEVICE(0x05c6, 0x9212)},	/* Acer Gobi Modem Device */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 014/164] sit: fix sit0 percpu double allocations
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (12 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 013/164] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 015/164] sfc: push partner queue for skb->xmit_more Kamal Mostafa
                   ` (149 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Steffen Klassert, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 4ece9009774596ee3df0acba65a324b7ea79387c ]

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: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv6/sit.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index cdbfe5a..eb3ea58 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1395,34 +1395,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[])
@@ -1832,23 +1818,19 @@ 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);
 	err = register_netdev(sitn->fb_tunnel_dev);
 	if (err)
 		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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 015/164] sfc: push partner queue for skb->xmit_more
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (13 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 014/164] sit: fix sit0 percpu double allocations Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 016/164] net: avoid NULL deref in inet_ctl_sock_destroy() Kamal Mostafa
                   ` (148 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin Habets, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Martin Habets <mhabets@solarflare.com>

[ Upstream commit b2663a4f30e85ec606b806f5135413e6d5c78d1e ]

When the IP stack passes SKBs the sfc driver puts them in 2 different TX
queues (called partners), one for checksummed and one for not checksummed.
If the SKB has xmit_more set the driver will delay pushing the work to the
NIC.

When later it does decide to push the buffers this patch ensures it also
pushes the partner queue, if that also has any delayed work. Before this
fix the work in the partner queue would be left for a long time and cause
a netdev watchdog.

Fixes: 70b33fb ("sfc: add support for skb->xmit_more")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Martin Habets <mhabets@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/sfc/ef10.c       |  4 +++-
 drivers/net/ethernet/sfc/farch.c      |  4 +++-
 drivers/net/ethernet/sfc/net_driver.h |  2 ++
 drivers/net/ethernet/sfc/tx.c         | 30 ++++++++++++++++++++++++++++--
 4 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index fbb6cfa..feca46e 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1344,7 +1344,9 @@ static void efx_ef10_tx_write(struct efx_tx_queue *tx_queue)
 	unsigned int write_ptr;
 	efx_qword_t *txd;
 
-	BUG_ON(tx_queue->write_count == tx_queue->insert_count);
+	tx_queue->xmit_more_available = false;
+	if (unlikely(tx_queue->write_count == tx_queue->insert_count))
+		return;
 
 	do {
 		write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 7597532..3992406 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -319,7 +319,9 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue)
 	unsigned write_ptr;
 	unsigned old_write_count = tx_queue->write_count;
 
-	BUG_ON(tx_queue->write_count == tx_queue->insert_count);
+	tx_queue->xmit_more_available = false;
+	if (unlikely(tx_queue->write_count == tx_queue->insert_count))
+		return;
 
 	do {
 		write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 325dd94..0bdef4a 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -218,6 +218,7 @@ struct efx_tx_buffer {
  * @tso_packets: Number of packets via the TSO xmit path
  * @pushes: Number of times the TX push feature has been used
  * @pio_packets: Number of times the TX PIO feature has been used
+ * @xmit_more_available: Are any packets waiting to be pushed to the NIC
  * @empty_read_count: If the completion path has seen the queue as empty
  *	and the transmission path has not yet checked this, the value of
  *	@read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0.
@@ -250,6 +251,7 @@ struct efx_tx_queue {
 	unsigned int tso_packets;
 	unsigned int pushes;
 	unsigned int pio_packets;
+	bool xmit_more_available;
 	/* Statistics to supplement MAC stats */
 	unsigned long tx_packets;
 
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index aaf2987..e70edc3 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -431,8 +431,20 @@ finish_packet:
 	efx_tx_maybe_stop_queue(tx_queue);
 
 	/* Pass off to hardware */
-	if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq))
+	if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) {
+		struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue);
+
+		/* There could be packets left on the partner queue if those
+		 * SKBs had skb->xmit_more set. If we do not push those they
+		 * could be left for a long time and cause a netdev watchdog.
+		 */
+		if (txq2->xmit_more_available)
+			efx_nic_push_buffers(txq2);
+
 		efx_nic_push_buffers(tx_queue);
+	} else {
+		tx_queue->xmit_more_available = skb->xmit_more;
+	}
 
 	tx_queue->tx_packets++;
 
@@ -721,6 +733,7 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue)
 	tx_queue->read_count = 0;
 	tx_queue->old_read_count = 0;
 	tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID;
+	tx_queue->xmit_more_available = false;
 
 	/* Set up TX descriptor ring */
 	efx_nic_init_tx(tx_queue);
@@ -746,6 +759,7 @@ void efx_fini_tx_queue(struct efx_tx_queue *tx_queue)
 
 		++tx_queue->read_count;
 	}
+	tx_queue->xmit_more_available = false;
 	netdev_tx_reset_queue(tx_queue->core_txq);
 }
 
@@ -1301,8 +1315,20 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
 	efx_tx_maybe_stop_queue(tx_queue);
 
 	/* Pass off to hardware */
-	if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq))
+	if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) {
+		struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue);
+
+		/* There could be packets left on the partner queue if those
+		 * SKBs had skb->xmit_more set. If we do not push those they
+		 * could be left for a long time and cause a netdev watchdog.
+		 */
+		if (txq2->xmit_more_available)
+			efx_nic_push_buffers(txq2);
+
 		efx_nic_push_buffers(tx_queue);
+	} else {
+		tx_queue->xmit_more_available = skb->xmit_more;
+	}
 
 	tx_queue->tso_bursts++;
 	return NETDEV_TX_OK;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 016/164] net: avoid NULL deref in inet_ctl_sock_destroy()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (14 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 015/164] sfc: push partner queue for skb->xmit_more Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 017/164] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev Kamal Mostafa
                   ` (147 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 8fa677d2706d325d71dab91bf6e6512c05214e37 ]

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>
Signed-off-by: Kamal Mostafa <kamal@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 b2828a0..a7d812d 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -42,7 +42,8 @@ int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
 
 static inline void inet_ctl_sock_destroy(struct sock *sk)
 {
-	sk_release_kernel(sk);
+	if (sk)
+		sk_release_kernel(sk);
 }
 
 #endif
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 017/164] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (15 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 016/164] net: avoid NULL deref in inet_ctl_sock_destroy() Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 018/164] ipv4: disable BH when changing ip local port range Kamal Mostafa
                   ` (146 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sabrina Dubroca, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sabrina Dubroca <sd@queasysnail.net>

[ Upstream commit 2a189f9e57650e9f310ddf4aad75d66c1233a064 ]

In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up
the dev_snmp6 entry that we have already registered for this device.
Call snmp6_unregister_dev in this case.

Fixes: a317a2f19da7d ("ipv6: fail early when creating netdev named all or default")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv6/addrconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 167d23e..06b8921 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -396,6 +396,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
 	if (err) {
 		ipv6_mc_destroy_dev(ndev);
 		del_timer(&ndev->regen_timer);
+		snmp6_unregister_dev(ndev);
 		goto err_release;
 	}
 	/* protected by rtnl_lock */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 018/164] ipv4: disable BH when changing ip local port range
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (16 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 017/164] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 019/164] packet: race condition in packet_bind Kamal Mostafa
                   ` (145 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tom Herbert, Cong Wang, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 4ee3bd4a8c7463cdef0b82ebc33fc94a9170a7e0 ]

This fixes the following lockdep warning:

 [ INFO: inconsistent lock state ]
 4.3.0-rc7+ #1197 Not tainted
 ---------------------------------
 inconsistent {IN-SOFTIRQ-R} -> {SOFTIRQ-ON-W} usage.
 sysctl/1019 [HC0[0]:SC0[0]:HE1:SE1] takes:
  (&(&net->ipv4.ip_local_ports.lock)->seqcount){+.+-..}, at: [<ffffffff81921de7>] ipv4_local_port_range+0xb4/0x12a
 {IN-SOFTIRQ-R} state was registered at:
   [<ffffffff810bd682>] __lock_acquire+0x2f6/0xdf0
   [<ffffffff810be6d5>] lock_acquire+0x11c/0x1a4
   [<ffffffff818e599c>] inet_get_local_port_range+0x4e/0xae
   [<ffffffff8166e8e3>] udp_flow_src_port.constprop.40+0x23/0x116
   [<ffffffff81671cb9>] vxlan_xmit_one+0x219/0xa6a
   [<ffffffff81672f75>] vxlan_xmit+0xa6b/0xaa5
   [<ffffffff817f2deb>] dev_hard_start_xmit+0x2ae/0x465
   [<ffffffff817f35ed>] __dev_queue_xmit+0x531/0x633
   [<ffffffff817f3702>] dev_queue_xmit_sk+0x13/0x15
   [<ffffffff818004a5>] neigh_resolve_output+0x12f/0x14d
   [<ffffffff81959cfa>] ip6_finish_output2+0x344/0x39f
   [<ffffffff8195bf58>] ip6_finish_output+0x88/0x8e
   [<ffffffff8195bfef>] ip6_output+0x91/0xe5
   [<ffffffff819792ae>] dst_output_sk+0x47/0x4c
   [<ffffffff81979392>] NF_HOOK_THRESH.constprop.30+0x38/0x82
   [<ffffffff8197981e>] mld_sendpack+0x189/0x266
   [<ffffffff8197b28b>] mld_ifc_timer_expire+0x1ef/0x223
   [<ffffffff810de581>] call_timer_fn+0xfb/0x28c
   [<ffffffff810ded1e>] run_timer_softirq+0x1c7/0x1f1

Fixes: b8f1a55639e6 ("udp: Add function to make source port for UDP tunnels")
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/sysctl_net_ipv4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index e0ee384..b3ee8ee 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -45,10 +45,10 @@ static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
 /* Update system visible IP port range */
 static void set_local_port_range(struct net *net, int range[2])
 {
-	write_seqlock(&net->ipv4.ip_local_ports.lock);
+	write_seqlock_bh(&net->ipv4.ip_local_ports.lock);
 	net->ipv4.ip_local_ports.range[0] = range[0];
 	net->ipv4.ip_local_ports.range[1] = range[1];
-	write_sequnlock(&net->ipv4.ip_local_ports.lock);
+	write_sequnlock_bh(&net->ipv4.ip_local_ports.lock);
 }
 
 /* Validate changes from /proc interface. */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 019/164] packet: race condition in packet_bind
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (17 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 018/164] ipv4: disable BH when changing ip local port range Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 020/164] net: fix a race in dst_release() Kamal Mostafa
                   ` (144 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Francesco Ruggeri, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Francesco Ruggeri <fruggeri@aristanetworks.com>

[ Upstream commit 30f7ea1c2b5f5fb7462c5ae44fe2e40cb2d6a474 ]

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: Kamal Mostafa <kamal@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 8da43cb..bfc1880 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2665,22 +2665,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;
@@ -2688,14 +2706,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);
@@ -2703,7 +2736,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;
@@ -2712,9 +2745,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;
 }
 
 /*
@@ -2726,8 +2760,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
@@ -2737,19 +2769,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
@@ -2760,16 +2786,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 = {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 020/164] net: fix a race in dst_release()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (18 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 019/164] packet: race condition in packet_bind Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57   ` Kamal Mostafa
                   ` (143 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit d69bbf88c8d0b367cf3e3a052f6daadf630ee566 ]

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>
Signed-off-by: Kamal Mostafa <kamal@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 e956ce6..f8db403 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);
 	}
 }
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 021/164] HID: core: Avoid uninitialized buffer access
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
@ 2015-12-02 16:57   ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB " Kamal Mostafa
                     ` (162 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Richard Purdie, Jiri Kosina, linux-input, Darren Hart,
	Jiri Kosina, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8b63879..d7d965f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1562,7 +1562,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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 021/164] HID: core: Avoid uninitialized buffer access
@ 2015-12-02 16:57   ` Kamal Mostafa
  0 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Kosina, Kamal Mostafa, Jiri Kosina, Richard Purdie,
	linux-input, Darren Hart

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8b63879..d7d965f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1562,7 +1562,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;
-- 
1.9.1

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

* [PATCH 3.19.y-ckt 022/164] [media] v4l2-compat-ioctl32: fix alignment for ARM64
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (20 preceding siblings ...)
  2015-12-02 16:57   ` Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 023/164] net: mvneta: Fix CPU_MAP registers initialisation Kamal Mostafa
                   ` (141 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrzej Hajda, Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 af63543..788b31c 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -266,7 +266,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;
@@ -286,7 +286,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) ||
@@ -587,10 +587,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. */
@@ -738,6 +738,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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 023/164] net: mvneta: Fix CPU_MAP registers initialisation
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (21 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 022/164] [media] v4l2-compat-ioctl32: fix alignment for ARM64 Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 024/164] mtd: mtdpart: fix add_mtd_partitions error path Kamal Mostafa
                   ` (140 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maxime Ripard, Gregory CLEMENT, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 f8a081a..5ff18c1 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -942,7 +942,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));
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 024/164] mtd: mtdpart: fix add_mtd_partitions error path
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (22 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 023/164] net: mvneta: Fix CPU_MAP registers initialisation Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 025/164] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Kamal Mostafa
                   ` (139 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Boris Brezillon, Brian Norris, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 a3e3a7d..6e98e2c 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -648,8 +648,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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 025/164] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (23 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 024/164] mtd: mtdpart: fix add_mtd_partitions error path Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 026/164] [media] v4l2-ctrls: arrays are also considered compound controls Kamal Mostafa
                   ` (138 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 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

3.19.8-ckt11 -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.19-stable: proc_pid_wchan context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 Documentation/filesystems/proc.txt |  5 +++--
 fs/proc/array.c                    | 16 ++++++++++++++--
 fs/proc/base.c                     | 11 +++++------
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index aae9dd1..a04b51b 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 bd117d0..4739054 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -368,7 +368,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;
@@ -500,7 +500,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 3f3d7ae..89b6904 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -238,13 +238,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 
 	wchan = get_wchan(task);
 
-	if (lookup_symbol_name(wchan, symname) < 0)
-		if (!ptrace_may_access(task, PTRACE_MODE_READ))
-			return 0;
-		else
-			return seq_printf(m, "%lu", wchan);
+	if (wchan && ptrace_may_access(task, PTRACE_MODE_READ) && !lookup_symbol_name(wchan, symname))
+		seq_printf(m, "%s", symname);
 	else
-		return seq_printf(m, "%s", symname);
+		seq_putc(m, '0');
+
+	return 0;
 }
 #endif /* CONFIG_KALLSYMS */
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 026/164] [media] v4l2-ctrls: arrays are also considered compound controls
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (24 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 025/164] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 027/164] [media] media: v4l2-ctrls: Fix 64bit support in get_ctrl() Kamal Mostafa
                   ` (137 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hans Verkuil <hans.verkuil@cisco.com>

commit 35204e2e84f2dae72012f8ca319659c12f428430 upstream.

Array controls weren't skipped when only V4L2_CTRL_FLAG_NEXT_CTRL was
provided (so no V4L2_CTRL_FLAG_NEXT_COMPOUND was set). This is wrong
since arrays are also considered compound controls (i.e. with more than
one value), and applications that do not know about arrays will not
be able to handle such controls.

Fix the test to include arrays.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 45c5b47..468a3b3 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2497,7 +2497,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
 			/* We found a control with the given ID, so just get
 			   the next valid one in the list. */
 			list_for_each_entry_continue(ref, &hdl->ctrl_refs, node) {
-				is_compound =
+				is_compound = ref->ctrl->is_array ||
 					ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
 				if (id < ref->ctrl->id &&
 				    (is_compound & mask) == match)
@@ -2511,7 +2511,7 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
 			   is one, otherwise the first 'if' above would have
 			   been true. */
 			list_for_each_entry(ref, &hdl->ctrl_refs, node) {
-				is_compound =
+				is_compound = ref->ctrl->is_array ||
 					ref->ctrl->type >= V4L2_CTRL_COMPOUND_TYPES;
 				if (id < ref->ctrl->id &&
 				    (is_compound & mask) == match)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 027/164] [media] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (25 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 026/164] [media] v4l2-ctrls: arrays are also considered compound controls Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 028/164] ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table Kamal Mostafa
                   ` (136 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benoit Parrot, Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Benoit Parrot <bparrot@ti.com>

commit a8077734055f870ba630563868a6349671ca8dfc upstream.

When trying to use v4l2_ctrl_g_ctrl_int64() to retrieve a
V4L2_CTRL_TYPE_INTEGER64 type value the internal helper function
get_ctrl() would prematurely exit because for this control type
the 'is_int' flag is not set. This would result in v4l2_ctrl_g_ctrl_int64
always returning 0.

Also v4l2_ctrl_g_ctrl_int64() is reading and returning the 32bit value
member instead of the 64bit version, so fixing that as well.

This patch extends the condition check to allow the V4L2_CTRL_TYPE_INTEGER64
type to continue processing instead of exiting.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 468a3b3..2e98f02 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2883,7 +2883,7 @@ static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)
 	 * cur_to_user() calls below would need to be modified not to access
 	 * userspace memory when called from get_ctrl().
 	 */
-	if (!ctrl->is_int)
+	if (!ctrl->is_int && ctrl->type != V4L2_CTRL_TYPE_INTEGER64)
 		return -EINVAL;
 
 	if (ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
@@ -2941,9 +2941,9 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl)
 
 	/* It's a driver bug if this happens. */
 	WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64);
-	c.value = 0;
+	c.value64 = 0;
 	get_ctrl(ctrl, &c);
-	return c.value;
+	return c.value64;
 }
 EXPORT_SYMBOL(v4l2_ctrl_g_ctrl_int64);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 028/164] ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (26 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 027/164] [media] media: v4l2-ctrls: Fix 64bit support in get_ctrl() Kamal Mostafa
@ 2015-12-02 16:57 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 029/164] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Kamal Mostafa
                   ` (135 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:57 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Osipenko, Thierry Reding, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Osipenko <digetx@gmail.com>

commit e77b675f8786f38d40fc1562e1275875daf67fef upstream.

Commit 72daceb9a10a ("net: rfkill: gpio: Add default GPIO driver mappings
for ACPI") removed possibility to request GPIO by table index for non-ACPI
platforms without changing its users. As result "shutdown" GPIO request
will fail if request for "reset" GPIO succeeded or "reset" will be
requested instead of "shutdown" if "reset" wasn't defined. Fix it by
making gpiod_lookup_table use con_id's instead of indexes.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Fixes: 72daceb (net: rfkill: gpio: Add default GPIO driver mappings for ACPI)
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Marc Dietrich <marvin24@gmx.de>
Tested-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-tegra/board-paz00.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index fbe74c6..49d1110 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -39,8 +39,8 @@ static struct platform_device wifi_rfkill_device = {
 static struct gpiod_lookup_table wifi_gpio_lookup = {
 	.dev_id = "rfkill_gpio",
 	.table = {
-		GPIO_LOOKUP_IDX("tegra-gpio", 25, NULL, 0, 0),
-		GPIO_LOOKUP_IDX("tegra-gpio", 85, NULL, 1, 0),
+		GPIO_LOOKUP("tegra-gpio", 25, "reset", 0),
+		GPIO_LOOKUP("tegra-gpio", 85, "shutdown", 0),
 		{ },
 	},
 };
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 029/164] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (27 preceding siblings ...)
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 028/164] ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 030/164] ARM: 8427/1: dma-mapping: add support for offset parameter " Kamal Mostafa
                   ` (134 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Szyprowski, Russell King, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 bc074ef..30558bb 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1365,12 +1365,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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 030/164] ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (28 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 029/164] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 031/164] integrity: prevent loading untrusted certificates on the IMA trusted keyring Kamal Mostafa
                   ` (133 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Szyprowski, Russell King, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 30558bb..7e5fda66 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1376,6 +1376,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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 031/164] integrity: prevent loading untrusted certificates on the IMA trusted keyring
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (29 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 030/164] ARM: 8427/1: dma-mapping: add support for offset parameter " Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 032/164] usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID Kamal Mostafa
                   ` (132 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Kasatkin, Mimi Zohar, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>

commit 72e1eed8abb11c79749266d433c817ce36732893 upstream.

If IMA_LOAD_X509 is enabled, either directly or indirectly via
IMA_APPRAISE_SIGNED_INIT, certificates are loaded onto the IMA
trusted keyring by the kernel via key_create_or_update(). When
the KEY_ALLOC_TRUSTED flag is provided, certificates are loaded
without first verifying the certificate is properly signed by a
trusted key on the system keyring.  This patch removes the
KEY_ALLOC_TRUSTED flag.

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 security/integrity/digsig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/integrity/digsig.c b/security/integrity/digsig.c
index 5e3bd72..972eb24 100644
--- a/security/integrity/digsig.c
+++ b/security/integrity/digsig.c
@@ -105,7 +105,7 @@ int __init integrity_load_x509(const unsigned int id, char *path)
 				   rc,
 				   ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
 				    KEY_USR_VIEW | KEY_USR_READ),
-				   KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_TRUSTED);
+				   KEY_ALLOC_NOT_IN_QUOTA);
 	if (IS_ERR(key)) {
 		rc = PTR_ERR(key);
 		pr_err("Problem loading X.509 certificate (%d): %s\n",
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 032/164] usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (30 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 031/164] integrity: prevent loading untrusted certificates on the IMA trusted keyring Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 033/164] usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1 Kamal Mostafa
                   ` (131 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: John Youn, Felipe Balbi, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: John Youn <John.Youn@synopsys.com>

commit 41adc59caece02aa2e988a0e8f9fe8e6f426f82e upstream.

This ID is for the Synopsys DWC_usb3 core with AXI interface on PCIe
HAPS platform. This core has the debug registers mapped at a separate
BAR in order to support enhanced hibernation.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/dwc3/dwc3-pci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index b642a2f..15b0fcb 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -30,6 +30,7 @@
 /* FIXME define these in <linux/pci_ids.h> */
 #define PCI_VENDOR_ID_SYNOPSYS		0x16c3
 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3	0xabcd
+#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce
 #define PCI_DEVICE_ID_INTEL_BYT		0x0f37
 #define PCI_DEVICE_ID_INTEL_MRFLD	0x119e
 #define PCI_DEVICE_ID_INTEL_BSW		0x22B7
@@ -218,6 +219,10 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
 				PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
 	},
+	{
+		PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
+				PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI),
+	},
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 033/164] usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (31 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 032/164] usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 034/164] usb: dwc3: Support Synopsys USB 3.1 IP Kamal Mostafa
                   ` (130 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: John Youn, Felipe Balbi, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: John Youn <John.Youn@synopsys.com>

commit e8095a25364a30216ad40dbe8893ed5c3c235949 upstream.

This adds the PCI product ID for the Synopsys USB 3.1 IP core
(DWC_usb31) on a HAPS-based PCI development platform.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/dwc3/dwc3-pci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 15b0fcb..637cd3d 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -31,6 +31,7 @@
 #define PCI_VENDOR_ID_SYNOPSYS		0x16c3
 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3	0xabcd
 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI 0xabce
+#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31 0xabcf
 #define PCI_DEVICE_ID_INTEL_BYT		0x0f37
 #define PCI_DEVICE_ID_INTEL_MRFLD	0x119e
 #define PCI_DEVICE_ID_INTEL_BSW		0x22B7
@@ -223,6 +224,10 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
 				PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI),
 	},
+	{
+		PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
+				PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31),
+	},
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 034/164] usb: dwc3: Support Synopsys USB 3.1 IP
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (32 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 033/164] usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1 Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 035/164] usb: dwc3: Add dis_enblslpm_quirk Kamal Mostafa
                   ` (129 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: John Youn, Felipe Balbi, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: John Youn <John.Youn@synopsys.com>

commit 690fb3718a70c66004342f6f5e2e8a5f95b977db upstream.

This patch allows the dwc3 driver to run on the new Synopsys USB 3.1
IP core, albeit in USB 3.0 mode only.

The Synopsys USB 3.1 IP (DWC_usb31) retains mostly the same register
interface and programming model as the existing USB 3.0 controller IP
(DWC_usb3). However the GSNPSID and version numbers are different.

Add checking for the new ID to pass driver probe.

Also, since the DWC_usb31 version number is lower in value than the
full GSNPSID of the DWC_usb3 IP, we set the high bit to identify
DWC_usb31 and to ensure the values are higher.

Finally, add a documentation note about the revision numbering scheme.
Any future revision checks (for STARS, workarounds, and new features)
should take into consideration how it applies to both the 3.1/3.0 IP.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/dwc3/core.c | 10 ++++++++--
 drivers/usb/dwc3/core.h | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 25ddc39..2687d33 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -445,12 +445,18 @@ static int dwc3_core_init(struct dwc3 *dwc)
 
 	reg = dwc3_readl(dwc->regs, DWC3_GSNPSID);
 	/* This should read as U3 followed by revision number */
-	if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) {
+	if ((reg & DWC3_GSNPSID_MASK) == 0x55330000) {
+		/* Detected DWC_usb3 IP */
+		dwc->revision = reg;
+	} else if ((reg & DWC3_GSNPSID_MASK) == 0x33310000) {
+		/* Detected DWC_usb31 IP */
+		dwc->revision = dwc3_readl(dwc->regs, DWC3_VER_NUMBER);
+		dwc->revision |= DWC3_REVISION_IS_DWC31;
+	} else {
 		dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
 		ret = -ENODEV;
 		goto err0;
 	}
-	dwc->revision = reg;
 
 	/*
 	 * Write Linux Version Code to our GUID register so it's easy to figure
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 192396c..87fe55c 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -107,6 +107,9 @@
 #define DWC3_GPRTBIMAP_FS0	0xc188
 #define DWC3_GPRTBIMAP_FS1	0xc18c
 
+#define DWC3_VER_NUMBER		0xc1a0
+#define DWC3_VER_TYPE		0xc1a4
+
 #define DWC3_GUSB2PHYCFG(n)	(0xc200 + (n * 0x04))
 #define DWC3_GUSB2I2CCTL(n)	(0xc240 + (n * 0x04))
 
@@ -755,6 +758,14 @@ struct dwc3 {
 	u32			num_event_buffers;
 	u32			u1u2;
 	u32			maximum_speed;
+
+	/*
+	 * All 3.1 IP version constants are greater than the 3.0 IP
+	 * version constants. This works for most version checks in
+	 * dwc3. However, in the future, this may not apply as
+	 * features may be developed on newer versions of the 3.0 IP
+	 * that are not in the 3.1 IP.
+	 */
 	u32			revision;
 
 #define DWC3_REVISION_173A	0x5533173a
@@ -777,6 +788,13 @@ struct dwc3 {
 #define DWC3_REVISION_270A	0x5533270a
 #define DWC3_REVISION_280A	0x5533280a
 
+/*
+ * NOTICE: we're using bit 31 as a "is usb 3.1" flag. This is really
+ * just so dwc31 revisions are always larger than dwc3.
+ */
+#define DWC3_REVISION_IS_DWC31		0x80000000
+#define DWC3_USB31_REVISION_110A	(0x3131302a | DWC3_REVISION_IS_USB31)
+
 	enum dwc3_ep0_next	ep0_next_event;
 	enum dwc3_ep0_state	ep0state;
 	enum dwc3_link_state	link_state;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 035/164] usb: dwc3: Add dis_enblslpm_quirk
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (33 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 034/164] usb: dwc3: Support Synopsys USB 3.1 IP Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 036/164] spi: ti-qspi: Fix data corruption seen on r/w stress test Kamal Mostafa
                   ` (128 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: John Youn, Felipe Balbi, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: John Youn <John.Youn@synopsys.com>

commit ec791d149bca4511e7d3a6a92bb3b030c5a443f9 upstream.

Add a quirk to clear the GUSB2PHYCFG.ENBLSLPM bit, which controls
whether the PHY receives the suspend signal from the controller.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
 drivers/usb/dwc3/core.c                        | 6 ++++++
 drivers/usb/dwc3/core.h                        | 4 ++++
 drivers/usb/dwc3/platform_data.h               | 1 +
 4 files changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
index cd7f045..e3f2c72 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -34,6 +34,8 @@ Optional properties:
 			LTSSM during USB3 Compliance mode.
  - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy.
  - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy.
+ - snps,dis_enblslpm_quirk: when set clears the enblslpm in GUSB2PHYCFG,
+			disabling the suspend signal to the PHY.
  - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal
 			utmi_l1_suspend_n, false when asserts utmi_sleep_n
  - snps,hird-threshold: HIRD threshold
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 2687d33..d84b1af 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -425,6 +425,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc)
 	if (dwc->dis_u2_susphy_quirk)
 		reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
 
+	if (dwc->dis_enblslpm_quirk)
+		reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
+
 	dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
 
 	mdelay(100);
@@ -839,6 +842,8 @@ static int dwc3_probe(struct platform_device *pdev)
 				"snps,dis_u3_susphy_quirk");
 		dwc->dis_u2_susphy_quirk = of_property_read_bool(node,
 				"snps,dis_u2_susphy_quirk");
+	dwc->dis_enblslpm_quirk = device_property_read_bool(dev,
+				"snps,dis_enblslpm_quirk");
 
 		dwc->tx_de_emphasis_quirk = of_property_read_bool(node,
 				"snps,tx_de_emphasis_quirk");
@@ -866,6 +871,7 @@ static int dwc3_probe(struct platform_device *pdev)
 		dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk;
 		dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk;
 		dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk;
+		dwc->dis_enblslpm_quirk = pdata->dis_enblslpm_quirk;
 
 		dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;
 		if (pdata->tx_de_emphasis)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 87fe55c..df92ff0 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -176,6 +176,7 @@
 /* Global USB2 PHY Configuration Register */
 #define DWC3_GUSB2PHYCFG_PHYSOFTRST	(1 << 31)
 #define DWC3_GUSB2PHYCFG_SUSPHY		(1 << 6)
+#define DWC3_GUSB2PHYCFG_ENBLSLPM	(1 << 8)
 
 /* Global USB3 PIPE Control Register */
 #define DWC3_GUSB3PIPECTL_PHYSOFTRST	(1 << 31)
@@ -706,6 +707,8 @@ struct dwc3_scratchpad_array {
  * @rx_detect_poll_quirk: set if we enable rx_detect to polling lfps quirk
  * @dis_u3_susphy_quirk: set if we disable usb3 suspend phy
  * @dis_u2_susphy_quirk: set if we disable usb2 suspend phy
+ * @dis_enblslpm_quirk: set if we clear enblslpm in GUSB2PHYCFG,
+ *                      disabling the suspend signal to the PHY.
  * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
  * @tx_de_emphasis: Tx de-emphasis value
  * 	0	- -6dB de-emphasis
@@ -846,6 +849,7 @@ struct dwc3 {
 	unsigned		rx_detect_poll_quirk:1;
 	unsigned		dis_u3_susphy_quirk:1;
 	unsigned		dis_u2_susphy_quirk:1;
+	unsigned		dis_enblslpm_quirk:1;
 
 	unsigned		tx_de_emphasis_quirk:1;
 	unsigned		tx_de_emphasis:2;
diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h
index a3a3b6d5..f0481f1 100644
--- a/drivers/usb/dwc3/platform_data.h
+++ b/drivers/usb/dwc3/platform_data.h
@@ -41,6 +41,7 @@ struct dwc3_platform_data {
 	unsigned rx_detect_poll_quirk:1;
 	unsigned dis_u3_susphy_quirk:1;
 	unsigned dis_u2_susphy_quirk:1;
+	unsigned dis_enblslpm_quirk:1;
 
 	unsigned tx_de_emphasis_quirk:1;
 	unsigned tx_de_emphasis:2;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 036/164] spi: ti-qspi: Fix data corruption seen on r/w stress test
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (34 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 035/164] usb: dwc3: Add dis_enblslpm_quirk Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 037/164] nfsd: serialize state seqid morphing operations Kamal Mostafa
                   ` (127 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vignesh R, Mark Brown, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 6146c4c..cf94cf3 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;
 }
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 037/164] nfsd: serialize state seqid morphing operations
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (35 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 036/164] spi: ti-qspi: Fix data corruption seen on r/w stress test Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 038/164] lockd: create NSM handles per net namespace Kamal Mostafa
                   ` (126 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jeff Layton, J. Bruce Fields, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jeff Layton <jlayton@poochiereds.net>

commit 35a92fe8770ce54c5eb275cd76128645bea2d200 upstream.

Andrew was seeing a race occur when an OPEN and OPEN_DOWNGRADE were
running in parallel. The server would receive the OPEN_DOWNGRADE first
and check its seqid, but then an OPEN would race in and bump it. The
OPEN_DOWNGRADE would then complete and bump the seqid again.  The result
was that the OPEN_DOWNGRADE would be applied after the OPEN, even though
it should have been rejected since the seqid changed.

The only recourse we have here I think is to serialize operations that
bump the seqid in a stateid, particularly when we're given a seqid in
the call. To address this, we add a new rw_semaphore to the
nfs4_ol_stateid struct. We do a down_write prior to checking the seqid
after looking up the stateid to ensure that nothing else is going to
bump it while we're operating on it.

In the case of OPEN, we do a down_read, as the call doesn't contain a
seqid. Those can run in parallel -- we just need to serialize them when
there is a concurrent OPEN_DOWNGRADE or CLOSE.

LOCK and LOCKU however always take the write lock as there is no
opportunity for parallelizing those.

Reported-and-Tested-by: Andrew W Elble <aweits@rit.edu>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
[ kamal: backport to 3.19-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/nfsd/nfs4state.c | 33 ++++++++++++++++++++++++++++-----
 fs/nfsd/state.h     | 17 +++++++++--------
 2 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 8bb73f8..2bf99cd 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3262,6 +3262,7 @@ static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp,
 	stp->st_access_bmap = 0;
 	stp->st_deny_bmap = 0;
 	stp->st_openstp = NULL;
+	init_rwsem(&stp->st_rwsem);
 	spin_lock(&oo->oo_owner.so_client->cl_lock);
 	list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids);
 	spin_lock(&fp->fi_lock);
@@ -4083,21 +4084,27 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
 	 */
 	if (stp) {
 		/* Stateid was found, this is an OPEN upgrade */
+		down_read(&stp->st_rwsem);
 		status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
-		if (status)
+		if (status) {
+			up_read(&stp->st_rwsem);
 			goto out;
+		}
 	} else {
 		stp = open->op_stp;
 		open->op_stp = NULL;
 		init_open_stateid(stp, fp, open);
+		down_read(&stp->st_rwsem);
 		status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open);
 		if (status) {
+			up_read(&stp->st_rwsem);
 			release_open_stateid(stp);
 			goto out;
 		}
 	}
 	update_stateid(&stp->st_stid.sc_stateid);
 	memcpy(&open->op_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
+	up_read(&stp->st_rwsem);
 
 	if (nfsd4_has_session(&resp->cstate)) {
 		if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
@@ -4665,10 +4672,13 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_
 		 * revoked delegations are kept only for free_stateid.
 		 */
 		return nfserr_bad_stateid;
+	down_write(&stp->st_rwsem);
 	status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
-	if (status)
-		return status;
-	return nfs4_check_fh(current_fh, stp);
+	if (status == nfs_ok)
+		status = nfs4_check_fh(current_fh, stp);
+	if (status != nfs_ok)
+		up_write(&stp->st_rwsem);
+	return status;
 }
 
 /* 
@@ -4715,6 +4725,7 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cs
 		return status;
 	oo = openowner(stp->st_stateowner);
 	if (!(oo->oo_flags & NFS4_OO_CONFIRMED)) {
+		up_write(&stp->st_rwsem);
 		nfs4_put_stid(&stp->st_stid);
 		return nfserr_bad_stateid;
 	}
@@ -4745,11 +4756,14 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		goto out;
 	oo = openowner(stp->st_stateowner);
 	status = nfserr_bad_stateid;
-	if (oo->oo_flags & NFS4_OO_CONFIRMED)
+	if (oo->oo_flags & NFS4_OO_CONFIRMED) {
+		up_write(&stp->st_rwsem);
 		goto put_stateid;
+	}
 	oo->oo_flags |= NFS4_OO_CONFIRMED;
 	update_stateid(&stp->st_stid.sc_stateid);
 	memcpy(&oc->oc_resp_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
+	up_write(&stp->st_rwsem);
 	dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n",
 		__func__, oc->oc_seqid, STATEID_VAL(&stp->st_stid.sc_stateid));
 
@@ -4828,6 +4842,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
 	memcpy(&od->od_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
 	status = nfs_ok;
 put_stateid:
+	up_write(&stp->st_rwsem);
 	nfs4_put_stid(&stp->st_stid);
 out:
 	nfsd4_bump_seqid(cstate, status);
@@ -4881,6 +4896,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		goto out; 
 	update_stateid(&stp->st_stid.sc_stateid);
 	memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
+	up_write(&stp->st_rwsem);
 
 	nfsd4_close_open_stateid(stp);
 
@@ -5109,6 +5125,7 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo,
 	stp->st_access_bmap = 0;
 	stp->st_deny_bmap = open_stp->st_deny_bmap;
 	stp->st_openstp = open_stp;
+	init_rwsem(&stp->st_rwsem);
 	list_add(&stp->st_locks, &open_stp->st_locks);
 	list_add(&stp->st_perstateowner, &lo->lo_owner.so_stateids);
 	spin_lock(&fp->fi_lock);
@@ -5277,6 +5294,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 					&open_stp, nn);
 		if (status)
 			goto out;
+		up_write(&open_stp->st_rwsem);
 		open_sop = openowner(open_stp->st_stateowner);
 		status = nfserr_bad_stateid;
 		if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
@@ -5284,6 +5302,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 			goto out;
 		status = lookup_or_create_lock_state(cstate, open_stp, lock,
 							&lock_stp, &new);
+		if (status == nfs_ok)
+			down_write(&lock_stp->st_rwsem);
 	} else {
 		status = nfs4_preprocess_seqid_op(cstate,
 				       lock->lk_old_lock_seqid,
@@ -5389,6 +5409,8 @@ out:
 		    seqid_mutating_err(ntohl(status)))
 			lock_sop->lo_owner.so_seqid++;
 
+		up_write(&lock_stp->st_rwsem);
+
 		/*
 		 * If this is a new, never-before-used stateid, and we are
 		 * returning an error, then just go ahead and release it.
@@ -5559,6 +5581,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 fput:
 	fput(filp);
 put_stateid:
+	up_write(&stp->st_rwsem);
 	nfs4_put_stid(&stp->st_stid);
 out:
 	nfsd4_bump_seqid(cstate, status);
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 9d3be37..162ead6 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -513,14 +513,15 @@ struct nfs4_file {
  * Better suggestions welcome.
  */
 struct nfs4_ol_stateid {
-	struct nfs4_stid    st_stid; /* must be first field */
-	struct list_head              st_perfile;
-	struct list_head              st_perstateowner;
-	struct list_head              st_locks;
-	struct nfs4_stateowner      * st_stateowner;
-	unsigned char                 st_access_bmap;
-	unsigned char                 st_deny_bmap;
-	struct nfs4_ol_stateid         * st_openstp;
+	struct nfs4_stid		st_stid;
+	struct list_head		st_perfile;
+	struct list_head		st_perstateowner;
+	struct list_head		st_locks;
+	struct nfs4_stateowner		*st_stateowner;
+	unsigned char			st_access_bmap;
+	unsigned char			st_deny_bmap;
+	struct nfs4_ol_stateid		*st_openstp;
+	struct rw_semaphore		st_rwsem;
 };
 
 static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 038/164] lockd: create NSM handles per net namespace
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (36 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 037/164] nfsd: serialize state seqid morphing operations Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 039/164] Btrfs: fix file corruption and data loss after cloning inline extents Kamal Mostafa
                   ` (125 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrey Ryabinin, J. Bruce Fields, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 969d589..b5f3c3a 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 47a32b6..6c05cd1 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);
 
 /*
@@ -264,33 +263,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;
@@ -353,6 +354,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
@@ -365,11 +367,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()) {
@@ -384,9 +388,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);
@@ -400,7 +405,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);
@@ -417,19 +422,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 097bfa3..89fe011 100644
--- a/fs/lockd/netns.h
+++ b/fs/lockd/netns.h
@@ -15,6 +15,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 55505cb..a9d5fb7 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -587,6 +587,7 @@ static int lockd_init_net(struct net *net)
 	INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender);
 	INIT_LIST_HEAD(&ln->lockd_manager.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 b147d1a..09c576f 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 21171f0..fb26b9f 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 ff82a32..fd3b65b 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -235,7 +235,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
@@ -243,11 +244,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);
 
 /*
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 039/164] Btrfs: fix file corruption and data loss after cloning inline extents
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (37 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 038/164] lockd: create NSM handles per net namespace Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 040/164] ARM: common: edma: Fix channel parameter for irq callbacks Kamal Mostafa
                   ` (124 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8f07947..230e205 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3159,6 +3159,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
  *
@@ -3423,21 +3567,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;
@@ -3455,42 +3584,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). */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 040/164] ARM: common: edma: Fix channel parameter for irq callbacks
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (38 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 039/164] Btrfs: fix file corruption and data loss after cloning inline extents Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 041/164] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints Kamal Mostafa
                   ` (123 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Ujfalusi, Vinod Koul, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 5662a87..3061320 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -406,7 +406,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);
@@ -460,7 +461,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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 041/164] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (39 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 040/164] ARM: common: edma: Fix channel parameter for irq callbacks Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 042/164] Btrfs: fix truncation of compressed and inlined extents Kamal Mostafa
                   ` (122 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David Woodhouse, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 3583db4..1babfe7 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3945,14 +3945,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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 042/164] Btrfs: fix truncation of compressed and inlined extents
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (40 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 041/164] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 043/164] jbd2: fix checkpoint list cleanup Kamal Mostafa
                   ` (121 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 fbcd590..76a450c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4074,6 +4074,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
@@ -4243,27 +4284,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:
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 043/164] jbd2: fix checkpoint list cleanup
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (41 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 042/164] Btrfs: fix truncation of compressed and inlined extents Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 044/164] ext4: fix potential use after free in __ext4_journal_stop Kamal Mostafa
                   ` (120 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jan Kara <jack@suse.com>

commit 33d14975e5ac469963d5d63856b61698ad0bff07 upstream.

Unlike comments and expectation of callers journal_clean_one_cp_list()
returned 1 not only if it freed the transaction but also if it freed
some buffers in the transaction. That could make
__jbd2_journal_clean_checkpoint_list() skip processing
t_checkpoint_io_list and continue with processing the next transaction.
This is mostly a cosmetic issue since the only result is we can
sometimes free less memory than we could. But it's still worth fixing.
Fix journal_clean_one_cp_list() to return 1 only if the transaction was
really freed.

Fixes: 50849db32a9f529235a84bcc84a6b8e631b1d0ec
Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/jbd2/checkpoint.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index 8c44654..684996c 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -427,7 +427,6 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 	struct journal_head *last_jh;
 	struct journal_head *next_jh = jh;
 	int ret;
-	int freed = 0;
 
 	if (!jh)
 		return 0;
@@ -441,10 +440,9 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 		else
 			ret = __jbd2_journal_remove_checkpoint(jh) + 1;
 		if (!ret)
-			return freed;
+			return 0;
 		if (ret == 2)
 			return 1;
-		freed = 1;
 		/*
 		 * This function only frees up some memory
 		 * if possible so we dont have an obligation
@@ -452,10 +450,10 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 		 * requested:
 		 */
 		if (need_resched())
-			return freed;
+			return 0;
 	} while (jh != last_jh);
 
-	return freed;
+	return 0;
 }
 
 /*
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 044/164] ext4: fix potential use after free in __ext4_journal_stop
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (42 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 043/164] jbd2: fix checkpoint list cleanup Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 045/164] [PATCH] fix calculation of meta_bg descriptor backups Kamal Mostafa
                   ` (119 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Lukas Czerner, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 d418431..e770c1ee 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)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 045/164] [PATCH] fix calculation of meta_bg descriptor backups
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (43 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 044/164] ext4: fix potential use after free in __ext4_journal_stop Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 046/164] ext4, jbd2: ensure entering into panic after recording an error in superblock Kamal Mostafa
                   ` (118 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Leiserson, Theodore Ts'o, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8a8ec62..c30ed18 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);
 	}
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 046/164] ext4, jbd2: ensure entering into panic after recording an error in superblock
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (44 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 045/164] [PATCH] fix calculation of meta_bg descriptor backups Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 047/164] vTPM: fix memory allocation flag for rtce buffer at kernel boot Kamal Mostafa
                   ` (117 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daeho Jeong, Theodore Ts'o, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 f46b29e..7eafbc1 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -395,9 +395,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)					\
@@ -586,8 +590,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 7003c09..0469f32 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2086,8 +2086,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 4caf8ac..c035001 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
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 047/164] vTPM: fix memory allocation flag for rtce buffer at kernel boot
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (45 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 046/164] ext4, jbd2: ensure entering into panic after recording an error in superblock Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 048/164] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Kamal Mostafa
                   ` (116 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hon Ching(Vicky) Lo, Peter Huewe, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 643bba7..9eab751 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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 048/164] spi: dw: explicitly free IRQ handler in dw_spi_remove_host()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (46 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 047/164] vTPM: fix memory allocation flag for rtce buffer at kernel boot Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 049/164] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish Kamal Mostafa
                   ` (115 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Shevchenko, Mark Brown, Luis Henriques, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 8edcd1b..67ce090 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -650,8 +650,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
 	dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60);
 	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;
@@ -694,6 +693,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;
@@ -711,6 +711,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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 049/164] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (47 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 048/164] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 050/164] [media] media: vb2 dma-sg: " Kamal Mostafa
                   ` (114 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tiffany Lin, Sakari Ailus, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 69e0483..1ff0004 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -120,7 +120,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)
@@ -132,7 +133,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);
 }
 
 /*********************************************/
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 050/164] [media] media: vb2 dma-sg: Fully cache synchronise buffers in prepare and finish
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (48 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 049/164] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 051/164] [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL Kamal Mostafa
                   ` (113 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tiffany Lin, Sakari Ailus, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 418dae2276065680bde7ae27d2c075e612a54de6 upstream.

In videobuf2 dma-sg memory types 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: d790b7eda953 ("vb2-dma-sg: move dma_(un)map_sg here")

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: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/v4l2-core/videobuf2-dma-sg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index b1838ab..91c6f56 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -209,7 +209,8 @@ static void vb2_dma_sg_prepare(void *buf_priv)
 	if (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_dma_sg_finish(void *buf_priv)
@@ -221,7 +222,7 @@ static void vb2_dma_sg_finish(void *buf_priv)
 	if (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);
 }
 
 static inline int vma_is_io(struct vm_area_struct *vma)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 051/164] [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (49 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 050/164] [media] media: vb2 dma-sg: " Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 052/164] Bluetooth: hidp: fix device disconnect on idle timeout Kamal Mostafa
                   ` (112 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Antonio Ospite, Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Antonio Ospite <ao2@ao2.it>

commit 759b26a1d916400a1a20948eb964dea6ad0bd9e9 upstream.

Since commit 5d0360a4f027576e5419d4a7c711c9ca0f1be8ca it's not possible
anymore to set auto clusters from auto to manual using VIDIOC_S_CTRL.

For example, setting autogain to manual with gspca/ov534 driver and this
sequence of commands does not work:

  v4l2-ctl --set-ctrl=gain_automatic=1
  v4l2-ctl --list-ctrls | grep gain_automatic
  # The following does not work
  v4l2-ctl --set-ctrl=gain_automatic=0
  v4l2-ctl --list-ctrls | grep gain_automatic

Changing the value using VIDIOC_S_EXT_CTRLS (like qv4l2 does) works
fine.

The apparent cause by looking at the changes in 5d0360a and comparing
with the code path for VIDIOC_S_EXT_CTRLS seems to be that the code in
v4l2-ctrls.c::set_ctrl() is not calling user_to_new() anymore after
calling update_from_auto_cluster(master).

However the root cause of the problem is that calling
update_from_auto_cluster(master) overrides also the _master_ control
state calling cur_to_new() while it was supposed to only update the
volatile controls.

Calling user_to_new() after update_from_auto_cluster(master) was just
masking the original bug by restoring the correct new value of the
master control before making the changes permanent.

Fix the original bug by making update_from_auto_cluster() not override
the new master control value.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 2e98f02..d85c260 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -3042,7 +3042,7 @@ static void update_from_auto_cluster(struct v4l2_ctrl *master)
 {
 	int i;
 
-	for (i = 0; i < master->ncontrols; i++)
+	for (i = 1; i < master->ncontrols; i++)
 		cur_to_new(master->cluster[i]);
 	if (!call_op(master, g_volatile_ctrl))
 		for (i = 1; i < master->ncontrols; i++)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 052/164] Bluetooth: hidp: fix device disconnect on idle timeout
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (50 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 051/164] [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 053/164] Bluetooth: ath3k: Add new AR3012 0930:021c id Kamal Mostafa
                   ` (111 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Herrmann, Marcel Holtmann, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 07348e1..8554353 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);
 }
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 053/164] Bluetooth: ath3k: Add new AR3012 0930:021c id
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (51 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 052/164] Bluetooth: hidp: fix device disconnect on idle timeout Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 054/164] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Kamal Mostafa
                   ` (110 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8dc319d..ecd520f 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) },
@@ -152,6 +153,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 ec5c3ae..9565dc6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -181,6 +181,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 },
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 054/164] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (52 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 053/164] Bluetooth: ath3k: Add new AR3012 0930:021c id Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 055/164] Bluetooth: Fix removing connection parameters when unpairing Kamal Mostafa
                   ` (109 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 ecd520f..81f6a885 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) },
@@ -165,6 +166,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, 0xe003), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 9565dc6..402c15c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -193,6 +193,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 },
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 055/164] Bluetooth: Fix removing connection parameters when unpairing
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (53 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 054/164] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 056/164] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word Kamal Mostafa
                   ` (108 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hedberg, Marcel Holtmann, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Johan Hedberg <johan.hedberg@intel.com>

commit a6ad2a6b9cc1d9d791aee5462cfb8528f366f1d4 upstream.

The commit 89cbb0638e9b7 introduced support for deferred connection
parameter removal when unpairing by removing them only once an
existing connection gets disconnected. However, it failed to address
the scenario when we're *not* connected and do an unpair operation.

What makes things worse is that most user space BlueZ versions will
first issue a disconnect request and only then unpair, meaning the
buggy code will be triggered every time. This effectively causes the
kernel to resume scanning and reconnect to a device for which we've
removed all keys and GATT database information.

This patch fixes the issue by adding the missing call to the
hci_conn_params_del() function to a branch which handles the case of
no existing connection.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/bluetooth/mgmt.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1775dbf..13bfd37 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2772,6 +2772,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 	} else {
 		u8 addr_type;
 
+		if (cp->addr.type == BDADDR_LE_PUBLIC)
+			addr_type = ADDR_LE_DEV_PUBLIC;
+		else
+			addr_type = ADDR_LE_DEV_RANDOM;
+
 		conn = hci_conn_hash_lookup_ba(hdev, LE_LINK,
 					       &cp->addr.bdaddr);
 		if (conn) {
@@ -2787,13 +2792,10 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 			 */
 			if (!cp->disconnect)
 				conn = NULL;
+		} else {
+			hci_conn_params_del(hdev, &cp->addr.bdaddr, addr_type);
 		}
 
-		if (cp->addr.type == BDADDR_LE_PUBLIC)
-			addr_type = ADDR_LE_DEV_PUBLIC;
-		else
-			addr_type = ADDR_LE_DEV_RANDOM;
-
 		hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type);
 
 		err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 056/164] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (54 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 055/164] Bluetooth: Fix removing connection parameters when unpairing Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 057/164] USB: qcserial: add Sierra Wireless MC74xx/EM74xx Kamal Mostafa
                   ` (107 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Mosberger, Nicolas Ferre, Mark Brown, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 df93c97..b92936e 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -582,7 +582,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 */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 057/164] USB: qcserial: add Sierra Wireless MC74xx/EM74xx
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (55 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 056/164] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 058/164] staging: rtl8712: Add device ID for Sitecom WLA2100 Kamal Mostafa
                   ` (106 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Greg Kroah-Hartman, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 ebcec8c..f49d262 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 */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 058/164] staging: rtl8712: Add device ID for Sitecom WLA2100
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (56 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 057/164] USB: qcserial: add Sierra Wireless MC74xx/EM74xx Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 059/164] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler Kamal Mostafa
                   ` (105 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, Frans van de Wiel, Greg Kroah-Hartman, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 7d0d171..6ef4d99 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)},
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 059/164] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (57 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 058/164] staging: rtl8712: Add device ID for Sitecom WLA2100 Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 060/164] ACPI: Using correct irq when waiting for events Kamal Mostafa
                   ` (104 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Yu, Rafael J. Wysocki, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 4c25675..5c99219 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
@@ -840,17 +841,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 77d4941..0f60a01 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -157,6 +157,12 @@ int acpi_ioapic_registered(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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 060/164] ACPI: Using correct irq when waiting for events
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (58 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 059/164] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 061/164] ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle Kamal Mostafa
                   ` (103 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Yu, Rafael J. Wysocki, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit efb1cf7d28b8aeacec53e9ba8f3f2809c5cb9686 upstream.

When the system is waiting for GPE/fixed event handler to finish,
it uses acpi_gbl_FADT.sci_interrupt directly as the IRQ number.
However, the remapped IRQ returned by acpi_gsi_to_irq() should be
passed to synchronize_hardirq() instead of it.

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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/osl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 5c99219..c2f4fd5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1195,8 +1195,8 @@ void acpi_os_wait_events_complete(void)
 	 * Make sure the GPE handler or the fixed event handler is not used
 	 * on another CPU after removal.
 	 */
-	if (acpi_irq_handler)
-		synchronize_hardirq(acpi_gbl_FADT.sci_interrupt);
+	if (acpi_sci_irq_valid())
+		synchronize_hardirq(acpi_sci_irq);
 	flush_workqueue(kacpid_wq);
 	flush_workqueue(kacpi_notify_wq);
 }
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 061/164] ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (59 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 060/164] ACPI: Using correct irq when waiting for events Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 062/164] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back Kamal Mostafa
                   ` (102 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Yu, Rafael J. Wysocki, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 8c01275e0cdf1959aa25c322fd5870c097733195 upstream.

For an ACPI compatible system, the SCI (ACPI System Control
Interrupt) is used to wake the system up from suspend-to-idle.
Once the CPU is woken up by the SCI, the interrupt handler will
first check if the current IRQ has been configured for system
wakeup, so irq_pm_check_wakeup() is invoked to validate the IRQ
number.  However, during suspend-to-idle, enable_irq_wake() is
called for acpi_gbl_FADT.sci_interrupt, although the IRQ number
that the SCI handler has been installed for should be passed to
it instead.  Thus, if acpi_gbl_FADT.sci_interrupt happens to be
different from that number, ACPI interrupts will not be able to
wake up the system from sleep.

Fix this problem by passing the IRQ number returned by
acpi_gsi_to_irq() to enable_irq_wake() instead of
acpi_gbl_FADT.sci_interrupt.

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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/sleep.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8aa9254..58c9760 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -631,13 +631,15 @@ static int acpi_freeze_prepare(void)
 {
 	acpi_enable_all_wakeup_gpes();
 	acpi_os_wait_events_complete();
-	enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
+	if (acpi_sci_irq_valid())
+		enable_irq_wake(acpi_sci_irq);
 	return 0;
 }
 
 static void acpi_freeze_restore(void)
 {
-	disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
+	if (acpi_sci_irq_valid())
+		disable_irq_wake(acpi_sci_irq);
 	acpi_enable_all_runtime_gpes();
 }
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 062/164] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (60 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 061/164] ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 063/164] ALSA: hda - Disable 64bit address for Creative HDA controllers Kamal Mostafa
                   ` (101 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kailang Yang, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 b16b63c..e851832 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4354,6 +4354,7 @@ enum {
 	ALC282_FIXUP_ASPIRE_V5_PINS,
 	ALC280_FIXUP_HP_GPIO4,
 	ALC286_FIXUP_HP_GPIO_LED,
+	ALC275_FIXUP_DELL_XPS,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -4853,6 +4854,17 @@ static const struct hda_fixup alc269_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc286_fixup_hp_gpio_led,
 	},
+	[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[] = {
@@ -4867,6 +4879,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
 	SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
 	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, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
 	SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 063/164] ALSA: hda - Disable 64bit address for Creative HDA controllers
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (61 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 062/164] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 064/164] MAINTAINERS: Add public mailing list for ARC Kamal Mostafa
                   ` (100 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/hda_intel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index a4e6e2f..9de6d8f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -324,6 +324,7 @@ enum {
 
 #define AZX_DCAPS_PRESET_CTHDA \
 	(AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |\
+	 AZX_DCAPS_NO_64BIT |\
 	 AZX_DCAPS_4K_BDLE_BOUNDARY | AZX_DCAPS_SNOOP_OFF)
 
 /*
@@ -2196,11 +2197,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
 	/* CM8888 */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 064/164] MAINTAINERS: Add public mailing list for ARC
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (62 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 063/164] ALSA: hda - Disable 64bit address for Creative HDA controllers Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally Kamal Mostafa
                   ` (99 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@canonical.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d66a97d..90f2094 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9295,6 +9295,7 @@ F:	include/net/switchdev.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/
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (63 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 064/164] MAINTAINERS: Add public mailing list for ARC Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 17:09   ` Sumit Saxena
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 066/164] megaraid_sas: Do not use PAGE_SIZE for max_sectors Kamal Mostafa
                   ` (98 subsequent siblings)
  163 siblings, 1 reply; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Kashyap Desai, Martin K. Petersen, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 0d5b47a724bab0ebaaa933d6ff5e584957aaa188 upstream.

Expose non-disk (TAPE drive, CD-ROM) unconditionally.

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: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index e541c6c..70cf60a 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev)
 		pd_index =
 			(sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) +
 			sdev->id;
-		if (instance->pd_list[pd_index].driveState ==
-					MR_PD_STATE_SYSTEM) {
+		if ((instance->pd_list[pd_index].driveState ==
+			MR_PD_STATE_SYSTEM) ||
+			(instance->pd_list[pd_index].driveType != TYPE_DISK)) {
 			return 0;
 		}
 		return -ENXIO;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 066/164] megaraid_sas: Do not use PAGE_SIZE for max_sectors
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (64 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 067/164] KVM: s390: SCA must not cross page boundaries Kamal Mostafa
                   ` (97 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Kashyap Desai, Martin K. Petersen, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 e94f9bd..ee598a3 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -360,6 +360,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 70cf60a..543d76f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4661,7 +4661,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 		instance->crash_dump_buf = NULL;
 	}
 	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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 067/164] KVM: s390: SCA must not cross page boundaries
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (65 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 066/164] megaraid_sas: Do not use PAGE_SIZE for max_sectors Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 068/164] arm64: Fix compat register mappings Kamal Mostafa
                   ` (96 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Hildenbrand, Christian Borntraeger, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 e3bab3a..304f05c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -443,7 +443,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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 068/164] arm64: Fix compat register mappings
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (66 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 067/164] KVM: s390: SCA must not cross page boundaries Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58   ` Kamal Mostafa
                   ` (95 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Robin Murphy, Catalin Marinas, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 41ed9e1..88d6e24 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]
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 069/164] can: Use correct type in sizeof() in nla_put()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
@ 2015-12-02 16:58   ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB " Kamal Mostafa
                     ` (162 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Vasut, Wolfgang Grandegger, netdev, Marc Kleine-Budde,
	Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 62ca0e8..8202ab3 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -912,7 +912,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) ||
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 069/164] can: Use correct type in sizeof() in nla_put()
@ 2015-12-02 16:58   ` Kamal Mostafa
  0 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marek Vasut, netdev, Kamal Mostafa, Marc Kleine-Budde,
	Wolfgang Grandegger

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 62ca0e8..8202ab3 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -912,7 +912,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) ||
-- 
1.9.1

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

* [PATCH 3.19.y-ckt 070/164] mtd: blkdevs: fix potential deadlock + lockdep warnings
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (68 preceding siblings ...)
  2015-12-02 16:58   ` Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 071/164] Revert "dm mpath: fix stalls when handling invalid ioctls" Kamal Mostafa
                   ` (93 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Brian Norris, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 3a69b1e..861d757 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);
 }
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 071/164] Revert "dm mpath: fix stalls when handling invalid ioctls"
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (69 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 070/164] mtd: blkdevs: fix potential deadlock + lockdep warnings Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 072/164] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015) Kamal Mostafa
                   ` (92 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mauricio Faria de Oliveira, Mike Snitzer, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 7b6b0f0..7ed0e7b 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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 072/164] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015)
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (70 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 071/164] Revert "dm mpath: fix stalls when handling invalid ioctls" Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 073/164] crypto: algif_hash - Only export and import on sockets with data Kamal Mostafa
                   ` (91 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jani Nikula, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 66adee1..ca0ec27 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13033,6 +13033,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)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 073/164] crypto: algif_hash - Only export and import on sockets with data
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (71 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 072/164] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015) Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 074/164] xtensa: fixes for configs without loop option Kamal Mostafa
                   ` (90 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herbert Xu, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 01f56eb..647551b 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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 074/164] xtensa: fixes for configs without loop option
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (72 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 073/164] crypto: algif_hash - Only export and import on sockets with data Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 075/164] PCI: spear: Fix dw_pcie_cfg_read/write() usage Kamal Mostafa
                   ` (89 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 755320f..746dcc8 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 a2a9021..2188b12 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 15a461e..9ed5564 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -249,7 +249,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 ace1892..7ea4dd6 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 da7d182..3918205 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 b90555c..8767896 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 57fd08b..32c955e 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"
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 075/164] PCI: spear: Fix dw_pcie_cfg_read/write() usage
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (73 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 074/164] xtensa: fixes for configs without loop option Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 076/164] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Kamal Mostafa
                   ` (88 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pratyush Anand, Bjorn Helgaas, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Gabriele Paoloni <gabriele.paoloni@huawei.com>

commit fa3b7cbab548b15da438b0cc13aa515f7f291f4d upstream.

The first argument of dw_pcie_cfg_read/write() is a 32-bit aligned address.
The second argument is the byte offset into a 32-bit word, and
dw_pcie_cfg_read/write() only look at the low two bits.

SPEAr13xx used dw_pcie_cfg_read() and dw_pcie_cfg_write() incorrectly: it
passed important address bits in the second argument, where they were
ignored.

Pass the complete 32-bit word address in the first argument and only the
2-bit offset into that word in the second argument.

Without this fix, SPEAr13xx host will never work with few buggy gen1 card
which connects with only gen1 host and also with any endpoint which would
generate a read request of more than 128 bytes.

[bhelgaas: changelog]
Reported-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pci/host/pcie-spear13xx.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/host/pcie-spear13xx.c b/drivers/pci/host/pcie-spear13xx.c
index 020d788..f3947b8 100644
--- a/drivers/pci/host/pcie-spear13xx.c
+++ b/drivers/pci/host/pcie-spear13xx.c
@@ -163,34 +163,36 @@ static int spear13xx_pcie_establish_link(struct pcie_port *pp)
 	 * default value in capability register is 512 bytes. So force
 	 * it to 128 here.
 	 */
-	dw_pcie_cfg_read(pp->dbi_base, exp_cap_off + PCI_EXP_DEVCTL, 4, &val);
+	dw_pcie_cfg_read(pp->dbi_base + exp_cap_off + PCI_EXP_DEVCTL,
+				0, 2, &val);
 	val &= ~PCI_EXP_DEVCTL_READRQ;
-	dw_pcie_cfg_write(pp->dbi_base, exp_cap_off + PCI_EXP_DEVCTL, 4, val);
+	dw_pcie_cfg_write(pp->dbi_base + exp_cap_off + PCI_EXP_DEVCTL,
+				0, 2, val);
 
-	dw_pcie_cfg_write(pp->dbi_base, PCI_VENDOR_ID, 2, 0x104A);
-	dw_pcie_cfg_write(pp->dbi_base, PCI_DEVICE_ID, 2, 0xCD80);
+	dw_pcie_cfg_write(pp->dbi_base + PCI_VENDOR_ID, 0, 2, 0x104A);
+	dw_pcie_cfg_write(pp->dbi_base + PCI_VENDOR_ID, 2, 2, 0xCD80);
 
 	/*
 	 * if is_gen1 is set then handle it, so that some buggy card
 	 * also works
 	 */
 	if (spear13xx_pcie->is_gen1) {
-		dw_pcie_cfg_read(pp->dbi_base, exp_cap_off + PCI_EXP_LNKCAP, 4,
-				 &val);
+		dw_pcie_cfg_read(pp->dbi_base + exp_cap_off + PCI_EXP_LNKCAP,
+					0, 4, &val);
 		if ((val & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
 			val &= ~((u32)PCI_EXP_LNKCAP_SLS);
 			val |= PCI_EXP_LNKCAP_SLS_2_5GB;
-			dw_pcie_cfg_write(pp->dbi_base, exp_cap_off +
-					  PCI_EXP_LNKCAP, 4, val);
+			dw_pcie_cfg_write(pp->dbi_base + exp_cap_off +
+						PCI_EXP_LNKCAP, 0, 4, val);
 		}
 
-		dw_pcie_cfg_read(pp->dbi_base, exp_cap_off + PCI_EXP_LNKCTL2, 4,
-				 &val);
+		dw_pcie_cfg_read(pp->dbi_base + exp_cap_off + PCI_EXP_LNKCTL2,
+					0, 2, &val);
 		if ((val & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
 			val &= ~((u32)PCI_EXP_LNKCAP_SLS);
 			val |= PCI_EXP_LNKCAP_SLS_2_5GB;
-			dw_pcie_cfg_write(pp->dbi_base, exp_cap_off +
-					  PCI_EXP_LNKCTL2, 4, val);
+			dw_pcie_cfg_write(pp->dbi_base + exp_cap_off +
+						PCI_EXP_LNKCTL2, 0, 2, val);
 		}
 	}
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 076/164] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (74 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 075/164] PCI: spear: Fix dw_pcie_cfg_read/write() usage Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 077/164] mac80211: fix divide by zero when NOA update Kamal Mostafa
                   ` (87 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Kashyap Desai, Martin K. Petersen, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 543d76f..4dd4f42 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -6382,6 +6382,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;
@@ -6399,9 +6402,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) ||
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 077/164] mac80211: fix divide by zero when NOA update
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (75 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 076/164] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 078/164] nl80211: Fix potential memory leak from parse_acl_data Kamal Mostafa
                   ` (86 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Janusz Dziedzic, Johannes Berg, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 1ce38e7..c5e76cf 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2891,6 +2891,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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 078/164] nl80211: Fix potential memory leak from parse_acl_data
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (76 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 077/164] mac80211: fix divide by zero when NOA update Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 079/164] mac80211: allow null chandef in tracing Kamal Mostafa
                   ` (85 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ola Olsson, Johannes Berg, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ola Olsson <ola1olsson@gmail.com>

commit 4baf6bea37247e59f1971e8009d13aeda95edba2 upstream.

If parse_acl_data succeeds but the subsequent parsing of smps
attributes fails, there will be a memory leak due to early returns.
Fix that by moving the ACL parsing later.

Fixes: 18998c381b19b ("cfg80211: allow requesting SMPS mode on ap start")
Signed-off-by: Ola Olsson <ola.olsson@sonymobile.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/wireless/nl80211.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e13325f..49cc71c 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3388,12 +3388,6 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 				     wdev->iftype))
 		return -EINVAL;
 
-	if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
-		params.acl = parse_acl_data(&rdev->wiphy, info);
-		if (IS_ERR(params.acl))
-			return PTR_ERR(params.acl);
-	}
-
 	if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
 		params.smps_mode =
 			nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]);
@@ -3417,6 +3411,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 		params.smps_mode = NL80211_SMPS_OFF;
 	}
 
+	if (info->attrs[NL80211_ATTR_ACL_POLICY]) {
+		params.acl = parse_acl_data(&rdev->wiphy, info);
+		if (IS_ERR(params.acl))
+			return PTR_ERR(params.acl);
+	}
+
 	wdev_lock(wdev);
 	err = rdev_start_ap(rdev, dev, &params);
 	if (!err) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 079/164] mac80211: allow null chandef in tracing
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (77 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 078/164] nl80211: Fix potential memory leak from parse_acl_data Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 080/164] xtensa: fix secondary core boot in SMP Kamal Mostafa
                   ` (84 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arik Nemtsov, Emmanuel Grumbach, Johannes Berg, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8e461a0..9be3f33 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -33,11 +33,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
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 080/164] xtensa: fix secondary core boot in SMP
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (78 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 079/164] mac80211: allow null chandef in tracing Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 081/164] recordmcount: Fix endianness handling bug for nop_mcount Kamal Mostafa
                   ` (83 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 a46c53f..986b5d0 100644
--- a/arch/xtensa/include/asm/vectors.h
+++ b/arch/xtensa/include/asm/vectors.h
@@ -48,6 +48,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 */
 
@@ -60,6 +63,8 @@
   /* Loaded just above possibly live vectors */
   #define LOAD_MEMORY_ADDRESS		(PLATFORM_DEFAULT_MEM_START + 0x3000)
 
+#define RESET_VECTOR1_VADDR		(XCHAL_RESET_VECTOR1_VADDR)
+
 #endif /* CONFIG_MMU */
 
 #define XC_VADDR(offset)		(VIRTUAL_MEMORY_ADDRESS  + offset)
@@ -71,10 +76,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 18d962a..093be91 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 06370cc..ed5b8b9 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 1b397a9..cb1df95 100644
--- a/arch/xtensa/kernel/vectors.S
+++ b/arch/xtensa/kernel/vectors.S
@@ -478,6 +478,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
@@ -587,7 +590,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 fc1bc2b..d66cd40 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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 081/164] recordmcount: Fix endianness handling bug for nop_mcount
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (79 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 080/164] xtensa: fix secondary core boot in SMP Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 082/164] recordmcount: arm64: Replace the ignored mcount call into nop Kamal Mostafa
                   ` (82 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Li Bin, Steven Rostedt, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@canonical.com>
---
 scripts/recordmcount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 49b582a..b9897e2 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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 082/164] recordmcount: arm64: Replace the ignored mcount call into nop
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (80 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 081/164] recordmcount: Fix endianness handling bug for nop_mcount Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 083/164] KVM: VMX: fix SMEP and SMAP without EPT Kamal Mostafa
                   ` (81 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: lkp, catalin.marinas, takahiro.akashi, Li Bin, Steven Rostedt,
	Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 2ee8a74f2a5da913637f75a19a0da0e7a08c0f86 upstream.

By now, the recordmcount only records the function that in
following sections:
.text/.ref.text/.sched.text/.spinlock.text/.irqentry.text/
.kprobes.text/.text.unlikely

For the function that not in these sections, the call mcount
will be in place and not be replaced when kernel boot up. And
it will bring performance overhead, such as do_mem_abort (in
.exception.text section). This patch make the call mcount to
nop for this case in recordmcount.

Link: http://lkml.kernel.org/r/1446019445-14421-1-git-send-email-huawei.libin@huawei.com
Link: http://lkml.kernel.org/r/1446193864-24593-4-git-send-email-huawei.libin@huawei.com

Cc: <lkp@intel.com>
Cc: <catalin.marinas@arm.com>
Cc: <takahiro.akashi@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Li Bin <huawei.libin@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 scripts/recordmcount.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 3d1984e..e00bcd1 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -42,6 +42,7 @@
 
 #ifndef EM_AARCH64
 #define EM_AARCH64	183
+#define R_AARCH64_NONE		0
 #define R_AARCH64_ABS64	257
 #endif
 
@@ -160,6 +161,22 @@ static int make_nop_x86(void *map, size_t const offset)
 	return 0;
 }
 
+static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5};
+static int make_nop_arm64(void *map, size_t const offset)
+{
+	uint32_t *ptr;
+
+	ptr = map + offset;
+	/* bl <_mcount> is 0x94000000 before relocation */
+	if (*ptr != 0x94000000)
+		return -1;
+
+	/* Convert to nop */
+	ulseek(fd_map, offset, SEEK_SET);
+	uwrite(fd_map, ideal_nop, 4);
+	return 0;
+}
+
 /*
  * Get the whole file as a programming convenience in order to avoid
  * malloc+lseek+read+free of many pieces.  If successful, then mmap
@@ -353,7 +370,12 @@ do_file(char const *const fname)
 			 altmcount = "__gnu_mcount_nc";
 			 break;
 	case EM_AARCH64:
-			 reltype = R_AARCH64_ABS64; gpfx = '_'; break;
+			reltype = R_AARCH64_ABS64;
+			make_nop = make_nop_arm64;
+			rel_type_nop = R_AARCH64_NONE;
+			ideal_nop = ideal_nop4_arm64;
+			gpfx = '_';
+			break;
 	case EM_IA_64:	 reltype = R_IA64_IMM64;   gpfx = '_'; break;
 	case EM_METAG:	 reltype = R_METAG_ADDR32;
 			 altmcount = "_mcount_wrapper";
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 083/164] KVM: VMX: fix SMEP and SMAP without EPT
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (81 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 082/164] recordmcount: arm64: Replace the ignored mcount call into nop Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure Kamal Mostafa
                   ` (80 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Paolo Bonzini, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 ba2ba0f..5a235e3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3553,20 +3553,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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (82 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 083/164] KVM: VMX: fix SMEP and SMAP without EPT Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-09 13:24   ` Krzysztof Kozlowski
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 085/164] ALSA: hda - Apply pin fixup for HP ProBook 6550b Kamal Mostafa
                   ` (79 subsequent siblings)
  163 siblings, 1 reply; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Eduardo Valentin, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 7da2fdc..26f8e86 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -729,27 +729,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;
@@ -849,6 +832,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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 085/164] ALSA: hda - Apply pin fixup for HP ProBook 6550b
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (83 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 086/164] ALSA: hda - Add Intel Lewisburg device IDs Audio Kamal Mostafa
                   ` (78 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 4469f3e..7eb9705 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -700,6 +700,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:
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 086/164] ALSA: hda - Add Intel Lewisburg device IDs Audio
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (84 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 085/164] ALSA: hda - Apply pin fixup for HP ProBook 6550b Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 087/164] firewire: ohci: fix JMicron JMB38x IT context discovery Kamal Mostafa
                   ` (77 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexandra Yates, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 9de6d8f..54f84b5 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2017,6 +2017,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 },
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 087/164] firewire: ohci: fix JMicron JMB38x IT context discovery
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (85 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 086/164] ALSA: hda - Add Intel Lewisburg device IDs Audio Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 088/164] scsi: restart list search after unlock in scsi_remove_target Kamal Mostafa
                   ` (76 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Stefan Richter, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 aff9018..a187972 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3680,6 +3680,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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 088/164] scsi: restart list search after unlock in scsi_remove_target
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (86 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 087/164] firewire: ohci: fix JMicron JMB38x IT context discovery Kamal Mostafa
@ 2015-12-02 16:58 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 089/164] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE Kamal Mostafa
                   ` (75 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:58 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christoph Hellwig, James Bottomley, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 9ad4116..5b771bc 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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 089/164] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (87 preceding siblings ...)
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 088/164] scsi: restart list search after unlock in scsi_remove_target Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 090/164] memcg: fix thresholds for 32b architectures Kamal Mostafa
                   ` (74 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Catalin Marinas, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Linus Torvalds, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@canonical.com>
---
 mm/slab.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 2aa29f3..01aeece 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -282,6 +282,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
 /*
@@ -2197,7 +2198,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
@@ -2261,7 +2262,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.
 		 */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 090/164] memcg: fix thresholds for 32b architectures.
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (88 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 089/164] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59   ` Kamal Mostafa
                   ` (73 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Hocko, Ben Hutchings, Vladimir Davydov, Johannes Weiner,
	Michal Hocko, Andrew Morton, Linus Torvalds, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Michal Hocko <mhocko@suse.com>

commit c12176d3368b9b36ae484d323d41e94be26f9b65 upstream.

Commit 424cdc141380 ("memcg: convert threshold to bytes") has fixed a
regression introduced by 3e32cb2e0a12 ("mm: memcontrol: lockless page
counters") where thresholds were silently converted to use page units
rather than bytes when interpreting the user input.

The fix is not complete, though, as properly pointed out by Ben Hutchings
during stable backport review.  The page count is converted to bytes but
unsigned long is used to hold the value which would be obviously not
sufficient for 32b systems with more than 4G thresholds.  The same applies
to usage as taken from mem_cgroup_usage which might overflow.

Let's remove this bytes vs.  pages internal tracking differences and
handle thresholds in page units internally.  Chage mem_cgroup_usage() to
return the value in page units and revert 424cdc141380 because this should
be sufficient for the consistent handling.  mem_cgroup_read_u64 as the
only users of mem_cgroup_usage outside of the threshold handling code is
converted to give the proper in bytes result.  It is doing that already
for page_counter output so this is more consistent as well.

The value presented to the userspace is still in bytes units.

Fixes: 424cdc141380 ("memcg: convert threshold to bytes")
Fixes: 3e32cb2e0a12 ("mm: memcontrol: lockless page counters")
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
From: Michal Hocko <mhocko@kernel.org>
Subject: memcg-fix-thresholds-for-32b-architectures-fix

Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
From: Andrew Morton <akpm@linux-foundation.org>
Subject: memcg-fix-thresholds-for-32b-architectures-fix-fix

don't attempt to inline mem_cgroup_usage()

The compiler ignores the inline anwyay.  And __always_inlining it adds 600
bytes of goop to the .o file.

Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/memcontrol.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 28253e5..fd6f44a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3360,9 +3360,9 @@ static unsigned long tree_stat(struct mem_cgroup *memcg,
 	return val;
 }
 
-static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
+static inline unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
 {
-	u64 val;
+	unsigned long val;
 
 	if (mem_cgroup_is_root(memcg)) {
 		val = tree_stat(memcg, MEM_CGROUP_STAT_CACHE);
@@ -3375,7 +3375,7 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
 		else
 			val = page_counter_read(&memcg->memsw);
 	}
-	return val << PAGE_SHIFT;
+	return val;
 }
 
 enum {
@@ -3409,9 +3409,9 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css,
 	switch (MEMFILE_ATTR(cft->private)) {
 	case RES_USAGE:
 		if (counter == &memcg->memory)
-			return mem_cgroup_usage(memcg, false);
+			return (u64)mem_cgroup_usage(memcg, false) * PAGE_SIZE;
 		if (counter == &memcg->memsw)
-			return mem_cgroup_usage(memcg, true);
+			return (u64)mem_cgroup_usage(memcg, true) * PAGE_SIZE;
 		return (u64)page_counter_read(counter) * PAGE_SIZE;
 	case RES_LIMIT:
 		return (u64)counter->limit * PAGE_SIZE;
@@ -3904,7 +3904,6 @@ static int __mem_cgroup_usage_register_event(struct mem_cgroup *memcg,
 	ret = page_counter_memparse(args, &threshold);
 	if (ret)
 		return ret;
-	threshold <<= PAGE_SHIFT;
 
 	mutex_lock(&memcg->thresholds_lock);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 091/164] arm64: bpf: fix div-by-zero case
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
@ 2015-12-02 16:59   ` Kamal Mostafa
  2015-12-02 16:57 ` [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB " Kamal Mostafa
                     ` (162 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Xi Wang, Alexei Starovoitov, linux-arm-kernel, Zi Shen Lim,
	Catalin Marinas, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Zi Shen Lim <zlim.lnx@gmail.com>

commit 251599e1d6906621f49218d7b474ddd159e58f3b upstream.

In the case of division by zero in a BPF program:
	A = A / X;  (X == 0)
the expected behavior is to terminate with return value 0.

This is confirmed by the test case introduced in commit 86bf1721b226
("test_bpf: add tests checking that JIT/interpreter sets A and X to 0.").

Reported-by: Yang Shi <yang.shi@linaro.org>
Tested-by: Yang Shi <yang.shi@linaro.org>
CC: Xi Wang <xi.wang@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-kernel@vger.kernel.org
Fixes: e54bcde3d69d ("arm64: eBPF JIT compiler")
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm64/net/bpf_jit.h      |  3 ++-
 arch/arm64/net/bpf_jit_comp.c | 37 +++++++++++++++++++++++++------------
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/net/bpf_jit.h b/arch/arm64/net/bpf_jit.h
index 98a26ce..aee5637 100644
--- a/arch/arm64/net/bpf_jit.h
+++ b/arch/arm64/net/bpf_jit.h
@@ -1,7 +1,7 @@
 /*
  * BPF JIT compiler for ARM64
  *
- * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.com>
+ * Copyright (C) 2014-2015 Zi Shen Lim <zlim.lnx@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -35,6 +35,7 @@
 	aarch64_insn_gen_comp_branch_imm(0, offset, Rt, A64_VARIANT(sf), \
 		AARCH64_INSN_BRANCH_COMP_##type)
 #define A64_CBZ(sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, ZERO)
+#define A64_CBNZ(sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, NONZERO)
 
 /* Conditional branch (immediate) */
 #define A64_COND_BRANCH(cond, offset) \
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index c047598..9ae6f23 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -1,7 +1,7 @@
 /*
  * BPF JIT compiler for ARM64
  *
- * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.com>
+ * Copyright (C) 2014-2015 Zi Shen Lim <zlim.lnx@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -225,6 +225,17 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
 	u8 jmp_cond;
 	s32 jmp_offset;
 
+#define check_imm(bits, imm) do {				\
+	if ((((imm) > 0) && ((imm) >> (bits))) ||		\
+	    (((imm) < 0) && (~(imm) >> (bits)))) {		\
+		pr_info("[%2d] imm=%d(0x%x) out of range\n",	\
+			i, imm, imm);				\
+		return -EINVAL;					\
+	}							\
+} while (0)
+#define check_imm19(imm) check_imm(19, imm)
+#define check_imm26(imm) check_imm(26, imm)
+
 	switch (code) {
 	/* dst = src */
 	case BPF_ALU | BPF_MOV | BPF_X:
@@ -258,8 +269,21 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
 		break;
 	case BPF_ALU | BPF_DIV | BPF_X:
 	case BPF_ALU64 | BPF_DIV | BPF_X:
+	{
+		const u8 r0 = bpf2a64[BPF_REG_0];
+
+		/* if (src == 0) return 0 */
+		jmp_offset = 3; /* skip ahead to else path */
+		check_imm19(jmp_offset);
+		emit(A64_CBNZ(is64, src, jmp_offset), ctx);
+		emit(A64_MOVZ(1, r0, 0, 0), ctx);
+		jmp_offset = epilogue_offset(ctx);
+		check_imm26(jmp_offset);
+		emit(A64_B(jmp_offset), ctx);
+		/* else */
 		emit(A64_UDIV(is64, dst, dst, src), ctx);
 		break;
+	}
 	case BPF_ALU | BPF_MOD | BPF_X:
 	case BPF_ALU64 | BPF_MOD | BPF_X:
 		ctx->tmp_used = 1;
@@ -393,17 +417,6 @@ emit_bswap_uxt:
 		emit(A64_ASR(is64, dst, dst, imm), ctx);
 		break;
 
-#define check_imm(bits, imm) do {				\
-	if ((((imm) > 0) && ((imm) >> (bits))) ||		\
-	    (((imm) < 0) && (~(imm) >> (bits)))) {		\
-		pr_info("[%2d] imm=%d(0x%x) out of range\n",	\
-			i, imm, imm);				\
-		return -EINVAL;					\
-	}							\
-} while (0)
-#define check_imm19(imm) check_imm(19, imm)
-#define check_imm26(imm) check_imm(26, imm)
-
 	/* JUMP off */
 	case BPF_JMP | BPF_JA:
 		jmp_offset = bpf2a64_offset(i + off, i, ctx);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 091/164] arm64: bpf: fix div-by-zero case
@ 2015-12-02 16:59   ` Kamal Mostafa
  0 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-arm-kernel

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Zi Shen Lim <zlim.lnx@gmail.com>

commit 251599e1d6906621f49218d7b474ddd159e58f3b upstream.

In the case of division by zero in a BPF program:
	A = A / X;  (X == 0)
the expected behavior is to terminate with return value 0.

This is confirmed by the test case introduced in commit 86bf1721b226
("test_bpf: add tests checking that JIT/interpreter sets A and X to 0.").

Reported-by: Yang Shi <yang.shi@linaro.org>
Tested-by: Yang Shi <yang.shi@linaro.org>
CC: Xi Wang <xi.wang@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: linux-arm-kernel at lists.infradead.org
CC: linux-kernel at vger.kernel.org
Fixes: e54bcde3d69d ("arm64: eBPF JIT compiler")
Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm64/net/bpf_jit.h      |  3 ++-
 arch/arm64/net/bpf_jit_comp.c | 37 +++++++++++++++++++++++++------------
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/net/bpf_jit.h b/arch/arm64/net/bpf_jit.h
index 98a26ce..aee5637 100644
--- a/arch/arm64/net/bpf_jit.h
+++ b/arch/arm64/net/bpf_jit.h
@@ -1,7 +1,7 @@
 /*
  * BPF JIT compiler for ARM64
  *
- * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.com>
+ * Copyright (C) 2014-2015 Zi Shen Lim <zlim.lnx@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -35,6 +35,7 @@
 	aarch64_insn_gen_comp_branch_imm(0, offset, Rt, A64_VARIANT(sf), \
 		AARCH64_INSN_BRANCH_COMP_##type)
 #define A64_CBZ(sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, ZERO)
+#define A64_CBNZ(sf, Rt, imm19) A64_COMP_BRANCH(sf, Rt, (imm19) << 2, NONZERO)
 
 /* Conditional branch (immediate) */
 #define A64_COND_BRANCH(cond, offset) \
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index c047598..9ae6f23 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -1,7 +1,7 @@
 /*
  * BPF JIT compiler for ARM64
  *
- * Copyright (C) 2014 Zi Shen Lim <zlim.lnx@gmail.com>
+ * Copyright (C) 2014-2015 Zi Shen Lim <zlim.lnx@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -225,6 +225,17 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
 	u8 jmp_cond;
 	s32 jmp_offset;
 
+#define check_imm(bits, imm) do {				\
+	if ((((imm) > 0) && ((imm) >> (bits))) ||		\
+	    (((imm) < 0) && (~(imm) >> (bits)))) {		\
+		pr_info("[%2d] imm=%d(0x%x) out of range\n",	\
+			i, imm, imm);				\
+		return -EINVAL;					\
+	}							\
+} while (0)
+#define check_imm19(imm) check_imm(19, imm)
+#define check_imm26(imm) check_imm(26, imm)
+
 	switch (code) {
 	/* dst = src */
 	case BPF_ALU | BPF_MOV | BPF_X:
@@ -258,8 +269,21 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
 		break;
 	case BPF_ALU | BPF_DIV | BPF_X:
 	case BPF_ALU64 | BPF_DIV | BPF_X:
+	{
+		const u8 r0 = bpf2a64[BPF_REG_0];
+
+		/* if (src == 0) return 0 */
+		jmp_offset = 3; /* skip ahead to else path */
+		check_imm19(jmp_offset);
+		emit(A64_CBNZ(is64, src, jmp_offset), ctx);
+		emit(A64_MOVZ(1, r0, 0, 0), ctx);
+		jmp_offset = epilogue_offset(ctx);
+		check_imm26(jmp_offset);
+		emit(A64_B(jmp_offset), ctx);
+		/* else */
 		emit(A64_UDIV(is64, dst, dst, src), ctx);
 		break;
+	}
 	case BPF_ALU | BPF_MOD | BPF_X:
 	case BPF_ALU64 | BPF_MOD | BPF_X:
 		ctx->tmp_used = 1;
@@ -393,17 +417,6 @@ emit_bswap_uxt:
 		emit(A64_ASR(is64, dst, dst, imm), ctx);
 		break;
 
-#define check_imm(bits, imm) do {				\
-	if ((((imm) > 0) && ((imm) >> (bits))) ||		\
-	    (((imm) < 0) && (~(imm) >> (bits)))) {		\
-		pr_info("[%2d] imm=%d(0x%x) out of range\n",	\
-			i, imm, imm);				\
-		return -EINVAL;					\
-	}							\
-} while (0)
-#define check_imm19(imm) check_imm(19, imm)
-#define check_imm26(imm) check_imm(26, imm)
-
 	/* JUMP off */
 	case BPF_JMP | BPF_JA:
 		jmp_offset = bpf2a64_offset(i + off, i, ctx);
-- 
1.9.1

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

* [PATCH 3.19.y-ckt 092/164] arm64: bpf: fix mod-by-zero case
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (90 preceding siblings ...)
  2015-12-02 16:59   ` Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 093/164] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled Kamal Mostafa
                   ` (71 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Zi Shen Lim, Alexei Starovoitov, Catalin Marinas, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Zi Shen Lim <zlim.lnx@gmail.com>

commit 14e589ff4aa3f28a5424e92b6495ecb8950080f7 upstream.

Turns out in the case of modulo by zero in a BPF program:
	A = A % X;  (X == 0)
the expected behavior is to terminate with return value 0.

The bug in JIT is exposed by a new test case [1].

[1] https://lkml.org/lkml/2015/11/4/499

Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>
Reported-by: Yang Shi <yang.shi@linaro.org>
Reported-by: Xi Wang <xi.wang@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
Fixes: e54bcde3d69d ("arm64: eBPF JIT compiler")
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm64/net/bpf_jit_comp.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 9ae6f23..6217f80 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -269,6 +269,8 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
 		break;
 	case BPF_ALU | BPF_DIV | BPF_X:
 	case BPF_ALU64 | BPF_DIV | BPF_X:
+	case BPF_ALU | BPF_MOD | BPF_X:
+	case BPF_ALU64 | BPF_MOD | BPF_X:
 	{
 		const u8 r0 = bpf2a64[BPF_REG_0];
 
@@ -281,16 +283,19 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
 		check_imm26(jmp_offset);
 		emit(A64_B(jmp_offset), ctx);
 		/* else */
-		emit(A64_UDIV(is64, dst, dst, src), ctx);
+		switch (BPF_OP(code)) {
+		case BPF_DIV:
+			emit(A64_UDIV(is64, dst, dst, src), ctx);
+			break;
+		case BPF_MOD:
+			ctx->tmp_used = 1;
+			emit(A64_UDIV(is64, tmp, dst, src), ctx);
+			emit(A64_MUL(is64, tmp, tmp, src), ctx);
+			emit(A64_SUB(is64, dst, dst, tmp), ctx);
+			break;
+		}
 		break;
 	}
-	case BPF_ALU | BPF_MOD | BPF_X:
-	case BPF_ALU64 | BPF_MOD | BPF_X:
-		ctx->tmp_used = 1;
-		emit(A64_UDIV(is64, tmp, dst, src), ctx);
-		emit(A64_MUL(is64, tmp, tmp, src), ctx);
-		emit(A64_SUB(is64, dst, dst, tmp), ctx);
-		break;
 	case BPF_ALU | BPF_LSH | BPF_X:
 	case BPF_ALU64 | BPF_LSH | BPF_X:
 		emit(A64_LSLV(is64, dst, dst, src), ctx);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 093/164] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (91 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 092/164] arm64: bpf: fix mod-by-zero case Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 094/164] proc: actually make proc_fd_permission() thread-friendly Kamal Mostafa
                   ` (70 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Iwai, Dmitry Torokhov, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 ce3d400..ba638b6 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1509,6 +1509,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
 	{ }
 };
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 094/164] proc: actually make proc_fd_permission() thread-friendly
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (92 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 093/164] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 095/164] printk: prevent userland from spoofing kernel messages Kamal Mostafa
                   ` (69 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Eric W. Biederman, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8e5ad83..4b724b3 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -284,11 +284,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;
 }
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 095/164] printk: prevent userland from spoofing kernel messages
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (93 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 094/164] proc: actually make proc_fd_permission() thread-friendly Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 096/164] fs, seqfile: always allow oom killer Kamal Mostafa
                   ` (68 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 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

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/printk/printk.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 4b52ee5..f812933 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -257,6 +257,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
@@ -519,7 +522,6 @@ struct devkmsg_user {
 static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
 {
 	char *buf, *line;
-	int i;
 	int level = default_message_loglevel;
 	int facility = 1;	/* LOG_USER */
 	size_t len = iocb->ki_nbytes;
@@ -549,12 +551,13 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
 	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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 096/164] fs, seqfile: always allow oom killer
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (94 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 095/164] printk: prevent userland from spoofing kernel messages Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 097/164] x86/cpu: Call verify_cpu() after having entered long mode too Kamal Mostafa
                   ` (67 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Rientjes, Greg Thelen, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Greg Thelen <gthelen@google.com>

commit 0f930902eb8806cff8dcaef9ff9faf3cfa5fd748 upstream.

Since 5cec38ac866b ("fs, seq_file: fallback to vmalloc instead of oom kill
processes") seq_buf_alloc() avoids calling the oom killer for PAGE_SIZE or
smaller allocations; but larger allocations can use the oom killer via
vmalloc().  Thus reads of small files can return ENOMEM, but larger files
use the oom killer to avoid ENOMEM.

The effect of this bug is that reads from /proc and other virtual
filesystems can return ENOMEM instead of the preferred behavior - oom
killing something (possibly the calling process).  I don't know of anyone
except Google who has noticed the issue.

I suspect the fix is more needed in smaller systems where there isn't any
reclaimable memory.  But these seem like the kinds of systems which
probably don't use the oom killer for production situations.

Memory overcommit requires use of the oom killer to select a victim
regardless of file size.

Enable oom killer for small seq_buf_alloc() allocations.

Fixes: 5cec38ac866b ("fs, seq_file: fallback to vmalloc instead of oom kill processes")
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/seq_file.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index dbf3a59..0950408 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -24,12 +24,17 @@ static void seq_set_overflow(struct seq_file *m)
 static void *seq_buf_alloc(unsigned long size)
 {
 	void *buf;
+	gfp_t gfp = GFP_KERNEL;
 
 	/*
-	 * __GFP_NORETRY to avoid oom-killings with high-order allocations -
-	 * it's better to fall back to vmalloc() than to kill things.
+	 * For high order allocations, use __GFP_NORETRY to avoid oom-killing -
+	 * it's better to fall back to vmalloc() than to kill things.  For small
+	 * allocations, just use GFP_KERNEL which will oom kill, thus no need
+	 * for vmalloc fallback.
 	 */
-	buf = kmalloc(size, GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
+	if (size > PAGE_SIZE)
+		gfp |= __GFP_NORETRY | __GFP_NOWARN;
+	buf = kmalloc(size, gfp);
 	if (!buf && size > PAGE_SIZE)
 		buf = vmalloc(size);
 	return buf;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 097/164] x86/cpu: Call verify_cpu() after having entered long mode too
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (95 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 096/164] fs, seqfile: always allow oom killer Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 098/164] parisc: Fixes and cleanups in kernel uapi header files Kamal Mostafa
                   ` (66 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Borislav Petkov, Matt Fleming, Peter Zijlstra, Thomas Gleixner,
	Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 a2dc0ad..761fd69 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 b9242ba..4cf401f 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
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 098/164] parisc: Fixes and cleanups in kernel uapi header files
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (96 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 097/164] x86/cpu: Call verify_cpu() after having entered long mode too Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 099/164] Btrfs: fix race leading to incorrect item deletion when dropping extents Kamal Mostafa
                   ` (65 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Helge Deller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Helge Deller <deller@gmx.de>

commit d0cf62fb63f760e98244d31396b3b58f3a1e326b upstream.

This patch fixes some bugs and partly cleans up the parisc uapi header
files to what glibc defined:
- compat_semid64_ds was wrong and did not take the endianess into
  account
- ipc64_perm exported userspace types which broke building userspace
  packages on debian (e.g. trinity)
- ipc64_perm needs to use a 32bit mode_t on 64bit kernel
- msqid64_ds and semid64_ds needs unsigned longs for various struct members
- shmid64_ds exported size_t instead of __kernel_size_t

And finally add some compile-time checks for the sizes of those structs
to avoid future breakage.

Runtime-tested with the Linux Test Project (LTP) testsuite.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/parisc/include/asm/compat.h           |  4 ++--
 arch/parisc/include/uapi/asm/ipcbuf.h      | 19 ++++++++++++-------
 arch/parisc/include/uapi/asm/msgbuf.h      | 10 +++++-----
 arch/parisc/include/uapi/asm/posix_types.h |  2 ++
 arch/parisc/include/uapi/asm/sembuf.h      |  6 +++---
 arch/parisc/include/uapi/asm/shmbuf.h      |  8 ++++----
 arch/parisc/mm/init.c                      | 16 ++++++++++++++++
 7 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h
index 94710cf..0448a2c 100644
--- a/arch/parisc/include/asm/compat.h
+++ b/arch/parisc/include/asm/compat.h
@@ -206,10 +206,10 @@ struct compat_ipc64_perm {
 
 struct compat_semid64_ds {
 	struct compat_ipc64_perm sem_perm;
-	compat_time_t sem_otime;
 	unsigned int __unused1;
-	compat_time_t sem_ctime;
+	compat_time_t sem_otime;
 	unsigned int __unused2;
+	compat_time_t sem_ctime;
 	compat_ulong_t sem_nsems;
 	compat_ulong_t __unused3;
 	compat_ulong_t __unused4;
diff --git a/arch/parisc/include/uapi/asm/ipcbuf.h b/arch/parisc/include/uapi/asm/ipcbuf.h
index bd956c4..790c411 100644
--- a/arch/parisc/include/uapi/asm/ipcbuf.h
+++ b/arch/parisc/include/uapi/asm/ipcbuf.h
@@ -1,6 +1,9 @@
 #ifndef __PARISC_IPCBUF_H__
 #define __PARISC_IPCBUF_H__
 
+#include <asm/bitsperlong.h>
+#include <linux/posix_types.h>
+
 /*
  * The ipc64_perm structure for PA-RISC is almost identical to
  * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the kernel.
@@ -10,16 +13,18 @@
 
 struct ipc64_perm
 {
-	key_t           key;
-	uid_t           uid;
-	gid_t           gid;
-	uid_t           cuid;
-	gid_t           cgid;
+	__kernel_key_t		key;
+	__kernel_uid_t		uid;
+	__kernel_gid_t		gid;
+	__kernel_uid_t		cuid;
+	__kernel_gid_t		cgid;
+#if __BITS_PER_LONG != 64
 	unsigned short int	__pad1;
-	mode_t          mode;
+#endif
+	__kernel_mode_t		mode;
 	unsigned short int	__pad2;
 	unsigned short int	seq;
-	unsigned int	__pad3;
+	unsigned int		__pad3;
 	unsigned long long int __unused1;
 	unsigned long long int __unused2;
 };
diff --git a/arch/parisc/include/uapi/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h
index 3421389..2e83ac7 100644
--- a/arch/parisc/include/uapi/asm/msgbuf.h
+++ b/arch/parisc/include/uapi/asm/msgbuf.h
@@ -27,13 +27,13 @@ struct msqid64_ds {
 	unsigned int   __pad3;
 #endif
 	__kernel_time_t msg_ctime;	/* last change time */
-	unsigned int  msg_cbytes;	/* current number of bytes on queue */
-	unsigned int  msg_qnum;	/* number of messages in queue */
-	unsigned int  msg_qbytes;	/* max number of bytes on queue */
+	unsigned long msg_cbytes;	/* current number of bytes on queue */
+	unsigned long msg_qnum;		/* number of messages in queue */
+	unsigned long msg_qbytes;	/* max number of bytes on queue */
 	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */
 	__kernel_pid_t msg_lrpid;	/* last receive pid */
-	unsigned int  __unused1;
-	unsigned int  __unused2;
+	unsigned long __unused1;
+	unsigned long __unused2;
 };
 
 #endif /* _PARISC_MSGBUF_H */
diff --git a/arch/parisc/include/uapi/asm/posix_types.h b/arch/parisc/include/uapi/asm/posix_types.h
index b934425..f3b5f70 100644
--- a/arch/parisc/include/uapi/asm/posix_types.h
+++ b/arch/parisc/include/uapi/asm/posix_types.h
@@ -7,8 +7,10 @@
  * assume GCC is being used.
  */
 
+#ifndef __LP64__
 typedef unsigned short		__kernel_mode_t;
 #define __kernel_mode_t __kernel_mode_t
+#endif
 
 typedef unsigned short		__kernel_ipc_pid_t;
 #define __kernel_ipc_pid_t __kernel_ipc_pid_t
diff --git a/arch/parisc/include/uapi/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h
index f01d89e..c20971b 100644
--- a/arch/parisc/include/uapi/asm/sembuf.h
+++ b/arch/parisc/include/uapi/asm/sembuf.h
@@ -23,9 +23,9 @@ struct semid64_ds {
 	unsigned int	__pad2;
 #endif
 	__kernel_time_t	sem_ctime;		/* last change time */
-	unsigned int	sem_nsems;		/* no. of semaphores in array */
-	unsigned int	__unused1;
-	unsigned int	__unused2;
+	unsigned long 	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	__unused1;
+	unsigned long	__unused2;
 };
 
 #endif /* _PARISC_SEMBUF_H */
diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h
index 8496c38..750e13e 100644
--- a/arch/parisc/include/uapi/asm/shmbuf.h
+++ b/arch/parisc/include/uapi/asm/shmbuf.h
@@ -30,12 +30,12 @@ struct shmid64_ds {
 #if __BITS_PER_LONG != 64
 	unsigned int		__pad4;
 #endif
-	size_t			shm_segsz;	/* size of segment (bytes) */
+	__kernel_size_t		shm_segsz;	/* size of segment (bytes) */
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
-	unsigned int		shm_nattch;	/* no. of current attaches */
-	unsigned int		__unused1;
-	unsigned int		__unused2;
+	unsigned long		shm_nattch;	/* no. of current attaches */
+	unsigned long		__unused1;
+	unsigned long		__unused2;
 };
 
 struct shminfo64 {
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 0bef864..2fef816 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -23,6 +23,7 @@
 #include <linux/unistd.h>
 #include <linux/nodemask.h>	/* for node_online_map */
 #include <linux/pagemap.h>	/* for release_pages and page_cache_release */
+#include <linux/compat.h>
 
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
@@ -30,6 +31,7 @@
 #include <asm/pdc_chassis.h>
 #include <asm/mmzone.h>
 #include <asm/sections.h>
+#include <asm/msgbuf.h>
 
 extern int  data_start;
 extern void parisc_kernel_start(void);	/* Kernel entry point in head.S */
@@ -590,6 +592,20 @@ unsigned long pcxl_dma_start __read_mostly;
 
 void __init mem_init(void)
 {
+	/* Do sanity checks on IPC (compat) structures */
+	BUILD_BUG_ON(sizeof(struct ipc64_perm) != 48);
+#ifndef CONFIG_64BIT
+	BUILD_BUG_ON(sizeof(struct semid64_ds) != 80);
+	BUILD_BUG_ON(sizeof(struct msqid64_ds) != 104);
+	BUILD_BUG_ON(sizeof(struct shmid64_ds) != 104);
+#endif
+#ifdef CONFIG_COMPAT
+	BUILD_BUG_ON(sizeof(struct compat_ipc64_perm) != sizeof(struct ipc64_perm));
+	BUILD_BUG_ON(sizeof(struct compat_semid64_ds) != 80);
+	BUILD_BUG_ON(sizeof(struct compat_msqid64_ds) != 104);
+	BUILD_BUG_ON(sizeof(struct compat_shmid64_ds) != 104);
+#endif
+
 	/* Do sanity checks on page table constants */
 	BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t));
 	BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t));
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 099/164] Btrfs: fix race leading to incorrect item deletion when dropping extents
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (97 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 098/164] parisc: Fixes and cleanups in kernel uapi header files Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 100/164] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow Kamal Mostafa
                   ` (64 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 5529ca8..11ec6e5 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();
 		}
 
 		/*
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 100/164] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (98 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 099/164] Btrfs: fix race leading to incorrect item deletion when dropping extents Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 101/164] ALSA: usb: Add native DSD support for Aune X1S Kamal Mostafa
                   ` (63 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 76a450c..0f48c7c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1287,8 +1287,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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 101/164] ALSA: usb: Add native DSD support for Aune X1S
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (99 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 100/164] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 102/164] perf: Fix inherited events vs. tracepoint filters Kamal Mostafa
                   ` (62 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jurgen Kramer, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jurgen Kramer <gtmkramer@xs4all.nl>

commit 16771c7c704769c5f3d70c024630b6e5b3eafa67 upstream.

This patch adds native DSD support for the Aune X1S 32BIT/384 DSD DAC

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index aa98e08..449555c 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1257,6 +1257,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
 	case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
 	case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
 	case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
+	case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */
 		if (fp->altsetting == 3)
 			return SNDRV_PCM_FMTBIT_DSD_U32_BE;
 		break;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 102/164] perf: Fix inherited events vs. tracepoint filters
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (100 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 101/164] ALSA: usb: Add native DSD support for Aune X1S Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 103/164] scsi_sysfs: Fix queue_ramp_up_period return code Kamal Mostafa
                   ` (61 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 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, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 3527176..c4535e3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6181,6 +6181,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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 103/164] scsi_sysfs: Fix queue_ramp_up_period return code
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (101 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 102/164] perf: Fix inherited events vs. tracepoint filters Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 104/164] Btrfs: fix race when listing an inode's xattrs Kamal Mostafa
                   ` (60 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Oberparleiter, Martin K. Petersen, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 5b771bc..e71eb8e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -898,7 +898,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,
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 104/164] Btrfs: fix race when listing an inode's xattrs
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (102 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 103/164] scsi_sysfs: Fix queue_ramp_up_period return code Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 105/164] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list Kamal Mostafa
                   ` (59 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Filipe Manana, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 01bad72..fbb0533 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 (found_key.type != 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))
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 105/164] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (103 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 104/164] Btrfs: fix race when listing an inode's xattrs Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 106/164] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag Kamal Mostafa
                   ` (58 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Darren Hart, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 37a1dbe..7b37b99 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -858,6 +858,13 @@ static const 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"),
+		},
+	},
 	{}
 };
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 106/164] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (104 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 105/164] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 107/164] KVM: x86: work around infinite loop in microcode when #AC is delivered Kamal Mostafa
                   ` (57 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, James Bottomley, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8d0824d..fa85f56 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1608,8 +1608,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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 107/164] KVM: x86: work around infinite loop in microcode when #AC is delivered
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (105 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 106/164] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 108/164] KVM: svm: unconditionally intercept #DB Kamal Mostafa
                   ` (56 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Northup, Paolo Bonzini, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 b5d7640..8a4add8 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 fe5d87e..c338a3d 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1105,6 +1105,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);
@@ -1791,6 +1792,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);
@@ -3354,6 +3361,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 5a235e3..7045706 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1507,7 +1507,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))
@@ -4908,6 +4908,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 &
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 108/164] KVM: svm: unconditionally intercept #DB
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (106 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 107/164] KVM: x86: work around infinite loop in microcode when #AC is delivered Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 109/164] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Kamal Mostafa
                   ` (55 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 c338a3d..610f66f 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1106,6 +1106,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);
@@ -1638,20 +1639,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
@@ -1757,7 +1751,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 &
@@ -3749,7 +3742,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)
@@ -4365,7 +4357,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,
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 109/164] drivers: of: of_reserved_mem: fixup the alignment with CMA setup
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (107 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 108/164] KVM: svm: unconditionally intercept #DB Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 110/164] drm/ast: Initialized data needed to map fbdev memory Kamal Mostafa
                   ` (54 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jason Liu, Grant Likely, Rob Herring, Rob Herring, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 dc566b3..4442c1a 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) {
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 110/164] drm/ast: Initialized data needed to map fbdev memory
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (108 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 109/164] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 111/164] FS-Cache: Increase reference of parent after registering, netfs success Kamal Mostafa
                   ` (53 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Egbert Eich, Dave Airlie, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 86205a2..05f6522 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -315,6 +315,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 5c60ae5..b0774e9 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -370,3 +370,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 035dacc..5b5d431 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -448,6 +448,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 b7ee263..69d19f3 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -547,6 +547,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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 111/164] FS-Cache: Increase reference of parent after registering, netfs success
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (109 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 110/164] drm/ast: Initialized data needed to map fbdev memory Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 112/164] FS-Cache: Don't override netfs's primary_index if registering failed Kamal Mostafa
                   ` (52 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kinglong Mee, David Howells, Al Viro, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 6d941f5..458cc96 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;
 	}
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 112/164] FS-Cache: Don't override netfs's primary_index if registering failed
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (110 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 111/164] FS-Cache: Increase reference of parent after registering, netfs success Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 113/164] FS-Cache: Handle a write to the page immediately beyond the EOF marker Kamal Mostafa
                   ` (51 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kinglong Mee, David Howells, Al Viro, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 458cc96..9b28649 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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 113/164] FS-Cache: Handle a write to the page immediately beyond the EOF marker
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (111 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 112/164] FS-Cache: Don't override netfs's primary_index if registering failed Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 114/164] binfmt_elf: Don't clobber passed executable's file header Kamal Mostafa
                   ` (50 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David Howells, Al Viro, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cachefiles/rdwr.c | 67 +++++++++++++++++++++++++++++-----------------------
 fs/fscache/page.c    |  2 +-
 2 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 616db0e7..12e6206 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -905,6 +905,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;
@@ -912,40 +921,38 @@ 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 {
-		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);
-			}
-		}
-
-		data = kmap(page);
-		ret = __kernel_write(file, data, len, &pos);
-		kunmap(page);
-		if (ret != len)
-			ret = -EIO;
-		fput(file);
+		goto error_2;
 	}
 
-	if (ret < 0) {
-		if (ret == -EIO)
-			cachefiles_io_error_obj(
-				object, "Write page to backing file failed");
-		ret = -ENOBUFS;
+	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);
+		}
 	}
 
-	_leave(" = %d", ret);
-	return ret;
+	data = kmap(page);
+	ret = __kernel_write(file, data, len, &pos);
+	kunmap(page);
+	fput(file);
+	if (ret != len)
+		goto error_eio;
+
+	_leave(" = 0");
+	return 0;
+
+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 de33b3f..03e3ff2 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -816,7 +816,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;
 	}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 114/164] binfmt_elf: Don't clobber passed executable's file header
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (112 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 113/164] FS-Cache: Handle a write to the page immediately beyond the EOF marker Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 115/164] fs/pipe.c: return error code rather than 0 in pipe_write() Kamal Mostafa
                   ` (49 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maciej W. Rozycki, Al Viro, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 8081aba..cd0dea9 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -758,16 +758,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++;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 115/164] fs/pipe.c: return error code rather than 0 in pipe_write()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (113 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 114/164] binfmt_elf: Don't clobber passed executable's file header Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 116/164] ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec Kamal Mostafa
                   ` (48 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric Biggers, Al Viro, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@canonical.com>
---
 fs/pipe.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/pipe.c b/fs/pipe.c
index 21981e5..6c856a1 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;
 		}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 116/164] ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (114 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 115/164] fs/pipe.c: return error code rather than 0 in pipe_write() Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 117/164] crypto: crc32c-pclmul - use .rodata instead of .rotata Kamal Mostafa
                   ` (47 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Lu, Han, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Lu, Han" <han.lu@intel.com>

commit e2656412f2a7343ecfd13eb74bac0a6e6e9c5aad upstream.

Broxton and Skylake have the same behavior on display audio. So this patch
applys Skylake fix-ups to Broxton.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ kamal: backport to 3.19-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index cfdc5a7..6a7fdab 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -48,8 +48,9 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
 #define is_haswell(codec)  ((codec)->vendor_id == 0x80862807)
 #define is_broadwell(codec)    ((codec)->vendor_id == 0x80862808)
 #define is_skylake(codec) ((codec)->vendor_id == 0x80862809)
+#define is_broxton(codec) ((codec)->vendor_id == 0x8086280a)
 #define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \
-					|| is_skylake(codec))
+				|| is_skylake(codec) || is_broxton(codec))
 
 #define is_valleyview(codec) ((codec)->vendor_id == 0x80862882)
 #define is_cherryview(codec) ((codec)->vendor_id == 0x80862883)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 117/164] crypto: crc32c-pclmul - use .rodata instead of .rotata
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (115 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 116/164] ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 118/164] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Kamal Mostafa
                   ` (46 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Iooss, Herbert Xu, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

commit 97bce7e0b58dfc7d159ded329f57961868fb060b upstream.

Module crc32c-intel uses a special read-only data section named .rotata.
This section is defined for K_table, and its name seems to be a spelling
mistake for .rodata.

Fixes: 473946e674eb ("crypto: crc32c-pclmul - Shrink K_table to 32-bit words")
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
index 26d49eb..902b117 100644
--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
+++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
@@ -330,7 +330,7 @@ ENDPROC(crc_pcl)
 	## PCLMULQDQ tables
 	## Table is 128 entries x 2 words (8 bytes) each
 	################################################################
-.section	.rotata, "a", %progbits
+.section	.rodata, "a", %progbits
 .align 8
 K_table:
 	.long 0x493c7d27, 0x00000001
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 118/164] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (116 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 117/164] crypto: crc32c-pclmul - use .rodata instead of .rotata Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 119/164] mwifiex: fix mwifiex_rdeeprom_read() Kamal Mostafa
                   ` (45 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Valentin Rothberg, Sebastian Reichel, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 3bed2f5..3ccadf6 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) {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 119/164] mwifiex: fix mwifiex_rdeeprom_read()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (117 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 118/164] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 120/164] dmaengine: dw: convert to __ffs() Kamal Mostafa
                   ` (44 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Kalle Valo, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 2713f7ac..9fac68d 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;
 }
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 120/164] dmaengine: dw: convert to __ffs()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (118 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 119/164] mwifiex: fix mwifiex_rdeeprom_read() Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 121/164] tcp: call sk_mark_napi_id() on the child, not the listener Kamal Mostafa
                   ` (43 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Shevchenko, Vinod Koul, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 de55fb8..1383c73 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -156,7 +156,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
@@ -704,7 +704,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)
@@ -783,7 +783,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)
@@ -803,7 +803,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);
@@ -843,7 +843,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)
@@ -863,7 +863,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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 121/164] tcp: call sk_mark_napi_id() on the child, not the listener
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (119 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 120/164] dmaengine: dw: convert to __ffs() Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 122/164] vivid: Fix iteration in driver removal path Kamal Mostafa
                   ` (42 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

commit 38cb52455c2c3e8b5751350a3fb32e43e82e129a upstream.

This fixes a typo : We want to store the NAPI id on child socket.
Presumably nobody really uses busy polling, on short lived flows.

Fixes: 3d97379a67486 ("tcp: move sk_mark_napi_id() at the right place")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/tcp_ipv4.c | 2 +-
 net/ipv6/tcp_ipv6.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 982347e..4441dd9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1456,7 +1456,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
 
 		if (nsk != sk) {
 			sock_rps_save_rxhash(nsk, skb);
-			sk_mark_napi_id(sk, skb);
+			sk_mark_napi_id(nsk, skb);
 			if (tcp_child_process(sk, nsk, skb)) {
 				rsk = nsk;
 				goto reset;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index fb41d5c..5cf4d0a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1326,7 +1326,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
 		 */
 		if (nsk != sk) {
 			sock_rps_save_rxhash(nsk, skb);
-			sk_mark_napi_id(sk, skb);
+			sk_mark_napi_id(nsk, skb);
 			if (tcp_child_process(sk, nsk, skb))
 				goto reset;
 			if (opt_skb)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 122/164] vivid: Fix iteration in driver removal path
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (120 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 121/164] tcp: call sk_mark_napi_id() on the child, not the listener Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 123/164] usb: ehci-orion: fix probe for !GENERIC_PHY Kamal Mostafa
                   ` (41 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

commit a5d42b8c3b3ddccd88dc1c70957177d31a6699fb upstream.

When the diver is removed and all the resources are deallocated,
we should be iterating through the created devices only.

Currently, the iteration ends when vivid_devs[i] is NULL. Since
the array contains VIVID_MAX_DEVS elements, it will oops if
n_devs=VIVID_MAX_DEVS because in that case, no element is NULL.

Fixes: c88a96b023d8 ('[media] vivid: add core driver code')

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/platform/vivid/vivid-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index a7e033a..d801b57 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -1314,8 +1314,11 @@ static void __exit vivid_exit(void)
 	struct vivid_dev *dev;
 	unsigned i;
 
-	for (i = 0; vivid_devs[i]; i++) {
+
+	for (i = 0; i < n_devs; i++) {
 		dev = vivid_devs[i];
+		if (!dev)
+			continue;
 
 		if (dev->has_vid_cap) {
 			v4l2_info(&dev->v4l2_dev, "unregistering %s\n",
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 123/164] usb: ehci-orion: fix probe for !GENERIC_PHY
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (121 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 122/164] vivid: Fix iteration in driver removal path Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 124/164] devres: fix a for loop bounds check Kamal Mostafa
                   ` (40 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jonas Gorski, Greg Kroah-Hartman, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 f6eafec..510ea3f 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -218,7 +218,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)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 124/164] devres: fix a for loop bounds check
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (122 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 123/164] usb: ehci-orion: fix probe for !GENERIC_PHY Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 125/164] netfilter: remove dead code Kamal Mostafa
                   ` (39 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Greg Kroah-Hartman, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@canonical.com>
---
 lib/devres.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/devres.c b/lib/devres.c
index 0f1dd2e..dfdd1a4 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -395,7 +395,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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 125/164] netfilter: remove dead code
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (123 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 124/164] devres: fix a for loop bounds check Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 126/164] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk Kamal Mostafa
                   ` (38 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Flavio Leitner, Pablo Neira Ayuso, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 f0daed2..ad28f15 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -184,10 +184,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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 126/164] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (124 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 125/164] netfilter: remove dead code Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 127/164] i2c: img-scb: enable fencing for all versions of the ip Kamal Mostafa
                   ` (37 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric W. Biederman, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 2e2f687..da93b4f 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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 127/164] i2c: img-scb: enable fencing for all versions of the ip
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (125 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 126/164] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 128/164] i2c: img-scb: do dummy writes before fifo access Kamal Mostafa
                   ` (36 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Wolfram Sang, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 0e59378bc05b084939af54d2066552ac42fa0fee upstream.

The code to read from the master read fifo, and write to the master
write fifo, checks a bit in an SCB register before every byte to
ensure that the fifo is not full (write fifo) or empty (read fifo).
Due to clock domain crossing inside the SCB block the updated value
of this bit is only visible after 2 cycles.

The scb_wr_rd_fence() function does 2 dummy writes (to the read-only
revision register), and it's called before reading from or writing to the
fifos to ensure that subsequent reads of the fifo status bits do not read
stale values.

As the 2 dummy writes are required in all versions of the ip, the version
check is dropped.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 0fcc169..bb4c597 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -278,8 +278,6 @@
 #define ISR_COMPLETE(err)	(ISR_COMPLETE_M | (ISR_STATUS_M & (err)))
 #define ISR_FATAL(err)		(ISR_COMPLETE(err) | ISR_FATAL_M)
 
-#define REL_SOC_IP_SCB_2_2_1	0x00020201
-
 enum img_i2c_mode {
 	MODE_INACTIVE,
 	MODE_RAW,
@@ -1118,10 +1116,8 @@ static int img_i2c_init(struct img_i2c *i2c)
 		return -EINVAL;
 	}
 
-	if (rev == REL_SOC_IP_SCB_2_2_1) {
-		i2c->need_wr_rd_fence = true;
-		dev_info(i2c->adap.dev.parent, "fence quirk enabled");
-	}
+	/* Fencing enabled by default. */
+	i2c->need_wr_rd_fence = true;
 
 	bitrate_khz = i2c->bitrate / 1000;
 	clk_khz = clk_get_rate(i2c->scb_clk) / 1000;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 128/164] i2c: img-scb: do dummy writes before fifo access
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (126 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 127/164] i2c: img-scb: enable fencing for all versions of the ip Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 129/164] i2c: img-scb: use DIV_ROUND_UP to round divisor values Kamal Mostafa
                   ` (35 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Wolfram Sang, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 2aefb1bd4101235be7d9f0d5ac8d56aa979f6081 upstream.

Move scb_wr_rd_fence to before reading from fifo and writing to
fifo to make sure the the first read/write is done after the required
number of cycles.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index bb4c597..3d8b842 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -534,6 +534,7 @@ static void img_i2c_read_fifo(struct img_i2c *i2c)
 		u32 fifo_status;
 		u8 data;
 
+		img_i2c_wr_rd_fence(i2c);
 		fifo_status = img_i2c_readl(i2c, SCB_FIFO_STATUS_REG);
 		if (fifo_status & FIFO_READ_EMPTY)
 			break;
@@ -542,7 +543,6 @@ static void img_i2c_read_fifo(struct img_i2c *i2c)
 		*i2c->msg.buf = data;
 
 		img_i2c_writel(i2c, SCB_READ_FIFO_REG, 0xff);
-		img_i2c_wr_rd_fence(i2c);
 		i2c->msg.len--;
 		i2c->msg.buf++;
 	}
@@ -554,12 +554,12 @@ static void img_i2c_write_fifo(struct img_i2c *i2c)
 	while (i2c->msg.len) {
 		u32 fifo_status;
 
+		img_i2c_wr_rd_fence(i2c);
 		fifo_status = img_i2c_readl(i2c, SCB_FIFO_STATUS_REG);
 		if (fifo_status & FIFO_WRITE_FULL)
 			break;
 
 		img_i2c_writel(i2c, SCB_WRITE_DATA_REG, *i2c->msg.buf);
-		img_i2c_wr_rd_fence(i2c);
 		i2c->msg.len--;
 		i2c->msg.buf++;
 	}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 129/164] i2c: img-scb: use DIV_ROUND_UP to round divisor values
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (127 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 128/164] i2c: img-scb: do dummy writes before fifo access Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 130/164] i2c: img-scb: fix LOW and HIGH period values for the SCL clock Kamal Mostafa
                   ` (34 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Wolfram Sang, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 5728d95f2458887ae3d95547c04352bba5080ad6 upstream.

Using % can be slow depending on the architecture.

Using DIV_ROUND_UP is nicer and more efficient way to do it.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 3d8b842..ef8eee1 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1177,9 +1177,7 @@ static int img_i2c_init(struct img_i2c *i2c)
 		int_bitrate++;
 
 	/* Setup TCKH value */
-	tckh = timing.tckh / clk_period;
-	if (timing.tckh % clk_period)
-		tckh++;
+	tckh = DIV_ROUND_UP(timing.tckh, clk_period);
 
 	if (tckh > 0)
 		data = tckh - 1;
@@ -1199,9 +1197,7 @@ static int img_i2c_init(struct img_i2c *i2c)
 	img_i2c_writel(i2c, SCB_TIME_TCKL_REG, data);
 
 	/* Setup TSDH value */
-	tsdh = timing.tsdh / clk_period;
-	if (timing.tsdh % clk_period)
-		tsdh++;
+	tsdh = DIV_ROUND_UP(timing.tsdh, clk_period);
 
 	if (tsdh > 1)
 		data = tsdh - 1;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 130/164] i2c: img-scb: fix LOW and HIGH period values for the SCL clock
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (128 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 129/164] i2c: img-scb: use DIV_ROUND_UP to round divisor values Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 131/164] i2c: img-scb: Clear line and interrupt status before starting a transfer Kamal Mostafa
                   ` (33 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Wolfram Sang, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 987008dbc48479af250cddda7f36e920a47ef54f upstream.

Currently, after determining the minimum value for the High period
(TCKH) the remainder of the internal clock pulses is set as the Low
period (TCKL). This causes the i2c clock duty cycle to be much less
than 50%.

Modify the starting position to TCKH and TCKL at 50% of the internal
clock, and adjusts the TCKH and TCKL values from there should the
minimum value for TCKL not be met. This results in duty cycles closer
to 50%.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index ef8eee1..515cbb4 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1176,25 +1176,29 @@ static int img_i2c_init(struct img_i2c *i2c)
 	    ((bitrate_khz * clk_period) / 2))
 		int_bitrate++;
 
-	/* Setup TCKH value */
-	tckh = DIV_ROUND_UP(timing.tckh, clk_period);
+	/*
+	 * Setup clock duty cycle, start with 50% and adjust TCKH and TCKL
+	 * values from there if they don't meet minimum timing requirements
+	 */
+	tckh = int_bitrate / 2;
+	tckl = int_bitrate - tckh;
 
-	if (tckh > 0)
-		data = tckh - 1;
-	else
-		data = 0;
+	/* Adjust TCKH and TCKL values */
+	data = DIV_ROUND_UP(timing.tckl, clk_period);
 
-	img_i2c_writel(i2c, SCB_TIME_TCKH_REG, data);
+	if (tckl < data) {
+		tckl = data;
+		tckh = int_bitrate - tckl;
+	}
 
-	/* Setup TCKL value */
-	tckl = int_bitrate - tckh;
+	if (tckh > 0)
+		--tckh;
 
 	if (tckl > 0)
-		data = tckl - 1;
-	else
-		data = 0;
+		--tckl;
 
-	img_i2c_writel(i2c, SCB_TIME_TCKL_REG, data);
+	img_i2c_writel(i2c, SCB_TIME_TCKH_REG, tckh);
+	img_i2c_writel(i2c, SCB_TIME_TCKL_REG, tckl);
 
 	/* Setup TSDH value */
 	tsdh = DIV_ROUND_UP(timing.tsdh, clk_period);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 131/164] i2c: img-scb: Clear line and interrupt status before starting a transfer
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (129 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 130/164] i2c: img-scb: fix LOW and HIGH period values for the SCL clock Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 132/164] i2c: img-scb: verify support for requested bit rate Kamal Mostafa
                   ` (32 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Wolfram Sang, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 1ed6faedfc9741cca2d97b25ab73902ba7177093 upstream.

Clear line status and all generated interrupts from the interrupt
status register before starting a transfer, as we may have
unserviced interrupts from previous transfers that might be
handled in the context of the new transfer.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 515cbb4..90ffb07 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1058,6 +1058,15 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 		i2c->last_msg = (i == num - 1);
 		reinit_completion(&i2c->msg_complete);
 
+		/*
+		 * Clear line status and all interrupts before starting a
+		 * transfer, as we may have unserviced interrupts from
+		 * previous transfers that might be handled in the context
+		 * of the new transfer.
+		 */
+		img_i2c_writel(i2c, SCB_INT_CLEAR_REG, ~0);
+		img_i2c_writel(i2c, SCB_CLEAR_REG, ~0);
+
 		if (atomic)
 			img_i2c_atomic_start(i2c);
 		else if (msg->flags & I2C_M_RD)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 132/164] i2c: img-scb: verify support for requested bit rate
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (130 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 131/164] i2c: img-scb: Clear line and interrupt status before starting a transfer Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 133/164] hsi: fix double kfree Kamal Mostafa
                   ` (31 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sifan Naeem, Wolfram Sang, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sifan Naeem <sifan.naeem@imgtec.com>

commit 58b0497dad1abbe389af83e3d7706be584cf3ba2 upstream.

The requested bit rate can be outside the range supported by the driver.
The maximum bit rate this driver supports at the moment is 400Khz.

If the requested bit rate is larger than the maximum supported by the
driver, set the bitrate to the maximum supported before bitrate_khz is
calculated.

Maximum speed supported by the driver can be increased to 1Mhz by
adding support for "fast plus mode" in the future.

Fixes: commit 27bce457d588 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: James Hartley <james.hartley@imgtec.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/i2c/busses/i2c-img-scb.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 90ffb07..d8d750c 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -1128,9 +1128,6 @@ static int img_i2c_init(struct img_i2c *i2c)
 	/* Fencing enabled by default. */
 	i2c->need_wr_rd_fence = true;
 
-	bitrate_khz = i2c->bitrate / 1000;
-	clk_khz = clk_get_rate(i2c->scb_clk) / 1000;
-
 	/* Determine what mode we're in from the bitrate */
 	timing = timings[0];
 	for (i = 0; i < ARRAY_SIZE(timings); i++) {
@@ -1139,6 +1136,17 @@ static int img_i2c_init(struct img_i2c *i2c)
 			break;
 		}
 	}
+	if (i2c->bitrate > timings[ARRAY_SIZE(timings) - 1].max_bitrate) {
+		dev_warn(i2c->adap.dev.parent,
+			 "requested bitrate (%u) is higher than the max bitrate supported (%u)\n",
+			 i2c->bitrate,
+			 timings[ARRAY_SIZE(timings) - 1].max_bitrate);
+		timing = timings[ARRAY_SIZE(timings) - 1];
+		i2c->bitrate = timing.max_bitrate;
+	}
+
+	bitrate_khz = i2c->bitrate / 1000;
+	clk_khz = clk_get_rate(i2c->scb_clk) / 1000;
 
 	/* Find the prescale that would give us that inc (approx delay = 0) */
 	prescale = SCB_OPT_INC * clk_khz / (256 * 16 * bitrate_khz);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 133/164] hsi: fix double kfree
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (131 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 132/164] i2c: img-scb: verify support for requested bit rate Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 134/164] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined Kamal Mostafa
                   ` (30 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Geliang Tang, Sebastian Reichel, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 fe93712..35d631e 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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 134/164] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined.
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (132 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 133/164] hsi: fix double kfree Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 135/164] regulator: arizona-ldo1: Fix handling of GPIO 0 Kamal Mostafa
                   ` (29 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roger Quadros, Sebastian Reichel, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 1f8652b..02e6603 100644
--- a/drivers/hsi/controllers/omap_ssi_port.c
+++ b/drivers/hsi/controllers/omap_ssi_port.c
@@ -1111,7 +1111,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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 135/164] regulator: arizona-ldo1: Fix handling of GPIO 0
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (133 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 134/164] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 136/164] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode Kamal Mostafa
                   ` (28 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Charles Keepax, Mark Brown, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

commit ce938001c08c6580a8da38dc226fa605512afab6 upstream.

The LDO1 driver is using the arizona_of_get_named_gpio helper function
which will return 0 if an error was encountered whilst parsing the GPIO,
as under the pdata scheme 0 was not being treated as a valid GPIO.
However, since the regulator framework was expanded to allow the use of
GPIO 0 this causes us to attempt to register GPIO 0 when we encountered
an error parsing the device tree.

This patch uses of_get_named_gpio directly and sets the
ena_gpio_initialized flag based on the return value.

Fixes: 1de3821ace82 ("regulator: Set ena_gpio_initialized in regulator drivers")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/regulator/arizona-ldo1.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index 8169165..7c1189a 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -17,6 +17,7 @@
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
@@ -184,13 +185,22 @@ static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
 {
 	struct arizona_pdata *pdata = &arizona->pdata;
 	struct arizona_ldo1 *ldo1 = config->driver_data;
+	struct device_node *np = arizona->dev->of_node;
 	struct device_node *init_node, *dcvdd_node;
 	struct regulator_init_data *init_data;
 
-	pdata->ldoena = arizona_of_get_named_gpio(arizona, "wlf,ldoena", true);
+	pdata->ldoena = of_get_named_gpio(np, "wlf,ldoena", 0);
+	if (pdata->ldoena < 0) {
+		dev_warn(arizona->dev,
+			 "LDOENA GPIO property missing/malformed: %d\n",
+			 pdata->ldoena);
+		pdata->ldoena = 0;
+	} else {
+		config->ena_gpio_initialized = true;
+	}
 
-	init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1");
-	dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0);
+	init_node = of_get_child_by_name(np, "ldo1");
+	dcvdd_node = of_parse_phandle(np, "DCVDD-supply", 0);
 
 	if (init_node) {
 		config->of_node = init_node;
@@ -262,8 +272,6 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 			ret = arizona_ldo1_of_get_pdata(arizona, &config, desc);
 			if (ret < 0)
 				return ret;
-
-			config.ena_gpio_initialized = true;
 		}
 	}
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 136/164] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (134 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 135/164] regulator: arizona-ldo1: Fix handling of GPIO 0 Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 137/164] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in Kamal Mostafa
                   ` (27 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Robert Jarzmik, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 599b925..1a42919 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa27x.h
@@ -19,7 +19,7 @@
 #define ARB_CORE_PARK		(1<<24)	   /* Be parked with core when idle */
 #define ARB_LOCK_FLAG		(1<<23)	   /* Only Locking masters gain access to the bus */
 
-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);
 
 #endif /* __MACH_PXA27x_H */
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index af423a4..782e6b9 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:
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 137/164] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (135 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 136/164] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 138/164] drm: Fix return value of drm_framebuffer_init() Kamal Mostafa
                   ` (26 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/firewire/bebob/Makefile     | 2 +-
 sound/firewire/dice/Makefile      | 2 +-
 sound/firewire/fireworks/Makefile | 2 +-
 sound/firewire/oxfw/Makefile      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/firewire/bebob/Makefile b/sound/firewire/bebob/Makefile
index 6cf470c..af7ed66 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/dice/Makefile b/sound/firewire/dice/Makefile
index 9ef228e..55b4be9 100644
--- a/sound/firewire/dice/Makefile
+++ b/sound/firewire/dice/Makefile
@@ -1,3 +1,3 @@
 snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \
 		 dice-pcm.o dice-hwdep.o dice.o
-obj-m += snd-dice.o
+obj-$(CONFIG_SND_DICE) += snd-dice.o
diff --git a/sound/firewire/fireworks/Makefile b/sound/firewire/fireworks/Makefile
index 0c74408..15ef7f7 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
diff --git a/sound/firewire/oxfw/Makefile b/sound/firewire/oxfw/Makefile
index a926850..06ff50f 100644
--- a/sound/firewire/oxfw/Makefile
+++ b/sound/firewire/oxfw/Makefile
@@ -1,3 +1,3 @@
 snd-oxfw-objs := oxfw-command.o oxfw-stream.o oxfw-control.o oxfw-pcm.o \
 		 oxfw-proc.o oxfw-midi.o oxfw-hwdep.o oxfw.o
-obj-m += snd-oxfw.o
+obj-$(CONFIG_SND_OXFW) += snd-oxfw.o
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 138/164] drm: Fix return value of drm_framebuffer_init()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (136 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 137/164] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 139/164] ALSA: dice: correct variable types for __be32 data Kamal Mostafa
                   ` (25 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Vetter, Lukas Wunner, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 2d06f91..f2cd2bf 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -312,8 +312,7 @@ static int drm_mode_object_get_reg(struct drm_device *dev,
  * 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)
@@ -427,7 +426,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);
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 139/164] ALSA: dice: correct variable types for __be32 data
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (137 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 138/164] drm: Fix return value of drm_framebuffer_init() Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 140/164] ALSA: dice: assign converted data to the same type of variable Kamal Mostafa
                   ` (24 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit 3e93d42a04eea4e621f87bfc51b0ab868e131cb9 upstream.

Some local variables in some functions are typed as unsigned int, while
__be32 value is assigned to them. This causes sparse warnings.

dice-stream.c:50:17: warning: incorrect type in assignment (different base types)
dice-stream.c:50:17:    expected unsigned int [unsigned] channel
dice-stream.c:50:17:    got restricted __be32 [usertype] <noident>
dice-stream.c:74:17: warning: incorrect type in assignment (different base types)
dice-stream.c:74:17:    expected unsigned int [unsigned] channel
dice-stream.c:74:17:    got restricted __be32 [usertype] <noident>

This commit fixes this bug.

Fixes: 288a8d0cb04f('ALSA: dice: Change the way to start stream')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/firewire/dice/dice-stream.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
index 07dbd01..d6ba4a3 100644
--- a/sound/firewire/dice/dice-stream.c
+++ b/sound/firewire/dice/dice-stream.c
@@ -44,16 +44,16 @@ int snd_dice_stream_get_rate_mode(struct snd_dice *dice, unsigned int rate,
 static void release_resources(struct snd_dice *dice,
 			      struct fw_iso_resources *resources)
 {
-	unsigned int channel;
+	__be32 channel;
 
 	/* Reset channel number */
 	channel = cpu_to_be32((u32)-1);
 	if (resources == &dice->tx_resources)
 		snd_dice_transaction_write_tx(dice, TX_ISOCHRONOUS,
-					      &channel, 4);
+					      &channel, sizeof(channel));
 	else
 		snd_dice_transaction_write_rx(dice, RX_ISOCHRONOUS,
-					      &channel, 4);
+					      &channel, sizeof(channel));
 
 	fw_iso_resources_free(resources);
 }
@@ -62,7 +62,7 @@ static int keep_resources(struct snd_dice *dice,
 			  struct fw_iso_resources *resources,
 			  unsigned int max_payload_bytes)
 {
-	unsigned int channel;
+	__be32 channel;
 	int err;
 
 	err = fw_iso_resources_allocate(resources, max_payload_bytes,
@@ -74,10 +74,10 @@ static int keep_resources(struct snd_dice *dice,
 	channel = cpu_to_be32(resources->channel);
 	if (resources == &dice->tx_resources)
 		err = snd_dice_transaction_write_tx(dice, TX_ISOCHRONOUS,
-						    &channel, 4);
+						    &channel, sizeof(channel));
 	else
 		err = snd_dice_transaction_write_rx(dice, RX_ISOCHRONOUS,
-						    &channel, 4);
+						    &channel, sizeof(channel));
 	if (err < 0)
 		release_resources(dice, resources);
 end:
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 140/164] ALSA: dice: assign converted data to the same type of variable
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (138 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 139/164] ALSA: dice: correct variable types for __be32 data Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 141/164] ALSA: fireworks: use u32 type for be32_to_cpup() macro Kamal Mostafa
                   ` (23 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit cbc6f28067aa0aa1193c2bf3546430b2c4dae22c upstream.

In former commit, u32 data was assigned to __be32 variable instead of an
int variable. This is not enough solution because it still causes sparse
warnings.

dice.c:80:23: warning: incorrect type in assignment (different base types)
dice.c:80:23:    expected restricted __be32 [usertype] value
dice.c:80:23:    got unsigned int
dice.c:81:21: warning: restricted __be32 degrades to integer
dice.c:81:46: warning: restricted __be32 degrades to integer

This commit fixes this bug.

Fixes: 7c2d4c0cf5ba('ALSA: dice: Split transaction functionality into a file')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/firewire/dice/dice.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c
index 70a111d..5d99436 100644
--- a/sound/firewire/dice/dice.c
+++ b/sound/firewire/dice/dice.c
@@ -29,7 +29,8 @@ static int dice_interface_check(struct fw_unit *unit)
 	struct fw_csr_iterator it;
 	int key, val, vendor = -1, model = -1, err;
 	unsigned int category, i;
-	__be32 *pointers, value;
+	__be32 *pointers;
+	u32 value;
 	__be32 version;
 
 	pointers = kmalloc_array(ARRAY_SIZE(min_values), sizeof(__be32),
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 141/164] ALSA: fireworks: use u32 type for be32_to_cpup() macro
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (139 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 140/164] ALSA: dice: assign converted data to the same type of variable Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 142/164] ALSA: bebob: use correct type for __be32 data Kamal Mostafa
                   ` (22 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 166f805..94bab04 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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 142/164] ALSA: bebob: use correct type for __be32 data
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (140 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 141/164] ALSA: fireworks: use u32 type for be32_to_cpup() macro Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 143/164] sunrpc: avoid warning in gss_key_timeout Kamal Mostafa
                   ` (21 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Takashi Sakamoto, Takashi Iwai, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 9ee25a6..fc7af1c 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -619,7 +619,7 @@ static const 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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 143/164] sunrpc: avoid warning in gss_key_timeout
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (141 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 142/164] ALSA: bebob: use correct type for __be32 data Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 144/164] clk: versatile-icst: fix memory leak Kamal Mostafa
                   ` (20 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, J. Bruce Fields, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Arnd Bergmann <arnd@arndb.de>

commit cc6a7aab5570beef884ff95f7cade6634bf815a1 upstream.

The gss_key_timeout() function causes a harmless warning in some
configurations, e.g. ARM imx_v6_v7_defconfig with gcc-5.2, if the
compiler cannot figure out the state of the 'expire' variable across
an rcu_read_unlock():

net/sunrpc/auth_gss/auth_gss.c: In function 'gss_key_timeout':
net/sunrpc/auth_gss/auth_gss.c:1422:211: warning: 'expire' may be used uninitialized in this function [-Wmaybe-uninitialized]

To avoid this warning without adding a bogus initialization, this
rewrites the function so the comparison is done inside of the
critical section. As a side-effect, it also becomes slightly
easier to understand because the implementation now more closely
resembles the comment above it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: c5e6aecd034e7 ("sunrpc: fix RCU handling of gc_ctx field")
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sunrpc/auth_gss/auth_gss.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index dace13d..799e65b 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -1411,17 +1411,16 @@ gss_key_timeout(struct rpc_cred *rc)
 {
 	struct gss_cred *gss_cred = container_of(rc, struct gss_cred, gc_base);
 	struct gss_cl_ctx *ctx;
-	unsigned long now = jiffies;
-	unsigned long expire;
+	unsigned long timeout = jiffies + (gss_key_expire_timeo * HZ);
+	int ret = 0;
 
 	rcu_read_lock();
 	ctx = rcu_dereference(gss_cred->gc_ctx);
-	if (ctx)
-		expire = ctx->gc_expiry - (gss_key_expire_timeo * HZ);
+	if (!ctx || time_after(timeout, ctx->gc_expiry))
+		ret = -EACCES;
 	rcu_read_unlock();
-	if (!ctx || time_after(now, expire))
-		return -EACCES;
-	return 0;
+
+	return ret;
 }
 
 static int
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 144/164] clk: versatile-icst: fix memory leak
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (142 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 143/164] sunrpc: avoid warning in gss_key_timeout Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 145/164] MIPS: atomic: Fix comment describing atomic64_add_unless's return value Kamal Mostafa
                   ` (19 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Linus Walleij, Stephen Boyd, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 bc96f10..9064636 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;
 }
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 145/164] MIPS: atomic: Fix comment describing atomic64_add_unless's return value.
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (143 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 144/164] clk: versatile-icst: fix memory leak Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 146/164] mfd: twl6040: Fix deferred probe handling for clk32k Kamal Mostafa
                   ` (18 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ralf Baechle, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 857da84..53ebb45 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -500,7 +500,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)
 {
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 146/164] mfd: twl6040: Fix deferred probe handling for clk32k
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (144 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 145/164] MIPS: atomic: Fix comment describing atomic64_add_unless's return value Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 147/164] DT: mmc: sh_mmcif: fix "compatible" property text Kamal Mostafa
                   ` (17 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tony Lindgren, Lee Jones, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 9687645..ab05f83 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;
 	}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 147/164] DT: mmc: sh_mmcif: fix "compatible" property text
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (145 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 146/164] mfd: twl6040: Fix deferred probe handling for clk32k Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 148/164] netfilter: nf_nat_redirect: add missing NULL pointer check Kamal Mostafa
                   ` (16 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Shtylyov, Ulf Hansson, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 76d63c2b59d4a1481bedc65a3ef25e9d1354dca3 upstream.

The "compatible" property text contradicts even the example given in the MMCIF
binding document itself;  moreover, the Renesas MMCIF driver only matches  on
the generic "compatible" string and doesn't look for the SoC specific strings
at all. Thus describe "renesas,sh-mmcif" as a fallback value.

Fixes: b4c27763d749 ("mmc: sh_mmcif: Document DT bindings")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 Documentation/devicetree/bindings/mmc/renesas,mmcif.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt b/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
index 299081f..3ab9ad5 100644
--- a/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
+++ b/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
@@ -6,11 +6,11 @@ and the properties used by the MMCIF device.
 
 Required properties:
 
-- compatible: must contain one of the following
+- compatible: should be "renesas,mmcif-<soctype>", "renesas,sh-mmcif" as a
+  fallback. Examples with <soctype> are:
 	- "renesas,mmcif-r8a7740" for the MMCIF found in r8a7740 SoCs
 	- "renesas,mmcif-r8a7790" for the MMCIF found in r8a7790 SoCs
 	- "renesas,mmcif-r8a7791" for the MMCIF found in r8a7791 SoCs
-	- "renesas,sh-mmcif" for the generic MMCIF
 
 - clocks: reference to the functional clock
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 148/164] netfilter: nf_nat_redirect: add missing NULL pointer check
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (146 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 147/164] DT: mmc: sh_mmcif: fix "compatible" property text Kamal Mostafa
@ 2015-12-02 16:59 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 149/164] of/fdt: fix error checking for earlycon address Kamal Mostafa
                   ` (15 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 16:59 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Munehisa Kamata, Pablo Neira Ayuso, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Munehisa Kamata <kamatam@amazon.com>

commit 94f9cd81436c85d8c3a318ba92e236ede73752fc upstream.

Commit 8b13eddfdf04cbfa561725cfc42d6868fe896f56 ("netfilter: refactor NAT
redirect IPv4 to use it from nf_tables") has introduced a trivial logic
change which can result in the following crash.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
IP: [<ffffffffa033002d>] nf_nat_redirect_ipv4+0x2d/0xa0 [nf_nat_redirect]
PGD 3ba662067 PUD 3ba661067 PMD 0
Oops: 0000 [#1] SMP
Modules linked in: ipv6(E) xt_REDIRECT(E) nf_nat_redirect(E) xt_tcpudp(E) iptable_nat(E) nf_conntrack_ipv4(E) nf_defrag_ipv4(E) nf_nat_ipv4(E) nf_nat(E) nf_conntrack(E) ip_tables(E) x_tables(E) binfmt_misc(E) xfs(E) libcrc32c(E) evbug(E) evdev(E) psmouse(E) i2c_piix4(E) i2c_core(E) acpi_cpufreq(E) button(E) ext4(E) crc16(E) jbd2(E) mbcache(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E)
CPU: 0 PID: 2536 Comm: ip Tainted: G            E   4.1.7-15.23.amzn1.x86_64 #1
Hardware name: Xen HVM domU, BIOS 4.2.amazon 05/06/2015
task: ffff8800eb438000 ti: ffff8803ba664000 task.ti: ffff8803ba664000
[...]
Call Trace:
 <IRQ>
 [<ffffffffa0334065>] redirect_tg4+0x15/0x20 [xt_REDIRECT]
 [<ffffffffa02e2e99>] ipt_do_table+0x2b9/0x5e1 [ip_tables]
 [<ffffffffa0328045>] iptable_nat_do_chain+0x25/0x30 [iptable_nat]
 [<ffffffffa031777d>] nf_nat_ipv4_fn+0x13d/0x1f0 [nf_nat_ipv4]
 [<ffffffffa0328020>] ? iptable_nat_ipv4_fn+0x20/0x20 [iptable_nat]
 [<ffffffffa031785e>] nf_nat_ipv4_in+0x2e/0x90 [nf_nat_ipv4]
 [<ffffffffa03280a5>] iptable_nat_ipv4_in+0x15/0x20 [iptable_nat]
 [<ffffffff81449137>] nf_iterate+0x57/0x80
 [<ffffffff814491f7>] nf_hook_slow+0x97/0x100
 [<ffffffff814504d4>] ip_rcv+0x314/0x400

unsigned int
nf_nat_redirect_ipv4(struct sk_buff *skb,
...
{
...
		rcu_read_lock();
		indev = __in_dev_get_rcu(skb->dev);
		if (indev != NULL) {
			ifa = indev->ifa_list;
			newdst = ifa->ifa_local; <---
		}
		rcu_read_unlock();
...
}

Before the commit, 'ifa' had been always checked before access. After the
commit, however, it could be accessed even if it's NULL. Interestingly,
this was once fixed in 2003.

http://marc.info/?l=netfilter-devel&m=106668497403047&w=2

In addition to the original one, we have seen the crash when packets that
need to be redirected somehow arrive on an interface which hasn't been
yet fully configured.

This change just reverts the logic to the old behavior to avoid the crash.

Fixes: 8b13eddfdf04 ("netfilter: refactor NAT redirect IPv4 to use it from nf_tables")
Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/netfilter/nf_nat_redirect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_nat_redirect.c b/net/netfilter/nf_nat_redirect.c
index 97b75f9..d438698 100644
--- a/net/netfilter/nf_nat_redirect.c
+++ b/net/netfilter/nf_nat_redirect.c
@@ -55,7 +55,7 @@ nf_nat_redirect_ipv4(struct sk_buff *skb,
 
 		rcu_read_lock();
 		indev = __in_dev_get_rcu(skb->dev);
-		if (indev != NULL) {
+		if (indev && indev->ifa_list) {
 			ifa = indev->ifa_list;
 			newdst = ifa->ifa_local;
 		}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 149/164] of/fdt: fix error checking for earlycon address
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (147 preceding siblings ...)
  2015-12-02 16:59 ` [PATCH 3.19.y-ckt 148/164] netfilter: nf_nat_redirect: add missing NULL pointer check Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 150/164] netfilter: nfnetlink: don't probe module if it exists Kamal Mostafa
                   ` (14 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Masahiro Yamada, Rob Herring, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 5100742..0159b48 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -788,14 +788,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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 150/164] netfilter: nfnetlink: don't probe module if it exists
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (148 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 149/164] of/fdt: fix error checking for earlycon address Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 151/164] sparc/PCI: Add mem64 resource parsing for root bus Kamal Mostafa
                   ` (13 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Westphal, Pablo Neira Ayuso, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 c421d94..7172b84 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -475,7 +475,7 @@ static int nfnetlink_bind(struct net *net, int group)
 	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);
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 151/164] sparc/PCI: Add mem64 resource parsing for root bus
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (149 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 150/164] netfilter: nfnetlink: don't probe module if it exists Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 152/164] xprtrdma: Re-arm after missed events Kamal Mostafa
                   ` (12 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yinghai Lu, Bjorn Helgaas, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Yinghai Lu <yinghai@kernel.org>

commit af86fa4001ca5644ae20cc2c52cdf67bb7db9752 upstream.

David reported that a T5-8 sparc system failed to boot with:

  pci_sun4v f02dbcfc: PCI host bridge to bus 0000:00
  pci_bus 0000:00: root bus resource [io  0x804000000000-0x80400fffffff] (bus address [0x0000-0xfffffff])
  pci_bus 0000:00: root bus resource [mem 0x800000000000-0x80007effffff] (bus address [0x00000000-0x7effffff])
  pci 0000:00:01.0: can't claim BAR 15 [mem 0x100000000-0x4afffffff pref]: no compatible bridge window

Note that we don't know about a host bridge aperture that contains
BAR 15.  OF does report a MEM64 aperture, but before this patch,
pci_determine_mem_io_space() ignored it.

Add support for host bridge apertures with 64-bit PCI addresses.  Also
set IORESOURCE_MEM_64 for PCI device and bridge resources in PCI 64-bit
memory space.

Sparc doesn't actually print the device and bridge resources, but after
this patch, we should have the equivalent of this:

  pci_sun4v f02dbcfc: PCI host bridge to bus 0000:00
  pci_bus 0000:00: root bus resource [io  0x804000000000-0x80400fffffff] (bus address [0x0000-0xfffffff])
  pci_bus 0000:00: root bus resource [mem 0x800000000000-0x80007effffff] (bus address [0x00000000-0x7effffff])
  pci_bus 0000:00: root bus resource [mem 0x800100000000-0x8007ffffffff] (bus address [0x100000000-0x7ffffffff])
  pci 0000:00:01.0:   bridge window [mem 0x800100000000-0x8004afffffff 64bit pref]

[bhelgaas: changelog, URL to David's report]
Fixes: d63e2e1f3df9 ("sparc/PCI: Clip bridge windows to fit in upstream windows")
Link: http://lkml.kernel.org/r/5514391F.2030300@oracle.com
Reported-by: David Ahern <david.ahern@oracle.com>
Tested-by: David Ahern <david.ahern@oracle.com>
Tested-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/sparc/kernel/pci.c        |  7 ++++++-
 arch/sparc/kernel/pci_common.c | 17 +++++++++++++++--
 arch/sparc/kernel/pci_impl.h   |  1 +
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f..808bb06 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -185,8 +185,10 @@ static unsigned long pci_parse_of_flags(u32 addr0)
 
 	if (addr0 & 0x02000000) {
 		flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
-		flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
 		flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
+		if (addr0 & 0x01000000)
+			flags |= IORESOURCE_MEM_64
+				 | PCI_BASE_ADDRESS_MEM_TYPE_64;
 		if (addr0 & 0x40000000)
 			flags |= IORESOURCE_PREFETCH
 				 | PCI_BASE_ADDRESS_MEM_PREFETCH;
@@ -660,6 +662,9 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
 				pbm->io_space.start);
 	pci_add_resource_offset(&resources, &pbm->mem_space,
 				pbm->mem_space.start);
+	if (pbm->mem64_space.flags)
+		pci_add_resource_offset(&resources, &pbm->mem64_space,
+					pbm->mem_space.start);
 	pbm->busn.start = pbm->pci_first_busno;
 	pbm->busn.end	= pbm->pci_last_busno;
 	pbm->busn.flags	= IORESOURCE_BUS;
diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index 944a065..33524c1 100644
--- a/arch/sparc/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
@@ -406,6 +406,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
 	}
 
 	num_pbm_ranges = i / sizeof(*pbm_ranges);
+	memset(&pbm->mem64_space, 0, sizeof(struct resource));
 
 	for (i = 0; i < num_pbm_ranges; i++) {
 		const struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
@@ -451,7 +452,12 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
 			break;
 
 		case 3:
-			/* XXX 64-bit MEM handling XXX */
+			/* 64-bit MEM handling */
+			pbm->mem64_space.start = a;
+			pbm->mem64_space.end = a + size - 1UL;
+			pbm->mem64_space.flags = IORESOURCE_MEM;
+			saw_mem = 1;
+			break;
 
 		default:
 			break;
@@ -465,15 +471,22 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
 		prom_halt();
 	}
 
-	printk("%s: PCI IO[%llx] MEM[%llx]\n",
+	printk("%s: PCI IO[%llx] MEM[%llx]",
 	       pbm->name,
 	       pbm->io_space.start,
 	       pbm->mem_space.start);
+	if (pbm->mem64_space.flags)
+		printk(" MEM64[%llx]",
+		       pbm->mem64_space.start);
+	printk("\n");
 
 	pbm->io_space.name = pbm->mem_space.name = pbm->name;
+	pbm->mem64_space.name = pbm->name;
 
 	request_resource(&ioport_resource, &pbm->io_space);
 	request_resource(&iomem_resource, &pbm->mem_space);
+	if (pbm->mem64_space.flags)
+		request_resource(&iomem_resource, &pbm->mem64_space);
 
 	pci_register_legacy_regions(&pbm->io_space,
 				    &pbm->mem_space);
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 75803c7..37222ca 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -97,6 +97,7 @@ struct pci_pbm_info {
 	/* PBM I/O and Memory space resources. */
 	struct resource			io_space;
 	struct resource			mem_space;
+	struct resource			mem64_space;
 	struct resource			busn;
 
 	/* Base of PCI Config space, can be per-PBM or shared. */
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 152/164] xprtrdma: Re-arm after missed events
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (150 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 151/164] sparc/PCI: Add mem64 resource parsing for root bus Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 153/164] ceph: fix message length computation Kamal Mostafa
                   ` (11 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chuck Lever, Anna Schumaker, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 c98e406..6925e93 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -208,38 +208,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
@@ -304,42 +283,17 @@ out_schedule:
 	return rc;
 }
 
-/*
- * 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);
 }
 
 static void
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 153/164] ceph: fix message length computation
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (151 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 152/164] xprtrdma: Re-arm after missed events Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 154/164] tracepoints: Fix documentation of RCU lockdep checks Kamal Mostafa
                   ` (10 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Yan, Zheng, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 d2171f4..611aa90 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1868,7 +1868,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) *
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 154/164] tracepoints: Fix documentation of RCU lockdep checks
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (152 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 153/164] ceph: fix message length computation Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 155/164] ipv6: fix tunnel error handling Kamal Mostafa
                   ` (9 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Hansen, Mathieu Desnoyers, Steven Rostedt, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

commit a15920bea0428cd22291637f6c72542b1843e65f upstream.

The documentation on top of __DECLARE_TRACE() does not match its
implementation since the condition check has been added to the
RCU lockdep checks. Update the documentation to match its
implementation.

Link: http://lkml.kernel.org/r/1446504164-21563-1-git-send-email-mathieu.desnoyers@efficios.com

CC: Dave Hansen <dave@sr71.net>
Fixes: a05d59a56733 "tracing: Add condition check to RCU lockdep checks"
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/tracepoint.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index c728513..37917e4 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -159,10 +159,11 @@ extern void syscall_unregfunc(void);
  * structure. Force alignment to the same alignment as the section start.
  *
  * When lockdep is enabled, we make sure to always do the RCU portions of
- * the tracepoint code, regardless of whether tracing is on or we match the
- * condition.  This lets us find RCU issues triggered with tracepoints even
- * when this tracepoint is off.  This code has no purpose other than poking
- * RCU a bit.
+ * the tracepoint code, regardless of whether tracing is on. However,
+ * don't check if the condition is false, due to interaction with idle
+ * instrumentation. This lets us find RCU issues triggered with tracepoints
+ * even when this tracepoint is off. This code has no purpose other than
+ * poking RCU a bit.
  */
 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
 	extern struct tracepoint __tracepoint_##name;			\
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 155/164] ipv6: fix tunnel error handling
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (153 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 154/164] tracepoints: Fix documentation of RCU lockdep checks Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 156/164] perf trace: Fix documentation for -i Kamal Mostafa
                   ` (8 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 3c75800..dae25ca 100644
--- a/net/ipv6/tunnel6.c
+++ b/net/ipv6/tunnel6.c
@@ -144,6 +144,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,
@@ -152,7 +162,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,
 };
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 156/164] perf trace: Fix documentation for -i
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (154 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 155/164] ipv6: fix tunnel error handling Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 157/164] bonding: fix panic on non-ARPHRD_ETHER enslave failure Kamal Mostafa
                   ` (7 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Feiner, David Ahern, Arnaldo Carvalho de Melo, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 7e1b1f2..2f374d7 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.
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 157/164] bonding: fix panic on non-ARPHRD_ETHER enslave failure
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (155 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 156/164] perf trace: Fix documentation for -i Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 158/164] rtc: ds1307: Fix alarm programming for mcp794xx Kamal Mostafa
                   ` (6 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nikolay Aleksandrov, Jay Vosburgh, David S. Miller, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 d3b9436..719ebf3 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1642,6 +1642,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;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 158/164] rtc: ds1307: Fix alarm programming for mcp794xx
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (156 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 157/164] bonding: fix panic on non-ARPHRD_ETHER enslave failure Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 159/164] mac80211: fix driver RSSI event calculations Kamal Mostafa
                   ` (5 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tero Kristo, Alexandre Belloni, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 4ffabb3..2e10b39 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -734,9 +734,9 @@ static int mcp794xx_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] &= ~MCP794XX_BIT_ALMX_IF;
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 159/164] mac80211: fix driver RSSI event calculations
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (157 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 158/164] rtc: ds1307: Fix alarm programming for mcp794xx Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 160/164] packet: fix match_fanout_group() Kamal Mostafa
                   ` (4 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 6e565ec..66acc4b 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3271,7 +3271,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;
 
 		/*
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 160/164] packet: fix match_fanout_group()
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (158 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 159/164] mac80211: fix driver RSSI event calculations Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 161/164] tcp: apply Kern's check on RTTs used for congestion control Kamal Mostafa
                   ` (3 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Willem de Bruijn, Eric Leblond, David S. Miller,
	Kamal Mostafa

3.19.8-ckt11 -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: Kamal Mostafa <kamal@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 bfc1880..ca5c040 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1405,10 +1405,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)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 161/164] tcp: apply Kern's check on RTTs used for congestion control
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (159 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 160/164] packet: fix match_fanout_group() Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 162/164] net: fix percpu memory leaks Kamal Mostafa
                   ` (2 subsequent siblings)
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yuchung Cheng, Neal Cardwell, Eric Dumazet, David S. Miller,
	Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 08ccca6..8e967ef 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2907,9 +2907,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;
 
@@ -3151,7 +3148,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 		flag |= FLAG_SACK_RENEGING;
 
 	skb_mstamp_get(&now);
-	if (likely(first_ackt.v64)) {
+	if (likely(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);
 	}
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 162/164] net: fix percpu memory leaks
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (160 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 161/164] tcp: apply Kern's check on RTTs used for congestion control Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 163/164] TPM: Avoid reference to potentially freed memory Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 164/164] [3.19-stable only] fib_rules: Fix dump_rules() not to exit early Kamal Mostafa
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Hannes Frederic Sowa, Jesper Dangaard Brouer,
	David S. Miller, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

commit 1d6119baf0610f813eb9d9580eb4fd16de5b4ceb upstream.

This patch fixes following problems :

1) percpu_counter_init() can return an error, therefore
  init_frag_mem_limit() must propagate this error so that
  inet_frags_init_net() can do the same up to its callers.

2) If ip[46]_frags_ns_ctl_register() fail, we must unwind
   properly and free the percpu_counter.

Without this fix, we leave freed object in percpu_counters
global list (if CONFIG_HOTPLUG_CPU) leading to crashes.

This bug was detected by KASAN and syzkaller tool
(http://github.com/google/syzkaller)

Fixes: 6d7b857d541e ("net: use lib/percpu_counter API for fragmentation mem accounting")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ kamal: backport to 3.19-stable: rename reassembly.c ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/net/inet_frag.h                 | 15 +++++++++------
 net/ieee802154/reassembly.c             | 11 ++++++++---
 net/ipv4/inet_fragment.c                |  6 ------
 net/ipv4/ip_fragment.c                  | 12 +++++++++---
 net/ipv6/netfilter/nf_conntrack_reasm.c | 12 +++++++++---
 net/ipv6/reassembly.c                   | 12 +++++++++---
 6 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 3242bfd..b931bbd 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -110,7 +110,15 @@ struct inet_frags {
 int inet_frags_init(struct inet_frags *);
 void inet_frags_fini(struct inet_frags *);
 
-void inet_frags_init_net(struct netns_frags *nf);
+static inline int inet_frags_init_net(struct netns_frags *nf)
+{
+	return percpu_counter_init(&nf->mem, 0, GFP_KERNEL);
+}
+static inline void inet_frags_uninit_net(struct netns_frags *nf)
+{
+	percpu_counter_destroy(&nf->mem);
+}
+
 void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
 
 void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
@@ -151,11 +159,6 @@ static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i)
 	__percpu_counter_add(&q->net->mem, i, frag_percpu_counter_batch);
 }
 
-static inline void init_frag_mem_limit(struct netns_frags *nf)
-{
-	percpu_counter_init(&nf->mem, 0, GFP_KERNEL);
-}
-
 static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
 {
 	unsigned int res;
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c
index 9d980ed..d67e4a2 100644
--- a/net/ieee802154/reassembly.c
+++ b/net/ieee802154/reassembly.c
@@ -523,14 +523,19 @@ static int __net_init lowpan_frags_init_net(struct net *net)
 {
 	struct netns_ieee802154_lowpan *ieee802154_lowpan =
 		net_ieee802154_lowpan(net);
+	int res;
 
 	ieee802154_lowpan->frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
 	ieee802154_lowpan->frags.low_thresh = IPV6_FRAG_LOW_THRESH;
 	ieee802154_lowpan->frags.timeout = IPV6_FRAG_TIMEOUT;
 
-	inet_frags_init_net(&ieee802154_lowpan->frags);
-
-	return lowpan_frags_ns_sysctl_register(net);
+	res = inet_frags_init_net(&ieee802154_lowpan->frags);
+	if (res)
+		return res;
+	res = lowpan_frags_ns_sysctl_register(net);
+	if (res)
+		inet_frags_uninit_net(&ieee802154_lowpan->frags);
+	return res;
 }
 
 static void __net_exit lowpan_frags_exit_net(struct net *net)
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index edc17b9..2c2a6b6 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -220,12 +220,6 @@ int inet_frags_init(struct inet_frags *f)
 }
 EXPORT_SYMBOL(inet_frags_init);
 
-void inet_frags_init_net(struct netns_frags *nf)
-{
-	init_frag_mem_limit(nf);
-}
-EXPORT_SYMBOL(inet_frags_init_net);
-
 void inet_frags_fini(struct inet_frags *f)
 {
 	cancel_work_sync(&f->frags_work);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 0f128f8..439e7de 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -816,6 +816,8 @@ static void __init ip4_frags_ctl_register(void)
 
 static int __net_init ipv4_frags_init_net(struct net *net)
 {
+	int res;
+
 	/* Fragment cache limits.
 	 *
 	 * The fragment memory accounting code, (tries to) account for
@@ -839,9 +841,13 @@ static int __net_init ipv4_frags_init_net(struct net *net)
 	 */
 	net->ipv4.frags.timeout = IP_FRAG_TIME;
 
-	inet_frags_init_net(&net->ipv4.frags);
-
-	return ip4_frags_ns_ctl_register(net);
+	res = inet_frags_init_net(&net->ipv4.frags);
+	if (res)
+		return res;
+	res = ip4_frags_ns_ctl_register(net);
+	if (res)
+		inet_frags_uninit_net(&net->ipv4.frags);
+	return res;
 }
 
 static void __net_exit ipv4_frags_exit_net(struct net *net)
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 6f187c8..3bbcb17 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -648,12 +648,18 @@ void nf_ct_frag6_consume_orig(struct sk_buff *skb)
 
 static int nf_ct_net_init(struct net *net)
 {
+	int res;
+
 	net->nf_frag.frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
 	net->nf_frag.frags.low_thresh = IPV6_FRAG_LOW_THRESH;
 	net->nf_frag.frags.timeout = IPV6_FRAG_TIMEOUT;
-	inet_frags_init_net(&net->nf_frag.frags);
-
-	return nf_ct_frag6_sysctl_register(net);
+	res = inet_frags_init_net(&net->nf_frag.frags);
+	if (res)
+		return res;
+	res = nf_ct_frag6_sysctl_register(net);
+	if (res)
+		inet_frags_uninit_net(&net->nf_frag.frags);
+	return res;
 }
 
 static void nf_ct_net_exit(struct net *net)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index d7d70e6..886d1c4 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -706,13 +706,19 @@ static void ip6_frags_sysctl_unregister(void)
 
 static int __net_init ipv6_frags_init_net(struct net *net)
 {
+	int res;
+
 	net->ipv6.frags.high_thresh = IPV6_FRAG_HIGH_THRESH;
 	net->ipv6.frags.low_thresh = IPV6_FRAG_LOW_THRESH;
 	net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT;
 
-	inet_frags_init_net(&net->ipv6.frags);
-
-	return ip6_frags_ns_sysctl_register(net);
+	res = inet_frags_init_net(&net->ipv6.frags);
+	if (res)
+		return res;
+	res = ip6_frags_ns_sysctl_register(net);
+	if (res)
+		inet_frags_uninit_net(&net->ipv6.frags);
+	return res;
 }
 
 static void __net_exit ipv6_frags_exit_net(struct net *net)
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 163/164] TPM: Avoid reference to potentially freed memory
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (161 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 162/164] net: fix percpu memory leaks Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 164/164] [3.19-stable only] fib_rules: Fix dump_rules() not to exit early Kamal Mostafa
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christophe JAILLET, Jarkko Sakkinen, Kamal Mostafa

3.19.8-ckt11 -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>
Signed-off-by: Kamal Mostafa <kamal@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 98ba2bd..565a0b3 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;
 
-- 
1.9.1


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

* [PATCH 3.19.y-ckt 164/164] [3.19-stable only] fib_rules: Fix dump_rules() not to exit early
  2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
                   ` (162 preceding siblings ...)
  2015-12-02 17:00 ` [PATCH 3.19.y-ckt 163/164] TPM: Avoid reference to potentially freed memory Kamal Mostafa
@ 2015-12-02 17:00 ` Kamal Mostafa
  163 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:00 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Roland Dreier, Kamal Mostafa

3.19.8-ckt11 -stable review patch.  If anyone has any objections, please let me know.

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

From: Roland Dreier <roland@purestorage.com>

Backports of 41fc014332d9 ("fib_rules: fix fib rule dumps across
multiple skbs") introduced a regression in "ip rule show" - it ends up
dumping the first rule over and over and never exiting, because 3.19
and earlier are missing commit 053c095a82cf ("netlink: make
nlmsg_end() and genlmsg_end() void"), so fib_nl_fill_rule() ends up
returning skb->len (i.e. > 0) in the success case.

Fix this by checking the return code for < 0 instead of != 0.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/core/fib_rules.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index aeedc3a..99ae718 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -631,7 +631,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
 		err = fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).portid,
 				       cb->nlh->nlmsg_seq, RTM_NEWRULE,
 				       NLM_F_MULTI, ops);
-		if (err)
+		if (err < 0)
 			break;
 skip:
 		idx++;
-- 
1.9.1


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

* RE: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally Kamal Mostafa
@ 2015-12-02 17:09   ` Sumit Saxena
  2015-12-02 17:39     ` Kamal Mostafa
  0 siblings, 1 reply; 173+ messages in thread
From: Sumit Saxena @ 2015-12-02 17:09 UTC (permalink / raw)
  To: Kamal Mostafa, linux-kernel, stable, kernel-team
  Cc: Kashyap Desai, Martin K. Petersen

patch- "aed335e megaraid_sas: Make tape drives visible on PERC5
controllers" is must along with current patch. Please consider.

> -----Original Message-----
> From: Kamal Mostafa [mailto:kamal@canonical.com]
> Sent: Wednesday, December 02, 2015 10:29 PM
> To: linux-kernel@vger.kernel.org; stable@vger.kernel.org; kernel-
> team@lists.ubuntu.com
> Cc: Sumit Saxena; Kashyap Desai; Martin K. Petersen; Kamal Mostafa
> Subject: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives
> unconditionally
>
> 3.19.8-ckt11 -stable review patch.  If anyone has any objections, please
let me
> know.
>
> ------------------
>
> From: "sumit.saxena@avagotech.com" <sumit.saxena@avagotech.com>
>
> commit 0d5b47a724bab0ebaaa933d6ff5e584957aaa188 upstream.
>
> Expose non-disk (TAPE drive, CD-ROM) unconditionally.
>
> 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: Kamal Mostafa <kamal@canonical.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index e541c6c..70cf60a 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device
> *sdev)
>  		pd_index =
>  			(sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL)
> +
>  			sdev->id;
> -		if (instance->pd_list[pd_index].driveState ==
> -					MR_PD_STATE_SYSTEM) {
> +		if ((instance->pd_list[pd_index].driveState ==
> +			MR_PD_STATE_SYSTEM) ||
> +			(instance->pd_list[pd_index].driveType !=
TYPE_DISK)) {
>  			return 0;
>  		}
>  		return -ENXIO;
> --
> 1.9.1

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

* Re: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally
  2015-12-02 17:09   ` Sumit Saxena
@ 2015-12-02 17:39     ` Kamal Mostafa
  0 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-02 17:39 UTC (permalink / raw)
  To: Sumit Saxena
  Cc: linux-kernel, stable, kernel-team, Kashyap Desai, Martin K. Petersen

On Wed, 2015-12-02 at 22:39 +0530, Sumit Saxena wrote:
> patch- "aed335e megaraid_sas: Make tape drives visible on PERC5
> controllers" is must along with current patch. Please consider.

Thanks Sumit.  I will pick up aed335e for this 3.19.8-ckt11 release as
well then.

 -Kamal


> > -----Original Message-----
> > From: Kamal Mostafa [mailto:kamal@canonical.com]
> > Sent: Wednesday, December 02, 2015 10:29 PM
> > To: linux-kernel@vger.kernel.org; stable@vger.kernel.org; kernel-
> > team@lists.ubuntu.com
> > Cc: Sumit Saxena; Kashyap Desai; Martin K. Petersen; Kamal Mostafa
> > Subject: [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives
> > unconditionally
> >
> > 3.19.8-ckt11 -stable review patch.  If anyone has any objections, please
> let me
> > know.
> >
> > ------------------
> >
> > From: "sumit.saxena@avagotech.com" <sumit.saxena@avagotech.com>
> >
> > commit 0d5b47a724bab0ebaaa933d6ff5e584957aaa188 upstream.
> >
> > Expose non-disk (TAPE drive, CD-ROM) unconditionally.
> >
> > 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: Kamal Mostafa <kamal@canonical.com>
> > ---
> >  drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> > b/drivers/scsi/megaraid/megaraid_sas_base.c
> > index e541c6c..70cf60a 100644
> > --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> > @@ -1681,8 +1681,9 @@ static int megasas_slave_alloc(struct scsi_device
> > *sdev)
> >  		pd_index =
> >  			(sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL)
> > +
> >  			sdev->id;
> > -		if (instance->pd_list[pd_index].driveState ==
> > -					MR_PD_STATE_SYSTEM) {
> > +		if ((instance->pd_list[pd_index].driveState ==
> > +			MR_PD_STATE_SYSTEM) ||
> > +			(instance->pd_list[pd_index].driveType !=
> TYPE_DISK)) {
> >  			return 0;
> >  		}
> >  		return -ENXIO;
> > --
> > 1.9.1
> 



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

* Re: [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-02 16:58 ` [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure Kamal Mostafa
@ 2015-12-09 13:24   ` Krzysztof Kozlowski
  2015-12-10  0:49     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 173+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-09 13:24 UTC (permalink / raw)
  To: Kamal Mostafa, linux-kernel, stable, kernel-team
  Cc: k.kozlowski.k, Eduardo Valentin

W dniu 03.12.2015 o 01:58, Kamal Mostafa pisze:
> 3.19.8-ckt11 -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>
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)

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 I think that still it shouldn't be ported for <4.2.

Best regards,
Krzysztof


> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 7da2fdc..26f8e86 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -729,27 +729,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;
> @@ -849,6 +832,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	[flat|nested] 173+ messages in thread

* Re: [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-09 13:24   ` Krzysztof Kozlowski
@ 2015-12-10  0:49     ` Krzysztof Kozlowski
  2015-12-10 16:26       ` Kamal Mostafa
  0 siblings, 1 reply; 173+ messages in thread
From: Krzysztof Kozlowski @ 2015-12-10  0:49 UTC (permalink / raw)
  To: Kamal Mostafa, linux-kernel, stable, kernel-team
  Cc: k.kozlowski.k, Eduardo Valentin

On 09.12.2015 22:24, Krzysztof Kozlowski wrote:
> W dniu 03.12.2015 o 01:58, Kamal Mostafa pisze:
>> 3.19.8-ckt11 -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>
>> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
>> ---
>>  drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
>>  1 file changed, 16 insertions(+), 17 deletions(-)
> 
> 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 I think that still it shouldn't be ported for <4.2.
> 
> Best regards,
> Krzysztof
> 

Sorry for the noise, I was wrong. Luis pointed out that the 5f09a5cbd14a
was itself backported to 3.19 so this applies to backporting as well.

No objections from my side.

Best regards,
Krzysztof


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

* Re: [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure
  2015-12-10  0:49     ` Krzysztof Kozlowski
@ 2015-12-10 16:26       ` Kamal Mostafa
  0 siblings, 0 replies; 173+ messages in thread
From: Kamal Mostafa @ 2015-12-10 16:26 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, stable, kernel-team, k.kozlowski.k, Eduardo Valentin

On Thu, 2015-12-10 at 09:49 +0900, Krzysztof Kozlowski wrote:
> On 09.12.2015 22:24, Krzysztof Kozlowski wrote:
> > W dniu 03.12.2015 o 01:58, Kamal Mostafa pisze:
> >> 3.19.8-ckt11 -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>
> >> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> >> ---
> >>  drivers/thermal/samsung/exynos_tmu.c | 33 ++++++++++++++++-----------------
> >>  1 file changed, 16 insertions(+), 17 deletions(-)
> > 
> > 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 I think that still it shouldn't be ported for <4.2.
> > 
> > Best regards,
> > Krzysztof
> > 
> 
> Sorry for the noise, I was wrong. Luis pointed out that the 5f09a5cbd14a
> was itself backported to 3.19 so this applies to backporting as well.

No worries.  Thanks for reviewing this, Krzysztof.

 -Kamal

> No objections from my side.
> 
> Best regards,
> Krzysztof
> 



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

end of thread, other threads:[~2015-12-10 16:26 UTC | newest]

Thread overview: 173+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02 16:57 [3.19.y-ckt stable] Linux 3.19.8-ckt11 stable review Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 001/164] x86/setup: Extend low identity map to cover whole kernel range Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 002/164] x86/setup: Fix low identity map for >= 2GB " Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 003/164] drm/radeon: add quirk for MSI R7 370 Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 004/164] drm/radeon: add quirk for ASUS " Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 005/164] drm/radeon: fix quirk for MSI R7 370 Armor 2X Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 006/164] irda: precedence bug in irlmp_seq_hb_idx() Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 007/164] tipc: allow non-linear first fragment buffer Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 008/164] qmi_wwan: add Sierra Wireless MC74xx/EM74xx Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 009/164] macvtap: unbreak receiving of gro skb with frag list Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 010/164] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 011/164] stmmac: Correctly report PTP capabilities Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 012/164] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 013/164] qmi_wwan: fix entry for HP lt4112 LTE/HSPA+ Gobi 4G Module Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 014/164] sit: fix sit0 percpu double allocations Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 015/164] sfc: push partner queue for skb->xmit_more Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 016/164] net: avoid NULL deref in inet_ctl_sock_destroy() Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 017/164] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 018/164] ipv4: disable BH when changing ip local port range Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 019/164] packet: race condition in packet_bind Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 020/164] net: fix a race in dst_release() Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 021/164] HID: core: Avoid uninitialized buffer access Kamal Mostafa
2015-12-02 16:57   ` Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 022/164] [media] v4l2-compat-ioctl32: fix alignment for ARM64 Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 023/164] net: mvneta: Fix CPU_MAP registers initialisation Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 024/164] mtd: mtdpart: fix add_mtd_partitions error path Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 025/164] fs/proc, core/debug: Don't expose absolute kernel addresses via wchan Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 026/164] [media] v4l2-ctrls: arrays are also considered compound controls Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 027/164] [media] media: v4l2-ctrls: Fix 64bit support in get_ctrl() Kamal Mostafa
2015-12-02 16:57 ` [PATCH 3.19.y-ckt 028/164] ARM: tegra: paz00: use con_id's to refer GPIO's in gpiod_lookup table Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 029/164] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 030/164] ARM: 8427/1: dma-mapping: add support for offset parameter " Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 031/164] integrity: prevent loading untrusted certificates on the IMA trusted keyring Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 032/164] usb: dwc3: pci: Add the Synopsys HAPS AXI Product ID Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 033/164] usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1 Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 034/164] usb: dwc3: Support Synopsys USB 3.1 IP Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 035/164] usb: dwc3: Add dis_enblslpm_quirk Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 036/164] spi: ti-qspi: Fix data corruption seen on r/w stress test Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 037/164] nfsd: serialize state seqid morphing operations Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 038/164] lockd: create NSM handles per net namespace Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 039/164] Btrfs: fix file corruption and data loss after cloning inline extents Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 040/164] ARM: common: edma: Fix channel parameter for irq callbacks Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 041/164] iommu/vt-d: Fix ATSR handling for Root-Complex integrated endpoints Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 042/164] Btrfs: fix truncation of compressed and inlined extents Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 043/164] jbd2: fix checkpoint list cleanup Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 044/164] ext4: fix potential use after free in __ext4_journal_stop Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 045/164] [PATCH] fix calculation of meta_bg descriptor backups Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 046/164] ext4, jbd2: ensure entering into panic after recording an error in superblock Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 047/164] vTPM: fix memory allocation flag for rtce buffer at kernel boot Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 048/164] spi: dw: explicitly free IRQ handler in dw_spi_remove_host() Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 049/164] [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 050/164] [media] media: vb2 dma-sg: " Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 051/164] [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 052/164] Bluetooth: hidp: fix device disconnect on idle timeout Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 053/164] Bluetooth: ath3k: Add new AR3012 0930:021c id Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 054/164] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 055/164] Bluetooth: Fix removing connection parameters when unpairing Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 056/164] spi: atmel: Fix DMA-setup for transfers with more than 8 bits per word Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 057/164] USB: qcserial: add Sierra Wireless MC74xx/EM74xx Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 058/164] staging: rtl8712: Add device ID for Sitecom WLA2100 Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 059/164] ACPI: Use correct IRQ when uninstalling ACPI interrupt handler Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 060/164] ACPI: Using correct irq when waiting for events Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 061/164] ACPI / PM: Fix incorrect wakeup IRQ setting during suspend-to-idle Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 062/164] ALSA: hda/realtek - Dell XPS one ALC3260 speaker no sound after resume back Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 063/164] ALSA: hda - Disable 64bit address for Creative HDA controllers Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 064/164] MAINTAINERS: Add public mailing list for ARC Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 065/164] megaraid_sas: Expose TAPE drives unconditionally Kamal Mostafa
2015-12-02 17:09   ` Sumit Saxena
2015-12-02 17:39     ` Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 066/164] megaraid_sas: Do not use PAGE_SIZE for max_sectors Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 067/164] KVM: s390: SCA must not cross page boundaries Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 068/164] arm64: Fix compat register mappings Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 069/164] can: Use correct type in sizeof() in nla_put() Kamal Mostafa
2015-12-02 16:58   ` Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 070/164] mtd: blkdevs: fix potential deadlock + lockdep warnings Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 071/164] Revert "dm mpath: fix stalls when handling invalid ioctls" Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 072/164] drm/i915: add quirk to enable backlight on Dell Chromebook 11 (2015) Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 073/164] crypto: algif_hash - Only export and import on sockets with data Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 074/164] xtensa: fixes for configs without loop option Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 075/164] PCI: spear: Fix dw_pcie_cfg_read/write() usage Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 076/164] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 077/164] mac80211: fix divide by zero when NOA update Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 078/164] nl80211: Fix potential memory leak from parse_acl_data Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 079/164] mac80211: allow null chandef in tracing Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 080/164] xtensa: fix secondary core boot in SMP Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 081/164] recordmcount: Fix endianness handling bug for nop_mcount Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 082/164] recordmcount: arm64: Replace the ignored mcount call into nop Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 083/164] KVM: VMX: fix SMEP and SMAP without EPT Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 084/164] thermal: exynos: Fix unbalanced regulator disable on probe failure Kamal Mostafa
2015-12-09 13:24   ` Krzysztof Kozlowski
2015-12-10  0:49     ` Krzysztof Kozlowski
2015-12-10 16:26       ` Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 085/164] ALSA: hda - Apply pin fixup for HP ProBook 6550b Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 086/164] ALSA: hda - Add Intel Lewisburg device IDs Audio Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 087/164] firewire: ohci: fix JMicron JMB38x IT context discovery Kamal Mostafa
2015-12-02 16:58 ` [PATCH 3.19.y-ckt 088/164] scsi: restart list search after unlock in scsi_remove_target Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 089/164] mm: slab: only move management objects off-slab for sizes larger than KMALLOC_MIN_SIZE Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 090/164] memcg: fix thresholds for 32b architectures Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 091/164] arm64: bpf: fix div-by-zero case Kamal Mostafa
2015-12-02 16:59   ` Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 092/164] arm64: bpf: fix mod-by-zero case Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 093/164] Input: elantech - add Fujitsu Lifebook U745 to force crc_enabled Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 094/164] proc: actually make proc_fd_permission() thread-friendly Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 095/164] printk: prevent userland from spoofing kernel messages Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 096/164] fs, seqfile: always allow oom killer Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 097/164] x86/cpu: Call verify_cpu() after having entered long mode too Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 098/164] parisc: Fixes and cleanups in kernel uapi header files Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 099/164] Btrfs: fix race leading to incorrect item deletion when dropping extents Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 100/164] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 101/164] ALSA: usb: Add native DSD support for Aune X1S Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 102/164] perf: Fix inherited events vs. tracepoint filters Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 103/164] scsi_sysfs: Fix queue_ramp_up_period return code Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 104/164] Btrfs: fix race when listing an inode's xattrs Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 105/164] ideapad-laptop: Add Lenovo Yoga 900 to no_hw_rfkill dmi list Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 106/164] storvsc: Don't set the SRB_FLAGS_QUEUE_ACTION_ENABLE flag Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 107/164] KVM: x86: work around infinite loop in microcode when #AC is delivered Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 108/164] KVM: svm: unconditionally intercept #DB Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 109/164] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 110/164] drm/ast: Initialized data needed to map fbdev memory Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 111/164] FS-Cache: Increase reference of parent after registering, netfs success Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 112/164] FS-Cache: Don't override netfs's primary_index if registering failed Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 113/164] FS-Cache: Handle a write to the page immediately beyond the EOF marker Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 114/164] binfmt_elf: Don't clobber passed executable's file header Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 115/164] fs/pipe.c: return error code rather than 0 in pipe_write() Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 116/164] ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 117/164] crypto: crc32c-pclmul - use .rodata instead of .rotata Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 118/164] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 119/164] mwifiex: fix mwifiex_rdeeprom_read() Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 120/164] dmaengine: dw: convert to __ffs() Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 121/164] tcp: call sk_mark_napi_id() on the child, not the listener Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 122/164] vivid: Fix iteration in driver removal path Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 123/164] usb: ehci-orion: fix probe for !GENERIC_PHY Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 124/164] devres: fix a for loop bounds check Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 125/164] netfilter: remove dead code Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 126/164] ipv4: Fix ip_queue_xmit to pass sk into ip_local_out_sk Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 127/164] i2c: img-scb: enable fencing for all versions of the ip Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 128/164] i2c: img-scb: do dummy writes before fifo access Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 129/164] i2c: img-scb: use DIV_ROUND_UP to round divisor values Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 130/164] i2c: img-scb: fix LOW and HIGH period values for the SCL clock Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 131/164] i2c: img-scb: Clear line and interrupt status before starting a transfer Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 132/164] i2c: img-scb: verify support for requested bit rate Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 133/164] hsi: fix double kfree Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 134/164] hsi: omap_ssi_port: Prevent warning if cawake_gpio is not defined Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 135/164] regulator: arizona-ldo1: Fix handling of GPIO 0 Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 136/164] ARM: pxa: remove incorrect __init annotation on pxa27x_set_pwrmode Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 137/164] ALSA: fireworks/bebob/oxfw/dice: enable to make as built-in Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 138/164] drm: Fix return value of drm_framebuffer_init() Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 139/164] ALSA: dice: correct variable types for __be32 data Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 140/164] ALSA: dice: assign converted data to the same type of variable Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 141/164] ALSA: fireworks: use u32 type for be32_to_cpup() macro Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 142/164] ALSA: bebob: use correct type for __be32 data Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 143/164] sunrpc: avoid warning in gss_key_timeout Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 144/164] clk: versatile-icst: fix memory leak Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 145/164] MIPS: atomic: Fix comment describing atomic64_add_unless's return value Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 146/164] mfd: twl6040: Fix deferred probe handling for clk32k Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 147/164] DT: mmc: sh_mmcif: fix "compatible" property text Kamal Mostafa
2015-12-02 16:59 ` [PATCH 3.19.y-ckt 148/164] netfilter: nf_nat_redirect: add missing NULL pointer check Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 149/164] of/fdt: fix error checking for earlycon address Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 150/164] netfilter: nfnetlink: don't probe module if it exists Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 151/164] sparc/PCI: Add mem64 resource parsing for root bus Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 152/164] xprtrdma: Re-arm after missed events Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 153/164] ceph: fix message length computation Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 154/164] tracepoints: Fix documentation of RCU lockdep checks Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 155/164] ipv6: fix tunnel error handling Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 156/164] perf trace: Fix documentation for -i Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 157/164] bonding: fix panic on non-ARPHRD_ETHER enslave failure Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 158/164] rtc: ds1307: Fix alarm programming for mcp794xx Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 159/164] mac80211: fix driver RSSI event calculations Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 160/164] packet: fix match_fanout_group() Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 161/164] tcp: apply Kern's check on RTTs used for congestion control Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 162/164] net: fix percpu memory leaks Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 163/164] TPM: Avoid reference to potentially freed memory Kamal Mostafa
2015-12-02 17:00 ` [PATCH 3.19.y-ckt 164/164] [3.19-stable only] fib_rules: Fix dump_rules() not to exit early Kamal Mostafa

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.