linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review
@ 2015-03-31 19:46 Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 001/143] quota: Store maximum space limit in bytes Kamal Mostafa
                   ` (142 more replies)
  0 siblings, 143 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Kamal Mostafa

This is the start of the review cycle for the Linux 3.13.11-ckt18 stable kernel.

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

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

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

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

 -Kamal

--
 arch/arc/include/asm/pgtable.h                     |   3 +-
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c          |   2 +-
 arch/arm/mach-pxa/corgi.c                          |   3 +
 arch/arm/mach-pxa/hx4700.c                         |   2 +
 arch/arm/mach-pxa/poodle.c                         |   2 +
 arch/arm/mach-pxa/spitz.c                          |   2 +
 arch/arm/mach-sa1100/pm.c                          |   1 +
 arch/arm64/kernel/signal32.c                       |   5 +-
 arch/metag/include/asm/processor.h                 |   4 +-
 arch/mips/kernel/mips_ksyms.c                      |   8 +
 arch/mips/kvm/kvm_locore.S                         |   2 +-
 arch/mips/kvm/kvm_mips.c                           |   8 +-
 arch/powerpc/sysdev/axonram.c                      |   2 +-
 arch/s390/kvm/kvm-s390.c                           |   2 +-
 arch/x86/mm/gup.c                                  |   2 +-
 arch/x86/mm/hugetlbpage.c                          |   8 +-
 block/blk-throttle.c                               |   3 +
 block/cfq-iosched.c                                |  16 +-
 drivers/bluetooth/ath3k.c                          |   2 +
 drivers/bluetooth/btusb.c                          |   1 +
 drivers/char/tpm/tpm-interface.c                   |   2 +-
 drivers/char/tpm/tpm_i2c_atmel.c                   |   4 +
 drivers/char/tpm/tpm_i2c_nuvoton.c                 |   5 +
 drivers/char/tpm/tpm_i2c_stm_st33.c                |   9 +-
 drivers/char/tpm/tpm_ibmvtpm.c                     |  28 ++-
 drivers/char/tpm/tpm_tis.c                         |  76 +++++--
 drivers/clk/clk-gate.c                             |   2 +-
 drivers/clk/zynq/clkc.c                            |   1 +
 drivers/cpufreq/cpufreq.c                          |   6 +-
 drivers/cpufreq/s3c2416-cpufreq.c                  |   4 +-
 drivers/cpufreq/s3c24xx-cpufreq.c                  |   2 +-
 drivers/cpufreq/speedstep-lib.c                    |   3 +
 drivers/cpufreq/speedstep-smi.c                    |  12 ++
 drivers/gpio/gpio-tps65912.c                       |  14 +-
 drivers/gpio/gpiolib-of.c                          |   9 +-
 drivers/gpu/drm/i915/i915_drv.h                    |   1 +
 drivers/gpu/drm/i915/intel_sideband.c              |  22 +-
 drivers/gpu/drm/radeon/atombios_dp.c               |   4 +-
 drivers/gpu/drm/radeon/cik.c                       |  37 ++--
 drivers/gpu/drm/radeon/kv_dpm.c                    |  17 +-
 drivers/gpu/drm/radeon/ni.c                        |   8 +-
 drivers/gpu/drm/radeon/r600_dpm.c                  |   2 +-
 drivers/gpu/drm/radeon/radeon_atombios.c           |   1 +
 drivers/hid/hid-input.c                            |  17 ++
 drivers/hid/i2c-hid/i2c-hid.c                      |   5 +-
 drivers/infiniband/hw/qib/qib.h                    |   9 +-
 drivers/infiniband/hw/qib/qib_eeprom.c             | 181 -----------------
 drivers/infiniband/hw/qib/qib_iba6120.c            |   2 -
 drivers/infiniband/hw/qib/qib_iba7220.c            |   2 -
 drivers/infiniband/hw/qib/qib_iba7322.c            |   2 -
 drivers/infiniband/hw/qib/qib_init.c               |   1 -
 drivers/infiniband/hw/qib/qib_sysfs.c              |  24 ---
 drivers/md/dm-io.c                                 |   6 +
 drivers/md/dm-raid1.c                              |   9 +
 drivers/md/dm-snap.c                               |   4 +-
 drivers/md/dm.c                                    |  27 +--
 drivers/md/raid1.c                                 |   5 +-
 drivers/md/raid5.c                                 |   3 +-
 drivers/media/usb/dvb-usb-v2/lmedm04.c             |   7 +
 drivers/misc/mei/hw-me.c                           |   5 +-
 drivers/mmc/host/sdhci-pxav3.c                     |  34 ++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |   2 +-
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |   5 +-
 drivers/net/ppp/ppp_deflate.c                      |   2 +-
 drivers/net/wireless/ath/ath5k/reset.c             |   2 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c        |   3 -
 drivers/net/wireless/iwlwifi/mvm/tx.c              |   5 +
 drivers/net/wireless/iwlwifi/pcie/tx.c             |   7 +-
 drivers/pci/pci-driver.c                           |   2 +-
 drivers/pci/rom.c                                  |   7 +-
 drivers/pinctrl/pinctrl-imx.c                      |   2 +-
 drivers/power/88pm860x_charger.c                   |   1 +
 drivers/power/bq24190_charger.c                    |   2 +-
 drivers/scsi/be2iscsi/be_main.c                    |   1 -
 drivers/scsi/megaraid/megaraid_sas_fusion.c        |   3 +-
 drivers/scsi/sg.c                                  |   6 +-
 drivers/staging/comedi/comedi_compat32.c           |  12 +-
 drivers/target/iscsi/iscsi_target_tq.c             |  28 +--
 drivers/target/target_core_pr.c                    |  25 +--
 drivers/target/target_core_sbc.c                   |  15 +-
 drivers/tty/pty.c                                  |   3 +
 drivers/tty/serial/atmel_serial.c                  |  16 +-
 drivers/tty/vt/vt.c                                |   4 +-
 drivers/usb/class/cdc-acm.c                        |  21 +-
 drivers/usb/core/buffer.c                          |  26 ++-
 drivers/usb/core/driver.c                          |  12 ++
 drivers/usb/core/hcd.c                             |  16 +-
 drivers/usb/core/usb.c                             |   1 +
 drivers/usb/host/isp1760-hcd.c                     |   3 +
 drivers/usb/musb/Kconfig                           |   2 +-
 drivers/usb/serial/cp210x.c                        |   1 +
 drivers/xen/manage.c                               |   8 +-
 fs/autofs4/dev-ioctl.c                             |   8 +-
 fs/btrfs/disk-io.c                                 |   2 +-
 fs/btrfs/tree-log.c                                |  80 +++++++-
 fs/jffs2/scan.c                                    |   5 +
 fs/nfs/callback_xdr.c                              |   4 +-
 fs/nilfs2/btree.c                                  |  47 ++++-
 fs/ocfs2/quota_local.c                             |   4 +-
 fs/proc/generic.c                                  |  12 --
 fs/proc/inode.c                                    |  21 ++
 fs/proc/internal.h                                 |   1 +
 fs/proc/task_mmu.c                                 |  67 ++++--
 fs/quota/dquot.c                                   |  18 +-
 fs/quota/quota_v1.c                                |   4 +-
 fs/quota/quota_v2.c                                |  10 +-
 fs/xfs/xfs_bmap.c                                  |   6 +-
 fs/xfs/xfs_buf_item.c                              |   4 +
 fs/xfs/xfs_inode.c                                 |   2 +
 fs/xfs/xfs_qm.c                                    |   5 +
 fs/xfs/xfs_symlink_remote.c                        |   2 +
 fs/xfs/xfs_trans.c                                 |   1 +
 include/drm/i915_pciids.h                          |   4 +-
 include/linux/fsnotify.h                           |   6 +-
 include/linux/hugetlb.h                            |   8 +-
 include/linux/quota.h                              |   4 +-
 include/linux/swapops.h                            |   4 +
 include/linux/usb/hcd.h                            |   3 +
 include/net/ip.h                                   |   2 +-
 include/net/netns/ipv4.h                           |   1 +
 include/target/target_core_base.h                  |   2 +-
 include/trace/events/kmem.h                        |   7 +-
 kernel/debug/kdb/kdb_main.c                        |   2 +-
 kernel/softirq.c                                   |   6 +-
 kernel/trace/trace.c                               |   2 +-
 mm/compaction.c                                    |   2 +-
 mm/hugetlb.c                                       | 124 +++++++++---
 mm/memory-failure.c                                |   2 -
 mm/memory.c                                        | 224 ++++++++++-----------
 mm/migrate.c                                       |   5 +-
 mm/mmap.c                                          |   4 +-
 mm/nommu.c                                         |   4 +-
 mm/page_alloc.c                                    |  12 +-
 net/ceph/osd_client.c                              |  30 ++-
 net/core/dev.c                                     |  20 +-
 net/core/pktgen.c                                  |  16 +-
 net/core/rtnetlink.c                               |   6 +-
 net/ipv4/ip_output.c                               |  30 +--
 net/ipv4/ip_sockglue.c                             |   8 +-
 net/ipv4/ping.c                                    |   5 +-
 net/ipv4/tcp_ipv4.c                                |  37 +++-
 net/ipv4/udp_diag.c                                |   4 +-
 net/ipv6/datagram.c                                |  10 +-
 net/ipv6/route.c                                   |   9 +-
 net/sctp/sm_make_chunk.c                           |   2 +-
 net/socket.c                                       |   3 -
 security/smack/smack.h                             |  10 +
 security/smack/smack_lsm.c                         |  16 +-
 sound/core/pcm_native.c                            |   2 +
 sound/pci/hda/patch_realtek.c                      |   3 +-
 sound/pci/hda/patch_sigmatel.c                     |  48 ++++-
 sound/pci/riptide/riptide.c                        |  27 ++-
 sound/pci/rme9652/hdspm.c                          |   6 +
 153 files changed, 1152 insertions(+), 804 deletions(-)

Adrian Knoth (1):
      ALSA: hdspm - Constrain periods to 2 on older cards

Al Viro (2):
      procfs: fix race between symlink removals and traversals
      autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation

Alan Stern (2):
      USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)
      USB: fix use-after-free bug in usb_hcd_unlink_urb()

Alex Deucher (5):
      drm/radeon: only enable kv/kb dpm interrupts once v3
      drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary
      drm/radeon: fix voltage setup on hawaii
      drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
      drm/radeon: fix 1 RB harvest config setup for TN/RL

Alexander Usyskin (2):
      mei: mask interrupt set bit on clean reset bit
      mei: me: release hw from reset only during the reset flow

Alexey Brodkin (1):
      ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE

Andrey Ryabinin (1):
      smack: fix possible use after frees in task_security() callers

Arnd Bergmann (3):
      usb: musb: omap2plus bus glue needs USB host support
      usb: musb: add omap-control dependency
      cpufreq: s3c: remove incorrect __init annotations

Calvin Owens (1):
      ksoftirqd: Enable IRQs and call cond_resched() before poking RCU

Catalin Marinas (1):
      arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian

Chen Jie (1):
      jffs2: fix handling of corrupted summary length

Christian König (1):
      drm/radeon: workaround for CP HW bug on CIK

Christoph Hellwig (1):
      net: don't OOPS on socket aio

Christophe Ricard (2):
      tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
      tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO

Cyrille Pitchen (2):
      tty/serial: at91: enable peripheral clock before accessing I/O registers
      tty/serial: at91: fix error handling in atmel_serial_probe()

Dan Carpenter (1):
      ALSA: off by one bug in snd_riptide_joystick_probe()

Darrick J. Wong (1):
      dm io: reject unsupported DISCARD requests with EOPNOTSUPP

Dave Chinner (4):
      xfs: ensure buffer types are set correctly
      xfs: inode unlink does not set AGI buffer type
      xfs: set buf types when converting extent formats
      xfs: set superblock buffer type correctly

David Herrmann (1):
      HID: input: fix confusion on conflicting mappings

David Hildenbrand (1):
      KVM: s390: base hrtimer on a monotonic clock

David Howells (1):
      TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev

David Sterba (1):
      btrfs: set proper message level for skinny metadata

Dmitry Eremin-Solenikov (4):
      ARM: pxa: add regulator_has_full_constraints to corgi board file
      ARM: pxa: add regulator_has_full_constraints to poodle board file
      ARM: pxa: add regulator_has_full_constraints to spitz board file
      ARM: 8284/1: sa1100: clear RCSR_SMR on resume

Dmitry Tunin (1):
      Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device

Emmanuel Grumbach (1):
      iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN

Eric Dumazet (3):
      net: rps: fix cpu unplug
      netxen: fix netxen_nic_poll() logic
      ipv4: tcp: get rid of ugly unicast_sock

Eyal Shapira (1):
      iwlwifi: mvm: validate tid and sta_id in ba_notif

Filipe Manana (1):
      Btrfs: fix fsync data loss after adding hard link to inode

Florian Westphal (1):
      ppp: deflate: never return len larger than output buffer

Govindarajulu Varadarajan (1):
      bnx2x: fix napi poll return value for repoll

Grazvydas Ignotas (1):
      mm/memory.c: actually remap enough memory

Hagen Paul Pfeifer (1):
      ipv6: stop sending PTB packets for MTU < 1280

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

Herbert Xu (1):
      udp_diag: Fix socket skipping within chain

Hon Ching (Vicky) Lo (1):
      tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma

Hui Wang (2):
      ALSA: hda - enable mute led quirk for one more hp machine.
      ALSA: hda - Add one more node in the EAPD supporting candidate list

Ian Abbott (1):
      staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

Ilya Dryomov (3):
      libceph: assert both regular and lingering lists in __remove_osd()
      libceph: change from BUG to WARN for __remove_osd() asserts
      libceph: fix double __remove_osd() problem

James Hogan (4):
      MIPS: KVM: Deliver guest interrupts after local_irq_disable()
      KVM: MIPS: Don't leak FPU/DSP to guest
      MIPS: Export FP functions used by lose_fpu(1) for KVM
      metag: Fix KSTK_EIP() and KSTK_ESP() macros

Jan Kara (3):
      quota: Store maximum space limit in bytes
      fsnotify: fix handling of renames in audit
      xfs: Fix quota type in quota structures when reusing quota file

Jay Lan (1):
      kdb: fix incorrect counts in KDB summary command output

Jeff Moyer (1):
      cfq-iosched: fix incorrect filing of rt async cfqq

Jiri Kosina (1):
      HID: fixup the conflicting keyboard mappings quirk

Jisheng Zhang (3):
      mmc: sdhci-pxav3: fix unbalanced clock issues during probe
      mmc: sdhci-pxav3: fix race between runtime pm and irq
      mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles

Joonsoo Kim (1):
      mm/compaction: fix wrong order check in compact_finished()

Kiran Padwal (1):
      char: tpm: Add missing error check for devm_kzalloc

Kirill A. Shutemov (1):
      mm: cleanup follow_page_mask()

Konstantin Khlebnikov (2):
      cfq-iosched: handle failure of cfq group allocation
      proc/pagemap: walk page tables under pte lock

Krzysztof Kozlowski (2):
      power: bq24190: Fix ignored supplicants
      power_supply: 88pm860x: Fix leaked power supply on probe fail

Lennart Sorensen (1):
      USB: cp210x: add ID for RUGGEDCOM USB Serial Console

Lokesh Vutla (1):
      ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3

Luciano Coelho (1):
      iwlwifi: mvm: always use mac color zero

Malcolm Priestley (1):
      [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb

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

Martin Vajnar (1):
      hx4700: regulator: declare full constraints

Matthew Wilcox (1):
      axonram: Fix bug in direct_access

Michel Dänzer (1):
      PCI: Fix infinite loop with ROM image of size 0

Mikulas Patocka (4):
      cpufreq: speedstep-smi: enable interrupts when waiting
      dm mirror: do not degrade the mirror on discard error
      dm: fix a race condition in dm_get_md
      dm snapshot: fix a possible invalid memory access on unload

Minh Duc Tran (1):
      fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit.

Mitko Haralanov (1):
      IB/qib: Do not write EEPROM

Naoya Horiguchi (6):
      mm/hugetlb: pmd_huge() returns true for non-present hugepage
      mm/hugetlb: take page table lock in follow_huge_pmd()
      mm/hugetlb: fix getting refcount 0 page in hugetlb_fault()
      mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection
      mm/hugetlb: add migration entry check in __unmap_hugepage_range
      mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()

NeilBrown (1):
      md/raid5: Fix livelock when array is both resyncing and degraded.

Nicholas Bellinger (4):
      iscsi-target: Drop problematic active_ts_list usage
      target: Fix PR_APTPL_BUF_LEN buffer size limitation
      target: Add missing WRITE_SAME end-of-device sanity check
      target: Check for LBA + sectors wrap-around in sbc_parse_cdb

Nicolas Pitre (1):
      vt: provide notifications on selection changes

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

Oliver Neukum (1):
      cdc-acm: add sanity checks

Peter Feiner (1):
      mm: softdirty: unmapped addresses between VMAs are clean

Peter Hurley (1):
      tty: Prevent untrappable signals from malicious program

Ricardo Ribalda Delgado (1):
      PCI: Generate uppercase hex for modalias var in uevent

Rodrigo Vivi (1):
      drm/i915/bdw: PCI IDs ending in 0xb are ULT.

Roman Gushchin (2):
      mm/mmap.c: fix arithmetic overflow in __vm_enough_memory()
      mm/nommu.c: fix arithmetic overflow in __vm_enough_memory()

Roopa Prabhu (1):
      bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify

Ross Lagerwall (1):
      xen/manage: Fix USB interaction issues when resuming

Ryusuke Konishi (1):
      nilfs2: fix potential memory overrun on inode

Sabrina Dubroca (1):
      pktgen: fix UDP checksum computation

Saran Maruti Ramanara (1):
      net: sctp: fix passing wrong parameter header to param_type2af in sctp_process_param

Scot Doyle (1):
      tpm_tis: verify interrupt during init

Sebastian Andrzej Siewior (1):
      usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN

Sebastian Hesselbarth (1):
      mmc: sdhci-pxav3: Remove checks for mandatory host clock

Sergei Shtylyov (1):
      clk-gate: fix bit # check in clk_register_gate()

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

Seth Forshee (1):
      HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events

Shobhit Kumar (1):
      drm/i915: Correct the IOSF Dev_FN field for IOSF transfers

Soren Brinkmann (1):
      clk: zynq: Force CPU_2X clock to be ungated

Sumit.Saxena@avagotech.com (1):
      megaraid_sas: disable interrupt_mask before enabling hardware interrupts

Takashi Iwai (4):
      ALSA: hda - Add the pin fixup for HP Envy TS bass speaker
      ALSA: hda - Set up GPIO for Toshiba Satellite S50D
      ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec
      ALSA: pcm: Don't leave PREPARED state after draining

Thadeu Lima de Souza Cascardo (1):
      blk-throttle: check stats_cpu before reading it from sysfs

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

Tony Battersby (1):
      sg: fix read() error reporting

Trond Myklebust (1):
      NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args

Uwe Kleine-König (1):
      pinctrl: pinctrl-imx: don't use invalid value of conf_reg

Vikram Mulukutla (1):
      tracing: Fix unmapping loop in tracing_mark_write

Viresh Kumar (1):
      cpufreq: Set cpufreq_cpu_data to NULL before putting kobject

Vlastimil Babka (1):
      mm: when stealing freepages, also take pages created by splitting buddy page

Willem de Bruijn (1):
      ip: zero sockaddr returned on error queue

honclo (1):
      Added Little Endian support to vtpm module

subashab@codeaurora.org (1):
      ping: Fix race in free in receive path

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

* [PATCH 3.13.y-ckt 001/143] quota: Store maximum space limit in bytes
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 002/143] ip: zero sockaddr returned on error queue Kamal Mostafa
                   ` (141 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jan Kara, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jan Kara <jack@suse.cz>

commit b10a08194c2b615955dfab2300331a90ae9344c7 upstream.

Currently maximum space limit quota format supports is in blocks however
since we store space limits in bytes, this is somewhat confusing. So
store the maximum limit in bytes as well. Also rename the field to match
the new unit and related inode field to match the new naming scheme.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ocfs2/quota_local.c |  4 ++--
 fs/quota/dquot.c       | 18 ++++--------------
 fs/quota/quota_v1.c    |  4 ++--
 fs/quota/quota_v2.c    | 10 +++++-----
 include/linux/quota.h  |  4 ++--
 5 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 2001862..068b525 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -700,8 +700,8 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
 	/* We don't need the lock and we have to acquire quota file locks
 	 * which will later depend on this lock */
 	mutex_unlock(&sb_dqopt(sb)->dqio_mutex);
-	info->dqi_maxblimit = 0x7fffffffffffffffLL;
-	info->dqi_maxilimit = 0x7fffffffffffffffLL;
+	info->dqi_max_spc_limit = 0x7fffffffffffffffLL;
+	info->dqi_max_ino_limit = 0x7fffffffffffffffLL;
 	oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS);
 	if (!oinfo) {
 		mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota"
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 274e310..064e9eb 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2396,16 +2396,6 @@ out:
 }
 EXPORT_SYMBOL(dquot_quota_on_mount);
 
-static inline qsize_t qbtos(qsize_t blocks)
-{
-	return blocks << QIF_DQBLKSIZE_BITS;
-}
-
-static inline qsize_t stoqb(qsize_t space)
-{
-	return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
-}
-
 /* Generic routine for getting common part of quota structure */
 static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di)
 {
@@ -2455,13 +2445,13 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di)
 		return -EINVAL;
 
 	if (((di->d_fieldmask & QC_SPC_SOFT) &&
-	     stoqb(di->d_spc_softlimit) > dqi->dqi_maxblimit) ||
+	     di->d_spc_softlimit > dqi->dqi_max_spc_limit) ||
 	    ((di->d_fieldmask & QC_SPC_HARD) &&
-	     stoqb(di->d_spc_hardlimit) > dqi->dqi_maxblimit) ||
+	     di->d_spc_hardlimit > dqi->dqi_max_spc_limit) ||
 	    ((di->d_fieldmask & QC_INO_SOFT) &&
-	     (di->d_ino_softlimit > dqi->dqi_maxilimit)) ||
+	     (di->d_ino_softlimit > dqi->dqi_max_ino_limit)) ||
 	    ((di->d_fieldmask & QC_INO_HARD) &&
-	     (di->d_ino_hardlimit > dqi->dqi_maxilimit)))
+	     (di->d_ino_hardlimit > dqi->dqi_max_ino_limit)))
 		return -ERANGE;
 
 	spin_lock(&dq_data_lock);
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index 469c684..8fe79be 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -169,8 +169,8 @@ static int v1_read_file_info(struct super_block *sb, int type)
 	}
 	ret = 0;
 	/* limits are stored as unsigned 32-bit data */
-	dqopt->info[type].dqi_maxblimit = 0xffffffff;
-	dqopt->info[type].dqi_maxilimit = 0xffffffff;
+	dqopt->info[type].dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS;
+	dqopt->info[type].dqi_max_ino_limit = 0xffffffff;
 	dqopt->info[type].dqi_igrace =
 			dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME;
 	dqopt->info[type].dqi_bgrace =
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 02751ec..d1a8054 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -117,12 +117,12 @@ static int v2_read_file_info(struct super_block *sb, int type)
 	qinfo = info->dqi_priv;
 	if (version == 0) {
 		/* limits are stored as unsigned 32-bit data */
-		info->dqi_maxblimit = 0xffffffff;
-		info->dqi_maxilimit = 0xffffffff;
+		info->dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS;
+		info->dqi_max_ino_limit = 0xffffffff;
 	} else {
-		/* used space is stored as unsigned 64-bit value */
-		info->dqi_maxblimit = 0xffffffffffffffffULL;	/* 2^64-1 */
-		info->dqi_maxilimit = 0xffffffffffffffffULL;
+		/* used space is stored as unsigned 64-bit value in bytes */
+		info->dqi_max_spc_limit = 0xffffffffffffffffULL; /* 2^64-1 */
+		info->dqi_max_ino_limit = 0xffffffffffffffffULL;
 	}
 	info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
 	info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index bc395be..a1066e9 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -211,8 +211,8 @@ struct mem_dqinfo {
 	unsigned long dqi_flags;
 	unsigned int dqi_bgrace;
 	unsigned int dqi_igrace;
-	qsize_t dqi_maxblimit;
-	qsize_t dqi_maxilimit;
+	qsize_t dqi_max_spc_limit;
+	qsize_t dqi_max_ino_limit;
 	void *dqi_priv;
 };
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 002/143] ip: zero sockaddr returned on error queue
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 001/143] quota: Store maximum space limit in bytes Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 003/143] net: rps: fix cpu unplug Kamal Mostafa
                   ` (140 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Willem de Bruijn, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Willem de Bruijn <willemb@google.com>

[ Upstream commit f812116b174e59a350acc8e4856213a166a91222 ]

The sockaddr is returned in IP(V6)_RECVERR as part of errhdr. That
structure is defined and allocated on the stack as

    struct {
            struct sock_extended_err ee;
            struct sockaddr_in(6)    offender;
    } errhdr;

The second part is only initialized for certain SO_EE_ORIGIN values.
Always initialize it completely.

An MTU exceeded error on a SOCK_RAW/IPPROTO_RAW is one example that
would return uninitialized bytes.

Signed-off-by: Willem de Bruijn <willemb@google.com>

----

Also verified that there is no padding between errhdr.ee and
errhdr.offender that could leak additional kernel data.
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/ip_sockglue.c |  8 ++------
 net/ipv6/datagram.c    | 10 +++-------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index ddf32a6..304cd16 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -428,15 +428,11 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 
 	memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err));
 	sin = &errhdr.offender;
-	sin->sin_family = AF_UNSPEC;
+	memset(sin, 0, sizeof(*sin));
 	if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP) {
-		struct inet_sock *inet = inet_sk(sk);
-
 		sin->sin_family = AF_INET;
 		sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
-		sin->sin_port = 0;
-		memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
-		if (inet->cmsg_flags)
+		if (inet_sk(sk)->cmsg_flags)
 			ip_cmsg_recv(msg, skb);
 	}
 
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 93b1aa3..53939a8 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -373,11 +373,10 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 
 	memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err));
 	sin = &errhdr.offender;
-	sin->sin6_family = AF_UNSPEC;
+	memset(sin, 0, sizeof(*sin));
+
 	if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) {
 		sin->sin6_family = AF_INET6;
-		sin->sin6_flowinfo = 0;
-		sin->sin6_port = 0;
 		if (skb->protocol == htons(ETH_P_IPV6)) {
 			sin->sin6_addr = ipv6_hdr(skb)->saddr;
 			if (np->rxopt.all)
@@ -386,12 +385,9 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 				ipv6_iface_scope_id(&sin->sin6_addr,
 						    IP6CB(skb)->iif);
 		} else {
-			struct inet_sock *inet = inet_sk(sk);
-
 			ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
 					       &sin->sin6_addr);
-			sin->sin6_scope_id = 0;
-			if (inet->cmsg_flags)
+			if (inet_sk(sk)->cmsg_flags)
 				ip_cmsg_recv(msg, skb);
 		}
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 003/143] net: rps: fix cpu unplug
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 001/143] quota: Store maximum space limit in bytes Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 002/143] ip: zero sockaddr returned on error queue Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 004/143] ipv6: stop sending PTB packets for MTU < 1280 Kamal Mostafa
                   ` (139 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Tom Herbert, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit ac64da0b83d82abe62f78b3d0e21cca31aea24fa ]

softnet_data.input_pkt_queue is protected by a spinlock that
we must hold when transferring packets from victim queue to an active
one. This is because other cpus could still be trying to enqueue packets
into victim queue.

A second problem is that when we transfert the NAPI poll_list from
victim to current cpu, we absolutely need to special case the percpu
backlog, because we do not want to add complex locking to protect
process_queue : Only owner cpu is allowed to manipulate it, unless cpu
is offline.

Based on initial patch from Prasad Sodagudi & Subash Abhinov
Kasiviswanathan.

This version is better because we do not slow down packet processing,
only make migration safer.

Reported-by: Prasad Sodagudi <psodagud@codeaurora.org>
Reported-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/core/dev.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index ce67174..ce649f2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6663,10 +6663,20 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 		oldsd->output_queue = NULL;
 		oldsd->output_queue_tailp = &oldsd->output_queue;
 	}
-	/* Append NAPI poll list from offline CPU. */
-	if (!list_empty(&oldsd->poll_list)) {
-		list_splice_init(&oldsd->poll_list, &sd->poll_list);
-		raise_softirq_irqoff(NET_RX_SOFTIRQ);
+	/* Append NAPI poll list from offline CPU, with one exception :
+	 * process_backlog() must be called by cpu owning percpu backlog.
+	 * We properly handle process_queue & input_pkt_queue later.
+	 */
+	while (!list_empty(&oldsd->poll_list)) {
+		struct napi_struct *napi = list_first_entry(&oldsd->poll_list,
+							    struct napi_struct,
+							    poll_list);
+
+		list_del_init(&napi->poll_list);
+		if (napi->poll == process_backlog)
+			napi->state = 0;
+		else
+			____napi_schedule(sd, napi);
 	}
 
 	raise_softirq_irqoff(NET_TX_SOFTIRQ);
@@ -6677,7 +6687,7 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 		netif_rx(skb);
 		input_queue_head_incr(oldsd);
 	}
-	while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
+	while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) {
 		netif_rx(skb);
 		input_queue_head_incr(oldsd);
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 004/143] ipv6: stop sending PTB packets for MTU < 1280
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (2 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 003/143] net: rps: fix cpu unplug Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 005/143] netxen: fix netxen_nic_poll() logic Kamal Mostafa
                   ` (138 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Fernando Gont, Hagen Paul Pfeifer, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hagen Paul Pfeifer <hagen@jauu.net>

[ Upstream commit 9d289715eb5c252ae15bd547cb252ca547a3c4f2 ]

Reduce the attack vector and stop generating IPv6 Fragment Header for
paths with an MTU smaller than the minimum required IPv6 MTU
size (1280 byte) - called atomic fragments.

See IETF I-D "Deprecating the Generation of IPv6 Atomic Fragments" [1]
for more information and how this "feature" can be misused.

[1] https://tools.ietf.org/html/draft-ietf-6man-deprecate-atomfrag-generation-00

Signed-off-by: Fernando Gont <fgont@si6networks.com>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv6/route.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0caafb5..3ca5fff 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1142,12 +1142,9 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
 		struct net *net = dev_net(dst->dev);
 
 		rt6->rt6i_flags |= RTF_MODIFIED;
-		if (mtu < IPV6_MIN_MTU) {
-			u32 features = dst_metric(dst, RTAX_FEATURES);
+		if (mtu < IPV6_MIN_MTU)
 			mtu = IPV6_MIN_MTU;
-			features |= RTAX_FEATURE_ALLFRAG;
-			dst_metric_set(dst, RTAX_FEATURES, features);
-		}
+
 		dst_metric_set(dst, RTAX_MTU, mtu);
 		rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires);
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 005/143] netxen: fix netxen_nic_poll() logic
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (3 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 004/143] ipv6: stop sending PTB packets for MTU < 1280 Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 006/143] udp_diag: Fix socket skipping within chain Kamal Mostafa
                   ` (137 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Manish Chopra, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 6088beef3f7517717bd21d90b379714dd0837079 ]

NAPI poll logic now enforces that a poller returns exactly the budget
when it wants to be called again.

If a driver limits TX completion, it has to return budget as well when
the limit is hit, not the number of received packets.

Reported-and-tested-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: d75b1ade567f ("net: less interrupt masking in NAPI")
Cc: Manish Chopra <manish.chopra@qlogic.com>
Acked-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 3bec8cf..024cd49 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -2392,7 +2392,10 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
 
 	work_done = netxen_process_rcv_ring(sds_ring, budget);
 
-	if ((work_done < budget) && tx_complete) {
+	if (!tx_complete)
+		work_done = budget;
+
+	if (work_done < budget) {
 		napi_complete(&sds_ring->napi);
 		if (test_bit(__NX_DEV_UP, &adapter->state))
 			netxen_nic_enable_int(sds_ring);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 006/143] udp_diag: Fix socket skipping within chain
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (4 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 005/143] netxen: fix netxen_nic_poll() logic Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 007/143] ping: Fix race in free in receive path Kamal Mostafa
                   ` (136 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Herbert Xu, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 86f3cddbc3037882414c7308973530167906b7e9 ]

While working on rhashtable walking I noticed that the UDP diag
dumping code is buggy.  In particular, the socket skipping within
a chain never happens, even though we record the number of sockets
that should be skipped.

As this code was supposedly copied from TCP, this patch does what
TCP does and resets num before we walk a chain.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/udp_diag.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 7927db0..4a000f1 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -99,11 +99,13 @@ static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlin
 	s_slot = cb->args[0];
 	num = s_num = cb->args[1];
 
-	for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) {
+	for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) {
 		struct sock *sk;
 		struct hlist_nulls_node *node;
 		struct udp_hslot *hslot = &table->hash[slot];
 
+		num = 0;
+
 		if (hlist_nulls_empty(&hslot->head))
 			continue;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 007/143] ping: Fix race in free in receive path
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (5 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 006/143] udp_diag: Fix socket skipping within chain Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 008/143] bnx2x: fix napi poll return value for repoll Kamal Mostafa
                   ` (135 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Subash Abhinov Kasiviswanathan, Eric Dumazet, David S. Miller,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: "subashab@codeaurora.org" <subashab@codeaurora.org>

[ Upstream commit fc752f1f43c1c038a2c6ae58cc739ebb5953ccb0 ]

An exception is seen in ICMP ping receive path where the skb
destructor sock_rfree() tries to access a freed socket. This happens
because ping_rcv() releases socket reference with sock_put() and this
internally frees up the socket. Later icmp_rcv() will try to free the
skb and as part of this, skb destructor is called and which leads
to a kernel panic as the socket is freed already in ping_rcv().

-->|exception
-007|sk_mem_uncharge
-007|sock_rfree
-008|skb_release_head_state
-009|skb_release_all
-009|__kfree_skb
-010|kfree_skb
-011|icmp_rcv
-012|ip_local_deliver_finish

Fix this incorrect free by cloning this skb and processing this cloned
skb instead.

This patch was suggested by Eric Dumazet

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Cc: Eric Dumazet <edumazet@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/ping.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 8e0f65c..8bba193 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -962,8 +962,11 @@ void ping_rcv(struct sk_buff *skb)
 
 	sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id));
 	if (sk != NULL) {
+		struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
+
 		pr_debug("rcv on socket %p\n", sk);
-		ping_queue_rcv_skb(sk, skb_get(skb));
+		if (skb2)
+			ping_queue_rcv_skb(sk, skb2);
 		sock_put(sk);
 		return;
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 008/143] bnx2x: fix napi poll return value for repoll
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (6 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 007/143] ping: Fix race in free in receive path Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 009/143] net: don't OOPS on socket aio Kamal Mostafa
                   ` (134 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Govindarajulu Varadarajan, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Govindarajulu Varadarajan <_govind@gmx.com>

[ Upstream commit 24e579c8898aa641ede3149234906982290934e5 ]

With the commit d75b1ade567ffab ("net: less interrupt masking in NAPI") napi
repoll is done only when work_done == budget. When in busy_poll is we return 0
in napi_poll. We should return budget.

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.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>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a9324f4..280cb5c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3100,7 +3100,7 @@ int bnx2x_poll(struct napi_struct *napi, int budget)
 		}
 #endif
 		if (!bnx2x_fp_lock_napi(fp))
-			return work_done;
+			return budget;
 
 		for_each_cos_in_tx_queue(fp, cos)
 			if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos]))
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 009/143] net: don't OOPS on socket aio
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (7 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 008/143] bnx2x: fix napi poll return value for repoll Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 010/143] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify Kamal Mostafa
                   ` (133 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christoph Hellwig, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Christoph Hellwig <hch@lst.de>

[ Upstream commit 06539d3071067ff146a9bffd1c801fa56d290909 ]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/socket.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index dc57dae..404be5e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -885,9 +885,6 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
 static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
 					 struct sock_iocb *siocb)
 {
-	if (!is_sync_kiocb(iocb))
-		BUG();
-
 	siocb->kiocb = iocb;
 	iocb->private = siocb;
 	return siocb;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 010/143] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (8 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 009/143] net: don't OOPS on socket aio Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 011/143] ipv4: tcp: get rid of ugly unicast_sock Kamal Mostafa
                   ` (132 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roopa Prabhu, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Roopa Prabhu <roopa@cumulusnetworks.com>

[ Upstream commit 59ccaaaa49b5b096cdc1f16706a9f931416b2332 ]

Reported in: https://bugzilla.kernel.org/show_bug.cgi?id=92081

This patch avoids calling rtnl_notify if the device ndo_bridge_getlink
handler does not return any bytes in the skb.

Alternately, the skb->len check can be moved inside rtnl_notify.

For the bridge vlan case described in 92081, there is also a fix needed
in bridge driver to generate a proper notification. Will fix that in
subsequent patch.

v2: rebase patch on net tree

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/core/rtnetlink.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7dca4b4..f48db99 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2542,12 +2542,16 @@ static int rtnl_bridge_notify(struct net_device *dev, u16 flags)
 			goto errout;
 	}
 
+	if (!skb->len)
+		goto errout;
+
 	rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
 	return 0;
 errout:
 	WARN_ON(err == -EMSGSIZE);
 	kfree_skb(skb);
-	rtnl_set_sk_err(net, RTNLGRP_LINK, err);
+	if (err)
+		rtnl_set_sk_err(net, RTNLGRP_LINK, err);
 	return err;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 011/143] ipv4: tcp: get rid of ugly unicast_sock
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (9 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 010/143] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 012/143] ppp: deflate: never return len larger than output buffer Kamal Mostafa
                   ` (131 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit bdbbb8527b6f6a358dbcb70dac247034d665b8e4 ]

In commit be9f4a44e7d41 ("ipv4: tcp: remove per net tcp_sock")
I tried to address contention on a socket lock, but the solution
I chose was horrible :

commit 3a7c384ffd57e ("ipv4: tcp: unicast_sock should not land outside
of TCP stack") addressed a selinux regression.

commit 0980e56e506b ("ipv4: tcp: set unicast_sock uc_ttl to -1")
took care of another regression.

commit b5ec8eeac46 ("ipv4: fix ip_send_skb()") fixed another regression.

commit 811230cd85 ("tcp: ipv4: initialize unicast_sock sk_pacing_rate")
was another shot in the dark.

Really, just use a proper socket per cpu, and remove the skb_orphan()
call, to re-enable flow control.

This solves a serious problem with FQ packet scheduler when used in
hostile environments, as we do not want to allocate a flow structure
for every RST packet sent in response to a spoofed packet.

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>
---
 include/net/ip.h         |  2 +-
 include/net/netns/ipv4.h |  1 +
 net/ipv4/ip_output.c     | 30 +++---------------------------
 net/ipv4/tcp_ipv4.c      | 37 ++++++++++++++++++++++++++++++++-----
 4 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/include/net/ip.h b/include/net/ip.h
index 5c76b1f..4613b19 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -174,7 +174,7 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
 	return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
 }
 
-void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
+void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
 			   __be32 saddr, const struct ip_reply_arg *arg,
 			   unsigned int len);
 
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index ee520cb..cf69c31 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -47,6 +47,7 @@ struct netns_ipv4 {
 	struct inet_peer_base	*peers;
 	struct tcpm_hash_bucket	*tcp_metrics_hash;
 	unsigned int		tcp_metrics_hash_log;
+	struct sock  * __percpu	*tcp_sk;
 	struct netns_frags	frags;
 #ifdef CONFIG_NETFILTER
 	struct xt_table		*iptable_filter;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 0b8fe5b..3730214 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1461,24 +1461,8 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset,
 /*
  *	Generic function to send a packet as reply to another packet.
  *	Used to send some TCP resets/acks so far.
- *
- *	Use a fake percpu inet socket to avoid false sharing and contention.
  */
-static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = {
-	.sk = {
-		.__sk_common = {
-			.skc_refcnt = ATOMIC_INIT(1),
-		},
-		.sk_wmem_alloc	= ATOMIC_INIT(1),
-		.sk_allocation	= GFP_ATOMIC,
-		.sk_flags	= (1UL << SOCK_USE_WRITE_QUEUE),
-		.sk_pacing_rate = ~0U,
-	},
-	.pmtudisc	= IP_PMTUDISC_WANT,
-	.uc_ttl		= -1,
-};
-
-void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
+void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
 			   __be32 saddr, const struct ip_reply_arg *arg,
 			   unsigned int len)
 {
@@ -1486,9 +1470,8 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
 	struct ipcm_cookie ipc;
 	struct flowi4 fl4;
 	struct rtable *rt = skb_rtable(skb);
+	struct net *net = sock_net(sk);
 	struct sk_buff *nskb;
-	struct sock *sk;
-	struct inet_sock *inet;
 	int err;
 
 	if (ip_options_echo(&replyopts.opt.opt, skb))
@@ -1518,15 +1501,11 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
 	if (IS_ERR(rt))
 		return;
 
-	inet = &get_cpu_var(unicast_sock);
+	inet_sk(sk)->tos = arg->tos;
 
-	inet->tos = arg->tos;
-	sk = &inet->sk;
 	sk->sk_priority = skb->priority;
 	sk->sk_protocol = ip_hdr(skb)->protocol;
 	sk->sk_bound_dev_if = arg->bound_dev_if;
-	sock_net_set(sk, net);
-	__skb_queue_head_init(&sk->sk_write_queue);
 	sk->sk_sndbuf = sysctl_wmem_default;
 	err = ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base,
 			     len, 0, &ipc, &rt, MSG_DONTWAIT);
@@ -1542,13 +1521,10 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
 			  arg->csumoffset) = csum_fold(csum_add(nskb->csum,
 								arg->csum));
 		nskb->ip_summed = CHECKSUM_NONE;
-		skb_orphan(nskb);
 		skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb));
 		ip_push_pending_frames(sk, &fl4);
 	}
 out:
-	put_cpu_var(unicast_sock);
-
 	ip_rt_put(rt);
 }
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9b726c0..9f627b9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -690,7 +690,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
 
 	net = dev_net(skb_dst(skb)->dev);
 	arg.tos = ip_hdr(skb)->tos;
-	ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr,
+	ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
+			      skb, ip_hdr(skb)->saddr,
 			      ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
 
 	TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
@@ -773,7 +774,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
 	if (oif)
 		arg.bound_dev_if = oif;
 	arg.tos = tos;
-	ip_send_unicast_reply(net, skb, ip_hdr(skb)->saddr,
+	ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
+			      skb, ip_hdr(skb)->saddr,
 			      ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len);
 
 	TCP_INC_STATS_BH(net, TCP_MIB_OUTSEGS);
@@ -2754,14 +2756,39 @@ struct proto tcp_prot = {
 };
 EXPORT_SYMBOL(tcp_prot);
 
+static void __net_exit tcp_sk_exit(struct net *net)
+{
+	int cpu;
+
+	for_each_possible_cpu(cpu)
+		inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu));
+	free_percpu(net->ipv4.tcp_sk);
+}
+
 static int __net_init tcp_sk_init(struct net *net)
 {
+	int res, cpu;
+
+	net->ipv4.tcp_sk = alloc_percpu(struct sock *);
+	if (!net->ipv4.tcp_sk)
+		return -ENOMEM;
+
+	for_each_possible_cpu(cpu) {
+		struct sock *sk;
+
+		res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW,
+					   IPPROTO_TCP, net);
+		if (res)
+			goto fail;
+		*per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk;
+	}
 	net->ipv4.sysctl_tcp_ecn = 2;
 	return 0;
-}
 
-static void __net_exit tcp_sk_exit(struct net *net)
-{
+fail:
+	tcp_sk_exit(net);
+
+	return res;
 }
 
 static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 012/143] ppp: deflate: never return len larger than output buffer
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (10 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 011/143] ipv4: tcp: get rid of ugly unicast_sock Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 013/143] net: sctp: fix passing wrong parameter header to param_type2af in sctp_process_param Kamal Mostafa
                   ` (130 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Westphal, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Florian Westphal <fw@strlen.de>

[ Upstream commit e2a4800e75780ccf4e6c2487f82b688ba736eb18 ]

When we've run out of space in the output buffer to store more data, we
will call zlib_deflate with a NULL output buffer until we've consumed
remaining input.

When this happens, olen contains the size the output buffer would have
consumed iff we'd have had enough room.

This can later cause skb_over_panic when ppp_generic skb_put()s
the returned length.

Reported-by: Iain Douglas <centos@1n6.org.uk>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ppp/ppp_deflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
index 602c625..b5edc7f 100644
--- a/drivers/net/ppp/ppp_deflate.c
+++ b/drivers/net/ppp/ppp_deflate.c
@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
 	/*
 	 * See if we managed to reduce the size of the packet.
 	 */
-	if (olen < isize) {
+	if (olen < isize && olen <= osize) {
 		state->stats.comp_bytes += olen;
 		state->stats.comp_packets++;
 	} else {
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 013/143] net: sctp: fix passing wrong parameter header to param_type2af in sctp_process_param
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (11 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 012/143] ppp: deflate: never return len larger than output buffer Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 014/143] ARM: pxa: add regulator_has_full_constraints to corgi board file Kamal Mostafa
                   ` (129 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Saran Maruti Ramanara, Daniel Borkmann, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Saran Maruti Ramanara <saran.neti@telus.com>

[ Upstream commit cfbf654efc6d78dc9812e030673b86f235bf677d ]

When making use of RFC5061, section 4.2.4. for setting the primary IP
address, we're passing a wrong parameter header to param_type2af(),
resulting always in NULL being returned.

At this point, param.p points to a sctp_addip_param struct, containing
a sctp_paramhdr (type = 0xc004, length = var), and crr_id as a correlation
id. Followed by that, as also presented in RFC5061 section 4.2.4., comes
the actual sctp_addr_param, which also contains a sctp_paramhdr, but
this time with the correct type SCTP_PARAM_IPV{4,6}_ADDRESS that
param_type2af() can make use of. Since we already hold a pointer to
addr_param from previous line, just reuse it for param_type2af().

Fixes: d6de3097592b ("[SCTP]: Add the handling of "Set Primary IP Address" parameter to INIT")
Signed-off-by: Saran Maruti Ramanara <saran.neti@telus.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sctp/sm_make_chunk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index ca22389..72cf5a3 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2608,7 +2608,7 @@ do_addr_param:
 
 		addr_param = param.v + sizeof(sctp_addip_param_t);
 
-		af = sctp_get_af_specific(param_type2af(param.p->type));
+		af = sctp_get_af_specific(param_type2af(addr_param->p.type));
 		if (af == NULL)
 			break;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 014/143] ARM: pxa: add regulator_has_full_constraints to corgi board file
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (12 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 013/143] net: sctp: fix passing wrong parameter header to param_type2af in sctp_process_param Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 015/143] ARM: pxa: add regulator_has_full_constraints to poodle " Kamal Mostafa
                   ` (128 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Eremin-Solenikov, Robert Jarzmik, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

commit 271e80176aae4e5b481f4bb92df9768c6075bbca upstream.

Add regulator_has_full_constraints() call to corgi board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on corgi if
regulators are enabled:

ads7846 spi1.0: unable to get regulator: -517
spi spi1.0: Driver ads7846 requests probe deferral
wm8731 0-001b: Failed to get supply 'AVDD': -517
wm8731 0-001b: Failed to request supplies: -517
wm8731 0-001b: ASoC: failed to probe component -517
corgi-audio corgi-audio: ASoC: failed to instantiate card -517

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-pxa/corgi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index f162f1b..82fd9dd 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -26,6 +26,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/io.h>
+#include <linux/regulator/machine.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/corgi_lcd.h>
@@ -711,6 +712,8 @@ static void __init corgi_init(void)
 		sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
+
+	regulator_has_full_constraints();
 }
 
 static void __init fixup_corgi(struct tag *tags, char **cmdline,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 015/143] ARM: pxa: add regulator_has_full_constraints to poodle board file
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (13 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 014/143] ARM: pxa: add regulator_has_full_constraints to corgi board file Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 016/143] ARM: pxa: add regulator_has_full_constraints to spitz " Kamal Mostafa
                   ` (127 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Eremin-Solenikov, Robert Jarzmik, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

commit 9bc78f32c2e430aebf6def965b316aa95e37a20c upstream.

Add regulator_has_full_constraints() call to poodle board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on poodle if
regulators are enabled:

ads7846 spi1.0: unable to get regulator: -517
spi spi1.0: Driver ads7846 requests probe deferral
wm8731 0-001b: Failed to get supply 'AVDD': -517
wm8731 0-001b: Failed to request supplies: -517
wm8731 0-001b: ASoC: failed to probe component -517

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-pxa/poodle.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index aedf053..b4fff29 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -25,6 +25,7 @@
 #include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
+#include <linux/regulator/machine.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/pxa2xx_spi.h>
@@ -454,6 +455,7 @@ static void __init poodle_init(void)
 	pxa_set_i2c_info(NULL);
 	i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices));
 	poodle_init_spi();
+	regulator_has_full_constraints();
 }
 
 static void __init fixup_poodle(struct tag *tags, char **cmdline,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 016/143] ARM: pxa: add regulator_has_full_constraints to spitz board file
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (14 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 015/143] ARM: pxa: add regulator_has_full_constraints to poodle " Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 017/143] hx4700: regulator: declare full constraints Kamal Mostafa
                   ` (126 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Eremin-Solenikov, Robert Jarzmik, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

commit baad2dc49c5d970ea881d92981a1b76c94a7b7a1 upstream.

Add regulator_has_full_constraints() call to spitz board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on spitz if
regulators are enabled:

ads7846 spi2.0: unable to get regulator: -517
spi spi2.0: Driver ads7846 requests probe deferral

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-pxa/spitz.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 0b11c1a..7f2693f 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -969,6 +969,8 @@ static void __init spitz_init(void)
 	spitz_nor_init();
 	spitz_nand_init();
 	spitz_i2c_init();
+
+	regulator_has_full_constraints();
 }
 
 static void __init spitz_fixup(struct tag *tags, char **cmdline,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 017/143] hx4700: regulator: declare full constraints
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (15 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 016/143] ARM: pxa: add regulator_has_full_constraints to spitz " Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 018/143] HID: input: fix confusion on conflicting mappings Kamal Mostafa
                   ` (125 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin Vajnar, Robert Jarzmik, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Martin Vajnar <martin.vajnar@gmail.com>

commit a52d209336f8fc7483a8c7f4a8a7d2a8e1692a6c upstream.

Since the removal of CONFIG_REGULATOR_DUMMY option, the touchscreen stopped
working. This patch enables the "replacement" for REGULATOR_DUMMY and
allows the touchscreen to work even though there is no regulator for "vcc".

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-pxa/hx4700.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index a7c30eb..007fd8a 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -892,6 +892,8 @@ static void __init hx4700_init(void)
 	mdelay(10);
 	gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1);
 	mdelay(10);
+
+	regulator_has_full_constraints();
 }
 
 MACHINE_START(H4700, "HP iPAQ HX4700")
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 018/143] HID: input: fix confusion on conflicting mappings
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (16 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 017/143] hx4700: regulator: declare full constraints Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 019/143] HID: fixup the conflicting keyboard mappings quirk Kamal Mostafa
                   ` (124 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Herrmann, Jiri Kosina, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 6ce901eb61aa30ba8565c62049ee80c90728ef14 upstream.

On an PC-101/103/104 keyboard (American layout) the 'Enter' key and its
neighbours look like this:

           +---+ +---+ +-------+
           | 1 | | 2 | |   5   |
           +---+ +---+ +-------+
             +---+ +-----------+
             | 3 | |     4     |
             +---+ +-----------+

On a PC-102/105 keyboard (European layout) it looks like this:

           +---+ +---+ +-------+
           | 1 | | 2 | |       |
           +---+ +---+ +-+  4  |
             +---+ +---+ |     |
             | 3 | | 5 | |     |
             +---+ +---+ +-----+

(Note that the number of keys is the same, but key '5' is moved down and
 the shape of key '4' is changed. Keys '1' to '3' are exactly the same.)

The keys 1-4 report the same scan-code in HID in both layouts, even though
the keysym they produce is usually different depending on the XKB-keymap
used by user-space.
However, key '5' (US 'backslash'/'pipe') reports 0x31 for the upper layout
and 0x32 for the lower layout, as defined by the HID spec. This is highly
confusing as the linux-input API uses a single keycode for both.

So far, this was never a problem as there never has been a keyboard with
both of those keys present at the same time. It would have to look
something like this:

           +---+ +---+ +-------+
           | 1 | | 2 | |  x31  |
           +---+ +---+ +-------+
             +---+ +---+ +-----+
             | 3 | |x32| |  4  |
             +---+ +---+ +-----+

HID can represent such a keyboard, but the linux-input API cannot.
Furthermore, any user-space mapping would be confused by this and,
luckily, no-one ever produced such hardware.

Now, the HID input layer fixed this mess by mapping both 0x31 and 0x32 to
the same keycode (KEY_BACKSLASH==0x2b). As only one of both physical keys
is present on a hardware, this works just fine.

Lets introduce hardware-vendors into this:
------------------------------------------

Unfortunately, it seems way to expensive to produce a different device for
American and European layouts. Therefore, hardware-vendors put both keys,
(0x31 and 0x32) on the same keyboard, but only one of them is hooked up
to the physical button, the other one is 'dead'.
This means, they can use the same hardware, with a different button-layout
and automatically produce the correct HID events for American *and*
European layouts. This is unproblematic for normal keyboards, as the
'dead' key will never report any KEY-DOWN events. But RollOver keyboards
send the whole matrix on each key-event, allowing n-key roll-over mode.
This means, we get a 0x31 and 0x32 event on each key-press. One of them
will always be 0, the other reports the real state. As we map both to the
same keycode, we will get spurious key-events, even though the real
key-state never changed.

The easiest way would be to blacklist 'dead' keys and never handle those.
We could simply read the 'country' tag of USB devices and blacklist either
key according to the layout. But... hardware vendors... want the same
device for all countries and thus many of them set 'country' to 0 for all
devices. Meh..

So we have to deal with this properly. As we cannot know which of the keys
is 'dead', we either need a heuristic and track those keys, or we simply
make use of our value-tracking for HID fields. We simply ignore HID events
for absolute data if the data didn't change. As HID tracks events on the
HID level, we haven't done the keycode translation, yet. Therefore, the
'dead' key is tracked independently of the real key, therefore, any events
on it will be ignored.

This patch simply discards any HID events for absolute data if it didn't
change compared to the last report. We need to ignore relative and
buffered-byte reports for obvious reasons. But those cannot be affected by
this bug, so we're fine.

Preferably, we'd do this filtering on the HID-core level. But this might
break a lot of custom drivers, if they do not follow the HID specs.
Therefore, we do this late in hid-input just before we inject it into the
input layer (which does the exact same filtering, but on the keycode
level).

If this turns out to break some devices, we might have to limit filtering
to EV_KEY events. But lets try to do the Right Thing first, and properly
filter any absolute data that didn't change.

This patch is tagged for 'stable' as it fixes a lot of n-key RollOver
hardware. We might wanna wait with backporting for a while, before we know
it doesn't break anything else, though.

Reported-by: Adam Goode <adam@spicenitz.org>
Reported-by: Fredrik Hallenberg <megahallon@gmail.com>
Tested-by: Fredrik Hallenberg <megahallon@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hid/hid-input.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index d97f232..a8382fa 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1063,6 +1063,22 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 		return;
 	}
 
+	/*
+	 * Ignore reports for absolute data if the data didn't change. This is
+	 * not only an optimization but also fixes 'dead' key reports. Some
+	 * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID
+	 * 0x31 and 0x32) report multiple keys, even though a localized keyboard
+	 * can only have one of them physically available. The 'dead' keys
+	 * report constant 0. As all map to the same keycode, they'd confuse
+	 * the input layer. If we filter the 'dead' keys on the HID level, we
+	 * skip the keycode translation and only forward real events.
+	 */
+	if (!(field->flags & (HID_MAIN_ITEM_RELATIVE |
+	                      HID_MAIN_ITEM_BUFFERED_BYTE)) &&
+	    usage->usage_index < field->maxusage &&
+	    value == field->value[usage->usage_index])
+		return;
+
 	/* report the usage code as scancode if the key status has changed */
 	if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
 		input_event(input, EV_MSC, MSC_SCAN, usage->hid);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 019/143] HID: fixup the conflicting keyboard mappings quirk
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (17 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 018/143] HID: input: fix confusion on conflicting mappings Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 020/143] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Kamal Mostafa
                   ` (123 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jiri Kosina, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jiri Kosina <jkosina@suse.cz>

commit 8e7b341037db1835ee6eea64663013cbfcf33575 upstream.

The ignore check that got added in 6ce901eb61 ("HID: input: fix confusion
on conflicting mappings") needs to properly check for VARIABLE reports
as well (ARRAY reports should be ignored), otherwise legitimate keyboards
might break.

Fixes: 6ce901eb61 ("HID: input: fix confusion on conflicting mappings")
Reported-by: Fredrik Hallenberg <megahallon@gmail.com>
Reported-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hid/hid-input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index a8382fa..bd6a436 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1075,6 +1075,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 	 */
 	if (!(field->flags & (HID_MAIN_ITEM_RELATIVE |
 	                      HID_MAIN_ITEM_BUFFERED_BYTE)) &&
+			      (field->flags & HID_MAIN_ITEM_VARIABLE) &&
 	    usage->usage_index < field->maxusage &&
 	    value == field->value[usage->usage_index])
 		return;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 020/143] megaraid_sas: disable interrupt_mask before enabling hardware interrupts
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (18 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 019/143] HID: fixup the conflicting keyboard mappings quirk Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 021/143] PCI: Generate uppercase hex for modalias var in uevent Kamal Mostafa
                   ` (122 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Chaitra Basappa, Christoph Hellwig, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Sumit.Saxena@avagotech.com" <Sumit.Saxena@avagotech.com>

commit c2ced1719a1b903350955a511e1666e6d05a7f5b upstream.

Update driver "mask_interrupts" before enable/disable hardware interrupt
in order to avoid missing interrupts because of "mask_interrupts" still
set to 1 and hardware interrupts are enabled.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index f655592..a1f04e3 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -92,6 +92,8 @@ megasas_enable_intr_fusion(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
 	regs = instance->reg_set;
+
+	instance->mask_interrupts = 0;
 	/* For Thunderbolt/Invader also clear intr on enable */
 	writel(~0, &regs->outbound_intr_status);
 	readl(&regs->outbound_intr_status);
@@ -100,7 +102,6 @@ megasas_enable_intr_fusion(struct megasas_instance *instance)
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
-	instance->mask_interrupts = 0;
 }
 
 /**
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 021/143] PCI: Generate uppercase hex for modalias var in uevent
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (19 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 020/143] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 022/143] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Kamal Mostafa
                   ` (121 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ricardo Ribalda Delgado, Bjorn Helgaas, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>

commit 145b3fe579db66fbe999a2bc3fd5b63dffe9636d upstream.

Some implementations of modprobe fail to load the driver for a PCI device
automatically because the "interface" part of the modalias from the kernel
is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI
r3.0, Appendix D.  Most interface types defined in the spec do not use
alpha characters, so they won't be affected.  For example, 00h, 01h, 10h,
20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we
already do for the Vendor ID, Device ID, Class, etc.

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface
class") fixed only half of the problem.  Some udev implementations rely on
the uevent file and not the modalias file.

Fixes: d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")
Fixes: 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class")
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 25f0bc6..7f41551 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1324,7 +1324,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
+	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X",
 			   pdev->vendor, pdev->device,
 			   pdev->subsystem_vendor, pdev->subsystem_device,
 			   (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 022/143] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (20 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 021/143] PCI: Generate uppercase hex for modalias var in uevent Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 023/143] tty/serial: at91: enable peripheral clock before accessing I/O registers Kamal Mostafa
                   ` (120 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Andrzej Siewior, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

commit 5efd2ea8c9f4f12916ffc8ba636792ce052f6911 upstream.

the following error pops up during "testusb -a -t 10"
| musb-hdrc musb-hdrc.1.auto: dma_pool_free buffer-128,	f134e000/be842000 (bad dma)
hcd_buffer_create() creates a few buffers, the smallest has 32 bytes of
size. ARCH_KMALLOC_MINALIGN is set to 64 bytes. This combo results in
hcd_buffer_alloc() returning memory which is 32 bytes aligned and it
might by identified by buffer_offset() as another buffer. This means the
buffer which is on a 32 byte boundary will not get freed, instead it
tries to free another buffer with the error message.

This patch fixes the issue by creating the smallest DMA buffer with the
size of ARCH_KMALLOC_MINALIGN (or 32 in case ARCH_KMALLOC_MINALIGN is
smaller). This might be 32, 64 or even 128 bytes. The next three pools
will have the size 128, 512 and 2048.
In case the smallest pool is 128 bytes then we have only three pools
instead of four (and zero the first entry in the array).
The last pool size is always 2048 bytes which is the assumed PAGE_SIZE /
2 of 4096. I doubt it makes sense to continue using PAGE_SIZE / 2 where
we would end up with 8KiB buffer in case we have 16KiB pages.
Instead I think it makes sense to have a common size(s) and extend them
if there is need to.
There is a BUILD_BUG_ON() now in case someone has a minalign of more than
128 bytes.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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/core/buffer.c | 26 +++++++++++++++++---------
 drivers/usb/core/usb.c    |  1 +
 include/linux/usb/hcd.h   |  1 +
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 2355974..4596f7e 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -22,17 +22,25 @@
  */
 
 /* FIXME tune these based on pool statistics ... */
-static const size_t	pool_max[HCD_BUFFER_POOLS] = {
-	/* platforms without dma-friendly caches might need to
-	 * prevent cacheline sharing...
-	 */
-	32,
-	128,
-	512,
-	PAGE_SIZE / 2
-	/* bigger --> allocate pages */
+static size_t pool_max[HCD_BUFFER_POOLS] = {
+	32, 128, 512, 2048,
 };
 
+void __init usb_init_pool_max(void)
+{
+	/*
+	 * The pool_max values must never be smaller than
+	 * ARCH_KMALLOC_MINALIGN.
+	 */
+	if (ARCH_KMALLOC_MINALIGN <= 32)
+		;			/* Original value is okay */
+	else if (ARCH_KMALLOC_MINALIGN <= 64)
+		pool_max[0] = 64;
+	else if (ARCH_KMALLOC_MINALIGN <= 128)
+		pool_max[0] = 0;	/* Don't use this pool */
+	else
+		BUILD_BUG();		/* We don't allow this */
+}
 
 /* SETUP primitives */
 
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4d11449..a922730 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1050,6 +1050,7 @@ static int __init usb_init(void)
 		pr_info("%s: USB support disabled\n", usbcore_name);
 		return 0;
 	}
+	usb_init_pool_max();
 
 	retval = usb_debugfs_init();
 	if (retval)
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index b8aba19..dffeeb2 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -444,6 +444,7 @@ extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
 #endif /* CONFIG_PCI */
 
 /* pci-ish (pdev null is ok) buffer alloc/mapping support */
+void usb_init_pool_max(void);
 int hcd_buffer_create(struct usb_hcd *hcd);
 void hcd_buffer_destroy(struct usb_hcd *hcd);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 023/143] tty/serial: at91: enable peripheral clock before accessing I/O registers
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (21 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 022/143] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 024/143] tty/serial: at91: fix error handling in atmel_serial_probe() Kamal Mostafa
                   ` (119 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cyrille Pitchen, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Cyrille Pitchen <cyrille.pitchen@atmel.com>

commit d4f641876a68d1961e30c202709cc2d484f69f6f upstream.

atmel_serial_probe() calls atmel_init_port(). In turn, atmel_init_port() calls
clk_disable_unprepare() to disable the peripheral clock before returning.

Later atmel_serial_probe() accesses some I/O registers such as the Mode and
Control registers for RS485 support then the Name and Version registers, through a call to
atmel_get_ip_name(), but at that moment the peripheral clock was still
disabled.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/atmel_serial.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index a49f10d..41060fb 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2421,6 +2421,12 @@ static int atmel_serial_probe(struct platform_device *pdev)
 	device_init_wakeup(&pdev->dev, 1);
 	platform_set_drvdata(pdev, port);
 
+	/*
+	 * The peripheral clock has been disabled by atmel_init_port():
+	 * enable it before accessing I/O registers
+	 */
+	clk_prepare_enable(port->clk);
+
 	if (port->rs485.flags & SER_RS485_ENABLED) {
 		UART_PUT_MR(&port->uart, ATMEL_US_USMODE_NORMAL);
 		UART_PUT_CR(&port->uart, ATMEL_US_RTSEN);
@@ -2431,6 +2437,12 @@ static int atmel_serial_probe(struct platform_device *pdev)
 	 */
 	atmel_get_ip_name(&port->uart);
 
+	/*
+	 * The peripheral clock can now safely be disabled till the port
+	 * is used
+	 */
+	clk_disable_unprepare(port->clk);
+
 	return 0;
 
 err_add_port:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 024/143] tty/serial: at91: fix error handling in atmel_serial_probe()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (22 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 023/143] tty/serial: at91: enable peripheral clock before accessing I/O registers Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 025/143] axonram: Fix bug in direct_access Kamal Mostafa
                   ` (118 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Cyrille Pitchen, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Cyrille Pitchen <cyrille.pitchen@atmel.com>

commit 6fbb9bdf0f3fbe23aeff806489791aa876adaffb upstream.

-EDEFER error wasn't handle properly by atmel_serial_probe().
As an example, when atmel_serial_probe() is called for the first time, we pass
the test_and_set_bit() test to check whether the port has already been
initalized. Then we call atmel_init_port(), which may return -EDEFER, possibly
returned before by clk_get(). Consequently atmel_serial_probe() used to return
this error code WITHOUT clearing the port bit in the "atmel_ports_in_use" mask.
When atmel_serial_probe() was called for the second time, it used to fail on
the test_and_set_bit() function then returning -EBUSY.

When atmel_serial_probe() fails, this patch make it clear the port bit in the
"atmel_ports_in_use" mask, if needed, before returning the error code.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/atmel_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 41060fb..52ada70 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2392,7 +2392,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
 
 	ret = atmel_init_port(port, pdev);
 	if (ret)
-		goto err;
+		goto err_clear_bit;
 
 	if (!atmel_use_pdc_rx(&port->uart)) {
 		ret = -ENOMEM;
@@ -2453,6 +2453,8 @@ err_alloc_ring:
 		clk_put(port->clk);
 		port->clk = NULL;
 	}
+err_clear_bit:
+	clear_bit(port->uart.line, atmel_ports_in_use);
 err:
 	return ret;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 025/143] axonram: Fix bug in direct_access
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (23 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 024/143] tty/serial: at91: fix error handling in atmel_serial_probe() Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 026/143] ksoftirqd: Enable IRQs and call cond_resched() before poking RCU Kamal Mostafa
                   ` (117 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Matthew Wilcox, Jens Axboe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Matthew Wilcox <matthew.r.wilcox@intel.com>

commit 91117a20245b59f70b563523edbf998a62fc6383 upstream.

The 'pfn' returned by axonram was completely bogus, and has been since
2008.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/powerpc/sysdev/axonram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 1c16141..1fea249 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -155,7 +155,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector,
 	}
 
 	*kaddr = (void *)(bank->ph_addr + offset);
-	*pfn = virt_to_phys(kaddr) >> PAGE_SHIFT;
+	*pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT;
 
 	return 0;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 026/143] ksoftirqd: Enable IRQs and call cond_resched() before poking RCU
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (24 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 025/143] axonram: Fix bug in direct_access Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 027/143] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Kamal Mostafa
                   ` (116 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Calvin Owens, Paul E. McKenney, Luis Henriques, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Calvin Owens <calvinowens@fb.com>

commit 28423ad283d5348793b0c45cc9b1af058e776fd6 upstream.

While debugging an issue with excessive softirq usage, I encountered the
following note in commit 3e339b5dae24a706 ("softirq: Use hotplug thread
infrastructure"):

    [ paulmck: Call rcu_note_context_switch() with interrupts enabled. ]

...but despite this note, the patch still calls RCU with IRQs disabled.

This seemingly innocuous change caused a significant regression in softirq
CPU usage on the sending side of a large TCP transfer (~1 GB/s): when
introducing 0.01% packet loss, the softirq usage would jump to around 25%,
spiking as high as 50%. Before the change, the usage would never exceed 5%.

Moving the call to rcu_note_context_switch() after the cond_sched() call,
as it was originally before the hotplug patch, completely eliminated this
problem.

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/softirq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 11025cc..824a7ff 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -654,9 +654,13 @@ static void run_ksoftirqd(unsigned int cpu)
 		 * in the task stack here.
 		 */
 		__do_softirq();
-		rcu_note_context_switch(cpu);
 		local_irq_enable();
 		cond_resched();
+
+		preempt_disable();
+		rcu_note_context_switch(cpu);
+		preempt_enable();
+
 		return;
 	}
 	local_irq_enable();
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 027/143] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (25 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 026/143] ksoftirqd: Enable IRQs and call cond_resched() before poking RCU Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 028/143] char: tpm: Add missing error check for devm_kzalloc Kamal Mostafa
                   ` (115 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Howells, Peter Huewe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: David Howells <dhowells@redhat.com>

commit 398a1e71dc827b994b7f2f56c7c2186fea7f8d75 upstream.

Add newly registered TPMs to the tail of the list, not the beginning, so that
things that are specifying TPM_ANY_NUM don't find that the device they're
using has inadvertently changed.  Adding a second device would break IMA, for
instance.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 901b370..5ad180b 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -1536,7 +1536,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
 
 	/* Make chip available */
 	spin_lock(&driver_lock);
-	list_add_rcu(&chip->list, &tpm_chip_list);
+	list_add_tail_rcu(&chip->list, &tpm_chip_list);
 	spin_unlock(&driver_lock);
 
 	return chip;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 028/143] char: tpm: Add missing error check for devm_kzalloc
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (26 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 027/143] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 029/143] tpm_tis: verify interrupt during init Kamal Mostafa
                   ` (114 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kiran Padwal, Peter Huewe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Kiran Padwal <kiran.padwal@smartplayin.com>

commit bb95cd34ba4c9467114acc78eeddd53ab1c10085 upstream.

Currently these driver are missing a check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

This patch adds a missing check for tpm_i2c_atmel.c and tpm_i2c_nuvoton.c

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm_i2c_atmel.c   | 4 ++++
 drivers/char/tpm/tpm_i2c_nuvoton.c | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index c3cd7fe..28a1501 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -208,6 +208,10 @@ static int i2c_atmel_probe(struct i2c_client *client,
 
 	chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data),
 					 GFP_KERNEL);
+	if (!chip->vendor.priv) {
+		rc = -ENOMEM;
+		goto out_err;
+	}
 
 	/* Default timeouts */
 	chip->vendor.timeout_a = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT);
diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index 6276fea..58decb7 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -579,6 +579,11 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 
 	chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data),
 					 GFP_KERNEL);
+	if (!chip->vendor.priv) {
+		rc = -ENOMEM;
+		goto out_err;
+	}
+
 	init_waitqueue_head(&chip->vendor.read_queue);
 	init_waitqueue_head(&chip->vendor.int_queue);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 029/143] tpm_tis: verify interrupt during init
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (27 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 028/143] char: tpm: Add missing error check for devm_kzalloc Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 030/143] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Kamal Mostafa
                   ` (113 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Scot Doyle, Peter Huewe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Scot Doyle <lkml14@scotdoyle.com>

commit 448e9c55c12d6bd4fa90a7e31d802e045666d7c8 upstream.

Some machines, such as the Acer C720 and Toshiba CB35, have TPMs that do
not send IRQs while also having an ACPI TPM entry indicating that they
will be sent. These machines freeze on resume while the tpm_tis module
waits for an IRQ, eventually timing out.

When in interrupt mode, the tpm_tis module should receive an IRQ during
module init. Fall back to polling mode if none is received when expected.

Signed-off-by: Scot Doyle <lkml14@scotdoyle.com>
Tested-by: Michael Mullin <masmullin@gmail.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
[phuewe: minor checkpatch fixed]
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm_tis.c | 76 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 62 insertions(+), 14 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 1b74459..b43dafb 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -75,6 +75,10 @@ enum tis_defaults {
 #define	TPM_DID_VID(l)			(0x0F00 | ((l) << 12))
 #define	TPM_RID(l)			(0x0F04 | ((l) << 12))
 
+struct priv_data {
+	bool irq_tested;
+};
+
 static LIST_HEAD(tis_chips);
 static DEFINE_MUTEX(tis_lock);
 
@@ -338,12 +342,27 @@ out_err:
 	return rc;
 }
 
+static void disable_interrupts(struct tpm_chip *chip)
+{
+	u32 intmask;
+
+	intmask =
+	    ioread32(chip->vendor.iobase +
+		     TPM_INT_ENABLE(chip->vendor.locality));
+	intmask &= ~TPM_GLOBAL_INT_ENABLE;
+	iowrite32(intmask,
+		  chip->vendor.iobase +
+		  TPM_INT_ENABLE(chip->vendor.locality));
+	free_irq(chip->vendor.irq, chip);
+	chip->vendor.irq = 0;
+}
+
 /*
  * If interrupts are used (signaled by an irq set in the vendor structure)
  * tpm.c can skip polling for the data to be available as the interrupt is
  * waited for here
  */
-static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
+static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
 {
 	int rc;
 	u32 ordinal;
@@ -373,6 +392,30 @@ out_err:
 	return rc;
 }
 
+static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
+{
+	int rc, irq;
+	struct priv_data *priv = chip->vendor.priv;
+
+	if (!chip->vendor.irq || priv->irq_tested)
+		return tpm_tis_send_main(chip, buf, len);
+
+	/* Verify receipt of the expected IRQ */
+	irq = chip->vendor.irq;
+	chip->vendor.irq = 0;
+	rc = tpm_tis_send_main(chip, buf, len);
+	chip->vendor.irq = irq;
+	if (!priv->irq_tested)
+		msleep(1);
+	if (!priv->irq_tested) {
+		disable_interrupts(chip);
+		dev_err(chip->dev,
+			FW_BUG "TPM interrupt not working, polling instead\n");
+	}
+	priv->irq_tested = true;
+	return rc;
+}
+
 /*
  * Early probing for iTPM with STS_DATA_EXPECT flaw.
  * Try sending command without itpm flag set and if that
@@ -515,6 +558,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
 	if (interrupt == 0)
 		return IRQ_NONE;
 
+	((struct priv_data *)chip->vendor.priv)->irq_tested = true;
 	if (interrupt & TPM_INTF_DATA_AVAIL_INT)
 		wake_up_interruptible(&chip->vendor.read_queue);
 	if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT)
@@ -544,9 +588,14 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 	u32 vendor, intfcaps, intmask;
 	int rc, i, irq_s, irq_e, probe;
 	struct tpm_chip *chip;
+	struct priv_data *priv;
 
+	priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL);
+	if (priv == NULL)
+		return -ENOMEM;
 	if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
 		return -ENODEV;
+	chip->vendor.priv = priv;
 
 	chip->vendor.iobase = ioremap(start, len);
 	if (!chip->vendor.iobase) {
@@ -615,19 +664,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 	if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
 		dev_dbg(dev, "\tData Avail Int Support\n");
 
-	/* get the timeouts before testing for irqs */
-	if (tpm_get_timeouts(chip)) {
-		dev_err(dev, "Could not get TPM timeouts and durations\n");
-		rc = -ENODEV;
-		goto out_err;
-	}
-
-	if (tpm_do_selftest(chip)) {
-		dev_err(dev, "TPM self test failed\n");
-		rc = -ENODEV;
-		goto out_err;
-	}
-
 	/* INTERRUPT Setup */
 	init_waitqueue_head(&chip->vendor.read_queue);
 	init_waitqueue_head(&chip->vendor.int_queue);
@@ -729,6 +765,18 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 		}
 	}
 
+	if (tpm_get_timeouts(chip)) {
+		dev_err(dev, "Could not get TPM timeouts and durations\n");
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	if (tpm_do_selftest(chip)) {
+		dev_err(dev, "TPM self test failed\n");
+		rc = -ENODEV;
+		goto out_err;
+	}
+
 	INIT_LIST_HEAD(&chip->vendor.list);
 	mutex_lock(&tis_lock);
 	list_add(&chip->vendor.list, &tis_chips);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 030/143] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (28 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 029/143] tpm_tis: verify interrupt during init Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 031/143] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Kamal Mostafa
                   ` (112 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hon Ching (Vicky) Lo, Peter Huewe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 84eb186bc37c0900b53077ca21cf6dd15823a232 upstream.

There was an oops in tpm_ibmvtpm_get_desired_dma, which caused
kernel panic during boot when vTPM is enabled in Power partition
configured in AMS mode.

vio_bus_probe calls vio_cmo_bus_probe which calls
tpm_ibmvtpm_get_desired_dma to get the size needed for DMA allocation.
The problem is, vio_cmo_bus_probe is called before calling probe, which
for vtpm is tpm_ibmvtpm_probe and it's this function that initializes
and sets up vtpm's CRQ and gets required data values.  Therefore,
since this has not yet been done, NULL is returned in attempt to get
the size for DMA allocation.

We added a NULL check.  In addition, a default buffer size will
be set when NULL is returned.

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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 2783a42..0f3e391 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -307,6 +307,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev)
 static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev)
 {
 	struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev);
+
+	/* ibmvtpm initializes at probe time, so the data we are
+	* asking for may not be set yet. Estimate that 4K required
+	* for TCE-mapped buffer in addition to CRQ.
+	*/
+	if (!ibmvtpm)
+		return CRQ_RES_BUF_SIZE + PAGE_SIZE;
+
 	return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 031/143] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (29 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 030/143] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 032/143] tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO Kamal Mostafa
                   ` (111 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christophe Ricard, Peter Huewe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit 1ba3b0b6f218072afe8372d12f1b6bf26a26008e upstream.

When sending data in tpm_stm_i2c_send, each loop iteration send buf.
Send buf + i instead as the goal of this for loop is to send a number
of byte from buf that fit in burstcnt. Once those byte are sent, we are
supposed to send the next ones.

The driver was working because the burstcount value returns always the maximum size for a TPM
command or response. (0x800 for a command and 0x400 for a response).

Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm_i2c_stm_st33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index b2cb24c..2a95ca3 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
 		if (burstcnt < 0)
 			return burstcnt;
 		size = min_t(int, len - i - 1, burstcnt);
-		ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size);
+		ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size);
 		if (ret < 0)
 			goto out_err;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 032/143] tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (30 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 031/143] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 033/143] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Kamal Mostafa
                   ` (110 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christophe Ricard, Peter Huewe, Luis Henriques, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Christophe Ricard <christophe.ricard@gmail.com>

commit c4eadfafb91d5501095c55ffadaa1168743f39d3 upstream.

Add a return value check when reading data from the FIFO register.

Reviewed-by: Jason Gunthorpe <jason.gunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
[ 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/char/tpm/tpm_i2c_stm_st33.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 2a95ca3..0fa5a16 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -398,7 +398,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
  */
 static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
 {
-	int size = 0, burstcnt, len;
+	int size = 0, burstcnt, len, ret;
 	struct i2c_client *client;
 
 	client = (struct i2c_client *)TPM_VPRIV(chip);
@@ -413,7 +413,10 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
 		if (burstcnt < 0)
 			return burstcnt;
 		len = min_t(int, burstcnt, count - size);
-		I2C_READ_DATA(client, TPM_DATA_FIFO, buf + size, len);
+		ret = I2C_READ_DATA(client, TPM_DATA_FIFO, buf + size, len);
+		if (ret < 0)
+			return ret;
+
 		size += len;
 	}
 	return size;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 033/143] mmc: sdhci-pxav3: fix unbalanced clock issues during probe
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (31 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 032/143] tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 034/143] iwlwifi: mvm: validate tid and sta_id in ba_notif Kamal Mostafa
                   ` (109 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jisheng Zhang, Ulf Hansson, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jisheng Zhang <jszhang@marvell.com>

commit 62cf983ad84275f8580c807e5e596216c46773cf upstream.

Commit 0dcaa2499b7d ("sdhci-pxav3: Fix runtime PM initialization") tries
to fix one hang issue caused by calling sdhci_add_host() on a suspended
device. The fix enables the clock twice, once by clk_prepare_enable() and
another by pm_runtime_get_sync(), meaning that the clock will never be
gated at runtime PM suspend. I observed the power consumption regression on
Marvell BG2Q SoCs.

In fact, the fix is not correct. There still be a very small window
during which a runtime suspend might somehow occur after pm_runtime_enable()
but before pm_runtime_get_sync().

This patch fixes all of the two problems by just incrementing the usage
counter before pm_runtime_enable(). It also adjust the order of disabling
runtime pm and storing the usage count in the error path to handle clock
gating properly.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 793dacd..dc09e70 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -288,10 +288,11 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 		}
 	}
 
-	pm_runtime_enable(&pdev->dev);
-	pm_runtime_get_sync(&pdev->dev);
+	pm_runtime_get_noresume(&pdev->dev);
+	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, PXAV3_RPM_DELAY_MS);
 	pm_runtime_use_autosuspend(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
 	pm_suspend_ignore_children(&pdev->dev, 1);
 
 	ret = sdhci_add_host(host);
@@ -316,8 +317,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 err_of_parse:
 err_cd_req:
 err_add_host:
-	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
 	clk_disable_unprepare(clk);
 	clk_put(clk);
 err_clk_get:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 034/143] iwlwifi: mvm: validate tid and sta_id in ba_notif
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (32 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 033/143] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 035/143] power: bq24190: Fix ignored supplicants Kamal Mostafa
                   ` (108 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eyal Shapira, Emmanuel Grumbach, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Eyal Shapira <eyal@wizery.com>

commit 2cee4762c528a9bd2cdff793197bf591a2196c11 upstream.

These are coming from the FW and are used to access arrays.
Bad values can cause an out of bounds access so discard
such ba_notifs and warn.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index c8f6974..e43d223 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -835,6 +835,11 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
 	sta_id = ba_notif->sta_id;
 	tid = ba_notif->tid;
 
+	if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT ||
+		      tid >= IWL_MAX_TID_COUNT,
+		      "sta_id %d tid %d", sta_id, tid))
+		return 0;
+
 	rcu_read_lock();
 
 	sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 035/143] power: bq24190: Fix ignored supplicants
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (33 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 034/143] iwlwifi: mvm: validate tid and sta_id in ba_notif Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 036/143] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Kamal Mostafa
                   ` (107 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Sebastian Reichel, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 478913fdbdfd4a781d91c993eb86838620fe7421 upstream.

The driver mismatched 'num_supplicants' with 'num_supplies' of
power_supply structure.

It provided list of supplicants (power_supply.supplied_to) but did
not set the number of supplicants. Instead it set the num_supplies which
is used when iterating over number of supplies (power_supply.supplied_from).

As a result the list of supplicants was ignored by core because its size
was 0.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: d7bf353fd0aa ("bq24190_charger: Add support for TI BQ24190 Battery Charger")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/power/bq24190_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c
index ad3ff8f..e4c95e1 100644
--- a/drivers/power/bq24190_charger.c
+++ b/drivers/power/bq24190_charger.c
@@ -929,7 +929,7 @@ static void bq24190_charger_init(struct power_supply *charger)
 	charger->properties = bq24190_charger_properties;
 	charger->num_properties = ARRAY_SIZE(bq24190_charger_properties);
 	charger->supplied_to = bq24190_charger_supplied_to;
-	charger->num_supplies = ARRAY_SIZE(bq24190_charger_supplied_to);
+	charger->num_supplicants = ARRAY_SIZE(bq24190_charger_supplied_to);
 	charger->get_property = bq24190_charger_get_property;
 	charger->set_property = bq24190_charger_set_property;
 	charger->property_is_writeable = bq24190_charger_property_is_writeable;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 036/143] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (34 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 035/143] power: bq24190: Fix ignored supplicants Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 037/143] Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device Kamal Mostafa
                   ` (106 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lokesh Vutla, Paul Walmsley, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Lokesh Vutla <lokeshvutla@ti.com>

commit 1c7e36bfc3e2fb2df5e2d1989a4b6fb9055a0f9b upstream.

With commit '7dedd34: ARM: OMAP2+: hwmod: Fix a crash in _setup_reset()
with DEBUG_LL' we moved from parsing cmdline to identify uart used
for earlycon to using the requsite hwmod CONFIG_DEBUG_OMAPxUARTy FLAGS.

On DRA7 UART3 hwmod doesn't have this flag enabled, and atleast on
BeagleBoard-X15, where we use UART3 for console, boot fails with
DEBUG_LL enabled. Enable DEBUG_OMAP4UART3_FLAGS for UART3 hwmod.

For using DEBUG_LL, enable CONFIG_DEBUG_OMAP4UART3 in menuconfig.

Fixes: 90020c7b2c5e ("ARM: OMAP: DRA7: hwmod: Create initial DRA7XX SoC data")
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 18f333c..3d41b06 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1669,7 +1669,7 @@ static struct omap_hwmod dra7xx_uart3_hwmod = {
 	.class		= &dra7xx_uart_hwmod_class,
 	.clkdm_name	= "l4per_clkdm",
 	.main_clk	= "uart3_gfclk_mux",
-	.flags		= HWMOD_SWSUP_SIDLE_ACT,
+	.flags		= HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP4UART3_FLAGS,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_offs = DRA7XX_CM_L4PER_UART3_CLKCTRL_OFFSET,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 037/143] Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (35 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 036/143] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 038/143] cfq-iosched: fix incorrect filing of rt async cfqq Kamal Mostafa
                   ` (105 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit 033efa920a7f22a8caf7a38d851a2f451781bbf7 upstream.

Add support of 13d3:3423 device.

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

T: Bus=01 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=13d3 ProdID=3423 Rev= 0.01
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms

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 e619031..0fd0537 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -104,6 +104,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x13d3, 0x3393) },
 	{ USB_DEVICE(0x13d3, 0x3402) },
 	{ USB_DEVICE(0x13d3, 0x3408) },
+	{ USB_DEVICE(0x13d3, 0x3423) },
 	{ USB_DEVICE(0x13d3, 0x3432) },
 
 	/* Atheros AR5BBU12 with sflash firmware */
@@ -155,6 +156,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
 
 	/* Atheros AR5BBU22 with sflash firmware */
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 20c0ccb..6e6c597 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -182,6 +182,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
 
 	/* Atheros AR5BBU12 with sflash firmware */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 038/143] cfq-iosched: fix incorrect filing of rt async cfqq
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (36 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 037/143] Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 039/143] smack: fix possible use after frees in task_security() callers Kamal Mostafa
                   ` (104 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jeff Moyer, Jens Axboe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jeff Moyer <jmoyer@redhat.com>

commit c6ce194325cef342313e3d27620411ce90a89c50 upstream.

Hi,

If you can manage to submit an async write as the first async I/O from
the context of a process with realtime scheduling priority, then a
cfq_queue is allocated, but filed into the wrong async_cfqq bucket.  It
ends up in the best effort array, but actually has realtime I/O
scheduling priority set in cfqq->ioprio.

The reason is that cfq_get_queue assumes the default scheduling class and
priority when there is no information present (i.e. when the async cfqq
is created):

static struct cfq_queue *
cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
	      struct bio *bio, gfp_t gfp_mask)
{
	const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
	const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);

cic->ioprio starts out as 0, which is "invalid".  So, class of 0
(IOPRIO_CLASS_NONE) is passed to cfq_async_queue_prio like so:

		async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio);

static struct cfq_queue **
cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio)
{
        switch (ioprio_class) {
        case IOPRIO_CLASS_RT:
                return &cfqd->async_cfqq[0][ioprio];
        case IOPRIO_CLASS_NONE:
                ioprio = IOPRIO_NORM;
                /* fall through */
        case IOPRIO_CLASS_BE:
                return &cfqd->async_cfqq[1][ioprio];
        case IOPRIO_CLASS_IDLE:
                return &cfqd->async_idle_cfqq;
        default:
                BUG();
        }
}

Here, instead of returning a class mapped from the process' scheduling
priority, we get back the bucket associated with IOPRIO_CLASS_BE.

Now, there is no queue allocated there yet, so we create it:

		cfqq = cfq_find_alloc_queue(cfqd, is_sync, cic, bio, gfp_mask);

That function ends up doing this:

			cfq_init_cfqq(cfqd, cfqq, current->pid, is_sync);
			cfq_init_prio_data(cfqq, cic);

cfq_init_cfqq marks the priority as having changed.  Then, cfq_init_prio
data does this:

	ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
	switch (ioprio_class) {
	default:
		printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class);
	case IOPRIO_CLASS_NONE:
		/*
		 * no prio set, inherit CPU scheduling settings
		 */
		cfqq->ioprio = task_nice_ioprio(tsk);
		cfqq->ioprio_class = task_nice_ioclass(tsk);
		break;

So we basically have two code paths that treat IOPRIO_CLASS_NONE
differently, which results in an RT async cfqq filed into a best effort
bucket.

Attached is a patch which fixes the problem.  I'm not sure how to make
it cleaner.  Suggestions would be welcome.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Tested-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 block/cfq-iosched.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 8f5fdf3..b8fb8bf 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3666,12 +3666,17 @@ static struct cfq_queue *
 cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
 	      struct bio *bio, gfp_t gfp_mask)
 {
-	const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
-	const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
+	int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
+	int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
 	struct cfq_queue **async_cfqq = NULL;
 	struct cfq_queue *cfqq = NULL;
 
 	if (!is_sync) {
+		if (!ioprio_valid(cic->ioprio)) {
+			struct task_struct *tsk = current;
+			ioprio = task_nice_ioprio(tsk);
+			ioprio_class = task_nice_ioclass(tsk);
+		}
 		async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio);
 		cfqq = *async_cfqq;
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 039/143] smack: fix possible use after frees in task_security() callers
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (37 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 038/143] cfq-iosched: fix incorrect filing of rt async cfqq Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 040/143] xfs: ensure buffer types are set correctly Kamal Mostafa
                   ` (103 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andrey Ryabinin, Luis Henriques, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Andrey Ryabinin <a.ryabinin@samsung.com>

commit 6d1cff2a885850b78b40c34777b46cf5da5d1050 upstream.

We hit use after free on dereferncing pointer to task_smack struct in
smk_of_task() called from smack_task_to_inode().

task_security() macro uses task_cred_xxx() to get pointer to the task_smack.
task_cred_xxx() could be used only for non-pointer members of task's
credentials. It cannot be used for pointer members since what they point
to may disapper after dropping RCU read lock.

Mainly task_security() used this way:
	smk_of_task(task_security(p))

Intead of this introduce function smk_of_task_struct() which
takes task_struct as argument and returns pointer to smk_known struct
and do this under RCU read lock.
Bogus task_security() macro is not used anymore, so remove it.

KASan's report for this:

	AddressSanitizer: use after free in smack_task_to_inode+0x50/0x70 at addr c4635600
	=============================================================================
	BUG kmalloc-64 (Tainted: PO): kasan error
	-----------------------------------------------------------------------------

	Disabling lock debugging due to kernel taint
	INFO: Allocated in new_task_smack+0x44/0xd8 age=39 cpu=0 pid=1866
		kmem_cache_alloc_trace+0x88/0x1bc
		new_task_smack+0x44/0xd8
		smack_cred_prepare+0x48/0x21c
		security_prepare_creds+0x44/0x4c
		prepare_creds+0xdc/0x110
		smack_setprocattr+0x104/0x150
		security_setprocattr+0x4c/0x54
		proc_pid_attr_write+0x12c/0x194
		vfs_write+0x1b0/0x370
		SyS_write+0x5c/0x94
		ret_fast_syscall+0x0/0x48
	INFO: Freed in smack_cred_free+0xc4/0xd0 age=27 cpu=0 pid=1564
		kfree+0x270/0x290
		smack_cred_free+0xc4/0xd0
		security_cred_free+0x34/0x3c
		put_cred_rcu+0x58/0xcc
		rcu_process_callbacks+0x738/0x998
		__do_softirq+0x264/0x4cc
		do_softirq+0x94/0xf4
		irq_exit+0xbc/0x120
		handle_IRQ+0x104/0x134
		gic_handle_irq+0x70/0xac
		__irq_svc+0x44/0x78
		_raw_spin_unlock+0x18/0x48
		sync_inodes_sb+0x17c/0x1d8
		sync_filesystem+0xac/0xfc
		vdfs_file_fsync+0x90/0xc0
		vfs_fsync_range+0x74/0x7c
	INFO: Slab 0xd3b23f50 objects=32 used=31 fp=0xc4635600 flags=0x4080
	INFO: Object 0xc4635600 @offset=5632 fp=0x  (null)

	Bytes b4 c46355f0: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a  ZZZZZZZZZZZZZZZZ
	Object c4635600: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635610: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635620: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635630: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  kkkkkkkkkkkkkkk.
	Redzone c4635640: bb bb bb bb                                      ....
	Padding c46356e8: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a  ZZZZZZZZZZZZZZZZ
	Padding c46356f8: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
	CPU: 5 PID: 834 Comm: launchpad_prelo Tainted: PBO 3.10.30 #1
	Backtrace:
	[<c00233a4>] (dump_backtrace+0x0/0x158) from [<c0023dec>] (show_stack+0x20/0x24)
	 r7:c4634010 r6:d3b23f50 r5:c4635600 r4:d1002140
	[<c0023dcc>] (show_stack+0x0/0x24) from [<c06d6d7c>] (dump_stack+0x20/0x28)
	[<c06d6d5c>] (dump_stack+0x0/0x28) from [<c01c1d50>] (print_trailer+0x124/0x144)
	[<c01c1c2c>] (print_trailer+0x0/0x144) from [<c01c1e88>] (object_err+0x3c/0x44)
	 r7:c4635600 r6:d1002140 r5:d3b23f50 r4:c4635600
	[<c01c1e4c>] (object_err+0x0/0x44) from [<c01cac18>] (kasan_report_error+0x2b8/0x538)
	 r6:d1002140 r5:d3b23f50 r4:c6429cf8 r3:c09e1aa7
	[<c01ca960>] (kasan_report_error+0x0/0x538) from [<c01c9430>] (__asan_load4+0xd4/0xf8)
	[<c01c935c>] (__asan_load4+0x0/0xf8) from [<c031e168>] (smack_task_to_inode+0x50/0x70)
	 r5:c4635600 r4:ca9da000
	[<c031e118>] (smack_task_to_inode+0x0/0x70) from [<c031af64>] (security_task_to_inode+0x3c/0x44)
	 r5:cca25e80 r4:c0ba9780
	[<c031af28>] (security_task_to_inode+0x0/0x44) from [<c023d614>] (pid_revalidate+0x124/0x178)
	 r6:00000000 r5:cca25e80 r4:cbabe3c0 r3:00008124
	[<c023d4f0>] (pid_revalidate+0x0/0x178) from [<c01db98c>] (lookup_fast+0x35c/0x43y4)
	 r9:c6429efc r8:00000101 r7:c079d940 r6:c6429e90 r5:c6429ed8 r4:c83c4148
	[<c01db630>] (lookup_fast+0x0/0x434) from [<c01deec8>] (do_last.isra.24+0x1c0/0x1108)
	[<c01ded08>] (do_last.isra.24+0x0/0x1108) from [<c01dff04>] (path_openat.isra.25+0xf4/0x648)
	[<c01dfe10>] (path_openat.isra.25+0x0/0x648) from [<c01e1458>] (do_filp_open+0x3c/0x88)
	[<c01e141c>] (do_filp_open+0x0/0x88) from [<c01ccb28>] (do_sys_open+0xf0/0x198)
	 r7:00000001 r6:c0ea2180 r5:0000000b r4:00000000
	[<c01cca38>] (do_sys_open+0x0/0x198) from [<c01ccc00>] (SyS_open+0x30/0x34)
	[<c01ccbd0>] (SyS_open+0x0/0x34) from [<c001db80>] (ret_fast_syscall+0x0/0x48)
	Read of size 4 by thread T834:
	Memory state around the buggy address:
	 c4635380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635400: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
	 c4635480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
	 c4635580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	>c4635600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
	           ^
	 c4635680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
	 c4635700: 00 00 00 00 04 fc fc fc fc fc fc fc fc fc fc fc
	 c4635780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635800: 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc fc
	 c4635880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	==================================================================

Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
[ luis: backported to 3.16:
  - dropped changes to smk_bu_task()
  - adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
[ kamal: backported to 3.13:
  - dropped changes to smk_ptrace_rule_check()
  - applied same change to smack_ptrace_traceme() ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 security/smack/smack.h     | 10 ++++++++++
 security/smack/smack_lsm.c | 16 +++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/security/smack/smack.h b/security/smack/smack.h
index 364cc64..051e358 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -286,6 +286,16 @@ static inline struct smack_known *smk_of_task(const struct task_smack *tsp)
 	return tsp->smk_task;
 }
 
+static inline struct smack_known *smk_of_task_struct(const struct task_struct *t)
+{
+	struct smack_known *skp;
+
+	rcu_read_lock();
+	skp = smk_of_task(__task_cred(t)->security);
+	rcu_read_unlock();
+	return skp;
+}
+
 /*
  * Present a pointer to the forked smack label entry in an task blob.
  */
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index b0be893..5b56590 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -43,8 +43,6 @@
 #include <linux/binfmts.h>
 #include "smack.h"
 
-#define task_security(task)	(task_cred_xxx((task), security))
-
 #define TRANS_TRUE	"TRUE"
 #define TRANS_TRUE_SIZE	4
 
@@ -181,7 +179,7 @@ static int smack_ptrace_access_check(struct task_struct *ctp, unsigned int mode)
 	if (rc != 0)
 		return rc;
 
-	skp = smk_of_task(task_security(ctp));
+	skp = smk_of_task_struct(ctp);
 	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
 	smk_ad_setfield_u_tsk(&ad, ctp);
 
@@ -207,7 +205,7 @@ static int smack_ptrace_traceme(struct task_struct *ptp)
 	if (rc != 0)
 		return rc;
 
-	skp = smk_of_task(task_security(ptp));
+	skp = smk_of_task_struct(ptp);
 	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
 	smk_ad_setfield_u_tsk(&ad, ptp);
 
@@ -1544,7 +1542,7 @@ static int smk_curacc_on_task(struct task_struct *p, int access,
 				const char *caller)
 {
 	struct smk_audit_info ad;
-	struct smack_known *skp = smk_of_task(task_security(p));
+	struct smack_known *skp = smk_of_task_struct(p);
 
 	smk_ad_init(&ad, caller, LSM_AUDIT_DATA_TASK);
 	smk_ad_setfield_u_tsk(&ad, p);
@@ -1594,7 +1592,7 @@ static int smack_task_getsid(struct task_struct *p)
  */
 static void smack_task_getsecid(struct task_struct *p, u32 *secid)
 {
-	struct smack_known *skp = smk_of_task(task_security(p));
+	struct smack_known *skp = smk_of_task_struct(p);
 
 	*secid = skp->smk_secid;
 }
@@ -1701,7 +1699,7 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
 {
 	struct smk_audit_info ad;
 	struct smack_known *skp;
-	struct smack_known *tkp = smk_of_task(task_security(p));
+	struct smack_known *tkp = smk_of_task_struct(p);
 
 	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
 	smk_ad_setfield_u_tsk(&ad, p);
@@ -1749,7 +1747,7 @@ static int smack_task_wait(struct task_struct *p)
 static void smack_task_to_inode(struct task_struct *p, struct inode *inode)
 {
 	struct inode_smack *isp = inode->i_security;
-	struct smack_known *skp = smk_of_task(task_security(p));
+	struct smack_known *skp = smk_of_task_struct(p);
 
 	isp->smk_inode = skp->smk_known;
 }
@@ -2878,7 +2876,7 @@ unlockandout:
  */
 static int smack_getprocattr(struct task_struct *p, char *name, char **value)
 {
-	struct smack_known *skp = smk_of_task(task_security(p));
+	struct smack_known *skp = smk_of_task_struct(p);
 	char *cp;
 	int slen;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 040/143] xfs: ensure buffer types are set correctly
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (38 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 039/143] smack: fix possible use after frees in task_security() callers Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 041/143] xfs: inode unlink does not set AGI buffer type Kamal Mostafa
                   ` (102 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Chinner, Dave Chinner, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dave Chinner <dchinner@redhat.com>

commit 0d612fb570b71ea2e49554a770cff4c489018b2c upstream.

Jan Kara reported that log recovery was finding buffers with invalid
types in them. This should not happen, and indicates a bug in the
logging of buffers. To catch this, add asserts to the buffer
formatting code to ensure that the buffer type is in range when the
transaction is committed.

We don't set a type on buffers being marked stale - they are not
going to get replayed, the format item exists only for recovery to
be able to prevent replay of the buffer, so the type does not
matter. Hence that needs special casing here.

Reported-by: Jan Kara <jack@suse.cz>
Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/xfs/xfs_buf_item.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 2227b9b..71f04c3 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -320,6 +320,10 @@ xfs_buf_item_format(
 	ASSERT(atomic_read(&bip->bli_refcount) > 0);
 	ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
 	       (bip->bli_flags & XFS_BLI_STALE));
+	ASSERT((bip->bli_flags & XFS_BLI_STALE) ||
+	       (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF
+	        && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF));
+
 
 	/*
 	 * If it is an inode buffer, transfer the in-memory state to the
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 041/143] xfs: inode unlink does not set AGI buffer type
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (39 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 040/143] xfs: ensure buffer types are set correctly Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 042/143] xfs: set buf types when converting extent formats Kamal Mostafa
                   ` (101 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Chinner, Dave Chinner, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dave Chinner <dchinner@redhat.com>

commit f19b872b086711bb4b22c3a0f52f16aa920bcc61 upstream.

This leads to log recovery throwing errors like:

XFS (md0): Mounting V5 Filesystem
XFS (md0): Starting recovery (logdev: internal)
XFS (md0): Unknown buffer type 0!
XFS (md0): _xfs_buf_ioapply: no ops on block 0xaea8802/0x1
ffff8800ffc53800: 58 41 47 49 .....

Which is the AGI buffer magic number.

Ensure that we set the type appropriately in both unlink list
addition and removal.

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/xfs/xfs_inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 001aa89..16bb5d0 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1950,6 +1950,7 @@ xfs_iunlink(
 	agi->agi_unlinked[bucket_index] = cpu_to_be32(agino);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		(sizeof(xfs_agino_t) * bucket_index);
+	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 	return 0;
@@ -2041,6 +2042,7 @@ xfs_iunlink_remove(
 		agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
 		offset = offsetof(xfs_agi_t, agi_unlinked) +
 			(sizeof(xfs_agino_t) * bucket_index);
+		xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 		xfs_trans_log_buf(tp, agibp, offset,
 				  (offset + sizeof(xfs_agino_t) - 1));
 	} else {
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 042/143] xfs: set buf types when converting extent formats
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (40 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 041/143] xfs: inode unlink does not set AGI buffer type Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 043/143] xfs: set superblock buffer type correctly Kamal Mostafa
                   ` (100 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Chinner, Dave Chinner, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dave Chinner <dchinner@redhat.com>

commit fe22d552b82d7cc7de1851233ae8bef579198637 upstream.

Conversion from local to extent format does not set the buffer type
correctly on the new extent buffer when a symlink data is moved out
of line.

Fix the symlink code and leave a comment in the generic bmap code
reminding us that the format-specific data copy needs to set the
destination buffer type appropriately.

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/xfs/xfs_bmap.c           | 6 +++++-
 fs/xfs/xfs_symlink_remote.c | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 3b2c14b..6beb7a9 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -977,7 +977,11 @@ xfs_bmap_local_to_extents(
 	*firstblock = args.fsbno;
 	bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0);
 
-	/* initialise the block and copy the data */
+	/*
+	 * Initialise the block and copy the data
+	 *
+	 * Note: init_fn must set the buffer log item type correctly!
+	 */
 	init_fn(tp, bp, ip, ifp);
 
 	/* account for the change in fork size and log everything */
diff --git a/fs/xfs/xfs_symlink_remote.c b/fs/xfs/xfs_symlink_remote.c
index bf59a2b..41f64a4 100644
--- a/fs/xfs/xfs_symlink_remote.c
+++ b/fs/xfs/xfs_symlink_remote.c
@@ -181,6 +181,8 @@ xfs_symlink_local_to_remote(
 	struct xfs_mount	*mp = ip->i_mount;
 	char			*buf;
 
+	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
+
 	if (!xfs_sb_version_hascrc(&mp->m_sb)) {
 		bp->b_ops = NULL;
 		memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 043/143] xfs: set superblock buffer type correctly
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (41 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 042/143] xfs: set buf types when converting extent formats Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 044/143] btrfs: set proper message level for skinny metadata Kamal Mostafa
                   ` (99 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dave Chinner, Dave Chinner, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dave Chinner <dchinner@redhat.com>

commit 3443a3bca54588f43286b725d8648d33a38c86f1 upstream.

When the superblock is modified in a transaction, the commonly
modified fields are not actually copied to the superblock buffer to
avoid the buffer lock becoming a serialisation point. However, there
are some other operations that modify the superblock fields within
the transaction that don't directly log to the superblock but rely
on the changes to be applied during the transaction commit (to
minimise the buffer lock hold time).

When we do this, we fail to mark the buffer log item as being a
superblock buffer and that can lead to the buffer not being marked
with the corect type in the log and hence causing recovery issues.
Fix it by setting the type correctly, similar to xfs_mod_sb()...

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/xfs/xfs_trans.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index c812c5c..b626f3d 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -474,6 +474,7 @@ xfs_trans_apply_sb_deltas(
 		whole = 1;
 	}
 
+	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF);
 	if (whole)
 		/*
 		 * Log the whole thing, the fields are noncontiguous.
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 044/143] btrfs: set proper message level for skinny metadata
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (42 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 043/143] xfs: set superblock buffer type correctly Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 045/143] KVM: s390: base hrtimer on a monotonic clock Kamal Mostafa
                   ` (98 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Sterba, Chris Mason, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: David Sterba <dsterba@suse.cz>

commit 5efa0490cc94aee06cd8d282683e22a8ce0a0026 upstream.

This has been confusing people for too long, the message is really just
informative.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/btrfs/disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index aae2276..15eaae5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2421,7 +2421,7 @@ int open_ctree(struct super_block *sb,
 		features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
 
 	if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
-		printk(KERN_ERR "btrfs: has skinny extents\n");
+		printk(KERN_INFO "BTRFS: has skinny extents\n");
 
 	/*
 	 * flag our filesystem as having big metadata blocks if
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 045/143] KVM: s390: base hrtimer on a monotonic clock
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (43 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 044/143] btrfs: set proper message level for skinny metadata Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 046/143] PCI: Fix infinite loop with ROM image of size 0 Kamal Mostafa
                   ` (97 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Hildenbrand, Christian Borntraeger, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 0ac96caf0f9381088c673a16d910b1d329670edf upstream.

The hrtimer that handles the wait with enabled timer interrupts
should not be disturbed by changes of the host time.

This patch changes our hrtimer to be based on a monotonic clock.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 2480d92..1e201ad 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -398,7 +398,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 	vcpu->arch.sie_block->ecb2  = 8;
 	vcpu->arch.sie_block->eca   = 0xC1002001U;
 	vcpu->arch.sie_block->fac   = (int) (long) vfacilities;
-	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
+	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	tasklet_init(&vcpu->arch.tasklet, kvm_s390_tasklet,
 		     (unsigned long) vcpu);
 	vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 046/143] PCI: Fix infinite loop with ROM image of size 0
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (44 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 045/143] KVM: s390: base hrtimer on a monotonic clock Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 047/143] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Kamal Mostafa
                   ` (96 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michel Dänzer, Bjorn Helgaas, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>

commit 16b036af31e1456cb69243a5a0c9ef801ecd1f17 upstream.

If the image size would ever read as 0, pci_get_rom_size() could keep
processing the same image over and over again.  Exit the loop if we ever
read a length of zero.

This fixes a soft lockup on boot when the radeon driver calls
pci_get_rom_size() on an AMD Radeon R7 250X PCIe discrete graphics card.

[bhelgaas: changelog, reference]
Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386973
Reported-by: Federico <federicotg@gmail.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pci/rom.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index c5d0a08..d6d4997 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -69,6 +69,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 {
 	void __iomem *image;
 	int last_image;
+	unsigned length;
 
 	image = rom;
 	do {
@@ -91,9 +92,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 		if (readb(pds + 3) != 'R')
 			break;
 		last_image = readb(pds + 21) & 0x80;
-		/* this length is reliable */
-		image += readw(pds + 16) * 512;
-	} while (!last_image);
+		length = readw(pds + 16);
+		image += length * 512;
+	} while (length && !last_image);
 
 	/* never return a size larger than the PCI resource window */
 	/* there are known ROMs that get the size wrong */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 047/143] USB: cp210x: add ID for RUGGEDCOM USB Serial Console
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (45 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 046/143] PCI: Fix infinite loop with ROM image of size 0 Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 048/143] clk: zynq: Force CPU_2X clock to be ungated Kamal Mostafa
                   ` (95 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Len Sorensen, Johan Hovold, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>

commit a6f0331236fa75afba14bbcf6668d42cebb55c43 upstream.

Added the USB serial console device ID for Siemens Ruggedcom devices
which have a USB port for their serial console.

Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 5312e18..df46ab0 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -56,6 +56,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */
 	{ USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
 	{ USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
+	{ USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */
 	{ USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
 	{ USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
 	{ USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 048/143] clk: zynq: Force CPU_2X clock to be ungated
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (46 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 047/143] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 049/143] mmc: sdhci-pxav3: Remove checks for mandatory host clock Kamal Mostafa
                   ` (94 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Soren Brinkmann, Michael Turquette, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Soren Brinkmann <soren.brinkmann@xilinx.com>

commit 3dccfecdb867fe35b305a4e493ef5652b7d9d4cb upstream.

The CPU_2X clock does not have a classical in-kernel user, but is,
amongst other things, required for OCM and debug access. Make sure this
clock is not mistakenly disabled during boot up by enabling it in the
platform's clock driver.

Fixes: 0ee52b157b8e 'clk: zynq: Add clock controller driver'
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/zynq/clkc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index 10772aa..e7cf8aa 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -290,6 +290,7 @@ static void __init zynq_clk_setup(struct device_node *np)
 	clks[cpu_2x] = clk_register_gate(NULL, clk_output_name[cpu_2x],
 			"cpu_2x_div", CLK_IGNORE_UNUSED, SLCR_ARM_CLK_CTRL,
 			26, 0, &armclk_lock);
+	clk_prepare_enable(clks[cpu_2x]);
 
 	clk = clk_register_fixed_factor(NULL, "cpu_1x_div", "cpu_div", 0, 1,
 			4 + 2 * tmp);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 049/143] mmc: sdhci-pxav3: Remove checks for mandatory host clock
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (47 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 048/143] clk: zynq: Force CPU_2X clock to be ungated Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 050/143] mmc: sdhci-pxav3: fix race between runtime pm and irq Kamal Mostafa
                   ` (93 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Hesselbarth, Ulf Hansson, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

commit 20d5a70344e526f51efe50861be10f6d743b7706 upstream.

NULL-checking a struct clk it not only wrong but also not required as
for PXAv3 driver the corresponding clock is mandatory. Remove the
checks from sdhci_pxav3_runtime_{suspend,resume}.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[ kamal: 3.13-stable prereq for:
  3bb10f6 mmc: sdhci-pxav3: fix race between runtime pm and irq ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index dc09e70..68c772f 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -381,13 +381,11 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	unsigned long flags;
 
-	if (pltfm_host->clk) {
-		spin_lock_irqsave(&host->lock, flags);
-		host->runtime_suspended = true;
-		spin_unlock_irqrestore(&host->lock, flags);
+	spin_lock_irqsave(&host->lock, flags);
+	host->runtime_suspended = true;
+	spin_unlock_irqrestore(&host->lock, flags);
 
-		clk_disable_unprepare(pltfm_host->clk);
-	}
+	clk_disable_unprepare(pltfm_host->clk);
 
 	return 0;
 }
@@ -398,13 +396,11 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	unsigned long flags;
 
-	if (pltfm_host->clk) {
-		clk_prepare_enable(pltfm_host->clk);
+	clk_prepare_enable(pltfm_host->clk);
 
-		spin_lock_irqsave(&host->lock, flags);
-		host->runtime_suspended = false;
-		spin_unlock_irqrestore(&host->lock, flags);
-	}
+	spin_lock_irqsave(&host->lock, flags);
+	host->runtime_suspended = false;
+	spin_unlock_irqrestore(&host->lock, flags);
 
 	return 0;
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 050/143] mmc: sdhci-pxav3: fix race between runtime pm and irq
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (48 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 049/143] mmc: sdhci-pxav3: Remove checks for mandatory host clock Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 051/143] power_supply: 88pm860x: Fix leaked power supply on probe fail Kamal Mostafa
                   ` (92 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jisheng Zhang, Ulf Hansson, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jisheng Zhang <jszhang@marvell.com>

commit 3bb10f60933e84abfe2be69f60b3486f9b96348b upstream.

This patch is to fix a race condition that may cause an unhandled irq,
which results in big sdhci interrupt numbers and endless "mmc1: got irq
while runtime suspended" msgs before v3.15.

Consider following scenario:

      CPU0                            CPU1
                              sdhci_pxav3_runtime_suspend()
                               spin_lock_irqsave(&host->lock, flags);
 sdhci_irq()
  spining on the &host->lock
                               host->runtime_suspended = true;
                               spin_unlock_irqrestore(&host->lock, flags);
  get the &host->lock
  runtime_suspended is true now
  return IRQ_NONE;

Fix this race by using the core sdhci.c supplied sdhci_runtime_suspend_host()
in runtime suspend hook which will disable card interrupts. We also use the
sdhci_runtime_resume_host() in the runtime resume hook accordingly.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 68c772f..bb906ab 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -379,11 +379,11 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	unsigned long flags;
+	int ret;
 
-	spin_lock_irqsave(&host->lock, flags);
-	host->runtime_suspended = true;
-	spin_unlock_irqrestore(&host->lock, flags);
+	ret = sdhci_runtime_suspend_host(host);
+	if (ret)
+		return ret;
 
 	clk_disable_unprepare(pltfm_host->clk);
 
@@ -394,15 +394,10 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	unsigned long flags;
 
 	clk_prepare_enable(pltfm_host->clk);
 
-	spin_lock_irqsave(&host->lock, flags);
-	host->runtime_suspended = false;
-	spin_unlock_irqrestore(&host->lock, flags);
-
-	return 0;
+	return sdhci_runtime_resume_host(host);
 }
 #endif
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 051/143] power_supply: 88pm860x: Fix leaked power supply on probe fail
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (49 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 050/143] mmc: sdhci-pxav3: fix race between runtime pm and irq Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 052/143] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Kamal Mostafa
                   ` (91 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Sebastian Reichel, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 24727b45b484e8937dcde53fa8d1aa70ac30ec0c upstream.

Driver forgot to unregister power supply if request_threaded_irq()
failed in probe(). In such case the memory associated with power supply
leaked.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: a830d28b48bf ("power_supply: Enable battery-charger for 88pm860x")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/power/88pm860x_charger.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index de029bb..5ccca87 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -711,6 +711,7 @@ static int pm860x_charger_probe(struct platform_device *pdev)
 	return 0;
 
 out_irq:
+	power_supply_unregister(&info->usb);
 	while (--i >= 0)
 		free_irq(info->irq[i], info);
 out:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 052/143] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (50 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 051/143] power_supply: 88pm860x: Fix leaked power supply on probe fail Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 053/143] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Kamal Mostafa
                   ` (90 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ian Abbott, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 42b8ce6f55facfa101462e694d33fc6bca471138 upstream.

`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/comedi/comedi_compat32.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c
index 1e9da40..5287810 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -262,7 +262,7 @@ static int compat_cmd(struct file *file, unsigned long arg)
 {
 	struct comedi_cmd __user *cmd;
 	struct comedi32_cmd_struct __user *cmd32;
-	int rc;
+	int rc, err;
 
 	cmd32 = compat_ptr(arg);
 	cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -271,7 +271,15 @@ static int compat_cmd(struct file *file, unsigned long arg)
 	if (rc)
 		return rc;
 
-	return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+	rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+	if (rc == -EAGAIN) {
+		/* Special case: copy cmd back to user. */
+		err = put_compat_cmd(cmd32, cmd);
+		if (err)
+			rc = err;
+	}
+
+	return rc;
 }
 
 /* Handle 32-bit COMEDI_CMDTEST ioctl. */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 053/143] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (51 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 052/143] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 054/143] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Kamal Mostafa
                   ` (89 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jisheng Zhang, Ulf Hansson, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jisheng Zhang <jszhang@marvell.com>

commit 14460dbaf7a5a0488963fdb8232ad5c8a8cca7b7 upstream.

Current code checks "clk_delay_cycles > 0" to know whether the optional
"mrvl,clk_delay_cycles" is set or not. But of_property_read_u32() doesn't
touch clk_delay_cycles if the property is not set. And type of
clk_delay_cycles is u32, so we may always set pdata->clk_delay_cycles as a
random value.

This patch fix this problem by check the return value of of_property_read_u32()
to know whether the optional clk-delay-cycles is set or not.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index bb906ab..9654246 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -201,8 +201,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev)
 	if (!pdata)
 		return NULL;
 
-	of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles);
-	if (clk_delay_cycles > 0)
+	if (!of_property_read_u32(np, "mrvl,clk-delay-cycles",
+				  &clk_delay_cycles))
 		pdata->clk_delay_cycles = clk_delay_cycles;
 
 	return pdata;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 054/143] ARM: 8284/1: sa1100: clear RCSR_SMR on resume
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (52 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 053/143] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Kamal Mostafa
@ 2015-03-31 19:46 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 055/143] usb: musb: omap2plus bus glue needs USB host support Kamal Mostafa
                   ` (88 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Eremin-Solenikov, Russell King, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

commit e461894dc2ce7778ccde1c3483c9b15a85a7fc5f upstream.

StrongARM core uses RCSR SMR bit to tell to bootloader that it was reset
by entering the sleep mode. After we have resumed, there is little point
in having that bit enabled. Moreover, if this bit is set before reboot,
the bootloader can become confused. Thus clear the SMR bit on resume
just before clearing the scratchpad (resume address) register.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-sa1100/pm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 6645d1e..34853d5 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -81,6 +81,7 @@ static int sa11x0_pm_enter(suspend_state_t state)
 	/*
 	 * Ensure not to come back here if it wasn't intended
 	 */
+	RCSR = RCSR_SMR;
 	PSPR = 0;
 
 	/*
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 055/143] usb: musb: omap2plus bus glue needs USB host support
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (53 preceding siblings ...)
  2015-03-31 19:46 ` [PATCH 3.13.y-ckt 054/143] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency Kamal Mostafa
                   ` (87 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, linux-omap, Felipe Balbi, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Arnd Bergmann <arnd@arndb.de>

commit a8d191c8bb2f11a8f381e7cb98f978b7288c1401 upstream.

The musb/omap2430.c bus glue driver calls usb_hcd_poll_rh_status,
which is only available if CONFIG_USB is also set, i.e. we
are building USB host mode and not just endpoint mode.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/musb/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 57dfc0c..a70f46f 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -74,7 +74,7 @@ config USB_MUSB_TUSB6010
 
 config USB_MUSB_OMAP2PLUS
 	tristate "OMAP2430 and onwards"
-	depends on ARCH_OMAP2PLUS
+	depends on ARCH_OMAP2PLUS && USB
 	select GENERIC_PHY
 
 config USB_MUSB_AM35X
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (54 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 055/143] usb: musb: omap2plus bus glue needs USB host support Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-04-01  9:37   ` Luis Henriques
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 057/143] cdc-acm: add sanity checks Kamal Mostafa
                   ` (86 subsequent siblings)
  142 siblings, 1 reply; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Felipe Balbi, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Arnd Bergmann <arnd@arndb.de>

commit fbba7db3990cb707ff91cd6507d53a0a730afe97 upstream.

The omap musb front-end calls into the phy driver directly
instead of using a generic phy interface, which causes a link
error when the specific driver is not built-in:

drivers/built-in.o: In function `omap2430_musb_disable':
usb/musb/omap2430.c:480: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o: In function `omap2430_musb_enable':
usb/musb/omap2430.c:466: undefined reference to `omap_control_usb_set_mode'
usb/musb/omap2430.c:447: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o: In function `omap_musb_set_mailbox':
usb/musb/omap2430.c:273: undefined reference to `omap_control_usb_set_mode'
usb/musb/omap2430.c:304: undefined reference to `omap_control_usb_set_mode'
drivers/built-in.o:(.debug_addr+0xbd9e0): more undefined references to `omap_control_usb_set_mode' follow

This adds an explicit dependency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ca784be36cc725 ("usb: start using the control module driver")
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/musb/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index a70f46f..ddcbcdd 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -74,7 +74,7 @@ config USB_MUSB_TUSB6010
 
 config USB_MUSB_OMAP2PLUS
 	tristate "OMAP2430 and onwards"
-	depends on ARCH_OMAP2PLUS && USB
+	depends on ARCH_OMAP2PLUS && USB && OMAP_CONTROL_PHY
 	select GENERIC_PHY
 
 config USB_MUSB_AM35X
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 057/143] cdc-acm: add sanity checks
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (55 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 058/143] USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd) Kamal Mostafa
                   ` (85 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Oliver Neukum <oneukum@suse.de>

commit 7e860a6e7aa62b337a61110430cd633db5b0d2dd upstream.

Check the special CDC headers for a plausible minimum length.
Another big operating systems ignores such garbage.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Reviewed-by: Adam Lee <adam8157@gmail.com>
Tested-by: Adam Lee <adam8157@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/class/cdc-acm.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 6746103..82dea40 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -943,6 +943,7 @@ static int acm_probe(struct usb_interface *intf,
 	unsigned long quirks;
 	int num_rx_buf;
 	int i;
+	unsigned int elength = 0;
 	int combined_interfaces = 0;
 	struct device *tty_dev;
 	int rv = -ENOMEM;
@@ -988,9 +989,12 @@ static int acm_probe(struct usb_interface *intf,
 			dev_err(&intf->dev, "skipping garbage\n");
 			goto next_desc;
 		}
+		elength = buffer[0];
 
 		switch (buffer[2]) {
 		case USB_CDC_UNION_TYPE: /* we've found it */
+			if (elength < sizeof(struct usb_cdc_union_desc))
+				goto next_desc;
 			if (union_header) {
 				dev_err(&intf->dev, "More than one "
 					"union descriptor, skipping ...\n");
@@ -999,31 +1003,38 @@ static int acm_probe(struct usb_interface *intf,
 			union_header = (struct usb_cdc_union_desc *)buffer;
 			break;
 		case USB_CDC_COUNTRY_TYPE: /* export through sysfs*/
+			if (elength < sizeof(struct usb_cdc_country_functional_desc))
+				goto next_desc;
 			cfd = (struct usb_cdc_country_functional_desc *)buffer;
 			break;
 		case USB_CDC_HEADER_TYPE: /* maybe check version */
 			break; /* for now we ignore it */
 		case USB_CDC_ACM_TYPE:
+			if (elength < 4)
+				goto next_desc;
 			ac_management_function = buffer[3];
 			break;
 		case USB_CDC_CALL_MANAGEMENT_TYPE:
+			if (elength < 5)
+				goto next_desc;
 			call_management_function = buffer[3];
 			call_interface_num = buffer[4];
 			if ((quirks & NOT_A_MODEM) == 0 && (call_management_function & 3) != 3)
 				dev_err(&intf->dev, "This device cannot do calls on its own. It is not a modem.\n");
 			break;
 		default:
-			/* there are LOTS more CDC descriptors that
+			/*
+			 * there are LOTS more CDC descriptors that
 			 * could legitimately be found here.
 			 */
 			dev_dbg(&intf->dev, "Ignoring descriptor: "
-					"type %02x, length %d\n",
-					buffer[2], buffer[0]);
+					"type %02x, length %ud\n",
+					buffer[2], elength);
 			break;
 		}
 next_desc:
-		buflen -= buffer[0];
-		buffer += buffer[0];
+		buflen -= elength;
+		buffer += elength;
 	}
 
 	if (!union_header) {
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 058/143] USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (56 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 057/143] cdc-acm: add sanity checks Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 059/143] USB: fix use-after-free bug in usb_hcd_unlink_urb() Kamal Mostafa
                   ` (84 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alan Stern, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 074f9dd55f9cab1b82690ed7e44bcf38b9616ce0 upstream.

Currently the USB stack assumes that all host controller drivers are
capable of receiving wakeup requests from downstream devices.
However, this isn't true for the isp1760-hcd driver, which means that
it isn't safe to do a runtime suspend of any device attached to a
root-hub port if the device requires wakeup.

This patch adds a "cant_recv_wakeups" flag to the usb_hcd structure
and sets the flag in isp1760-hcd.  The core is modified to prevent a
direct child of the root hub from being put into runtime suspend with
wakeup enabled if the flag is set.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/core/driver.c      | 12 ++++++++++++
 drivers/usb/host/isp1760-hcd.c |  3 +++
 include/linux/usb/hcd.h        |  2 ++
 3 files changed, 17 insertions(+)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2ff20e1..f573c1d 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1748,6 +1748,18 @@ static int autosuspend_check(struct usb_device *udev)
 		dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n");
 		return -EOPNOTSUPP;
 	}
+
+	/*
+	 * If the device is a direct child of the root hub and the HCD
+	 * doesn't handle wakeup requests, don't allow autosuspend when
+	 * wakeup is needed.
+	 */
+	if (w && udev->parent == udev->bus->root_hub &&
+			bus_to_hcd(udev->bus)->cant_recv_wakeups) {
+		dev_dbg(&udev->dev, "HCD doesn't handle wakeup requests\n");
+		return -EOPNOTSUPP;
+	}
+
 	udev->do_remote_wakeup = w;
 	return 0;
 }
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 2facee5..ea50291 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -2247,6 +2247,9 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len,
 	hcd->rsrc_start = res_start;
 	hcd->rsrc_len = res_len;
 
+	/* This driver doesn't support wakeup requests */
+	hcd->cant_recv_wakeups = 1;
+
 	ret = usb_add_hcd(hcd, irq, irqflags);
 	if (ret)
 		goto err_unmap;
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index dffeeb2..9e714eb 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -142,6 +142,8 @@ struct usb_hcd {
 	unsigned		authorized_default:1;
 	unsigned		has_tt:1;	/* Integrated TT in root hub */
 	unsigned		amd_resume_bug:1; /* AMD remote wakeup quirk */
+	unsigned		cant_recv_wakeups:1;
+			/* wakeup requests from downstream aren't received */
 
 	unsigned int		irq;		/* irq allocated */
 	void __iomem		*regs;		/* device memory/io */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 059/143] USB: fix use-after-free bug in usb_hcd_unlink_urb()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (57 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 058/143] USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd) Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 060/143] iwlwifi: mvm: always use mac color zero Kamal Mostafa
                   ` (83 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alan Stern, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit c99197902da284b4b723451c1471c45b18537cde upstream.

The usb_hcd_unlink_urb() routine in hcd.c contains two possible
use-after-free errors.  The dev_dbg() statement at the end of the
routine dereferences urb and urb->dev even though both structures may
have been deallocated.

This patch fixes the problem by storing urb->dev in a local variable
(avoiding the dereference of urb) and moving the dev_dbg() up before
the usb_put_dev() call.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/core/hcd.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 4a4dae5..178696f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1616,6 +1616,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)
 int usb_hcd_unlink_urb (struct urb *urb, int status)
 {
 	struct usb_hcd		*hcd;
+	struct usb_device	*udev = urb->dev;
 	int			retval = -EIDRM;
 	unsigned long		flags;
 
@@ -1627,20 +1628,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
 	spin_lock_irqsave(&hcd_urb_unlink_lock, flags);
 	if (atomic_read(&urb->use_count) > 0) {
 		retval = 0;
-		usb_get_dev(urb->dev);
+		usb_get_dev(udev);
 	}
 	spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags);
 	if (retval == 0) {
 		hcd = bus_to_hcd(urb->dev->bus);
 		retval = unlink1(hcd, urb, status);
-		usb_put_dev(urb->dev);
+		if (retval == 0)
+			retval = -EINPROGRESS;
+		else if (retval != -EIDRM && retval != -EBUSY)
+			dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n",
+					urb, retval);
+		usb_put_dev(udev);
 	}
-
-	if (retval == 0)
-		retval = -EINPROGRESS;
-	else if (retval != -EIDRM && retval != -EBUSY)
-		dev_dbg(&urb->dev->dev, "hcd_unlink_urb %p fail %d\n",
-				urb, retval);
 	return retval;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 060/143] iwlwifi: mvm: always use mac color zero
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (58 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 059/143] USB: fix use-after-free bug in usb_hcd_unlink_urb() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 061/143] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Kamal Mostafa
                   ` (82 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Luciano Coelho, Emmanuel Grumbach, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Luciano Coelho <luciano.coelho@intel.com>

commit 5523d11cc46393a1e61b7ef4a0b2d4e7ed9521e4 upstream.

We don't really need to use different mac colors when adding mac
contexts, because they're not used anywhere.  In fact, the firmware
doesn't accept 255 as a valid color, so we get into a SYSASSERT 0x3401
when we reach that.

Remove the color increment to use always zero and avoid reaching 255.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 3960541..d82dc72 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -403,9 +403,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
 	mvmvif->uploaded = false;
 	mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
 
-	/* does this make sense at all? */
-	mvmvif->color++;
-
 	spin_lock_bh(&mvm->time_event_lock);
 	iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data);
 	spin_unlock_bh(&mvm->time_event_lock);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 061/143] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (59 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 060/143] iwlwifi: mvm: always use mac color zero Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 062/143] vt: provide notifications on selection changes Kamal Mostafa
                   ` (81 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Emmanuel Grumbach, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

commit cd8f438405032ac8ff88bd8f2eca5e0c0063b14b upstream.

The base address of the scheduler in the device's memory
(SRAM) comes from two different sources. The periphery
register and the alive notification from the firmware.
We have a check in iwl_pcie_tx_start that ensures that
they are the same.
When we resume from WoWLAN, the firmware may have crashed
for whatever reason. In that case, the whole device may be
reset which means that the periphery register will hold a
meaningless value. When we come to compare
trans_pcie->scd_base_addr (which really holds the value we
had when we loaded the WoWLAN firmware upon suspend) and
the current value of the register, we don't see a match
unsurprisingly.
Trick the check to avoid a loud yet harmless WARN.
Note that when the WoWLAN has crashed, we will see that
in iwl_trans_pcie_d3_resume which will let the op_mode
know. Once the op_mode is informed that the WowLAN firmware
has crashed, it can't do much besides resetting the whole
device.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/iwlwifi/pcie/tx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 0adde91..d4654ba 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -729,7 +729,12 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans)
 	iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG,
 			   trans_pcie->kw.dma >> 4);
 
-	iwl_pcie_tx_start(trans, trans_pcie->scd_base_addr);
+	/*
+	 * Send 0 as the scd_base_addr since the device may have be reset
+	 * while we were in WoWLAN in which case SCD_SRAM_BASE_ADDR will
+	 * contain garbage.
+	 */
+	iwl_pcie_tx_start(trans, 0);
 }
 
 /*
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 062/143] vt: provide notifications on selection changes
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (60 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 061/143] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 063/143] tty: Prevent untrappable signals from malicious program Kamal Mostafa
                   ` (80 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Pitre, Dave Mielke, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nicolas Pitre <nicolas.pitre@linaro.org>

commit 19e3ae6b4f07a87822c1c9e7ed99d31860e701af upstream.

The vcs device's poll/fasync support relies on the vt notifier to signal
changes to the screen content.  Notifier invocations were missing for
changes that comes through the selection interface though.  Fix that.

Tested with BRLTTY 5.2.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Cc: Dave Mielke <dave@mielke.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 23b5d32..693091a 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -498,6 +498,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed)
 #endif
 	if (DO_UPDATE(vc))
 		do_update_region(vc, (unsigned long) p, count);
+	notify_update(vc);
 }
 
 /* used by selection: complement pointer position */
@@ -514,6 +515,7 @@ void complement_pos(struct vc_data *vc, int offset)
 		scr_writew(old, screenpos(vc, old_offset, 1));
 		if (DO_UPDATE(vc))
 			vc->vc_sw->con_putc(vc, old, oldy, oldx);
+		notify_update(vc);
 	}
 
 	old_offset = offset;
@@ -531,8 +533,8 @@ void complement_pos(struct vc_data *vc, int offset)
 			oldy = (offset >> 1) / vc->vc_cols;
 			vc->vc_sw->con_putc(vc, new, oldy, oldx);
 		}
+		notify_update(vc);
 	}
-
 }
 
 static void insert_char(struct vc_data *vc, unsigned int nr)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 063/143] tty: Prevent untrappable signals from malicious program
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (61 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 062/143] vt: provide notifications on selection changes Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 064/143] cpufreq: Set cpufreq_cpu_data to NULL before putting kobject Kamal Mostafa
                   ` (79 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Theodore Ts'o, Howard Chu, One Thousand Gnomes, Jiri Slaby,
	Peter Hurley, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Hurley <peter@hurleysoftware.com>

commit 37480a05685ed5b8e1b9bf5e5c53b5810258b149 upstream.

Commit 26df6d13406d1a5 ("tty: Add EXTPROC support for LINEMODE")
allows a process which has opened a pty master to send _any_ signal
to the process group of the pty slave. Although potentially
exploitable by a malicious program running a setuid program on
a pty slave, it's unknown if this exploit currently exists.

Limit to signals actually used.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Howard Chu <hyc@symas.com>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/pty.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 25c9bc7..e49616e 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -209,6 +209,9 @@ static int pty_signal(struct tty_struct *tty, int sig)
 	unsigned long flags;
 	struct pid *pgrp;
 
+	if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP)
+		return -EINVAL;
+
 	if (tty->link) {
 		spin_lock_irqsave(&tty->link->ctrl_lock, flags);
 		pgrp = get_pid(tty->link->pgrp);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 064/143] cpufreq: Set cpufreq_cpu_data to NULL before putting kobject
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (62 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 063/143] tty: Prevent untrappable signals from malicious program Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 065/143] [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Kamal Mostafa
                   ` (78 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Viresh Kumar, Rafael J. Wysocki, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Viresh Kumar <viresh.kumar@linaro.org>

commit 6ffae8c06fab058d6c3f8ecb7f921327721034e7 upstream.

In __cpufreq_remove_dev_finish(), per-cpu 'cpufreq_cpu_data' needs
to be cleared before calling kobject_put(&policy->kobj) and under
cpufreq_driver_lock. Otherwise, if someone else calls cpufreq_cpu_get()
in parallel with it, they can obtain a non-NULL policy from that after
kobject_put(&policy->kobj) was executed.

Consider this case:

Thread A				Thread B
cpufreq_cpu_get()
  acquire cpufreq_driver_lock
  read-per-cpu cpufreq_cpu_data
					kobject_put(&policy->kobj);
  kobject_get(&policy->kobj);
					...
					per_cpu(&cpufreq_cpu_data, cpu) = NULL

And this will result in a warning like this one:

 ------------[ cut here ]------------
 WARNING: CPU: 0 PID: 4 at include/linux/kref.h:47
 kobject_get+0x41/0x50()
 Modules linked in: acpi_cpufreq(+) nfsd auth_rpcgss nfs_acl
 lockd grace sunrpc xfs libcrc32c sd_mod ixgbe igb mdio ahci hwmon
 ...
 Call Trace:
  [<ffffffff81661b14>] dump_stack+0x46/0x58
  [<ffffffff81072b61>] warn_slowpath_common+0x81/0xa0
  [<ffffffff81072c7a>] warn_slowpath_null+0x1a/0x20
  [<ffffffff812e16d1>] kobject_get+0x41/0x50
  [<ffffffff815262a5>] cpufreq_cpu_get+0x75/0xc0
  [<ffffffff81527c3e>] cpufreq_update_policy+0x2e/0x1f0
  [<ffffffff810b8cb2>] ? up+0x32/0x50
  [<ffffffff81381aa9>] ? acpi_ns_get_node+0xcb/0xf2
  [<ffffffff81381efd>] ? acpi_evaluate_object+0x22c/0x252
  [<ffffffff813824f6>] ? acpi_get_handle+0x95/0xc0
  [<ffffffff81360967>] ? acpi_has_method+0x25/0x40
  [<ffffffff81391e08>] acpi_processor_ppc_has_changed+0x77/0x82
  [<ffffffff81089566>] ? move_linked_works+0x66/0x90
  [<ffffffff8138e8ed>] acpi_processor_notify+0x58/0xe7
  [<ffffffff8137410c>] acpi_ev_notify_dispatch+0x44/0x5c
  [<ffffffff8135f293>] acpi_os_execute_deferred+0x15/0x22
  [<ffffffff8108c910>] process_one_work+0x160/0x410
  [<ffffffff8108d05b>] worker_thread+0x11b/0x520
  [<ffffffff8108cf40>] ? rescuer_thread+0x380/0x380
  [<ffffffff81092421>] kthread+0xe1/0x100
  [<ffffffff81092340>] ? kthread_create_on_node+0x1b0/0x1b0
  [<ffffffff81669ebc>] ret_from_fork+0x7c/0xb0
  [<ffffffff81092340>] ? kthread_create_on_node+0x1b0/0x1b0
 ---[ end trace 89e66eb9795efdf7 ]---

The actual code flow is as follows:

 Thread A: Workqueue: kacpi_notify

 acpi_processor_notify()
   acpi_processor_ppc_has_changed()
         cpufreq_update_policy()
           cpufreq_cpu_get()
             kobject_get()

 Thread B: xenbus_thread()

 xenbus_thread()
   msg->u.watch.handle->callback()
     handle_vcpu_hotplug_event()
       vcpu_hotplug()
         cpu_down()
           __cpu_notify(CPU_POST_DEAD..)
             cpufreq_cpu_callback()
               __cpufreq_remove_dev_finish()
                 cpufreq_policy_put_kobj()
                   kobject_put()

cpufreq_cpu_get() gets the policy from per-cpu variable cpufreq_cpu_data
under cpufreq_driver_lock, and once it gets a valid policy it expects it
to not be freed until cpufreq_cpu_put() is called.

But the race happens when another thread puts the kobject first and updates
cpufreq_cpu_data before or later. And so the first thread gets a valid policy
structure and before it does kobject_get() on it, the second one has already
done kobject_put().

Fix this by setting cpufreq_cpu_data to NULL before putting the kobject and that
too under locks.

Reported-by: Ethan Zhao <ethan.zhao@oracle.com>
Reported-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/cpufreq/cpufreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index a9cd300..b9f6367 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1262,9 +1262,10 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
 	unsigned long flags;
 	struct cpufreq_policy *policy;
 
-	read_lock_irqsave(&cpufreq_driver_lock, flags);
+	write_lock_irqsave(&cpufreq_driver_lock, flags);
 	policy = per_cpu(cpufreq_cpu_data, cpu);
-	read_unlock_irqrestore(&cpufreq_driver_lock, flags);
+	per_cpu(cpufreq_cpu_data, cpu) = NULL;
+	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	if (!policy) {
 		pr_debug("%s: No cpu_data found\n", __func__);
@@ -1319,7 +1320,6 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
 		}
 	}
 
-	per_cpu(cpufreq_cpu_data, cpu) = NULL;
 	return 0;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 065/143] [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (63 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 064/143] cpufreq: Set cpufreq_cpu_data to NULL before putting kobject Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 066/143] mei: mask interrupt set bit on clean reset bit Kamal Mostafa
                   ` (77 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Malcolm Priestley, Mauro Carvalho Chehab, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Malcolm Priestley <tvboxspy@gmail.com>

commit 15e1ce33182d1d5dbd8efe8d382b9352dc857527 upstream.

A quirk of some older firmwares that report endpoint pipe type as PIPE_BULK
but the endpoint otheriwse functions as interrupt.

Check if usb_endpoint_type is USB_ENDPOINT_XFER_BULK and set as usb_rcvbulkpipe.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index f674dc0..d2a4e6d 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -350,6 +350,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
 {
 	struct dvb_usb_device *d = adap_to_d(adap);
 	struct lme2510_state *lme_int = adap_to_priv(adap);
+	struct usb_host_endpoint *ep;
 
 	lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC);
 
@@ -371,6 +372,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
 				adap,
 				8);
 
+	/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */
+	ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);
+
+	if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK)
+		lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa),
+
 	lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
 	usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 066/143] mei: mask interrupt set bit on clean reset bit
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (64 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 065/143] [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 067/143] mei: me: release hw from reset only during the reset flow Kamal Mostafa
                   ` (76 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Usyskin, Tomas Winkler, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 1ab1e79b9fd4b01331490bbe2e630a0fc0b25449 upstream.

We should mask interrupt set bit when writing back
hcsr value in reset bit clean-up.

This is refinement for
mei: clean reset bit before reset
commit b13a65ef190e488e2761d65bdd2e1fe8a3a125f5

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/misc/mei/hw-me.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index eebe329..55cef5e 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -187,7 +187,7 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
 	if ((hcsr & H_RST) == H_RST) {
 		dev_warn(&dev->pdev->dev, "H_RST is set = 0x%08X", hcsr);
 		hcsr &= ~H_RST;
-		mei_me_reg_write(hw, H_CSR, hcsr);
+		mei_hcsr_set(hw, hcsr);
 		hcsr = mei_hcsr_read(hw);
 	}
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 067/143] mei: me: release hw from reset only during the reset flow
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (65 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 066/143] mei: mask interrupt set bit on clean reset bit Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 068/143] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Kamal Mostafa
                   ` (75 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Usyskin, Tomas Winkler, Greg Kroah-Hartman, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 663b7ee9517eec6deea9a48c7a1392a9a34f7809 upstream.

We might enter the interrupt handler with hw_ready already set,
but prior we actually started the reset flow.
To soleve this we move the reset release from the interrupt handler
to the HW start wait function which is part of the reset sequence.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/misc/mei/hw-me.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 55cef5e..df71a7f 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -276,6 +276,7 @@ static int mei_me_hw_ready_wait(struct mei_device *dev)
 		return err;
 	}
 
+	mei_me_hw_reset_release(dev);
 	dev->recvd_hw_ready = false;
 	return 0;
 }
@@ -522,9 +523,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
 	/*  check if we need to start the dev */
 	if (!mei_host_is_ready(dev)) {
 		if (mei_hw_is_ready(dev)) {
-			mei_me_hw_reset_release(dev);
 			dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
-
 			dev->recvd_hw_ready = true;
 			wake_up_interruptible(&dev->wait_hw_ready);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 068/143] MIPS: KVM: Deliver guest interrupts after local_irq_disable()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (66 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 067/143] mei: me: release hw from reset only during the reset flow Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 069/143] KVM: MIPS: Don't leak FPU/DSP to guest Kamal Mostafa
                   ` (74 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Paolo Bonzini, Gleb Natapov, kvm, Ralf Baechle,
	linux-mips, Sanjay Lal, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 044f0f03eca0110e1835b2ea038a484b93950328 upstream.

When about to run the guest, deliver guest interrupts after disabling
host interrupts. This should prevent an hrtimer interrupt from being
handled after delivering guest interrupts, and therefore not delivering
the guest timer interrupt until after the next guest exit.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Sanjay Lal <sanjayl@kymasys.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/mips/kvm/kvm_mips.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 7a8b440..4d058a7 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -424,11 +424,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 		vcpu->mmio_needed = 0;
 	}
 
+	local_irq_disable();
 	/* Check if we have any exceptions/interrupts pending */
 	kvm_mips_deliver_interrupts(vcpu,
 				    kvm_read_c0_guest_cause(vcpu->arch.cop0));
 
-	local_irq_disable();
 	kvm_guest_enter();
 
 	r = __kvm_mips_vcpu_run(run, vcpu);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 069/143] KVM: MIPS: Don't leak FPU/DSP to guest
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (67 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 068/143] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 070/143] ALSA: hda - Add the pin fixup for HP Envy TS bass speaker Kamal Mostafa
                   ` (73 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Paolo Bonzini, Ralf Baechle, Sanjay Lal,
	Gleb Natapov, kvm, linux-mips, Luis Henriques, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit f798217dfd038af981a18bbe4bc57027a08bb182 upstream.

The FPU and DSP are enabled via the CP0 Status CU1 and MX bits by
kvm_mips_set_c0_status() on a guest exit, presumably in case there is
active state that needs saving if pre-emption occurs. However neither of
these bits are cleared again when returning to the guest.

This effectively gives the guest access to the FPU/DSP hardware after
the first guest exit even though it is not aware of its presence,
allowing FP instructions in guest user code to intermittently actually
execute instead of trapping into the guest OS for emulation. It will
then read & manipulate the hardware FP registers which technically
belong to the user process (e.g. QEMU), or are stale from another user
process. It can also crash the guest OS by causing an FP exception, for
which a guest exception handler won't have been registered.

First lets save and disable the FPU (and MSA) state with lose_fpu(1)
before entering the guest. This simplifies the problem, especially for
when guest FPU/MSA support is added in the future, and prevents FR=1 FPU
state being live when the FR bit gets cleared for the guest, which
according to the architecture causes the contents of the FPU and vector
registers to become UNPREDICTABLE.

We can then safely remove the enabling of the FPU in
kvm_mips_set_c0_status(), since there should never be any active FPU or
MSA state to save at pre-emption, which should plug the FPU leak.

DSP state is always live rather than being lazily restored, so for that
it is simpler to just clear the MX bit again when re-entering the guest.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Sanjay Lal <sanjayl@kymasys.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[ luis: backported to 3.16: files rename:
  - locore.S -> kvm_locore.S
  - mips.c -> kvm_mips.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/mips/kvm/kvm_locore.S | 2 +-
 arch/mips/kvm/kvm_mips.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S
index bbace09..03a2db5 100644
--- a/arch/mips/kvm/kvm_locore.S
+++ b/arch/mips/kvm/kvm_locore.S
@@ -428,7 +428,7 @@ __kvm_mips_return_to_guest:
 	/* Setup status register for running guest in UM */
 	.set	at
 	or	v1, v1, (ST0_EXL | KSU_USER | ST0_IE)
-	and	v1, v1, ~ST0_CU0
+	and	v1, v1, ~(ST0_CU0 | ST0_MX)
 	.set	noat
 	mtc0	v1, CP0_STATUS
 	ehb
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 4d058a7..bdc5eeb 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -15,6 +15,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
+#include <asm/fpu.h>
 #include <asm/page.h>
 #include <asm/cacheflush.h>
 #include <asm/mmu_context.h>
@@ -424,6 +425,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 		vcpu->mmio_needed = 0;
 	}
 
+	lose_fpu(1);
+
 	local_irq_disable();
 	/* Check if we have any exceptions/interrupts pending */
 	kvm_mips_deliver_interrupts(vcpu,
@@ -1028,9 +1031,6 @@ void kvm_mips_set_c0_status(void)
 {
 	uint32_t status = read_c0_status();
 
-	if (cpu_has_fpu)
-		status |= (ST0_CU1);
-
 	if (cpu_has_dsp)
 		status |= (ST0_MX);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 070/143] ALSA: hda - Add the pin fixup for HP Envy TS bass speaker
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (68 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 069/143] KVM: MIPS: Don't leak FPU/DSP to guest Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 071/143] ALSA: hda - Set up GPIO for Toshiba Satellite S50D Kamal Mostafa
                   ` (72 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Iwai <tiwai@suse.de>

commit 8695a003a5f4f5bc88b915e1c4a56d954f810f6e upstream.

NID 0x10 seems corresponding to the bass speaker.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_sigmatel.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7467559..5da7130 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -104,6 +104,7 @@ enum {
 	STAC_92HD83XXX_HP,
 	STAC_HP_ENVY_BASS,
 	STAC_HP_BNB13_EQ,
+	STAC_HP_ENVY_TS_BASS,
 	STAC_92HD83XXX_MODELS
 };
 
@@ -2653,6 +2654,13 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = {
 		.chained = true,
 		.chain_id = STAC_92HD83XXX_HP_MIC_LED,
 	},
+	[STAC_HP_ENVY_TS_BASS] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x10, 0x92170111 },
+			{}
+		},
+	},
 };
 
 static const struct hda_model_fixup stac92hd83xxx_models[] = {
@@ -2669,6 +2677,7 @@ static const struct hda_model_fixup stac92hd83xxx_models[] = {
 	{ .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
 	{ .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
 	{ .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },
+	{ .id = STAC_HP_ENVY_TS_BASS, .name = "hp-envy-ts-bass" },
 	{}
 };
 
@@ -2724,6 +2733,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
 			  "HP bNB13", STAC_HP_BNB13_EQ),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A,
 			  "HP bNB13", STAC_HP_BNB13_EQ),
+	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190e,
+			  "HP ENVY TS", STAC_HP_ENVY_TS_BASS),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940,
 			  "HP bNB13", STAC_HP_BNB13_EQ),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 071/143] ALSA: hda - Set up GPIO for Toshiba Satellite S50D
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (69 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 070/143] ALSA: hda - Add the pin fixup for HP Envy TS bass speaker Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 072/143] xen/manage: Fix USB interaction issues when resuming Kamal Mostafa
                   ` (71 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Iwai <tiwai@suse.de>

commit 4227de2a7e5f0ff6a58e919a9c4f2bb06e882f48 upstream.

Toshiba Satellite S50D laptop with an IDT codec uses the GPIO4 (0x10)
as the master EAPD.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=915858
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_sigmatel.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 5da7130..552448f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -105,6 +105,7 @@ enum {
 	STAC_HP_ENVY_BASS,
 	STAC_HP_BNB13_EQ,
 	STAC_HP_ENVY_TS_BASS,
+	STAC_92HD83XXX_GPIO10_EAPD,
 	STAC_92HD83XXX_MODELS
 };
 
@@ -2146,6 +2147,19 @@ static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
 		spec->headset_jack = 1;
 }
 
+static void stac92hd83xxx_fixup_gpio10_eapd(struct hda_codec *codec,
+					    const struct hda_fixup *fix,
+					    int action)
+{
+	struct sigmatel_spec *spec = codec->spec;
+
+	if (action != HDA_FIXUP_ACT_PRE_PROBE)
+		return;
+	spec->eapd_mask = spec->gpio_mask = spec->gpio_dir =
+		spec->gpio_data = 0x10;
+	spec->eapd_switch = 0;
+}
+
 static const struct hda_verb hp_bnb13_eq_verbs[] = {
 	/* 44.1KHz base */
 	{ 0x22, 0x7A6, 0x3E },
@@ -2661,6 +2675,10 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = {
 			{}
 		},
 	},
+	[STAC_92HD83XXX_GPIO10_EAPD] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = stac92hd83xxx_fixup_gpio10_eapd,
+	},
 };
 
 static const struct hda_model_fixup stac92hd83xxx_models[] = {
@@ -2866,6 +2884,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
 		      "HP Mini", STAC_92HD83XXX_HP_LED),
 	SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
+	SND_PCI_QUIRK(PCI_VENDOR_ID_TOSHIBA, 0xfa91,
+		      "Toshiba Satellite S50D", STAC_92HD83XXX_GPIO10_EAPD),
 	{} /* terminator */
 };
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 072/143] xen/manage: Fix USB interaction issues when resuming
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (70 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 071/143] ALSA: hda - Set up GPIO for Toshiba Satellite S50D Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 073/143] drm/i915: Correct the IOSF Dev_FN field for IOSF transfers Kamal Mostafa
                   ` (70 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ross Lagerwall, David Vrabel, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ross Lagerwall <ross.lagerwall@citrix.com>

commit 72978b2fe2f2cdf9f319c6c6dcdbe92b38de2be2 upstream.

Commit 61a734d305e1 ("xen/manage: Always freeze/thaw processes when
suspend/resuming") ensured that userspace processes were always frozen
before suspending to reduce interaction issues when resuming devices.
However, freeze_processes() does not freeze kernel threads.  Freeze
kernel threads as well to prevent deadlocks with the khubd thread when
resuming devices.

This is what native suspend and resume does.

Example deadlock:
[ 7279.648010]  [<ffffffff81446bde>] ? xen_poll_irq_timeout+0x3e/0x50
[ 7279.648010]  [<ffffffff81448d60>] xen_poll_irq+0x10/0x20
[ 7279.648010]  [<ffffffff81011723>] xen_lock_spinning+0xb3/0x120
[ 7279.648010]  [<ffffffff810115d1>] __raw_callee_save_xen_lock_spinning+0x11/0x20
[ 7279.648010]  [<ffffffff815620b6>] ? usb_control_msg+0xe6/0x120
[ 7279.648010]  [<ffffffff81747e50>] ? _raw_spin_lock_irq+0x50/0x60
[ 7279.648010]  [<ffffffff8174522c>] wait_for_completion+0xac/0x160
[ 7279.648010]  [<ffffffff8109c520>] ? try_to_wake_up+0x2c0/0x2c0
[ 7279.648010]  [<ffffffff814b60f2>] dpm_wait+0x32/0x40
[ 7279.648010]  [<ffffffff814b6eb0>] device_resume+0x90/0x210
[ 7279.648010]  [<ffffffff814b7d71>] dpm_resume+0x121/0x250
[ 7279.648010]  [<ffffffff8144c570>] ? xenbus_dev_request_and_reply+0xc0/0xc0
[ 7279.648010]  [<ffffffff814b80d5>] dpm_resume_end+0x15/0x30
[ 7279.648010]  [<ffffffff81449fba>] do_suspend+0x10a/0x200
[ 7279.648010]  [<ffffffff8144a2f0>] ? xen_pre_suspend+0x20/0x20
[ 7279.648010]  [<ffffffff8144a1d0>] shutdown_handler+0x120/0x150
[ 7279.648010]  [<ffffffff8144c60f>] xenwatch_thread+0x9f/0x160
[ 7279.648010]  [<ffffffff810ac510>] ? finish_wait+0x80/0x80
[ 7279.648010]  [<ffffffff8108d189>] kthread+0xc9/0xe0
[ 7279.648010]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80
[ 7279.648010]  [<ffffffff8175087c>] ret_from_fork+0x7c/0xb0
[ 7279.648010]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80

[ 7441.216287] INFO: task khubd:89 blocked for more than 120 seconds.
[ 7441.219457]       Tainted: G            X 3.13.11-ckt12.kz #1
[ 7441.222176] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 7441.225827] khubd           D ffff88003f433440     0    89      2 0x00000000
[ 7441.229258]  ffff88003ceb9b98 0000000000000046 ffff88003ce83000 0000000000013440
[ 7441.232959]  ffff88003ceb9fd8 0000000000013440 ffff88003cd13000 ffff88003ce83000
[ 7441.236658]  0000000000000286 ffff88003d3e0000 ffff88003ceb9bd0 00000001001aa01e
[ 7441.240415] Call Trace:
[ 7441.241614]  [<ffffffff817442f9>] schedule+0x29/0x70
[ 7441.243930]  [<ffffffff81743406>] schedule_timeout+0x166/0x2c0
[ 7441.246681]  [<ffffffff81075b80>] ? call_timer_fn+0x110/0x110
[ 7441.249339]  [<ffffffff8174357e>] schedule_timeout_uninterruptible+0x1e/0x20
[ 7441.252644]  [<ffffffff81077710>] msleep+0x20/0x30
[ 7441.254812]  [<ffffffff81555f00>] hub_port_reset+0xf0/0x580
[ 7441.257400]  [<ffffffff81558465>] hub_port_init+0x75/0xb40
[ 7441.259981]  [<ffffffff814bb3c9>] ? update_autosuspend+0x39/0x60
[ 7441.262817]  [<ffffffff814bb4f0>] ? pm_runtime_set_autosuspend_delay+0x50/0xa0
[ 7441.266212]  [<ffffffff8155a64a>] hub_thread+0x71a/0x1750
[ 7441.268728]  [<ffffffff810ac510>] ? finish_wait+0x80/0x80
[ 7441.271272]  [<ffffffff81559f30>] ? usb_port_resume+0x670/0x670
[ 7441.274067]  [<ffffffff8108d189>] kthread+0xc9/0xe0
[ 7441.276305]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80
[ 7441.279131]  [<ffffffff8175087c>] ret_from_fork+0x7c/0xb0
[ 7441.281659]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/xen/manage.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index a344372..6343145 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -112,10 +112,16 @@ static void do_suspend(void)
 
 	err = freeze_processes();
 	if (err) {
-		pr_err("%s: freeze failed %d\n", __func__, err);
+		pr_err("%s: freeze processes failed %d\n", __func__, err);
 		goto out;
 	}
 
+	err = freeze_kernel_threads();
+	if (err) {
+		pr_err("%s: freeze kernel threads failed %d\n", __func__, err);
+		goto out_thaw;
+	}
+
 	err = dpm_suspend_start(PMSG_FREEZE);
 	if (err) {
 		pr_err("%s: dpm_suspend_start %d\n", __func__, err);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 073/143] drm/i915: Correct the IOSF Dev_FN field for IOSF transfers
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (71 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 072/143] xen/manage: Fix USB interaction issues when resuming Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 074/143] cfq-iosched: handle failure of cfq group allocation Kamal Mostafa
                   ` (69 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shobhit Kumar, Jani Nikula, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Shobhit Kumar <shobhit.kumar@intel.com>

commit d180d2bbb66579e3bf449642b8ec2a76f4014fcd upstream.

As per the specififcation, the SB_DevFn is the PCI_DEVFN of the target
device and not the source. So PCI_DEVFN(2,0) is not correct. Further the
port ID should be enough to identify devices unless they are MFD. The
SB_DevFn was intended to remove ambiguity in case of these MFD devices.

For non MFD devices the recommendation for the target device IP was to
ignore these fields, but not all of them followed the recommendation.
Some like CCK ignore these fields and hence PCI_DEVFN(2, 0) works and so
does PCI_DEVFN(0, 0) as it works for DPIO. The issue came to light because
of GPIONC which was not getting programmed correctly with PCI_DEVFN(2, 0).
It turned out that this did not follow the recommendation and expected 0
in this field.

In general the recommendation is to use SB_DevFn as PCI_DEVFN(0, 0) for
all devices except target PCI devices.

Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
[ kamal: backport to 3.13-stable: context; omitted vlv_bunit_*() changes ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/intel_sideband.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sideband.c b/drivers/gpu/drm/i915/intel_sideband.c
index 9944d81..5b487d5 100644
--- a/drivers/gpu/drm/i915/intel_sideband.c
+++ b/drivers/gpu/drm/i915/intel_sideband.c
@@ -73,7 +73,7 @@ u32 vlv_punit_read(struct drm_i915_private *dev_priv, u8 addr)
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
 	mutex_lock(&dev_priv->dpio_lock);
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_PUNIT,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_PUNIT,
 			PUNIT_OPCODE_REG_READ, addr, &val);
 	mutex_unlock(&dev_priv->dpio_lock);
 
@@ -85,7 +85,7 @@ void vlv_punit_write(struct drm_i915_private *dev_priv, u8 addr, u32 val)
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
 	mutex_lock(&dev_priv->dpio_lock);
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_PUNIT,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_PUNIT,
 			PUNIT_OPCODE_REG_WRITE, addr, &val);
 	mutex_unlock(&dev_priv->dpio_lock);
 }
@@ -97,7 +97,7 @@ u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr)
 	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
 
 	mutex_lock(&dev_priv->dpio_lock);
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_NC,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_NC,
 			PUNIT_OPCODE_REG_READ, addr, &val);
 	mutex_unlock(&dev_priv->dpio_lock);
 
@@ -107,56 +107,56 @@ u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr)
 u32 vlv_gpio_nc_read(struct drm_i915_private *dev_priv, u32 reg)
 {
 	u32 val = 0;
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPIO_NC,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_GPIO_NC,
 			PUNIT_OPCODE_REG_READ, reg, &val);
 	return val;
 }
 
 void vlv_gpio_nc_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
 {
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPIO_NC,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_GPIO_NC,
 			PUNIT_OPCODE_REG_WRITE, reg, &val);
 }
 
 u32 vlv_cck_read(struct drm_i915_private *dev_priv, u32 reg)
 {
 	u32 val = 0;
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_CCK,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_CCK,
 			PUNIT_OPCODE_REG_READ, reg, &val);
 	return val;
 }
 
 void vlv_cck_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
 {
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_CCK,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_CCK,
 			PUNIT_OPCODE_REG_WRITE, reg, &val);
 }
 
 u32 vlv_ccu_read(struct drm_i915_private *dev_priv, u32 reg)
 {
 	u32 val = 0;
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_CCU,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_CCU,
 			PUNIT_OPCODE_REG_READ, reg, &val);
 	return val;
 }
 
 void vlv_ccu_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
 {
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_CCU,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_CCU,
 			PUNIT_OPCODE_REG_WRITE, reg, &val);
 }
 
 u32 vlv_gps_core_read(struct drm_i915_private *dev_priv, u32 reg)
 {
 	u32 val = 0;
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPS_CORE,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_GPS_CORE,
 			PUNIT_OPCODE_REG_READ, reg, &val);
 	return val;
 }
 
 void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
 {
-	vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPS_CORE,
+	vlv_sideband_rw(dev_priv, PCI_DEVFN(0, 0), IOSF_PORT_GPS_CORE,
 			PUNIT_OPCODE_REG_WRITE, reg, &val);
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 074/143] cfq-iosched: handle failure of cfq group allocation
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (72 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 073/143] drm/i915: Correct the IOSF Dev_FN field for IOSF transfers Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 075/143] tracing: Fix unmapping loop in tracing_mark_write Kamal Mostafa
                   ` (68 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Konstantin Khlebnikov, Jens Axboe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

commit 69abaffec7d47a083739b79e3066cb3730eba72e upstream.

Cfq_lookup_create_cfqg() allocates struct blkcg_gq using GFP_ATOMIC.
In cfq_find_alloc_queue() possible allocation failure is not handled.
As a result kernel oopses on NULL pointer dereference when
cfq_link_cfqq_cfqg() calls cfqg_get() for NULL pointer.

Bug was introduced in v3.5 in commit cd1604fab4f9 ("blkcg: factor
out blkio_group creation"). Prior to that commit cfq group lookup
had returned pointer to root group as fallback.

This patch handles this error using existing fallback oom_cfqq.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Fixes: cd1604fab4f9 ("blkcg: factor out blkio_group creation")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 block/cfq-iosched.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index b8fb8bf..e13e06d 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3600,6 +3600,11 @@ retry:
 
 	blkcg = bio_blkcg(bio);
 	cfqg = cfq_lookup_create_cfqg(cfqd, blkcg);
+	if (!cfqg) {
+		cfqq = &cfqd->oom_cfqq;
+		goto out;
+	}
+
 	cfqq = cic_to_cfqq(cic, is_sync);
 
 	/*
@@ -3636,7 +3641,7 @@ retry:
 		} else
 			cfqq = &cfqd->oom_cfqq;
 	}
-
+out:
 	if (new_cfqq)
 		kmem_cache_free(cfq_pool, new_cfqq);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 075/143] tracing: Fix unmapping loop in tracing_mark_write
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (73 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 074/143] cfq-iosched: handle failure of cfq group allocation Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 076/143] fsnotify: fix handling of renames in audit Kamal Mostafa
                   ` (67 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vikram Mulukutla, Steven Rostedt, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Vikram Mulukutla <markivx@codeaurora.org>

commit 7215853e985a4bef1a6c14e00e89dfec84f1e457 upstream.

Commit 6edb2a8a385f0cdef51dae37ff23e74d76d8a6ce introduced
an array map_pages that contains the addresses returned by
kmap_atomic. However, when unmapping those pages, map_pages[0]
is unmapped before map_pages[1], breaking the nesting requirement
as specified in the documentation for kmap_atomic/kunmap_atomic.

This was caught by the highmem debug code present in kunmap_atomic.
Fix the loop to do the unmapping properly.

Link: http://lkml.kernel.org/r/1418871056-6614-1-git-send-email-markivx@codeaurora.org

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reported-by: Lime Yang <limey@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 111cc34..bc88bc2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4604,7 +4604,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 	*fpos += written;
 
  out_unlock:
-	for (i = 0; i < nr_pages; i++){
+	for (i = nr_pages - 1; i >= 0; i--) {
 		kunmap_atomic(map_page[i]);
 		put_page(pages[i]);
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 076/143] fsnotify: fix handling of renames in audit
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (74 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 075/143] tracing: Fix unmapping loop in tracing_mark_write Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 077/143] drm/radeon: workaround for CP HW bug on CIK Kamal Mostafa
                   ` (66 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Paul Moore, Eric Paris, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jan Kara <jack@suse.cz>

commit 6ee8e25fc3e916193bce4ebb43d5439e1e2144ab upstream.

Commit e9fd702a58c4 ("audit: convert audit watches to use fsnotify
instead of inotify") broke handling of renames in audit.  Audit code
wants to update inode number of an inode corresponding to watched name
in a directory.  When something gets renamed into a directory to a
watched name, inotify previously passed moved inode to audit code
however new fsnotify code passes directory inode where the change
happened.  That confuses audit and it starts watching parent directory
instead of a file in a directory.

This can be observed for example by doing:

  cd /tmp
  touch foo bar
  auditctl -w /tmp/foo
  touch foo
  mv bar foo
  touch foo

In audit log we see events like:

  type=CONFIG_CHANGE msg=audit(1423563584.155:90): auid=1000 ses=2 op="updated rules" path="/tmp/foo" key=(null) list=4 res=1
  ...
  type=PATH msg=audit(1423563584.155:91): item=2 name="bar" inode=1046884 dev=08:0 2 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE
  type=PATH msg=audit(1423563584.155:91): item=3 name="foo" inode=1046842 dev=08:0 2 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE
  type=PATH msg=audit(1423563584.155:91): item=4 name="foo" inode=1046884 dev=08:0 2 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=CREATE
  ...

and that's it - we see event for the first touch after creating the
audit rule, we see events for rename but we don't see any event for the
last touch.  However we start seeing events for unrelated stuff
happening in /tmp.

Fix the problem by passing moved inode as data in the FS_MOVED_FROM and
FS_MOVED_TO events instead of the directory where the change happens.
This doesn't introduce any new problems because noone besides
audit_watch.c cares about the passed value:

  fs/notify/fanotify/fanotify.c cares only about FSNOTIFY_EVENT_PATH events.
  fs/notify/dnotify/dnotify.c doesn't care about passed 'data' value at all.
  fs/notify/inotify/inotify_fsnotify.c uses 'data' only for FSNOTIFY_EVENT_PATH.
  kernel/audit_tree.c doesn't care about passed 'data' at all.
  kernel/audit_watch.c expects moved inode as 'data'.

Fixes: e9fd702a58c49db ("audit: convert audit watches to use fsnotify instead of inotify")
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Eric Paris <eparis@redhat.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>
---
 include/linux/fsnotify.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 1c804b0..7ee1774 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -101,8 +101,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
 		new_dir_mask |= FS_ISDIR;
 	}
 
-	fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
-	fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
+	fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,
+		 fs_cookie);
+	fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
+		 fs_cookie);
 
 	if (target)
 		fsnotify_link_count(target);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 077/143] drm/radeon: workaround for CP HW bug on CIK
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (75 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 076/143] fsnotify: fix handling of renames in audit Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 078/143] drm/radeon: only enable kv/kb dpm interrupts once v3 Kamal Mostafa
                   ` (65 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christian König, Alex Deucher, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>

commit a9c73a0e022c33954835e66fec3cd744af90ec98 upstream.

Emit the EOP twice to avoid cache flushing problems.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/cik.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index de0652e..37b79f2 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -3513,7 +3513,21 @@ void cik_fence_gfx_ring_emit(struct radeon_device *rdev,
 	struct radeon_ring *ring = &rdev->ring[fence->ring];
 	u64 addr = rdev->fence_drv[fence->ring].gpu_addr;
 
-	/* EVENT_WRITE_EOP - flush caches, send int */
+	/* Workaround for cache flush problems. First send a dummy EOP
+	 * event down the pipe with seq one below.
+	 */
+	radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4));
+	radeon_ring_write(ring, (EOP_TCL1_ACTION_EN |
+				 EOP_TC_ACTION_EN |
+				 EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) |
+				 EVENT_INDEX(5)));
+	radeon_ring_write(ring, addr & 0xfffffffc);
+	radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) |
+				DATA_SEL(1) | INT_SEL(0));
+	radeon_ring_write(ring, fence->seq - 1);
+	radeon_ring_write(ring, 0);
+
+	/* Then send the real EOP event down the pipe. */
 	radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4));
 	radeon_ring_write(ring, (EOP_TCL1_ACTION_EN |
 				 EOP_TC_ACTION_EN |
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 078/143] drm/radeon: only enable kv/kb dpm interrupts once v3
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (76 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 077/143] drm/radeon: workaround for CP HW bug on CIK Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 079/143] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Kamal Mostafa
                   ` (64 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alex Deucher, Christian König, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 410af8d7285a0b96314845c75c39fd612b755688 upstream.

Enable at init and disable on fini. Workaround for hardware problems.

v2 (chk): extend commit message
v3: add new function

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com> (v2)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/cik.c    | 21 ---------------------
 drivers/gpu/drm/radeon/kv_dpm.c | 17 +++++++++++++++--
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 37b79f2..9d8e30d 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -6631,7 +6631,6 @@ int cik_irq_set(struct radeon_device *rdev)
 	u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6;
 	u32 grbm_int_cntl = 0;
 	u32 dma_cntl, dma_cntl1;
-	u32 thermal_int;
 
 	if (!rdev->irq.installed) {
 		WARN(1, "Can't enable IRQ/MSI because no handler is installed\n");
@@ -6668,13 +6667,6 @@ int cik_irq_set(struct radeon_device *rdev)
 	cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE;
 	cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE;
 
-	if (rdev->flags & RADEON_IS_IGP)
-		thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL) &
-			~(THERM_INTH_MASK | THERM_INTL_MASK);
-	else
-		thermal_int = RREG32_SMC(CG_THERMAL_INT) &
-			~(THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW);
-
 	/* enable CP interrupts on all rings */
 	if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) {
 		DRM_DEBUG("cik_irq_set: sw int gfx\n");
@@ -6832,14 +6824,6 @@ int cik_irq_set(struct radeon_device *rdev)
 		hpd6 |= DC_HPDx_INT_EN;
 	}
 
-	if (rdev->irq.dpm_thermal) {
-		DRM_DEBUG("dpm thermal\n");
-		if (rdev->flags & RADEON_IS_IGP)
-			thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK;
-		else
-			thermal_int |= THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW;
-	}
-
 	WREG32(CP_INT_CNTL_RING0, cp_int_cntl);
 
 	WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, dma_cntl);
@@ -6893,11 +6877,6 @@ int cik_irq_set(struct radeon_device *rdev)
 	WREG32(DC_HPD5_INT_CONTROL, hpd5);
 	WREG32(DC_HPD6_INT_CONTROL, hpd6);
 
-	if (rdev->flags & RADEON_IS_IGP)
-		WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int);
-	else
-		WREG32_SMC(CG_THERMAL_INT, thermal_int);
-
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 8fcc491..c8372ef 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -1121,6 +1121,19 @@ void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable)
 	}
 }
 
+static void kv_enable_thermal_int(struct radeon_device *rdev, bool enable)
+{
+	u32 thermal_int;
+
+	thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL);
+	if (enable)
+		thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK;
+	else
+		thermal_int &= ~(THERM_INTH_MASK | THERM_INTL_MASK);
+	WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int);
+
+}
+
 int kv_dpm_enable(struct radeon_device *rdev)
 {
 	struct kv_power_info *pi = kv_get_pi(rdev);
@@ -1222,8 +1235,7 @@ int kv_dpm_enable(struct radeon_device *rdev)
 			DRM_ERROR("kv_set_thermal_temperature_range failed\n");
 			return ret;
 		}
-		rdev->irq.dpm_thermal = true;
-		radeon_irq_set(rdev);
+		kv_enable_thermal_int(rdev, true);
 	}
 
 	ret = kv_smc_bapm_enable(rdev, false);
@@ -1269,6 +1281,7 @@ void kv_dpm_disable(struct radeon_device *rdev)
 	kv_stop_dpm(rdev);
 	kv_enable_ulv(rdev, false);
 	kv_reset_am(rdev);
+	kv_enable_thermal_int(rdev, false);
 
 	kv_update_current_ps(rdev, rdev->pm.dpm.boot_ps);
 }
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 079/143] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (77 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 078/143] drm/radeon: only enable kv/kb dpm interrupts once v3 Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 080/143] cpufreq: speedstep-smi: enable interrupts when waiting Kamal Mostafa
                   ` (63 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Trond Myklebust, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit d8ba1f971497c19cf80da1ea5391a46a5f9fbd41 upstream.

If the call to decode_rc_list() fails due to a memory allocation error,
then we need to truncate the array size to ensure that we only call
kfree() on those pointer that were allocated.

Reported-by: David Ramos <daramos@stanford.edu>
Fixes: 4aece6a19cf7f ("nfs41: cb_sequence xdr implementation")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/nfs/callback_xdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index f4ccfe6..02f8d09 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
 
 		for (i = 0; i < args->csa_nrclists; i++) {
 			status = decode_rc_list(xdr, &args->csa_rclists[i]);
-			if (status)
+			if (status) {
+				args->csa_nrclists = i;
 				goto out_free;
+			}
 		}
 	}
 	status = 0;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 080/143] cpufreq: speedstep-smi: enable interrupts when waiting
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (78 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 079/143] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 081/143] mm/hugetlb: pmd_huge() returns true for non-present hugepage Kamal Mostafa
                   ` (62 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rafael J. Wysocki, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit d4d4eda23794c701442e55129dd4f8f2fefd5e4d upstream.

On Dell Latitude C600 laptop with Pentium 3 850MHz processor, the
speedstep-smi driver sometimes loads and sometimes doesn't load with
"change to state X failed" message.

The hardware sometimes refuses to change frequency and in this case, we
need to retry later. I found out that we need to enable interrupts while
waiting. When we enable interrupts, the hardware blockage that prevents
frequency transition resolves and the transition is possible. With
disabled interrupts, the blockage doesn't resolve (no matter how long do
we wait). The exact reasons for this hardware behavior are unknown.

This patch enables interrupts in the function speedstep_set_state that can
be called with disabled interrupts. However, this function is called with
disabled interrupts only from speedstep_get_freqs, so it shouldn't cause
any problem.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/cpufreq/speedstep-lib.c |  3 +++
 drivers/cpufreq/speedstep-smi.c | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
index 7047821..4ab7a21 100644
--- a/drivers/cpufreq/speedstep-lib.c
+++ b/drivers/cpufreq/speedstep-lib.c
@@ -400,6 +400,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor,
 
 	pr_debug("previous speed is %u\n", prev_speed);
 
+	preempt_disable();
 	local_irq_save(flags);
 
 	/* switch to low state */
@@ -464,6 +465,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor,
 
 out:
 	local_irq_restore(flags);
+	preempt_enable();
+
 	return ret;
 }
 EXPORT_SYMBOL_GPL(speedstep_get_freqs);
diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c
index 0f5326d..34bd13c 100644
--- a/drivers/cpufreq/speedstep-smi.c
+++ b/drivers/cpufreq/speedstep-smi.c
@@ -188,6 +188,7 @@ static void speedstep_set_state(unsigned int state)
 		return;
 
 	/* Disable IRQs */
+	preempt_disable();
 	local_irq_save(flags);
 
 	command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
@@ -198,9 +199,19 @@ static void speedstep_set_state(unsigned int state)
 
 	do {
 		if (retry) {
+			/*
+			 * We need to enable interrupts, otherwise the blockage
+			 * won't resolve.
+			 *
+			 * We disable preemption so that other processes don't
+			 * run. If other processes were running, they could
+			 * submit more DMA requests, making the blockage worse.
+			 */
 			pr_debug("retry %u, previous result %u, waiting...\n",
 					retry, result);
+			local_irq_enable();
 			mdelay(retry * 50);
+			local_irq_disable();
 		}
 		retry++;
 		__asm__ __volatile__(
@@ -217,6 +228,7 @@ static void speedstep_set_state(unsigned int state)
 
 	/* enable IRQs */
 	local_irq_restore(flags);
+	preempt_enable();
 
 	if (new_state == state)
 		pr_debug("change to %u MHz succeeded after %u tries "
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 081/143] mm/hugetlb: pmd_huge() returns true for non-present hugepage
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (79 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 080/143] cpufreq: speedstep-smi: enable interrupts when waiting Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 082/143] mm: cleanup follow_page_mask() Kamal Mostafa
                   ` (61 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Hugh Dickins, James Hogan, David Rientjes,
	Mel Gorman, Johannes Weiner, Michal Hocko, Rik van Riel,
	Andrea Arcangeli, Luiz Capitulino, Nishanth Aravamudan,
	Lee Schermerhorn, Steve Capper, Andrew Morton, Linus Torvalds,
	Luis Henriques, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit cbef8478bee55775ac312a574aad48af7bb9cf9f upstream.

Migrating hugepages and hwpoisoned hugepages are considered as non-present
hugepages, and they are referenced via migration entries and hwpoison
entries in their page table slots.

This behavior causes race condition because pmd_huge() doesn't tell
non-huge pages from migrating/hwpoisoned hugepages.  follow_page_mask() is
one example where the kernel would call follow_page_pte() for such
hugepage while this function is supposed to handle only normal pages.

To avoid this, this patch makes pmd_huge() return true when pmd_none() is
true *and* pmd_present() is false.  We don't have to worry about mixing up
non-present pmd entry with normal pmd (pointing to leaf level pte entry)
because pmd_present() is true in normal pmd.

The same race condition could happen in (x86-specific) gup_pmd_range(),
where this patch simply adds pmd_present() check instead of pmd_huge().
This is because gup_pmd_range() is fast path.  If we have non-present
hugepage in this function, we will go into gup_huge_pmd(), then return 0
at flag mask check, and finally fall back to the slow path.

Fixes: 290408d4a2 ("hugetlb: hugepage migration core")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/mm/gup.c         | 2 +-
 arch/x86/mm/hugetlbpage.c | 8 +++++++-
 mm/hugetlb.c              | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 0596e8e..5bb7b36 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -172,7 +172,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
 		 */
 		if (pmd_none(pmd) || pmd_trans_splitting(pmd))
 			return 0;
-		if (unlikely(pmd_large(pmd))) {
+		if (unlikely(pmd_large(pmd) || !pmd_present(pmd))) {
 			/*
 			 * NUMA hinting faults need to be handled in the GUP
 			 * slowpath for accounting purposes and so that they
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index fa029fb..e473dbe 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -66,9 +66,15 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
 	return ERR_PTR(-EINVAL);
 }
 
+/*
+ * pmd_huge() returns 1 if @pmd is hugetlb related entry, that is normal
+ * hugetlb entry or non-present (migration or hwpoisoned) hugetlb entry.
+ * Otherwise, returns 0.
+ */
 int pmd_huge(pmd_t pmd)
 {
-	return !!(pmd_val(pmd) & _PAGE_PSE);
+	return !pmd_none(pmd) &&
+		(pmd_val(pmd) & (_PAGE_PRESENT|_PAGE_PSE)) != _PAGE_PRESENT;
 }
 
 int pud_huge(pud_t pud)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index d821a7e..2a9e991 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3441,6 +3441,8 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 {
 	struct page *page;
 
+	if (!pmd_present(*pmd))
+		return NULL;
 	page = pte_page(*(pte_t *)pmd);
 	if (page)
 		page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 082/143] mm: cleanup follow_page_mask()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (80 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 081/143] mm/hugetlb: pmd_huge() returns true for non-present hugepage Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 083/143] mm/hugetlb: take page table lock in follow_huge_pmd() Kamal Mostafa
                   ` (60 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kirill A. Shutemov, Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

commit 69e68b4f03135da4a09d1215a3942d7dabd1075b upstream.

Cleanups:
 - move pte-related code to separate function. It's about half of the
   function;
 - get rid of some goto-logic;
 - use 'return NULL' instead of 'return page' where page can only be
   NULL;

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ kamal: applied to mm/memory.c as 3.13-stable prereq for
  e66f17f mm/hugetlb: take page table lock in follow_huge_pmd() ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/memory.c | 231 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 119 insertions(+), 112 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 9ddabd0..b7785d4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1440,105 +1440,35 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
 }
 EXPORT_SYMBOL_GPL(zap_vma_ptes);
 
-/**
- * follow_page_mask - look up a page descriptor from a user-virtual address
- * @vma: vm_area_struct mapping @address
- * @address: virtual address to look up
- * @flags: flags modifying lookup behaviour
- * @page_mask: on output, *page_mask is set according to the size of the page
- *
- * @flags can have FOLL_ flags set, defined in <linux/mm.h>
- *
- * Returns the mapped (struct page *), %NULL if no mapping exists, or
- * an error pointer if there is a mapping to something not represented
- * by a page descriptor (see also vm_normal_page()).
- */
-struct page *follow_page_mask(struct vm_area_struct *vma,
-			      unsigned long address, unsigned int flags,
-			      unsigned int *page_mask)
+static struct page *no_page_table(struct vm_area_struct *vma,
+		unsigned int flags)
 {
-	pgd_t *pgd;
-	pud_t *pud;
-	pmd_t *pmd;
-	pte_t *ptep, pte;
-	spinlock_t *ptl;
-	struct page *page;
-	struct mm_struct *mm = vma->vm_mm;
-
-	*page_mask = 0;
-
-	page = follow_huge_addr(mm, address, flags & FOLL_WRITE);
-	if (!IS_ERR(page)) {
-		BUG_ON(flags & FOLL_GET);
-		goto out;
-	}
-
-	page = NULL;
-	pgd = pgd_offset(mm, address);
-	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
-		goto no_page_table;
+	/*
+	 * When core dumping an enormous anonymous area that nobody
+	 * has touched so far, we don't want to allocate unnecessary pages or
+	 * page tables.  Return error instead of NULL to skip handle_mm_fault,
+	 * then get_dump_page() will return NULL to leave a hole in the dump.
+	 * But we can only make this optimization where a hole would surely
+	 * be zero-filled if handle_mm_fault() actually did handle it.
+	 */
+	if ((flags & FOLL_DUMP) && (!vma->vm_ops || !vma->vm_ops->fault))
+		return ERR_PTR(-EFAULT);
+	return NULL;
+}
 
-	pud = pud_offset(pgd, address);
-	if (pud_none(*pud))
-		goto no_page_table;
-	if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
-		if (flags & FOLL_GET)
-			goto out;
-		page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE);
-		goto out;
-	}
-	if (unlikely(pud_bad(*pud)))
-		goto no_page_table;
+static struct page *follow_page_pte(struct vm_area_struct *vma,
+		unsigned long address, pmd_t *pmd, unsigned int flags)
+{
+	struct mm_struct *mm = vma->vm_mm;
+	struct page *page;
+	spinlock_t *ptl;
+	pte_t *ptep, pte;
 
-	pmd = pmd_offset(pud, address);
-	if (pmd_none(*pmd))
-		goto no_page_table;
-	if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) {
-		page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE);
-		if (flags & FOLL_GET) {
-			/*
-			 * Refcount on tail pages are not well-defined and
-			 * shouldn't be taken. The caller should handle a NULL
-			 * return when trying to follow tail pages.
-			 */
-			if (PageHead(page))
-				get_page(page);
-			else {
-				page = NULL;
-				goto out;
-			}
-		}
-		goto out;
-	}
-	if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
-		goto no_page_table;
-	if (pmd_trans_huge(*pmd)) {
-		if (flags & FOLL_SPLIT) {
-			split_huge_page_pmd(vma, address, pmd);
-			goto split_fallthrough;
-		}
-		ptl = pmd_lock(mm, pmd);
-		if (likely(pmd_trans_huge(*pmd))) {
-			if (unlikely(pmd_trans_splitting(*pmd))) {
-				spin_unlock(ptl);
-				wait_split_huge_page(vma->anon_vma, pmd);
-			} else {
-				page = follow_trans_huge_pmd(vma, address,
-							     pmd, flags);
-				spin_unlock(ptl);
-				*page_mask = HPAGE_PMD_NR - 1;
-				goto out;
-			}
-		} else
-			spin_unlock(ptl);
-		/* fall through */
-	}
-split_fallthrough:
+retry:
 	if (unlikely(pmd_bad(*pmd)))
-		goto no_page_table;
+		return no_page_table(vma, flags);
 
 	ptep = pte_offset_map_lock(mm, pmd, address, &ptl);
-
 	pte = *ptep;
 	if (!pte_present(pte)) {
 		swp_entry_t entry;
@@ -1556,12 +1486,14 @@ split_fallthrough:
 			goto no_page;
 		pte_unmap_unlock(ptep, ptl);
 		migration_entry_wait(mm, pmd, address);
-		goto split_fallthrough;
+		goto retry;
 	}
 	if ((flags & FOLL_NUMA) && pte_numa(pte))
 		goto no_page;
-	if ((flags & FOLL_WRITE) && !pte_write(pte))
-		goto unlock;
+	if ((flags & FOLL_WRITE) && !pte_write(pte)) {
+		pte_unmap_unlock(ptep, ptl);
+		return NULL;
+	}
 
 	page = vm_normal_page(vma, address, pte);
 	if (unlikely(!page)) {
@@ -1606,11 +1538,8 @@ split_fallthrough:
 			unlock_page(page);
 		}
 	}
-unlock:
 	pte_unmap_unlock(ptep, ptl);
-out:
 	return page;
-
 bad_page:
 	pte_unmap_unlock(ptep, ptl);
 	return ERR_PTR(-EFAULT);
@@ -1618,21 +1547,99 @@ bad_page:
 no_page:
 	pte_unmap_unlock(ptep, ptl);
 	if (!pte_none(pte))
+		return NULL;
+	return no_page_table(vma, flags);
+}
+
+/**
+ * follow_page_mask - look up a page descriptor from a user-virtual address
+ * @vma: vm_area_struct mapping @address
+ * @address: virtual address to look up
+ * @flags: flags modifying lookup behaviour
+ * @page_mask: on output, *page_mask is set according to the size of the page
+ *
+ * @flags can have FOLL_ flags set, defined in <linux/mm.h>
+ *
+ * Returns the mapped (struct page *), %NULL if no mapping exists, or
+ * an error pointer if there is a mapping to something not represented
+ * by a page descriptor (see also vm_normal_page()).
+ */
+struct page *follow_page_mask(struct vm_area_struct *vma,
+			      unsigned long address, unsigned int flags,
+			      unsigned int *page_mask)
+{
+	pgd_t *pgd;
+	pud_t *pud;
+	pmd_t *pmd;
+	spinlock_t *ptl;
+	struct page *page;
+	struct mm_struct *mm = vma->vm_mm;
+
+	*page_mask = 0;
+
+	page = follow_huge_addr(mm, address, flags & FOLL_WRITE);
+	if (!IS_ERR(page)) {
+		BUG_ON(flags & FOLL_GET);
 		return page;
+	}
 
-no_page_table:
-	/*
-	 * When core dumping an enormous anonymous area that nobody
-	 * has touched so far, we don't want to allocate unnecessary pages or
-	 * page tables.  Return error instead of NULL to skip handle_mm_fault,
-	 * then get_dump_page() will return NULL to leave a hole in the dump.
-	 * But we can only make this optimization where a hole would surely
-	 * be zero-filled if handle_mm_fault() actually did handle it.
-	 */
-	if ((flags & FOLL_DUMP) &&
-	    (!vma->vm_ops || !vma->vm_ops->fault))
-		return ERR_PTR(-EFAULT);
-	return page;
+	pgd = pgd_offset(mm, address);
+	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
+		return no_page_table(vma, flags);
+
+	pud = pud_offset(pgd, address);
+	if (pud_none(*pud))
+		return no_page_table(vma, flags);
+	if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
+		if (flags & FOLL_GET)
+			return NULL;
+		page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE);
+		return page;
+	}
+	if (unlikely(pud_bad(*pud)))
+		return no_page_table(vma, flags);
+
+	pmd = pmd_offset(pud, address);
+	if (pmd_none(*pmd))
+		return no_page_table(vma, flags);
+	if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) {
+		page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE);
+		if (flags & FOLL_GET) {
+			/*
+			 * Refcount on tail pages are not well-defined and
+			 * shouldn't be taken. The caller should handle a NULL
+			 * return when trying to follow tail pages.
+			 */
+			if (PageHead(page))
+				get_page(page);
+			else
+				page = NULL;
+		}
+		return page;
+	}
+	if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
+		return no_page_table(vma, flags);
+	if (pmd_trans_huge(*pmd)) {
+		if (flags & FOLL_SPLIT) {
+			split_huge_page_pmd(vma, address, pmd);
+			return follow_page_pte(vma, address, pmd, flags);
+		}
+		ptl = pmd_lock(mm, pmd);
+		if (likely(pmd_trans_huge(*pmd))) {
+			if (unlikely(pmd_trans_splitting(*pmd))) {
+				spin_unlock(ptl);
+				wait_split_huge_page(vma->anon_vma, pmd);
+			} else {
+				page = follow_trans_huge_pmd(vma, address,
+							     pmd, flags);
+				spin_unlock(ptl);
+				*page_mask = HPAGE_PMD_NR - 1;
+				return page;
+			}
+		} else
+			spin_unlock(ptl);
+	}
+	return follow_page_pte(vma, address, pmd, flags);
 }
 
 static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 083/143] mm/hugetlb: take page table lock in follow_huge_pmd()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (81 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 082/143] mm: cleanup follow_page_mask() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 084/143] mm/hugetlb: fix getting refcount 0 page in hugetlb_fault() Kamal Mostafa
                   ` (59 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, James Hogan, David Rientjes, Mel Gorman,
	Johannes Weiner, Michal Hocko, Rik van Riel, Andrea Arcangeli,
	Luiz Capitulino, Nishanth Aravamudan, Lee Schermerhorn,
	Steve Capper, Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit e66f17ff71772b209eed39de35aaa99ba819c93d upstream.

We have a race condition between move_pages() and freeing hugepages, where
move_pages() calls follow_page(FOLL_GET) for hugepages internally and
tries to get its refcount without preventing concurrent freeing.  This
race crashes the kernel, so this patch fixes it by moving FOLL_GET code
for hugepages into follow_huge_pmd() with taking the page table lock.

This patch intentionally removes page==NULL check after pte_page.
This is justified because pte_page() never returns NULL for any
architectures or configurations.

This patch changes the behavior of follow_huge_pmd() for tail pages and
then tail pages can be pinned/returned.  So the caller must be changed to
properly handle the returned tail pages.

We could have a choice to add the similar locking to
follow_huge_(addr|pud) for consistency, but it's not necessary because
currently these functions don't support FOLL_GET flag, so let's leave it
for future development.

Here is the reproducer:

  $ cat movepages.c
  #include <stdio.h>
  #include <stdlib.h>
  #include <numaif.h>

  #define ADDR_INPUT      0x700000000000UL
  #define HPS             0x200000
  #define PS              0x1000

  int main(int argc, char *argv[]) {
          int i;
          int nr_hp = strtol(argv[1], NULL, 0);
          int nr_p  = nr_hp * HPS / PS;
          int ret;
          void **addrs;
          int *status;
          int *nodes;
          pid_t pid;

          pid = strtol(argv[2], NULL, 0);
          addrs  = malloc(sizeof(char *) * nr_p + 1);
          status = malloc(sizeof(char *) * nr_p + 1);
          nodes  = malloc(sizeof(char *) * nr_p + 1);

          while (1) {
                  for (i = 0; i < nr_p; i++) {
                          addrs[i] = (void *)ADDR_INPUT + i * PS;
                          nodes[i] = 1;
                          status[i] = 0;
                  }
                  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
                                        MPOL_MF_MOVE_ALL);
                  if (ret == -1)
                          err("move_pages");

                  for (i = 0; i < nr_p; i++) {
                          addrs[i] = (void *)ADDR_INPUT + i * PS;
                          nodes[i] = 0;
                          status[i] = 0;
                  }
                  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
                                        MPOL_MF_MOVE_ALL);
                  if (ret == -1)
                          err("move_pages");
          }
          return 0;
  }

  $ cat hugepage.c
  #include <stdio.h>
  #include <sys/mman.h>
  #include <string.h>

  #define ADDR_INPUT      0x700000000000UL
  #define HPS             0x200000

  int main(int argc, char *argv[]) {
          int nr_hp = strtol(argv[1], NULL, 0);
          char *p;

          while (1) {
                  p = mmap((void *)ADDR_INPUT, nr_hp * HPS, PROT_READ | PROT_WRITE,
                           MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
                  if (p != (void *)ADDR_INPUT) {
                          perror("mmap");
                          break;
                  }
                  memset(p, 0, nr_hp * HPS);
                  munmap(p, nr_hp * HPS);
          }
  }

  $ sysctl vm.nr_hugepages=40
  $ ./hugepage 10 &
  $ ./movepages 10 $(pgrep -f hugepage)

Fixes: e632a938d914 ("mm: migrate: add hugepage migration code to move_pages()")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reported-by: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ kamal: backport to 3.13-stable: applied mm/gup.c change to mm/memory.c ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/hugetlb.h |  8 ++++----
 include/linux/swapops.h |  4 ++++
 mm/hugetlb.c            | 48 ++++++++++++++++++++++++++++++++++--------------
 mm/memory.c             | 25 ++++++++-----------------
 mm/migrate.c            |  5 +++--
 5 files changed, 53 insertions(+), 37 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 5572709..723c75c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -89,9 +89,9 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep);
 struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
 			      int write);
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-				pmd_t *pmd, int write);
+				pmd_t *pmd, int flags);
 struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
-				pud_t *pud, int write);
+				pud_t *pud, int flags);
 int pmd_huge(pmd_t pmd);
 int pud_huge(pud_t pmd);
 unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
@@ -128,8 +128,8 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
 static inline void hugetlb_show_meminfo(void)
 {
 }
-#define follow_huge_pmd(mm, addr, pmd, write)	NULL
-#define follow_huge_pud(mm, addr, pud, write)	NULL
+#define follow_huge_pmd(mm, addr, pmd, flags)	NULL
+#define follow_huge_pud(mm, addr, pud, flags)	NULL
 #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
 #define pmd_huge(x)	0
 #define pud_huge(x)	0
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index c0f7526..d7f3b3f 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -137,6 +137,8 @@ static inline void make_migration_entry_read(swp_entry_t *entry)
 	*entry = swp_entry(SWP_MIGRATION_READ, swp_offset(*entry));
 }
 
+extern void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
+					spinlock_t *ptl);
 extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
 					unsigned long address);
 extern void migration_entry_wait_huge(struct vm_area_struct *vma,
@@ -150,6 +152,8 @@ static inline int is_migration_entry(swp_entry_t swp)
 }
 #define migration_entry_to_page(swp) NULL
 static inline void make_migration_entry_read(swp_entry_t *entryp) { }
+static inline void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
+					spinlock_t *ptl) { }
 static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
 					 unsigned long address) { }
 static inline void migration_entry_wait_huge(struct vm_area_struct *vma,
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2a9e991..f6f1972 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3437,28 +3437,48 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 
 struct page *
 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-		pmd_t *pmd, int write)
+		pmd_t *pmd, int flags)
 {
-	struct page *page;
-
-	if (!pmd_present(*pmd))
-		return NULL;
-	page = pte_page(*(pte_t *)pmd);
-	if (page)
-		page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
+	struct page *page = NULL;
+	spinlock_t *ptl;
+retry:
+	ptl = pmd_lockptr(mm, pmd);
+	spin_lock(ptl);
+	/*
+	 * make sure that the address range covered by this pmd is not
+	 * unmapped from other threads.
+	 */
+	if (!pmd_huge(*pmd))
+		goto out;
+	if (pmd_present(*pmd)) {
+		page = pte_page(*(pte_t *)pmd) +
+			((address & ~PMD_MASK) >> PAGE_SHIFT);
+		if (flags & FOLL_GET)
+			get_page(page);
+	} else {
+		if (is_hugetlb_entry_migration(huge_ptep_get((pte_t *)pmd))) {
+			spin_unlock(ptl);
+			__migration_entry_wait(mm, (pte_t *)pmd, ptl);
+			goto retry;
+		}
+		/*
+		 * hwpoisoned entry is treated as no_page_table in
+		 * follow_page_mask().
+		 */
+	}
+out:
+	spin_unlock(ptl);
 	return page;
 }
 
 struct page *
 follow_huge_pud(struct mm_struct *mm, unsigned long address,
-		pud_t *pud, int write)
+		pud_t *pud, int flags)
 {
-	struct page *page;
+	if (flags & FOLL_GET)
+		return NULL;
 
-	page = pte_page(*(pte_t *)pud);
-	if (page)
-		page += ((address & ~PUD_MASK) >> PAGE_SHIFT);
-	return page;
+	return pte_page(*(pte_t *)pud) + ((address & ~PUD_MASK) >> PAGE_SHIFT);
 }
 
 #else /* !CONFIG_ARCH_WANT_GENERAL_HUGETLB */
diff --git a/mm/memory.c b/mm/memory.c
index b7785d4..7040326 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1591,10 +1591,10 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
 	if (pud_none(*pud))
 		return no_page_table(vma, flags);
 	if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
-		if (flags & FOLL_GET)
-			return NULL;
-		page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE);
-		return page;
+		page = follow_huge_pud(mm, address, pud, flags);
+		if (page)
+			return page;
+		return no_page_table(vma, flags);
 	}
 	if (unlikely(pud_bad(*pud)))
 		return no_page_table(vma, flags);
@@ -1603,19 +1603,10 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
 	if (pmd_none(*pmd))
 		return no_page_table(vma, flags);
 	if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) {
-		page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE);
-		if (flags & FOLL_GET) {
-			/*
-			 * Refcount on tail pages are not well-defined and
-			 * shouldn't be taken. The caller should handle a NULL
-			 * return when trying to follow tail pages.
-			 */
-			if (PageHead(page))
-				get_page(page);
-			else
-				page = NULL;
-		}
-		return page;
+		page = follow_huge_pmd(mm, address, pmd, flags);
+		if (page)
+			return page;
+		return no_page_table(vma, flags);
 	}
 	if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
 		return no_page_table(vma, flags);
diff --git a/mm/migrate.c b/mm/migrate.c
index 62047f8..af1bf18 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -210,7 +210,7 @@ static void remove_migration_ptes(struct page *old, struct page *new)
  * get to the page and wait until migration is finished.
  * When we return from this function the fault will be retried.
  */
-static void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
+void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
 				spinlock_t *ptl)
 {
 	pte_t pte;
@@ -1232,7 +1232,8 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
 			goto put_and_set;
 
 		if (PageHuge(page)) {
-			isolate_huge_page(page, &pagelist);
+			if (PageHead(page))
+				isolate_huge_page(page, &pagelist);
 			goto put_and_set;
 		}
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 084/143] mm/hugetlb: fix getting refcount 0 page in hugetlb_fault()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (82 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 083/143] mm/hugetlb: take page table lock in follow_huge_pmd() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 085/143] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Kamal Mostafa
                   ` (58 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Hugh Dickins, James Hogan, David Rientjes,
	Mel Gorman, Johannes Weiner, Michal Hocko, Rik van Riel,
	Andrea Arcangeli, Luiz Capitulino, Nishanth Aravamudan,
	Lee Schermerhorn, Steve Capper, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit 0f792cf949a0be506c2aa8bfac0605746b146dda upstream.

When running the test which causes the race as shown in the previous patch,
we can hit the BUG "get_page() on refcount 0 page" in hugetlb_fault().

This race happens when pte turns into migration entry just after the first
check of is_hugetlb_entry_migration() in hugetlb_fault() passed with false.
To fix this, we need to check pte_present() again after huge_ptep_get().

This patch also reorders taking ptl and doing pte_page(), because
pte_page() should be done in ptl.  Due to this reordering, we need use
trylock_page() in page != pagecache_page case to respect locking order.

Fixes: 66aebce747ea ("hugetlb: fix race condition in hugetlb_fault()")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.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>
---
 mm/hugetlb.c | 52 ++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 36 insertions(+), 16 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f6f1972..70e6b84 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2923,6 +2923,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 	struct page *pagecache_page = NULL;
 	static DEFINE_MUTEX(hugetlb_instantiation_mutex);
 	struct hstate *h = hstate_vma(vma);
+	int need_wait_lock = 0;
 
 	address &= huge_page_mask(h);
 
@@ -2956,6 +2957,16 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 	ret = 0;
 
 	/*
+	 * entry could be a migration/hwpoison entry at this point, so this
+	 * check prevents the kernel from going below assuming that we have
+	 * a active hugepage in pagecache. This goto expects the 2nd page fault,
+	 * and is_hugetlb_entry_(migration|hwpoisoned) check will properly
+	 * handle it.
+	 */
+	if (!pte_present(entry))
+		goto out_mutex;
+
+	/*
 	 * If we are going to COW the mapping later, we examine the pending
 	 * reservations for this page now. This will ensure that any
 	 * allocations necessary to record that reservation occur outside the
@@ -2974,30 +2985,31 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 								vma, address);
 	}
 
+	ptl = huge_pte_lock(h, mm, ptep);
+
+	/* Check for a racing update before calling hugetlb_cow */
+	if (unlikely(!pte_same(entry, huge_ptep_get(ptep))))
+		goto out_ptl;
+
 	/*
 	 * hugetlb_cow() requires page locks of pte_page(entry) and
 	 * pagecache_page, so here we need take the former one
 	 * when page != pagecache_page or !pagecache_page.
-	 * Note that locking order is always pagecache_page -> page,
-	 * so no worry about deadlock.
 	 */
 	page = pte_page(entry);
-	get_page(page);
 	if (page != pagecache_page)
-		lock_page(page);
-
-	ptl = huge_pte_lockptr(h, mm, ptep);
-	spin_lock(ptl);
-	/* Check for a racing update before calling hugetlb_cow */
-	if (unlikely(!pte_same(entry, huge_ptep_get(ptep))))
-		goto out_ptl;
+		if (!trylock_page(page)) {
+			need_wait_lock = 1;
+			goto out_ptl;
+		}
 
+	get_page(page);
 
 	if (flags & FAULT_FLAG_WRITE) {
 		if (!huge_pte_write(entry)) {
 			ret = hugetlb_cow(mm, vma, address, ptep, entry,
 					pagecache_page, ptl);
-			goto out_ptl;
+			goto out_put_page;
 		}
 		entry = huge_pte_mkdirty(entry);
 	}
@@ -3005,7 +3017,10 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 	if (huge_ptep_set_access_flags(vma, address, ptep, entry,
 						flags & FAULT_FLAG_WRITE))
 		update_mmu_cache(vma, address, ptep);
-
+out_put_page:
+	if (page != pagecache_page)
+		unlock_page(page);
+	put_page(page);
 out_ptl:
 	spin_unlock(ptl);
 
@@ -3013,13 +3028,18 @@ out_ptl:
 		unlock_page(pagecache_page);
 		put_page(pagecache_page);
 	}
-	if (page != pagecache_page)
-		unlock_page(page);
-	put_page(page);
-
 out_mutex:
 	mutex_unlock(&hugetlb_instantiation_mutex);
 
+	/*
+	 * Generally it's safe to hold refcount during waiting page lock. But
+	 * here we just wait to defer the next page fault to avoid busy loop and
+	 * the page is not used after unlocked before returning from the current
+	 * page fault. So we are safe from accessing freed page, even if we wait
+	 * here without taking refcount.
+	 */
+	if (need_wait_lock)
+		wait_on_page_locked(page);
 	return ret;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 085/143] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (83 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 084/143] mm/hugetlb: fix getting refcount 0 page in hugetlb_fault() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 086/143] mm/hugetlb: add migration entry check in __unmap_hugepage_range Kamal Mostafa
                   ` (57 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Hugh Dickins, James Hogan, David Rientjes,
	Mel Gorman, Johannes Weiner, Michal Hocko, Rik van Riel,
	Andrea Arcangeli, Luiz Capitulino, Nishanth Aravamudan,
	Lee Schermerhorn, Steve Capper, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit a8bda28d87c38c6aa93de28ba5d30cc18e865a11 upstream.

There is a race condition between hugepage migration and
change_protection(), where hugetlb_change_protection() doesn't care about
migration entries and wrongly overwrites them.  That causes unexpected
results like kernel crash.  HWPoison entries also can cause the same
problem.

This patch adds is_hugetlb_entry_(migration|hwpoisoned) check in this
function to do proper actions.

Fixes: 290408d4a2 ("hugetlb: hugepage migration core")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.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>
---
 mm/hugetlb.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 70e6b84..1728087 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3168,7 +3168,26 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
 			spin_unlock(ptl);
 			continue;
 		}
-		if (!huge_pte_none(huge_ptep_get(ptep))) {
+		pte = huge_ptep_get(ptep);
+		if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+			spin_unlock(ptl);
+			continue;
+		}
+		if (unlikely(is_hugetlb_entry_migration(pte))) {
+			swp_entry_t entry = pte_to_swp_entry(pte);
+
+			if (is_write_migration_entry(entry)) {
+				pte_t newpte;
+
+				make_migration_entry_read(&entry);
+				newpte = swp_entry_to_pte(entry);
+				set_huge_pte_at(mm, address, ptep, newpte);
+				pages++;
+			}
+			spin_unlock(ptl);
+			continue;
+		}
+		if (!huge_pte_none(pte)) {
 			pte = huge_ptep_get_and_clear(mm, address, ptep);
 			pte = pte_mkhuge(huge_pte_modify(pte, newprot));
 			pte = arch_make_huge_pte(pte, vma, NULL, 0);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 086/143] mm/hugetlb: add migration entry check in __unmap_hugepage_range
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (84 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 085/143] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 087/143] mm: softdirty: unmapped addresses between VMAs are clean Kamal Mostafa
                   ` (56 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Hugh Dickins, James Hogan, David Rientjes,
	Mel Gorman, Johannes Weiner, Michal Hocko, Rik van Riel,
	Andrea Arcangeli, Luiz Capitulino, Nishanth Aravamudan,
	Lee Schermerhorn, Steve Capper, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit 9fbc1f635fd0bd28cb32550211bf095753ac637a upstream.

If __unmap_hugepage_range() tries to unmap the address range over which
hugepage migration is on the way, we get the wrong page because pte_page()
doesn't work for migration entries.  This patch simply clears the pte for
migration entries as we do for hwpoison entries.

Fixes: 290408d4a2 ("hugetlb: hugepage migration core")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.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>
---
 mm/hugetlb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1728087..a716aac 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2473,9 +2473,10 @@ again:
 			goto unlock;
 
 		/*
-		 * HWPoisoned hugepage is already unmapped and dropped reference
+		 * Migrating hugepage or HWPoisoned hugepage is already
+		 * unmapped and its refcount is dropped, so just clear pte here.
 		 */
-		if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+		if (unlikely(!pte_present(pte))) {
 			huge_pte_clear(mm, address, ptep);
 			goto unlock;
 		}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 087/143] mm: softdirty: unmapped addresses between VMAs are clean
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (85 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 086/143] mm/hugetlb: add migration entry check in __unmap_hugepage_range Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 088/143] proc/pagemap: walk page tables under pte lock Kamal Mostafa
                   ` (55 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Feiner, Kirill A. Shutemov, Cyrill Gorcunov,
	Pavel Emelyanov, Jamie Liu, Hugh Dickins, Naoya Horiguchi,
	Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Peter Feiner <pfeiner@google.com>

commit 81d0fa623c5b8dbd5279d9713094b0f9b0a00fb4 upstream.

If a /proc/pid/pagemap read spans a [VMA, an unmapped region, then a
VM_SOFTDIRTY VMA], the virtual pages in the unmapped region are reported
as softdirty.  Here's a program to demonstrate the bug:

int main() {
	const uint64_t PAGEMAP_SOFTDIRTY = 1ul << 55;
	uint64_t pme[3];
	int fd = open("/proc/self/pagemap", O_RDONLY);;
	char *m = mmap(NULL, 3 * getpagesize(), PROT_READ,
	               MAP_ANONYMOUS | MAP_SHARED, -1, 0);
	munmap(m + getpagesize(), getpagesize());
	pread(fd, pme, 24, (unsigned long) m / getpagesize() * 8);
	assert(pme[0] & PAGEMAP_SOFTDIRTY);    /* passes */
	assert(!(pme[1] & PAGEMAP_SOFTDIRTY)); /* fails */
	assert(pme[2] & PAGEMAP_SOFTDIRTY);    /* passes */
	return 0;
}

(Note that all pages in new VMAs are softdirty until cleared).

Tested:
	Used the program given above. I'm going to include this code in
	a selftest in the future.

[n-horiguchi@ah.jp.nec.com: prevent pagemap_pte_range() from overrunning]
Signed-off-by: Peter Feiner <pfeiner@google.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Jamie Liu <jamieliu@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ kamal: 3.13-stable prereq for
  05fbf35 proc/pagemap: walk page tables under pte lock ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/proc/task_mmu.c | 61 +++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 21 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 8f78819..396a204 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -994,7 +994,6 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 	spinlock_t *ptl;
 	pte_t *pte;
 	int err = 0;
-	pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2));
 
 	/* find the first VMA at or above 'addr' */
 	vma = find_vma(walk->mm, addr);
@@ -1008,6 +1007,7 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 
 		for (; addr != end; addr += PAGE_SIZE) {
 			unsigned long offset;
+			pagemap_entry_t pme;
 
 			offset = (addr & ~PAGEMAP_WALK_MASK) >>
 					PAGE_SHIFT;
@@ -1022,32 +1022,51 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 
 	if (pmd_trans_unstable(pmd))
 		return 0;
-	for (; addr != end; addr += PAGE_SIZE) {
-		int flags2;
-
-		/* check to see if we've left 'vma' behind
-		 * and need a new, higher one */
-		if (vma && (addr >= vma->vm_end)) {
-			vma = find_vma(walk->mm, addr);
-			if (vma && (vma->vm_flags & VM_SOFTDIRTY))
-				flags2 = __PM_SOFT_DIRTY;
-			else
-				flags2 = 0;
-			pme = make_pme(PM_NOT_PRESENT(pm->v2) | PM_STATUS2(pm->v2, flags2));
+
+	while (1) {
+		/* End of address space hole, which we mark as non-present. */
+		unsigned long hole_end;
+
+		if (vma)
+			hole_end = min(end, vma->vm_start);
+		else
+			hole_end = end;
+
+		for (; addr < hole_end; addr += PAGE_SIZE) {
+			pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2));
+
+			err = add_to_pagemap(addr, &pme, pm);
+			if (err)
+				return err;
 		}
 
-		/* check that 'vma' actually covers this address,
-		 * and that it isn't a huge page vma */
-		if (vma && (vma->vm_start <= addr) &&
-		    !is_vm_hugetlb_page(vma)) {
+		if (!vma || vma->vm_start >= end)
+			break;
+		/*
+		 * We can't possibly be in a hugetlb VMA. In general,
+		 * for a mm_walk with a pmd_entry and a hugetlb_entry,
+		 * the pmd_entry can only be called on addresses in a
+		 * hugetlb if the walk starts in a non-hugetlb VMA and
+		 * spans a hugepage VMA. Since pagemap_read walks are
+		 * PMD-sized and PMD-aligned, this will never be true.
+		 */
+		BUG_ON(is_vm_hugetlb_page(vma));
+
+		/* Addresses in the VMA. */
+		for (; addr < min(end, vma->vm_end); addr += PAGE_SIZE) {
+			pagemap_entry_t pme;
 			pte = pte_offset_map(pmd, addr);
 			pte_to_pagemap_entry(&pme, pm, vma, addr, *pte);
-			/* unmap before userspace copy */
 			pte_unmap(pte);
+			err = add_to_pagemap(addr, &pme, pm);
+			if (err)
+				return err;
 		}
-		err = add_to_pagemap(addr, &pme, pm);
-		if (err)
-			return err;
+
+		if (addr == end)
+			break;
+
+		vma = find_vma(walk->mm, addr);
 	}
 
 	cond_resched();
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 088/143] proc/pagemap: walk page tables under pte lock
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (86 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 087/143] mm: softdirty: unmapped addresses between VMAs are clean Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 089/143] mm: when stealing freepages, also take pages created by splitting buddy page Kamal Mostafa
                   ` (54 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Konstantin Khlebnikov, Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

commit 05fbf357d94152171bc50f8a369390f1f16efd89 upstream.

Lockless access to pte in pagemap_pte_range() might race with page
migration and trigger BUG_ON(!PageLocked()) in migration_entry_to_page():

CPU A (pagemap)                           CPU B (migration)
                                          lock_page()
                                          try_to_unmap(page, TTU_MIGRATION...)
                                               make_migration_entry()
                                               set_pte_at()
<read *pte>
pte_to_pagemap_entry()
                                          remove_migration_ptes()
                                          unlock_page()
    if(is_migration_entry())
        migration_entry_to_page()
            BUG_ON(!PageLocked(page))

Also lockless read might be non-atomic if pte is larger than wordsize.
Other pte walkers (smaps, numa_maps, clear_refs) already lock ptes.

Fixes: 052fb0d635df ("proc: report file/anon bit in /proc/pid/pagemap")
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Reported-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/proc/task_mmu.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 396a204..903c19f 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -992,7 +992,7 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 	struct vm_area_struct *vma;
 	struct pagemapread *pm = walk->private;
 	spinlock_t *ptl;
-	pte_t *pte;
+	pte_t *pte, *orig_pte;
 	int err = 0;
 
 	/* find the first VMA at or above 'addr' */
@@ -1053,15 +1053,19 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
 		BUG_ON(is_vm_hugetlb_page(vma));
 
 		/* Addresses in the VMA. */
-		for (; addr < min(end, vma->vm_end); addr += PAGE_SIZE) {
+		orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
+		for (; addr < min(end, vma->vm_end); pte++, addr += PAGE_SIZE) {
 			pagemap_entry_t pme;
-			pte = pte_offset_map(pmd, addr);
+
 			pte_to_pagemap_entry(&pme, pm, vma, addr, *pte);
-			pte_unmap(pte);
 			err = add_to_pagemap(addr, &pme, pm);
 			if (err)
-				return err;
+				break;
 		}
+		pte_unmap_unlock(orig_pte, ptl);
+
+		if (err)
+			return err;
 
 		if (addr == end)
 			break;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 089/143] mm: when stealing freepages, also take pages created by splitting buddy page
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (87 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 088/143] proc/pagemap: walk page tables under pte lock Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 090/143] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Kamal Mostafa
                   ` (53 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vlastimil Babka, Zhang Yanfei, David Rientjes, Rik van Riel,
	Aneesh Kumar K.V, Kirill A. Shutemov, Johannes Weiner,
	Joonsoo Kim, Michal Hocko, KOSAKI Motohiro, Andrew Morton,
	Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Vlastimil Babka <vbabka@suse.cz>

commit 99592d598eca62bdbbf62b59941c189176dfc614 upstream.

When studying page stealing, I noticed some weird looking decisions in
try_to_steal_freepages().  The first I assume is a bug (Patch 1), the
following two patches were driven by evaluation.

Testing was done with stress-highalloc of mmtests, using the
mm_page_alloc_extfrag tracepoint and postprocessing to get counts of how
often page stealing occurs for individual migratetypes, and what
migratetypes are used for fallbacks.  Arguably, the worst case of page
stealing is when UNMOVABLE allocation steals from MOVABLE pageblock.
RECLAIMABLE allocation stealing from MOVABLE allocation is also not ideal,
so the goal is to minimize these two cases.

The evaluation of v2 wasn't always clear win and Joonsoo questioned the
results.  Here I used different baseline which includes RFC compaction
improvements from [1].  I found that the compaction improvements reduce
variability of stress-highalloc, so there's less noise in the data.

First, let's look at stress-highalloc configured to do sync compaction,
and how these patches reduce page stealing events during the test.  First
column is after fresh reboot, other two are reiterations of test without
reboot.  That was all accumulater over 5 re-iterations (so the benchmark
was run 5x3 times with 5 fresh restarts).

Baseline:

                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                  5-nothp-1       5-nothp-2       5-nothp-3
Page alloc extfrag event                               10264225     8702233    10244125
Extfrag fragmenting                                    10263271     8701552    10243473
Extfrag fragmenting for unmovable                         13595       17616       15960
Extfrag fragmenting unmovable placed with movable          7989       12193        8447
Extfrag fragmenting for reclaimable                         658        1840        1817
Extfrag fragmenting reclaimable placed with movable         558        1677        1679
Extfrag fragmenting for movable                        10249018     8682096    10225696

With Patch 1:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                  6-nothp-1       6-nothp-2       6-nothp-3
Page alloc extfrag event                               11834954     9877523     9774860
Extfrag fragmenting                                    11833993     9876880     9774245
Extfrag fragmenting for unmovable                          7342       16129       11712
Extfrag fragmenting unmovable placed with movable          4191       10547        6270
Extfrag fragmenting for reclaimable                         373        1130         923
Extfrag fragmenting reclaimable placed with movable         302         906         738
Extfrag fragmenting for movable                        11826278     9859621     9761610

With Patch 2:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                  7-nothp-1       7-nothp-2       7-nothp-3
Page alloc extfrag event                                4725990     3668793     3807436
Extfrag fragmenting                                     4725104     3668252     3806898
Extfrag fragmenting for unmovable                          6678        7974        7281
Extfrag fragmenting unmovable placed with movable          2051        3829        4017
Extfrag fragmenting for reclaimable                         429        1208        1278
Extfrag fragmenting reclaimable placed with movable         369         976        1034
Extfrag fragmenting for movable                         4717997     3659070     3798339

With Patch 3:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                  8-nothp-1       8-nothp-2       8-nothp-3
Page alloc extfrag event                                5016183     4700142     3850633
Extfrag fragmenting                                     5015325     4699613     3850072
Extfrag fragmenting for unmovable                          1312        3154        3088
Extfrag fragmenting unmovable placed with movable          1115        2777        2714
Extfrag fragmenting for reclaimable                         437        1193        1097
Extfrag fragmenting reclaimable placed with movable         330         969         879
Extfrag fragmenting for movable                         5013576     4695266     3845887

In v2 we've seen apparent regression with Patch 1 for unmovable events,
this is now gone, suggesting it was indeed noise.  Here, each patch
improves the situation for unmovable events.  Reclaimable is improved by
patch 1 and then either the same modulo noise, or perhaps sligtly worse -
a small price for unmovable improvements, IMHO.  The number of movable
allocations falling back to other migratetypes is most noisy, but it's
reduced to half at Patch 2 nevertheless.  These are least critical as
compaction can move them around.

If we look at success rates, the patches don't affect them, that didn't change.

Baseline:
                             3.19-rc4              3.19-rc4              3.19-rc4
                            5-nothp-1             5-nothp-2             5-nothp-3
Success 1 Min         49.00 (  0.00%)       42.00 ( 14.29%)       41.00 ( 16.33%)
Success 1 Mean        51.00 (  0.00%)       45.00 ( 11.76%)       42.60 ( 16.47%)
Success 1 Max         55.00 (  0.00%)       51.00 (  7.27%)       46.00 ( 16.36%)
Success 2 Min         53.00 (  0.00%)       47.00 ( 11.32%)       44.00 ( 16.98%)
Success 2 Mean        59.60 (  0.00%)       50.80 ( 14.77%)       48.20 ( 19.13%)
Success 2 Max         64.00 (  0.00%)       56.00 ( 12.50%)       52.00 ( 18.75%)
Success 3 Min         84.00 (  0.00%)       82.00 (  2.38%)       78.00 (  7.14%)
Success 3 Mean        85.60 (  0.00%)       82.80 (  3.27%)       79.40 (  7.24%)
Success 3 Max         86.00 (  0.00%)       83.00 (  3.49%)       80.00 (  6.98%)

Patch 1:
                             3.19-rc4              3.19-rc4              3.19-rc4
                            6-nothp-1             6-nothp-2             6-nothp-3
Success 1 Min         49.00 (  0.00%)       44.00 ( 10.20%)       44.00 ( 10.20%)
Success 1 Mean        51.80 (  0.00%)       46.00 ( 11.20%)       45.80 ( 11.58%)
Success 1 Max         54.00 (  0.00%)       49.00 (  9.26%)       49.00 (  9.26%)
Success 2 Min         58.00 (  0.00%)       49.00 ( 15.52%)       48.00 ( 17.24%)
Success 2 Mean        60.40 (  0.00%)       51.80 ( 14.24%)       50.80 ( 15.89%)
Success 2 Max         63.00 (  0.00%)       54.00 ( 14.29%)       55.00 ( 12.70%)
Success 3 Min         84.00 (  0.00%)       81.00 (  3.57%)       79.00 (  5.95%)
Success 3 Mean        85.00 (  0.00%)       81.60 (  4.00%)       79.80 (  6.12%)
Success 3 Max         86.00 (  0.00%)       82.00 (  4.65%)       82.00 (  4.65%)

Patch 2:

                             3.19-rc4              3.19-rc4              3.19-rc4
                            7-nothp-1             7-nothp-2             7-nothp-3
Success 1 Min         50.00 (  0.00%)       44.00 ( 12.00%)       39.00 ( 22.00%)
Success 1 Mean        52.80 (  0.00%)       45.60 ( 13.64%)       42.40 ( 19.70%)
Success 1 Max         55.00 (  0.00%)       46.00 ( 16.36%)       47.00 ( 14.55%)
Success 2 Min         52.00 (  0.00%)       48.00 (  7.69%)       45.00 ( 13.46%)
Success 2 Mean        53.40 (  0.00%)       49.80 (  6.74%)       48.80 (  8.61%)
Success 2 Max         57.00 (  0.00%)       52.00 (  8.77%)       52.00 (  8.77%)
Success 3 Min         84.00 (  0.00%)       81.00 (  3.57%)       79.00 (  5.95%)
Success 3 Mean        85.00 (  0.00%)       82.40 (  3.06%)       79.60 (  6.35%)
Success 3 Max         86.00 (  0.00%)       83.00 (  3.49%)       80.00 (  6.98%)

Patch 3:
                             3.19-rc4              3.19-rc4              3.19-rc4
                            8-nothp-1             8-nothp-2             8-nothp-3
Success 1 Min         46.00 (  0.00%)       44.00 (  4.35%)       42.00 (  8.70%)
Success 1 Mean        50.20 (  0.00%)       45.60 (  9.16%)       44.00 ( 12.35%)
Success 1 Max         52.00 (  0.00%)       47.00 (  9.62%)       47.00 (  9.62%)
Success 2 Min         53.00 (  0.00%)       49.00 (  7.55%)       48.00 (  9.43%)
Success 2 Mean        55.80 (  0.00%)       50.60 (  9.32%)       49.00 ( 12.19%)
Success 2 Max         59.00 (  0.00%)       52.00 ( 11.86%)       51.00 ( 13.56%)
Success 3 Min         84.00 (  0.00%)       80.00 (  4.76%)       79.00 (  5.95%)
Success 3 Mean        85.40 (  0.00%)       81.60 (  4.45%)       80.40 (  5.85%)
Success 3 Max         87.00 (  0.00%)       83.00 (  4.60%)       82.00 (  5.75%)

While there's no improvement here, I consider reduced fragmentation events
to be worth on its own.  Patch 2 also seems to reduce scanning for free
pages, and migrations in compaction, suggesting it has somewhat less work
to do:

Patch 1:

Compaction stalls                 4153        3959        3978
Compaction success                1523        1441        1446
Compaction failures               2630        2517        2531
Page migrate success           4600827     4943120     5104348
Page migrate failure             19763       16656       17806
Compaction pages isolated      9597640    10305617    10653541
Compaction migrate scanned    77828948    86533283    87137064
Compaction free scanned      517758295   521312840   521462251
Compaction cost                   5503        5932        6110

Patch 2:

Compaction stalls                 3800        3450        3518
Compaction success                1421        1316        1317
Compaction failures               2379        2134        2201
Page migrate success           4160421     4502708     4752148
Page migrate failure             19705       14340       14911
Compaction pages isolated      8731983     9382374     9910043
Compaction migrate scanned    98362797    96349194    98609686
Compaction free scanned      496512560   469502017   480442545
Compaction cost                   5173        5526        5811

As with v2, /proc/pagetypeinfo appears unaffected with respect to numbers
of unmovable and reclaimable pageblocks.

Configuring the benchmark to allocate like THP page fault (i.e.  no sync
compaction) gives much noisier results for iterations 2 and 3 after
reboot.  This is not so surprising given how [1] offers lower improvements
in this scenario due to less restarts after deferred compaction which
would change compaction pivot.

Baseline:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                    5-thp-1         5-thp-2         5-thp-3
Page alloc extfrag event                                8148965     6227815     6646741
Extfrag fragmenting                                     8147872     6227130     6646117
Extfrag fragmenting for unmovable                         10324       12942       15975
Extfrag fragmenting unmovable placed with movable          5972        8495       10907
Extfrag fragmenting for reclaimable                         601        1707        2210
Extfrag fragmenting reclaimable placed with movable         520        1570        2000
Extfrag fragmenting for movable                         8136947     6212481     6627932

Patch 1:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                    6-thp-1         6-thp-2         6-thp-3
Page alloc extfrag event                                8345457     7574471     7020419
Extfrag fragmenting                                     8343546     7573777     7019718
Extfrag fragmenting for unmovable                         10256       18535       30716
Extfrag fragmenting unmovable placed with movable          6893       11726       22181
Extfrag fragmenting for reclaimable                         465        1208        1023
Extfrag fragmenting reclaimable placed with movable         353         996         843
Extfrag fragmenting for movable                         8332825     7554034     6987979

Patch 2:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                    7-thp-1         7-thp-2         7-thp-3
Page alloc extfrag event                                3512847     3020756     2891625
Extfrag fragmenting                                     3511940     3020185     2891059
Extfrag fragmenting for unmovable                          9017        6892        6191
Extfrag fragmenting unmovable placed with movable          1524        3053        2435
Extfrag fragmenting for reclaimable                         445        1081        1160
Extfrag fragmenting reclaimable placed with movable         375         918         986
Extfrag fragmenting for movable                         3502478     3012212     2883708

Patch 3:
                                                   3.19-rc4        3.19-rc4        3.19-rc4
                                                    8-thp-1         8-thp-2         8-thp-3
Page alloc extfrag event                                3181699     3082881     2674164
Extfrag fragmenting                                     3180812     3082303     2673611
Extfrag fragmenting for unmovable                          1201        4031        4040
Extfrag fragmenting unmovable placed with movable           974        3611        3645
Extfrag fragmenting for reclaimable                         478        1165        1294
Extfrag fragmenting reclaimable placed with movable         387         985        1030
Extfrag fragmenting for movable                         3179133     3077107     2668277

The improvements for first iteration are clear, the rest is much noisier
and can appear like regression for Patch 1.  Anyway, patch 2 rectifies it.

Allocation success rates are again unaffected so there's no point in
making this e-mail any longer.

[1] http://marc.info/?l=linux-mm&m=142166196321125&w=2

This patch (of 3):

When __rmqueue_fallback() is called to allocate a page of order X, it will
find a page of order Y >= X of a fallback migratetype, which is different
from the desired migratetype.  With the help of try_to_steal_freepages(),
it may change the migratetype (to the desired one) also of:

1) all currently free pages in the pageblock containing the fallback page
2) the fallback pageblock itself
3) buddy pages created by splitting the fallback page (when Y > X)

These decisions take the order Y into account, as well as the desired
migratetype, with the goal of preventing multiple fallback allocations
that could e.g.  distribute UNMOVABLE allocations among multiple
pageblocks.

Originally, decision for 1) has implied the decision for 3).  Commit
47118af076f6 ("mm: mmzone: MIGRATE_CMA migration type added") changed that
(probably unintentionally) so that the buddy pages in case 3) are always
changed to the desired migratetype, except for CMA pageblocks.

Commit fef903efcf0c ("mm/page_allo.c: restructure free-page stealing code
and fix a bug") did some refactoring and added a comment that the case of
3) is intended.  Commit 0cbef29a7821 ("mm: __rmqueue_fallback() should
respect pageblock type") removed the comment and tried to restore the
original behavior where 1) implies 3), but due to the previous
refactoring, the result is instead that only 2) implies 3) - and the
conditions for 2) are less frequently met than conditions for 1).  This
may increase fragmentation in situations where the code decides to steal
all free pages from the pageblock (case 1)), but then gives back the buddy
pages produced by splitting.

This patch restores the original intended logic where 1) implies 3).
During testing with stress-highalloc from mmtests, this has shown to
decrease the number of events where UNMOVABLE and RECLAIMABLE allocations
steal from MOVABLE pageblocks, which can lead to permanent fragmentation.
In some cases it has increased the number of events when MOVABLE
allocations steal from UNMOVABLE or RECLAIMABLE pageblocks, but these are
fixable by sync compaction and thus less harmful.

Note that evaluation has shown that the behavior introduced by
47118af076f6 for buddy pages in case 3) is actually even better than the
original logic, so the following patch will introduce it properly once
again.  For stable backports of this patch it makes thus sense to only fix
versions containing 0cbef29a7821.

[iamjoonsoo.kim@lge.com: tracepoint fix]
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.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>
---
 include/trace/events/kmem.h |  7 ++++---
 mm/page_alloc.c             | 12 +++++-------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index aece134..4ad10ba 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -268,11 +268,11 @@ TRACE_EVENT(mm_page_alloc_extfrag,
 
 	TP_PROTO(struct page *page,
 		int alloc_order, int fallback_order,
-		int alloc_migratetype, int fallback_migratetype, int new_migratetype),
+		int alloc_migratetype, int fallback_migratetype),
 
 	TP_ARGS(page,
 		alloc_order, fallback_order,
-		alloc_migratetype, fallback_migratetype, new_migratetype),
+		alloc_migratetype, fallback_migratetype),
 
 	TP_STRUCT__entry(
 		__field(	struct page *,	page			)
@@ -289,7 +289,8 @@ TRACE_EVENT(mm_page_alloc_extfrag,
 		__entry->fallback_order		= fallback_order;
 		__entry->alloc_migratetype	= alloc_migratetype;
 		__entry->fallback_migratetype	= fallback_migratetype;
-		__entry->change_ownership	= (new_migratetype == alloc_migratetype);
+		__entry->change_ownership	= (alloc_migratetype ==
+					get_pageblock_migratetype(page));
 	),
 
 	TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 83a20df..b764a6a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1034,8 +1034,8 @@ static void change_pageblock_range(struct page *pageblock_page,
  * nor move CMA pages to different free lists. We don't want unmovable pages
  * to be allocated from MIGRATE_CMA areas.
  *
- * Returns the new migratetype of the pageblock (or the same old migratetype
- * if it was unchanged).
+ * Returns the allocation migratetype if free pages were stolen, or the
+ * fallback migratetype if it was decided not to steal.
  */
 static int try_to_steal_freepages(struct zone *zone, struct page *page,
 				  int start_type, int fallback_type)
@@ -1064,12 +1064,10 @@ static int try_to_steal_freepages(struct zone *zone, struct page *page,
 
 		/* Claim the whole block if over half of it is free */
 		if (pages >= (1 << (pageblock_order-1)) ||
-				page_group_by_mobility_disabled) {
-
+				page_group_by_mobility_disabled)
 			set_pageblock_migratetype(page, start_type);
-			return start_type;
-		}
 
+		return start_type;
 	}
 
 	return fallback_type;
@@ -1114,7 +1112,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype)
 			       new_type);
 
 			trace_mm_page_alloc_extfrag(page, order, current_order,
-				start_migratetype, migratetype, new_type);
+				start_migratetype, migratetype);
 
 			return page;
 		}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 090/143] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (88 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 089/143] mm: when stealing freepages, also take pages created by splitting buddy page Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 091/143] mm/nommu.c: " Kamal Mostafa
                   ` (52 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roman Gushchin, Andrew Shewmaker, Rik van Riel,
	Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Roman Gushchin <klamm@yandex-team.ru>

commit 5703b087dc8eaf47bfb399d6cf512d471beff405 upstream.

I noticed, that "allowed" can easily overflow by falling below 0,
because (total_vm / 32) can be larger than "allowed".  The problem
occurs in OVERCOMMIT_NONE mode.

In this case, a huge allocation can success and overcommit the system
(despite OVERCOMMIT_NONE mode).  All subsequent allocations will fall
(system-wide), so system become unusable.

The problem was masked out by commit c9b1d0981fcc
("mm: limit growth of 3% hardcoded other user reserve"),
but it's easy to reproduce it on older kernels:
1) set overcommit_memory sysctl to 2
2) mmap() large file multiple times (with VM_SHARED flag)
3) try to malloc() large amount of memory

It also can be reproduced on newer kernels, but miss-configured
sysctl_user_reserve_kbytes is required.

Fix this issue by switching to signed arithmetic here.

[akpm@linux-foundation.org: use min_t]
Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>
Cc: Andrew Shewmaker <agshew@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
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/mmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index d3b8887..e359e9e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -127,7 +127,7 @@ EXPORT_SYMBOL_GPL(vm_memory_committed);
  */
 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 {
-	unsigned long free, allowed, reserve;
+	long free, allowed, reserve;
 
 	vm_acct_memory(pages);
 
@@ -191,7 +191,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 	 */
 	if (mm) {
 		reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10);
-		allowed -= min(mm->total_vm / 32, reserve);
+		allowed -= min_t(long, mm->total_vm / 32, reserve);
 	}
 
 	if (percpu_counter_read_positive(&vm_committed_as) < allowed)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 091/143] mm/nommu.c: fix arithmetic overflow in __vm_enough_memory()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (89 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 090/143] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 092/143] iscsi-target: Drop problematic active_ts_list usage Kamal Mostafa
                   ` (51 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roman Gushchin, Andrew Shewmaker, Rik van Riel,
	Konstantin Khlebnikov, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Roman Gushchin <klamm@yandex-team.ru>

commit 8138a67a5557ffea3a21dfd6f037842d4e748513 upstream.

I noticed that "allowed" can easily overflow by falling below 0, because
(total_vm / 32) can be larger than "allowed".  The problem occurs in
OVERCOMMIT_NONE mode.

In this case, a huge allocation can success and overcommit the system
(despite OVERCOMMIT_NONE mode).  All subsequent allocations will fall
(system-wide), so system become unusable.

The problem was masked out by commit c9b1d0981fcc
("mm: limit growth of 3% hardcoded other user reserve"),
but it's easy to reproduce it on older kernels:
1) set overcommit_memory sysctl to 2
2) mmap() large file multiple times (with VM_SHARED flag)
3) try to malloc() large amount of memory

It also can be reproduced on newer kernels, but miss-configured
sysctl_user_reserve_kbytes is required.

Fix this issue by switching to signed arithmetic here.

Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>
Cc: Andrew Shewmaker <agshew@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
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/nommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index fec093a..0f28834 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1896,7 +1896,7 @@ EXPORT_SYMBOL(unmap_mapping_range);
  */
 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 {
-	unsigned long free, allowed, reserve;
+	long free, allowed, reserve;
 
 	vm_acct_memory(pages);
 
@@ -1960,7 +1960,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 	 */
 	if (mm) {
 		reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10);
-		allowed -= min(mm->total_vm / 32, reserve);
+		allowed -= min_t(long, mm->total_vm / 32, reserve);
 	}
 
 	if (percpu_counter_read_positive(&vm_committed_as) < allowed)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 092/143] iscsi-target: Drop problematic active_ts_list usage
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (90 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 091/143] mm/nommu.c: " Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 093/143] target: Fix PR_APTPL_BUF_LEN buffer size limitation Kamal Mostafa
                   ` (50 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Nicholas Bellinger, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 3fd7b60f2c7418239d586e359e0c6d8503e10646 upstream.

This patch drops legacy active_ts_list usage within iscsi_target_tq.c
code.  It was originally used to track the active thread sets during
iscsi-target shutdown, and is no longer used by modern upstream code.

Two people have reported list corruption using traditional iscsi-target
and iser-target with the following backtrace, that appears to be related
to iscsi_thread_set->ts_list being used across both active_ts_list and
inactive_ts_list.

[   60.782534] ------------[ cut here ]------------
[   60.782543] WARNING: CPU: 0 PID: 9430 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0()
[   60.782545] list_del corruption, ffff88045b00d180->next is LIST_POISON1 (dead000000100100)
[   60.782546] Modules linked in: ib_srpt tcm_qla2xxx qla2xxx tcm_loop tcm_fc libfc scsi_transport_fc scsi_tgt ib_isert rdma_cm iw_cm ib_addr iscsi_target_mod target_core_pscsi target_core_file target_core_iblock target_core_mod configfs ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables bridge stp llc autofs4 sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 ib_ipoib ib_cm ib_uverbs ib_umad mlx4_en mlx4_ib ib_sa ib_mad ib_core mlx4_core dm_mirror dm_region_hash dm_log dm_mod vhost_net macvtap macvlan vhost tun kvm_intel kvm uinput iTCO_wdt iTCO_vendor_support microcode serio_raw pcspkr sb_edac edac_core sg i2c_i801 lpc_ich mfd_core mtip32xx igb i2c_algo_bit i2c_core ptp pps_core ioatdma dca wmi ext3(F) jbd(F) mbcache(F) sd_mod(F) crc_t10dif(F) crct10dif_common(F) ahci(F) libahci(F) isci(F) libsas(F) scsi_transport_sas(F) [last unloaded: speedstep_lib]
[   60.782597] CPU: 0 PID: 9430 Comm: iscsi_ttx Tainted: GF 3.12.19+ #2
[   60.782598] Hardware name: Supermicro X9DRX+-F/X9DRX+-F, BIOS 3.00 07/09/2013
[   60.782599]  0000000000000035 ffff88044de31d08 ffffffff81553ae7 0000000000000035
[   60.782602]  ffff88044de31d58 ffff88044de31d48 ffffffff8104d1cc 0000000000000002
[   60.782605]  ffff88045b00d180 ffff88045b00d0c0 ffff88045b00d0c0 ffff88044de31e58
[   60.782607] Call Trace:
[   60.782611]  [<ffffffff81553ae7>] dump_stack+0x49/0x62
[   60.782615]  [<ffffffff8104d1cc>] warn_slowpath_common+0x8c/0xc0
[   60.782618]  [<ffffffff8104d2b6>] warn_slowpath_fmt+0x46/0x50
[   60.782620]  [<ffffffff81280933>] __list_del_entry+0x63/0xd0
[   60.782622]  [<ffffffff812809b1>] list_del+0x11/0x40
[   60.782630]  [<ffffffffa06e7cf9>] iscsi_del_ts_from_active_list+0x29/0x50 [iscsi_target_mod]
[   60.782635]  [<ffffffffa06e87b1>] iscsi_tx_thread_pre_handler+0xa1/0x180 [iscsi_target_mod]
[   60.782642]  [<ffffffffa06fb9ae>] iscsi_target_tx_thread+0x4e/0x220 [iscsi_target_mod]
[   60.782647]  [<ffffffffa06fb960>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
[   60.782652]  [<ffffffffa06fb960>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
[   60.782655]  [<ffffffff8106f99e>] kthread+0xce/0xe0
[   60.782657]  [<ffffffff8106f8d0>] ? kthread_freezable_should_stop+0x70/0x70
[   60.782660]  [<ffffffff8156026c>] ret_from_fork+0x7c/0xb0
[   60.782662]  [<ffffffff8106f8d0>] ? kthread_freezable_should_stop+0x70/0x70
[   60.782663] ---[ end trace 9662f4a661d33965 ]---

Since this code is no longer used, go ahead and drop the problematic usage
all-together.

Reported-by: Gavin Guo <gavin.guo@canonical.com>
Reported-by: Moussa Ba <moussaba@micron.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/iscsi/iscsi_target_tq.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c
index 601e9cc..bb2890e 100644
--- a/drivers/target/iscsi/iscsi_target_tq.c
+++ b/drivers/target/iscsi/iscsi_target_tq.c
@@ -24,36 +24,22 @@
 #include "iscsi_target_tq.h"
 #include "iscsi_target.h"
 
-static LIST_HEAD(active_ts_list);
 static LIST_HEAD(inactive_ts_list);
-static DEFINE_SPINLOCK(active_ts_lock);
 static DEFINE_SPINLOCK(inactive_ts_lock);
 static DEFINE_SPINLOCK(ts_bitmap_lock);
 
-static void iscsi_add_ts_to_active_list(struct iscsi_thread_set *ts)
-{
-	spin_lock(&active_ts_lock);
-	list_add_tail(&ts->ts_list, &active_ts_list);
-	iscsit_global->active_ts++;
-	spin_unlock(&active_ts_lock);
-}
-
 static void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts)
 {
+	if (!list_empty(&ts->ts_list)) {
+		WARN_ON(1);
+		return;
+	}
 	spin_lock(&inactive_ts_lock);
 	list_add_tail(&ts->ts_list, &inactive_ts_list);
 	iscsit_global->inactive_ts++;
 	spin_unlock(&inactive_ts_lock);
 }
 
-static void iscsi_del_ts_from_active_list(struct iscsi_thread_set *ts)
-{
-	spin_lock(&active_ts_lock);
-	list_del(&ts->ts_list);
-	iscsit_global->active_ts--;
-	spin_unlock(&active_ts_lock);
-}
-
 static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
 {
 	struct iscsi_thread_set *ts;
@@ -66,7 +52,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
 
 	ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list);
 
-	list_del(&ts->ts_list);
+	list_del_init(&ts->ts_list);
 	iscsit_global->inactive_ts--;
 	spin_unlock(&inactive_ts_lock);
 
@@ -204,8 +190,6 @@ static void iscsi_deallocate_extra_thread_sets(void)
 
 void iscsi_activate_thread_set(struct iscsi_conn *conn, struct iscsi_thread_set *ts)
 {
-	iscsi_add_ts_to_active_list(ts);
-
 	spin_lock_bh(&ts->ts_state_lock);
 	conn->thread_set = ts;
 	ts->conn = conn;
@@ -397,7 +381,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts)
 
 	if (ts->delay_inactive && (--ts->thread_count == 0)) {
 		spin_unlock_bh(&ts->ts_state_lock);
-		iscsi_del_ts_from_active_list(ts);
 
 		if (!iscsit_global->in_shutdown)
 			iscsi_deallocate_extra_thread_sets();
@@ -452,7 +435,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts)
 
 	if (ts->delay_inactive && (--ts->thread_count == 0)) {
 		spin_unlock_bh(&ts->ts_state_lock);
-		iscsi_del_ts_from_active_list(ts);
 
 		if (!iscsit_global->in_shutdown)
 			iscsi_deallocate_extra_thread_sets();
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 093/143] target: Fix PR_APTPL_BUF_LEN buffer size limitation
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (91 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 092/143] iscsi-target: Drop problematic active_ts_list usage Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 094/143] mm/compaction: fix wrong order check in compact_finished() Kamal Mostafa
                   ` (49 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Nicholas Bellinger, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit f161d4b44d7cc1dc66b53365215227db356378b1 upstream.

This patch addresses the original PR_APTPL_BUF_LEN = 8k limitiation
for write-out of PR APTPL metadata that Martin has recently been
running into.

It changes core_scsi3_update_and_write_aptpl() to use vzalloc'ed
memory instead of kzalloc, and increases the default hardcoded
length to 256k.

It also adds logic in core_scsi3_update_and_write_aptpl() to double
the original length upon core_scsi3_update_aptpl_buf() failure, and
retries until the vzalloc'ed buffer is large enough to accommodate
the outgoing APTPL metadata.

Reported-by: Martin Svec <martin.svec@zoner.cz>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/target_core_pr.c   | 25 +++++++++++++------------
 include/target/target_core_base.h |  2 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 1205dbd..0fccdcf 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1877,8 +1877,8 @@ static int core_scsi3_update_aptpl_buf(
 		}
 
 		if ((len + strlen(tmp) >= pr_aptpl_buf_len)) {
-			pr_err("Unable to update renaming"
-				" APTPL metadata\n");
+			pr_err("Unable to update renaming APTPL metadata,"
+			       " reallocating larger buffer\n");
 			ret = -EMSGSIZE;
 			goto out;
 		}
@@ -1895,8 +1895,8 @@ static int core_scsi3_update_aptpl_buf(
 			lun->lun_sep->sep_rtpi, lun->unpacked_lun, reg_count);
 
 		if ((len + strlen(tmp) >= pr_aptpl_buf_len)) {
-			pr_err("Unable to update renaming"
-				" APTPL metadata\n");
+			pr_err("Unable to update renaming APTPL metadata,"
+			       " reallocating larger buffer\n");
 			ret = -EMSGSIZE;
 			goto out;
 		}
@@ -1959,7 +1959,7 @@ static int __core_scsi3_write_aptpl_to_file(
 static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, bool aptpl)
 {
 	unsigned char *buf;
-	int rc;
+	int rc, len = PR_APTPL_BUF_LEN;
 
 	if (!aptpl) {
 		char *null_buf = "No Registrations or Reservations\n";
@@ -1973,25 +1973,26 @@ static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, b
 
 		return 0;
 	}
-
-	buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL);
+retry:
+	buf = vzalloc(len);
 	if (!buf)
 		return TCM_OUT_OF_RESOURCES;
 
-	rc = core_scsi3_update_aptpl_buf(dev, buf, PR_APTPL_BUF_LEN);
+	rc = core_scsi3_update_aptpl_buf(dev, buf, len);
 	if (rc < 0) {
-		kfree(buf);
-		return TCM_OUT_OF_RESOURCES;
+		vfree(buf);
+		len *= 2;
+		goto retry;
 	}
 
 	rc = __core_scsi3_write_aptpl_to_file(dev, buf);
 	if (rc != 0) {
 		pr_err("SPC-3 PR: Could not update APTPL\n");
-		kfree(buf);
+		vfree(buf);
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 	dev->t10_pr.pr_aptpl_active = 1;
-	kfree(buf);
+	vfree(buf);
 	pr_debug("SPC-3 PR: Set APTPL Bit Activated\n");
 	return 0;
 }
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index e3569f8..8baf440 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -380,7 +380,7 @@ struct t10_reservation {
 	/* Activate Persistence across Target Power Loss enabled
 	 * for SCSI device */
 	int pr_aptpl_active;
-#define PR_APTPL_BUF_LEN			8192
+#define PR_APTPL_BUF_LEN			262144
 	u32 pr_generation;
 	spinlock_t registration_lock;
 	spinlock_t aptpl_reg_lock;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 094/143] mm/compaction: fix wrong order check in compact_finished()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (92 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 093/143] target: Fix PR_APTPL_BUF_LEN buffer size limitation Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 095/143] mm/memory.c: actually remap enough memory Kamal Mostafa
                   ` (48 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joonsoo Kim, Mel Gorman, David Rientjes, Rik van Riel,
	Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

commit 372549c2a3778fd3df445819811c944ad54609ca upstream.

What we want to check here is whether there is highorder freepage in buddy
list of other migratetype in order to steal it without fragmentation.
But, current code just checks cc->order which means allocation request
order.  So, this is wrong.

Without this fix, non-movable synchronous compaction below pageblock order
would not stopped until compaction is complete, because migratetype of
most pageblocks are movable and high order freepage made by compaction is
usually on movable type buddy list.

There is some report related to this bug. See below link.

  http://www.spinics.net/lists/linux-mm/msg81666.html

Although the issued system still has load spike comes from compaction,
this makes that system completely stable and responsive according to his
report.

stress-highalloc test in mmtests with non movable order 7 allocation
doesn't show any notable difference in allocation success rate, but, it
shows more compaction success rate.

Compaction success rate (Compaction success * 100 / Compaction stalls, %)
18.47 : 28.94

Fixes: 1fb3f8ca0e92 ("mm: compaction: capture a suitable high-order page immediately when it is made available")
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.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/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 1b99ee9..b1067a4 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -887,7 +887,7 @@ static int compact_finished(struct zone *zone,
 			return COMPACT_PARTIAL;
 
 		/* Job done if allocation would set block type */
-		if (cc->order >= pageblock_order && area->nr_free)
+		if (order >= pageblock_order && area->nr_free)
 			return COMPACT_PARTIAL;
 	}
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 095/143] mm/memory.c: actually remap enough memory
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (93 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 094/143] mm/compaction: fix wrong order check in compact_finished() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 096/143] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page() Kamal Mostafa
                   ` (47 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Grazvydas Ignotas, Rik van Riel, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Grazvydas Ignotas <notasas@gmail.com>

commit 9cb12d7b4ccaa976f97ce0c5fd0f1b6a83bc2a75 upstream.

For whatever reason, generic_access_phys() only remaps one page, but
actually allows to access arbitrary size.  It's quite easy to trigger
large reads, like printing out large structure with gdb, which leads to a
crash.  Fix it by remapping correct size.

Fixes: 28b2ee20c7cb ("access_process_vm device memory infrastructure")
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Cc: Rik van Riel <riel@redhat.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/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index 7040326..0d58cbc 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4025,7 +4025,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
 	if (follow_phys(vma, addr, write, &prot, &phys_addr))
 		return -EINVAL;
 
-	maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot);
+	maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
 	if (write)
 		memcpy_toio(maddr + offset, buf, len);
 	else
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 096/143] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (94 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 095/143] mm/memory.c: actually remap enough memory Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 097/143] ALSA: hda - enable mute led quirk for one more hp machine Kamal Mostafa
                   ` (46 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Naoya Horiguchi, Andi Kleen, Tony Luck, Chen Gong, Andrew Morton,
	Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

commit 9ab3b598d2dfbdb0153ffa7e4b1456bbff59a25d upstream.

A race condition starts to be visible in recent mmotm, where a PG_hwpoison
flag is set on a migration source page *before* it's back in buddy page
poo= l.

This is problematic because no page flag is supposed to be set when
freeing (see __free_one_page().) So the user-visible effect of this race
is that it could trigger the BUG_ON() when soft-offlining is called.

The root cause is that we call lru_add_drain_all() to make sure that the
page is in buddy, but that doesn't work because this function just
schedule= s a work item and doesn't wait its completion.
drain_all_pages() does drainin= g directly, so simply dropping
lru_add_drain_all() solves this problem.

Fixes: f15bdfa802bf ("mm/memory-failure.c: fix memory leak in successful soft offlining")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Chen Gong <gong.chen@linux.intel.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/memory-failure.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index ba1ab14..112be59f 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1639,8 +1639,6 @@ static int __soft_offline_page(struct page *page, int flags)
 			 * setting PG_hwpoison.
 			 */
 			if (!is_free_buddy_page(page))
-				lru_add_drain_all();
-			if (!is_free_buddy_page(page))
 				drain_all_pages();
 			SetPageHWPoison(page);
 			if (!is_free_buddy_page(page))
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 097/143] ALSA: hda - enable mute led quirk for one more hp machine.
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (95 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 096/143] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page() Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 098/143] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Kamal Mostafa
                   ` (45 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Hui Wang, Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hui Wang <hui.wang@canonical.com>

commit 7976eb49cbd138d8014fa02682d8f969ad1e9ff2 upstream.

Otherwise, the mute led can't work at all.

Tested-by: Taihsiang Ho <taihsiang.ho@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/1410704
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 7f57874..113f15c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4449,6 +4449,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	/* ALC282 */
 	SND_PCI_QUIRK(0x103c, 0x2191, "HP Touchsmart 14", ALC269_FIXUP_HP_MUTE_LED_MIC1),
 	SND_PCI_QUIRK(0x103c, 0x2192, "HP Touchsmart 15", ALC269_FIXUP_HP_MUTE_LED_MIC1),
+	SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
 	SND_PCI_QUIRK(0x103c, 0x220d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
 	SND_PCI_QUIRK(0x103c, 0x220e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
 	SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 098/143] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (96 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 097/143] ALSA: hda - enable mute led quirk for one more hp machine Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 099/143] drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary Kamal Mostafa
                   ` (44 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexey Brodkin, Vineet Gupta, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Alexey Brodkin <abrodkin@synopsys.com>

commit 06f34e1c28f3608b0ce5b310e41102d3fe7b65a1 upstream.

We used to calculate page address differently in 2 cases:

1. In virt_to_page(x) we do
 --->8---
 mem_map + (x - CONFIG_LINUX_LINK_BASE) >> PAGE_SHIFT
 --->8---

2. In in pte_page(x) we do
 --->8---
 mem_map + (pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT
 --->8---

That leads to problems in case PAGE_OFFSET != CONFIG_LINUX_LINK_BASE -
different pages will be selected depending on where and how we calculate
page address.

In particular in the STAR 9000853582 when gdb attempted to read memory
of another process it got improper page in get_user_pages() because this
is exactly one of the places where we search for a page by pte_page().

The fix is trivial - we need to calculate page address similarly in both
cases.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arc/include/asm/pgtable.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 6b0b7f7e..7670f33 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -259,7 +259,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_clear(xp)			do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(x) (mem_map + \
-		(unsigned long)(((pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT)))
+		(unsigned long)(((pte_val(x) - CONFIG_LINUX_LINK_BASE) >> \
+				PAGE_SHIFT)))
 
 #define mk_pte(page, pgprot)						\
 ({									\
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 099/143] drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (97 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 098/143] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 100/143] drm/radeon: fix voltage setup on hawaii Kamal Mostafa
                   ` (43 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 66c2b84ba6256bc5399eed45582af9ebb3ba2c15 upstream.

Don't restrict it to just eDP panels.  Some LVDS bridge chips require
this.  Fixes blank panels on resume on certain laptops.  Noticed
by mrnuke on IRC.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=42960

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/atombios_dp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 719c7a1..13b458e 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -700,10 +700,8 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
 		radeon_write_dpcd_reg(dp_info->radeon_connector,
 				      DP_DOWNSPREAD_CTRL, 0);
 
-	if ((dp_info->connector->connector_type == DRM_MODE_CONNECTOR_eDP) &&
-	    (dig->panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)) {
+	if (dig->panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)
 		radeon_write_dpcd_reg(dp_info->radeon_connector, DP_EDP_CONFIGURATION_SET, 1);
-	}
 
 	/* set the lane count on the sink */
 	tmp = dp_info->dp_lane_count;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 100/143] drm/radeon: fix voltage setup on hawaii
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (98 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 099/143] drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 101/143] ALSA: hdspm - Constrain periods to 2 on older cards Kamal Mostafa
                   ` (42 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 09b6e85fc868568e1b2820235a2a851aecbccfcc upstream.

Missing parameter when fetching the real voltage values
from atom.  Fixes problems with dynamic clocking on
certain boards.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=87457

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_atombios.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 2f7e9b8..87b0d72 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -3280,6 +3280,7 @@ int radeon_atom_get_voltage_evv(struct radeon_device *rdev,
 
 	args.in.ucVoltageType = VOLTAGE_TYPE_VDDC;
 	args.in.ucVoltageMode = ATOM_GET_VOLTAGE_EVV_VOLTAGE;
+	args.in.usVoltageLevel = cpu_to_le16(virtual_voltage_id);
 	args.in.ulSCLKFreq =
 		cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 101/143] ALSA: hdspm - Constrain periods to 2 on older cards
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (99 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 100/143] drm/radeon: fix voltage setup on hawaii Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 102/143] jffs2: fix handling of corrupted summary length Kamal Mostafa
                   ` (41 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Adrian Knoth, Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Adrian Knoth <adi@drcomp.erfurt.thur.de>

commit f0153c3d948c1764f6c920a0675d86fc1d75813e upstream.

RME RayDAT and AIO use a fixed buffer size of 16384 samples. With period
sizes of 32-4096, this translates to 4-512 periods.

The older RME cards have a variable buffer size but require exactly two
periods.

This patch enforces nperiods=2 on those cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/rme9652/hdspm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index e98dc00..2116750 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6102,6 +6102,9 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream)
 		snd_pcm_hw_constraint_minmax(runtime,
 					     SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 					     64, 8192);
+		snd_pcm_hw_constraint_minmax(runtime,
+					     SNDRV_PCM_HW_PARAM_PERIODS,
+					     2, 2);
 		break;
 	}
 
@@ -6176,6 +6179,9 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream)
 		snd_pcm_hw_constraint_minmax(runtime,
 					     SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 					     64, 8192);
+		snd_pcm_hw_constraint_minmax(runtime,
+					     SNDRV_PCM_HW_PARAM_PERIODS,
+					     2, 2);
 		break;
 	}
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 102/143] jffs2: fix handling of corrupted summary length
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (100 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 101/143] ALSA: hdspm - Constrain periods to 2 on older cards Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 103/143] dm mirror: do not degrade the mirror on discard error Kamal Mostafa
                   ` (40 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Jie, Andrew Morton, David Woodhouse, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Chen Jie <chenjie6@huawei.com>

commit 164c24063a3eadee11b46575c5482b2f1417be49 upstream.

sm->offset maybe wrong but magic maybe right, the offset do not have CRC.

Badness at c00c7580 [verbose debug info unavailable]
NIP: c00c7580 LR: c00c718c CTR: 00000014
REGS: df07bb40 TRAP: 0700   Not tainted  (2.6.34.13-WR4.3.0.0_standard)
MSR: 00029000 <EE,ME,CE>  CR: 22084f84  XER: 00000000
TASK = df84d6e0[908] 'mount' THREAD: df07a000
GPR00: 00000001 df07bbf0 df84d6e0 00000000 00000001 00000000 df07bb58 00000041
GPR08: 00000041 c0638860 00000000 00000010 22084f88 100636c8 df814ff8 00000000
GPR16: df84d6e0 dfa558cc c05adb90 00000048 c0452d30 00000000 000240d0 000040d0
GPR24: 00000014 c05ae734 c05be2e0 00000000 00000001 00000000 00000000 c05ae730
NIP [c00c7580] __alloc_pages_nodemask+0x4d0/0x638
LR [c00c718c] __alloc_pages_nodemask+0xdc/0x638
Call Trace:
[df07bbf0] [c00c718c] __alloc_pages_nodemask+0xdc/0x638 (unreliable)
[df07bc90] [c00c7708] __get_free_pages+0x20/0x48
[df07bca0] [c00f4a40] __kmalloc+0x15c/0x1ec
[df07bcd0] [c01fc880] jffs2_scan_medium+0xa58/0x14d0
[df07bd70] [c01ff38c] jffs2_do_mount_fs+0x1f4/0x6b4
[df07bdb0] [c020144c] jffs2_do_fill_super+0xa8/0x260
[df07bdd0] [c020230c] jffs2_fill_super+0x104/0x184
[df07be00] [c0335814] get_sb_mtd_aux+0x9c/0xec
[df07be20] [c033596c] get_sb_mtd+0x84/0x1e8
[df07be60] [c0201ed0] jffs2_get_sb+0x1c/0x2c
[df07be70] [c0103898] vfs_kern_mount+0x78/0x1e8
[df07bea0] [c0103a58] do_kern_mount+0x40/0x100
[df07bec0] [c011fe90] do_mount+0x240/0x890
[df07bf10] [c0120570] sys_mount+0x90/0xd8
[df07bf40] [c00110d8] ret_from_syscall+0x0/0x4

=== Exception: c01 at 0xff61a34
    LR = 0x100135f0
Instruction dump:
38800005 38600000 48010f41 4bfffe1c 4bfc2d15 4bfffe8c 72e90200 4082fc28
3d20c064 39298860 8809000d 68000001 <0f000000> 2f800000 419efc0c 38000001
mount: mounting /dev/mtdblock3 on /common failed: Input/output error

Signed-off-by: Chen Jie <chenjie6@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/jffs2/scan.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 7654e87..9ad5ba4 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -510,6 +510,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 				sumlen = c->sector_size - je32_to_cpu(sm->offset);
 				sumptr = buf + buf_size - sumlen;
 
+				/* sm->offset maybe wrong but MAGIC maybe right */
+				if (sumlen > c->sector_size)
+					goto full_scan;
+
 				/* Now, make sure the summary itself is available */
 				if (sumlen > buf_size) {
 					/* Need to kmalloc for this. */
@@ -544,6 +548,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 		}
 	}
 
+full_scan:
 	buf_ofs = jeb->offset;
 
 	if (!buf_size) {
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 103/143] dm mirror: do not degrade the mirror on discard error
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (101 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 102/143] jffs2: fix handling of corrupted summary length Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 104/143] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Kamal Mostafa
                   ` (39 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Mike Snitzer, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit f2ed51ac64611d717d1917820a01930174c2f236 upstream.

It may be possible that a device claims discard support but it rejects
discards with -EOPNOTSUPP.  It happens when using loopback on ext2/ext3
filesystem driven by the ext4 driver.  It may also happen if the
underlying devices are moved from one disk on another.

If discard error happens, we reject the bio with -EOPNOTSUPP, but we do
not degrade the array.

This patch fixes failed test shell/lvconvert-repair-transient.sh in the
lvm2 testsuite if the testsuite is extracted on an ext2 or ext3
filesystem and it is being driven by the ext4 driver.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-raid1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 9584443..9388c36 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context)
 		return;
 	}
 
+	/*
+	 * If the bio is discard, return an error, but do not
+	 * degrade the array.
+	 */
+	if (bio->bi_rw & REQ_DISCARD) {
+		bio_endio(bio, -EOPNOTSUPP);
+		return;
+	}
+
 	for (i = 0; i < ms->nr_mirrors; i++)
 		if (test_bit(i, &error))
 			fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 104/143] dm io: reject unsupported DISCARD requests with EOPNOTSUPP
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (102 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 103/143] dm mirror: do not degrade the mirror on discard error Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 105/143] target: Add missing WRITE_SAME end-of-device sanity check Kamal Mostafa
                   ` (38 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Darrick J. Wong, Mike Snitzer, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: "Darrick J. Wong" <darrick.wong@oracle.com>

commit 37527b869207ad4c208b1e13967d69b8bba1fbf9 upstream.

I created a dm-raid1 device backed by a device that supports DISCARD
and another device that does NOT support DISCARD with the following
dm configuration:

 #  echo '0 2048 mirror core 1 512 2 /dev/sda 0 /dev/sdb 0' | dmsetup create moo
 # lsblk -D
 NAME         DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
 sda                 0        4K       1G         0
 `-moo (dm-0)        0        4K       1G         0
 sdb                 0        0B       0B         0
 `-moo (dm-0)        0        4K       1G         0

Notice that the mirror device /dev/mapper/moo advertises DISCARD
support even though one of the mirror halves doesn't.

If I issue a DISCARD request (via fstrim, mount -o discard, or ioctl
BLKDISCARD) through the mirror, kmirrord gets stuck in an infinite
loop in do_region() when it tries to issue a DISCARD request to sdb.
The problem is that when we call do_region() against sdb, num_sectors
is set to zero because q->limits.max_discard_sectors is zero.
Therefore, "remaining" never decreases and the loop never terminates.

To fix this: before entering the loop, check for the combination of
REQ_DISCARD and no discard and return -EOPNOTSUPP to avoid hanging up
the mirror device.

This bug was found by the unfortunate coincidence of pvmove and a
discard operation in the RHEL 6.5 kernel; upstream is also affected.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-io.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index e60c2ea..951addc 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -290,6 +290,12 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
 	unsigned short logical_block_size = queue_logical_block_size(q);
 	sector_t num_sectors;
 
+	/* Reject unsupported discard requests */
+	if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) {
+		dec_count(io, region, -EOPNOTSUPP);
+		return;
+	}
+
 	/*
 	 * where->count may be zero if rw holds a flush and we need to
 	 * send a zero-sized flush.
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 105/143] target: Add missing WRITE_SAME end-of-device sanity check
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (103 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 104/143] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 106/143] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Kamal Mostafa
                   ` (37 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin Petersen, Christoph Hellwig, Nicholas Bellinger, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 8e575c50a171f2579e367a7f778f86477dfdaf49 upstream.

This patch adds a check to sbc_setup_write_same() to verify
the incoming WRITE_SAME LBA + number of blocks does not exceed
past the end-of-device.

Also check for potential LBA wrap-around as well.

Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/target_core_sbc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 6aae89d..3039bc4 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -260,6 +260,8 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb)
 static sense_reason_t
 sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops)
 {
+	struct se_device *dev = cmd->se_dev;
+	sector_t end_lba = dev->transport->get_blocks(dev) + 1;
 	unsigned int sectors = sbc_get_write_same_sectors(cmd);
 
 	if ((flags[0] & 0x04) || (flags[0] & 0x02)) {
@@ -273,6 +275,16 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
 			sectors, cmd->se_dev->dev_attrib.max_write_same_len);
 		return TCM_INVALID_CDB_FIELD;
 	}
+	/*
+	 * Sanity check for LBA wrap and request past end of device.
+	 */
+	if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) ||
+	    ((cmd->t_task_lba + sectors) > end_lba)) {
+		pr_err("WRITE_SAME exceeds last lba %llu (lba %llu, sectors %u)\n",
+		       (unsigned long long)end_lba, cmd->t_task_lba, sectors);
+		return TCM_ADDRESS_OUT_OF_RANGE;
+	}
+
 	/* We always have ANC_SUP == 0 so setting ANCHOR is always an error */
 	if (flags[0] & 0x10) {
 		pr_warn("WRITE SAME with ANCHOR not supported\n");
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 106/143] target: Check for LBA + sectors wrap-around in sbc_parse_cdb
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (104 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 105/143] target: Add missing WRITE_SAME end-of-device sanity check Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 107/143] Btrfs: fix fsync data loss after adding hard link to inode Kamal Mostafa
                   ` (36 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin Petersen, Christoph Hellwig, Nicholas Bellinger, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit aa179935edea9a64dec4b757090c8106a3907ffa upstream.

This patch adds a check to sbc_parse_cdb() in order to detect when
an LBA + sector vs. end-of-device calculation wraps when the LBA is
sufficently large enough (eg: 0xFFFFFFFFFFFFFFFF).

Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/target_core_sbc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 3039bc4..e19fabf 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -852,7 +852,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
 		unsigned long long end_lba;
 
 		end_lba = dev->transport->get_blocks(dev) + 1;
-		if (cmd->t_task_lba + sectors > end_lba) {
+		if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) ||
+		    ((cmd->t_task_lba + sectors) > end_lba)) {
 			pr_err("cmd exceeds last lba %llu "
 				"(lba %llu, sectors %u)\n",
 				end_lba, cmd->t_task_lba, sectors);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 107/143] Btrfs: fix fsync data loss after adding hard link to inode
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (105 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 106/143] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 108/143] Added Little Endian support to vtpm module Kamal Mostafa
                   ` (35 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Filipe Manana, Chris Mason, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Filipe Manana <fdmanana@suse.com>

commit 1a4bcf470c886b955adf36486f4c86f2441d85cb upstream.

We have a scenario where after the fsync log replay we can lose file data
that had been previously fsync'ed if we added an hard link for our inode
and after that we sync'ed the fsync log (for example by fsync'ing some
other file or directory).

This is because when adding an hard link we updated the inode item in the
log tree with an i_size value of 0. At that point the new inode item was
in memory only and a subsequent fsync log replay would not make us lose
the file data. However if after adding the hard link we sync the log tree
to disk, by fsync'ing some other file or directory for example, we ended
up losing the file data after log replay, because the inode item in the
persisted log tree had an an i_size of zero.

This is easy to reproduce, and the following excerpt from my test for
xfstests shows this:

  _scratch_mkfs >> $seqres.full 2>&1
  _init_flakey
  _mount_flakey

  # Create one file with data and fsync it.
  # This made the btrfs fsync log persist the data and the inode metadata with
  # a correct inode->i_size (4096 bytes).
  $XFS_IO_PROG -f -c "pwrite -S 0xaa -b 4K 0 4K" -c "fsync" \
       $SCRATCH_MNT/foo | _filter_xfs_io

  # Now add one hard link to our file. This made the btrfs code update the fsync
  # log, in memory only, with an inode metadata having a size of 0.
  ln $SCRATCH_MNT/foo $SCRATCH_MNT/foo_link

  # Now force persistence of the fsync log to disk, for example, by fsyncing some
  # other file.
  touch $SCRATCH_MNT/bar
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar

  # Before a power loss or crash, we could read the 4Kb of data from our file as
  # expected.
  echo "File content before:"
  od -t x1 $SCRATCH_MNT/foo

  # Simulate a crash/power loss.
  _load_flakey_table $FLAKEY_DROP_WRITES
  _unmount_flakey

  _load_flakey_table $FLAKEY_ALLOW_WRITES
  _mount_flakey

  # After the fsync log replay, because the fsync log had a value of 0 for our
  # inode's i_size, we couldn't read anymore the 4Kb of data that we previously
  # wrote and fsync'ed. The size of the file became 0 after the fsync log replay.
  echo "File content after:"
  od -t x1 $SCRATCH_MNT/foo

Another alternative test, that doesn't need to fsync an inode in the same
transaction it was created, is:

  _scratch_mkfs >> $seqres.full 2>&1
  _init_flakey
  _mount_flakey

  # Create our test file with some data.
  $XFS_IO_PROG -f -c "pwrite -S 0xaa -b 8K 0 8K" \
       $SCRATCH_MNT/foo | _filter_xfs_io

  # Make sure the file is durably persisted.
  sync

  # Append some data to our file, to increase its size.
  $XFS_IO_PROG -f -c "pwrite -S 0xcc -b 4K 8K 4K" \
       $SCRATCH_MNT/foo | _filter_xfs_io

  # Fsync the file, so from this point on if a crash/power failure happens, our
  # new data is guaranteed to be there next time the fs is mounted.
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo

  # Add one hard link to our file. This made btrfs write into the in memory fsync
  # log a special inode with generation 0 and an i_size of 0 too. Note that this
  # didn't update the inode in the fsync log on disk.
  ln $SCRATCH_MNT/foo $SCRATCH_MNT/foo_link

  # Now make sure the in memory fsync log is durably persisted.
  # Creating and fsync'ing another file will do it.
  touch $SCRATCH_MNT/bar
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar

  # As expected, before the crash/power failure, we should be able to read the
  # 12Kb of file data.
  echo "File content before:"
  od -t x1 $SCRATCH_MNT/foo

  # Simulate a crash/power loss.
  _load_flakey_table $FLAKEY_DROP_WRITES
  _unmount_flakey

  _load_flakey_table $FLAKEY_ALLOW_WRITES
  _mount_flakey

  # After mounting the fs again, the fsync log was replayed.
  # The btrfs fsync log replay code didn't update the i_size of the persisted
  # inode because the inode item in the log had a special generation with a
  # value of 0 (and it couldn't know the correct i_size, since that inode item
  # had a 0 i_size too). This made the last 4Kb of file data inaccessible and
  # effectively lost.
  echo "File content after:"
  od -t x1 $SCRATCH_MNT/foo

This isn't a new issue/regression. This problem has been around since the
log tree code was added in 2008:

  Btrfs: Add a write ahead tree log to optimize synchronous operations
  (commit e02119d5a7b4396c5a872582fddc8bd6d305a70a)

Test cases for xfstests follow soon.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/btrfs/tree-log.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 71 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 51c038d..18bf34e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -469,8 +469,20 @@ insert:
 		src_item = (struct btrfs_inode_item *)src_ptr;
 		dst_item = (struct btrfs_inode_item *)dst_ptr;
 
-		if (btrfs_inode_generation(eb, src_item) == 0)
+		if (btrfs_inode_generation(eb, src_item) == 0) {
+			struct extent_buffer *dst_eb = path->nodes[0];
+
+			if (S_ISREG(btrfs_inode_mode(eb, src_item)) &&
+			    S_ISREG(btrfs_inode_mode(dst_eb, dst_item))) {
+				struct btrfs_map_token token;
+				u64 ino_size = btrfs_inode_size(eb, src_item);
+
+				btrfs_init_map_token(&token);
+				btrfs_set_token_inode_size(dst_eb, dst_item,
+							   ino_size, &token);
+			}
 			goto no_copy;
+		}
 
 		if (overwrite_root &&
 		    S_ISDIR(btrfs_inode_mode(eb, src_item)) &&
@@ -3121,7 +3133,8 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans,
 static void fill_inode_item(struct btrfs_trans_handle *trans,
 			    struct extent_buffer *leaf,
 			    struct btrfs_inode_item *item,
-			    struct inode *inode, int log_inode_only)
+			    struct inode *inode, int log_inode_only,
+			    u64 logged_isize)
 {
 	struct btrfs_map_token token;
 
@@ -3134,7 +3147,7 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
 		 * to say 'update this inode with these values'
 		 */
 		btrfs_set_token_inode_generation(leaf, item, 0, &token);
-		btrfs_set_token_inode_size(leaf, item, 0, &token);
+		btrfs_set_token_inode_size(leaf, item, logged_isize, &token);
 	} else {
 		btrfs_set_token_inode_generation(leaf, item,
 						 BTRFS_I(inode)->generation,
@@ -3186,7 +3199,7 @@ static int log_inode_item(struct btrfs_trans_handle *trans,
 		return ret;
 	inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
 				    struct btrfs_inode_item);
-	fill_inode_item(trans, path->nodes[0], inode_item, inode, 0);
+	fill_inode_item(trans, path->nodes[0], inode_item, inode, 0, 0);
 	btrfs_release_path(path);
 	return 0;
 }
@@ -3195,7 +3208,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
 			       struct inode *inode,
 			       struct btrfs_path *dst_path,
 			       struct extent_buffer *src,
-			       int start_slot, int nr, int inode_only)
+			       int start_slot, int nr, int inode_only,
+			       u64 logged_isize)
 {
 	unsigned long src_offset;
 	unsigned long dst_offset;
@@ -3242,7 +3256,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
 						    dst_path->slots[0],
 						    struct btrfs_inode_item);
 			fill_inode_item(trans, dst_path->nodes[0], inode_item,
-					inode, inode_only == LOG_INODE_EXISTS);
+					inode, inode_only == LOG_INODE_EXISTS,
+					logged_isize);
 		} else {
 			copy_extent_buffer(dst_path->nodes[0], src, dst_offset,
 					   src_offset, ins_sizes[i]);
@@ -3606,6 +3621,33 @@ process:
 	return ret;
 }
 
+static int logged_inode_size(struct btrfs_root *log, struct inode *inode,
+			     struct btrfs_path *path, u64 *size_ret)
+{
+	struct btrfs_key key;
+	int ret;
+
+	key.objectid = btrfs_ino(inode);
+	key.type = BTRFS_INODE_ITEM_KEY;
+	key.offset = 0;
+
+	ret = btrfs_search_slot(NULL, log, &key, path, 0, 0);
+	if (ret < 0) {
+		return ret;
+	} else if (ret > 0) {
+		*size_ret = i_size_read(inode);
+	} else {
+		struct btrfs_inode_item *item;
+
+		item = btrfs_item_ptr(path->nodes[0], path->slots[0],
+				      struct btrfs_inode_item);
+		*size_ret = btrfs_inode_size(path->nodes[0], item);
+	}
+
+	btrfs_release_path(path);
+	return 0;
+}
+
 /* log a single inode in the tree log.
  * At least one parent directory for this inode must exist in the tree
  * or be logged already.
@@ -3637,6 +3679,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
 	int ins_nr;
 	bool fast_search = false;
 	u64 ino = btrfs_ino(inode);
+	u64 logged_isize = 0;
 
 	path = btrfs_alloc_path();
 	if (!path)
@@ -3690,6 +3733,25 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
 			max_key_type = BTRFS_XATTR_ITEM_KEY;
 		ret = drop_objectid_items(trans, log, path, ino, max_key_type);
 	} else {
+		if (inode_only == LOG_INODE_EXISTS) {
+			/*
+			 * Make sure the new inode item we write to the log has
+			 * the same isize as the current one (if it exists).
+			 * This is necessary to prevent data loss after log
+			 * replay, and also to prevent doing a wrong expanding
+			 * truncate - for e.g. create file, write 4K into offset
+			 * 0, fsync, write 4K into offset 4096, add hard link,
+			 * fsync some other file (to sync log), power fail - if
+			 * we use the inode's current i_size, after log replay
+			 * we get a 8Kb file, with the last 4Kb extent as a hole
+			 * (zeroes), as if an expanding truncate happened,
+			 * instead of getting a file of 4Kb only.
+			 */
+			err = logged_inode_size(log, inode, path,
+						&logged_isize);
+			if (err)
+				goto out_unlock;
+		}
 		if (test_and_clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
 				       &BTRFS_I(inode)->runtime_flags)) {
 			clear_bit(BTRFS_INODE_COPY_EVERYTHING,
@@ -3746,7 +3808,7 @@ again:
 		}
 
 		ret = copy_items(trans, inode, dst_path, src, ins_start_slot,
-				 ins_nr, inode_only);
+				 ins_nr, inode_only, logged_isize);
 		if (ret) {
 			err = ret;
 			goto out_unlock;
@@ -3765,7 +3827,7 @@ next_slot:
 		if (ins_nr) {
 			ret = copy_items(trans, inode, dst_path, src,
 					 ins_start_slot,
-					 ins_nr, inode_only);
+					 ins_nr, inode_only, logged_isize);
 			if (ret) {
 				err = ret;
 				goto out_unlock;
@@ -3785,7 +3847,7 @@ next_slot:
 	}
 	if (ins_nr) {
 		ret = copy_items(trans, inode, dst_path, src, ins_start_slot,
-				 ins_nr, inode_only);
+				 ins_nr, inode_only, logged_isize);
 		if (ret) {
 			err = ret;
 			goto out_unlock;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 108/143] Added Little Endian support to vtpm module
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (106 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 107/143] Btrfs: fix fsync data loss after adding hard link to inode Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 109/143] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Kamal Mostafa
                   ` (34 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hon Ching(Vicky) Lo, Joy Latten, Peter Huewe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: honclo <honclo@imap.linux.ibm.com>

commit eb71f8a5e33fa1066fb92f0111ab366a341e1f6c upstream.

The tpm_ibmvtpm module is affected by an unaligned access problem.
ibmvtpm_crq_get_version failed with rc=-4 during boot when vTPM is
enabled in Power partition, which supports both little endian and
big endian modes.

We added little endian support to fix this problem:
1) added cpu_to_be64 calls to ensure BE data is sent from an LE OS.
2) added be16_to_cpu and be32_to_cpu calls to make sure data received
   is in LE format on a LE OS.

Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
[phuewe: manually applied the patch :( ]
Reviewed-by: Ashley Lai <ashley@ahsleylai.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 0f3e391..da6727b 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -148,7 +148,8 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
 	crq.len = (u16)count;
 	crq.data = ibmvtpm->rtce_dma_handle;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]),
+			      cpu_to_be64(word[1]));
 	if (rc != H_SUCCESS) {
 		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
 		rc = 0;
@@ -186,7 +187,8 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm)
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]),
+			      cpu_to_be64(buf[1]));
 	if (rc != H_SUCCESS)
 		dev_err(ibmvtpm->dev,
 			"ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc);
@@ -212,7 +214,8 @@ static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm)
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_GET_VERSION;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]),
+			      cpu_to_be64(buf[1]));
 	if (rc != H_SUCCESS)
 		dev_err(ibmvtpm->dev,
 			"ibmvtpm_crq_get_version failed rc=%d\n", rc);
@@ -335,7 +338,8 @@ static int tpm_ibmvtpm_suspend(struct device *dev)
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]),
+			      cpu_to_be64(buf[1]));
 	if (rc != H_SUCCESS)
 		dev_err(ibmvtpm->dev,
 			"tpm_ibmvtpm_suspend failed rc=%d\n", rc);
@@ -519,11 +523,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
 	case IBMVTPM_VALID_CMD:
 		switch (crq->msg) {
 		case VTPM_GET_RTCE_BUFFER_SIZE_RES:
-			if (crq->len <= 0) {
+			if (be16_to_cpu(crq->len) <= 0) {
 				dev_err(ibmvtpm->dev, "Invalid rtce size\n");
 				return;
 			}
-			ibmvtpm->rtce_size = crq->len;
+			ibmvtpm->rtce_size = be16_to_cpu(crq->len);
 			ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size,
 						    GFP_KERNEL);
 			if (!ibmvtpm->rtce_buf) {
@@ -544,11 +548,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
 
 			return;
 		case VTPM_GET_VERSION_RES:
-			ibmvtpm->vtpm_version = crq->data;
+			ibmvtpm->vtpm_version = be32_to_cpu(crq->data);
 			return;
 		case VTPM_TPM_COMMAND_RES:
 			/* len of the data in rtce buffer */
-			ibmvtpm->res_len = crq->len;
+			ibmvtpm->res_len = be16_to_cpu(crq->len);
 			wake_up_interruptible(&ibmvtpm->wq);
 			return;
 		default:
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 109/143] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit.
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (107 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 108/143] Added Little Endian support to vtpm module Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 110/143] sg: fix read() error reporting Kamal Mostafa
                   ` (33 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Minh Tran, James Bottomley, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Minh Duc Tran <MinhDuc.Tran@Emulex.Com>

commit f76a610a8b4b6280eaedf48f3af9d5d74e418b66 upstream.

In reference to bug https://bugzilla.redhat.com/show_bug.cgi?id=1097141
Assert is seen with AMD cpu whenever calling pci_alloc_consistent.

[   29.406183] ------------[ cut here ]------------
[   29.410505] kernel BUG at lib/iommu-helper.c:13!

Signed-off-by: Minh Tran <minh.tran@emulex.com>
Fixes: 6733b39a1301b0b020bbcbf3295852e93e624cb1
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/be2iscsi/be_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 1f37505..2d5a97d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -581,7 +581,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
 			"beiscsi_hba_alloc - iscsi_host_alloc failed\n");
 		return NULL;
 	}
-	shost->dma_boundary = pcidev->dma_mask;
 	shost->max_id = BE2_MAX_SESSIONS;
 	shost->max_channel = 0;
 	shost->max_cmd_len = BEISCSI_MAX_CMD_LEN;
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 110/143] sg: fix read() error reporting
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (108 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 109/143] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 111/143] IB/qib: Do not write EEPROM Kamal Mostafa
                   ` (32 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tony Battersby, James Bottomley, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Tony Battersby <tonyb@cybernetics.com>

commit 3b524a683af8991b4eab4182b947c65f0ce1421b upstream.

Fix SCSI generic read() incorrectly returning success after detecting an
error.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/sg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index df5e961..eb81c98 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -522,7 +522,7 @@ static ssize_t
 sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 {
 	sg_io_hdr_t *hp = &srp->header;
-	int err = 0;
+	int err = 0, err2;
 	int len;
 
 	if (count < SZ_SG_IO_HDR) {
@@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 		goto err_out;
 	}
 err_out:
-	err = sg_finish_rem_req(srp);
-	return (0 == err) ? count : err;
+	err2 = sg_finish_rem_req(srp);
+	return err ? : err2 ? : count;
 }
 
 static ssize_t
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 111/143] IB/qib: Do not write EEPROM
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (109 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 110/143] sg: fix read() error reporting Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 112/143] md/raid5: Fix livelock when array is both resyncing and degraded Kamal Mostafa
                   ` (31 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mitko Haralanov, Mike Marciniszyn, Roland Dreier, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mitko Haralanov <mitko.haralanov@intel.com>

commit 18c0b82a3e4501511b08d0e8676fb08ac08734a3 upstream.

This changeset removes all the code that allows the driver to write to
the EEPROM and update the recorded error counters and power on hours.

These two stats are unused and writing them exposes a timing risk
which could leave the EEPROM in a bad state preventing further normal
operation of the HCA.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/infiniband/hw/qib/qib.h         |   9 +-
 drivers/infiniband/hw/qib/qib_eeprom.c  | 181 --------------------------------
 drivers/infiniband/hw/qib/qib_iba6120.c |   2 -
 drivers/infiniband/hw/qib/qib_iba7220.c |   2 -
 drivers/infiniband/hw/qib/qib_iba7322.c |   2 -
 drivers/infiniband/hw/qib/qib_init.c    |   1 -
 drivers/infiniband/hw/qib/qib_sysfs.c   |  24 -----
 7 files changed, 1 insertion(+), 220 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
index 1946101..675d3c7 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -1080,12 +1080,6 @@ struct qib_devdata {
 	/* control high-level access to EEPROM */
 	struct mutex eep_lock;
 	uint64_t traffic_wds;
-	/* active time is kept in seconds, but logged in hours */
-	atomic_t active_time;
-	/* Below are nominal shadow of EEPROM, new since last EEPROM update */
-	uint8_t eep_st_errs[QIB_EEP_LOG_CNT];
-	uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT];
-	uint16_t eep_hrs;
 	/*
 	 * masks for which bits of errs, hwerrs that cause
 	 * each of the counters to increment.
@@ -1307,8 +1301,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer,
 int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr,
 		    const void *buffer, int len);
 void qib_get_eeprom_info(struct qib_devdata *);
-int qib_update_eeprom_log(struct qib_devdata *dd);
-void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr);
+#define qib_inc_eeprom_err(dd, eidx, incr)
 void qib_dump_lookup_output_queue(struct qib_devdata *);
 void qib_force_pio_avail_update(struct qib_devdata *);
 void qib_clear_symerror_on_linkup(unsigned long opaque);
diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c
index 4d5d71a..e2280b0 100644
--- a/drivers/infiniband/hw/qib/qib_eeprom.c
+++ b/drivers/infiniband/hw/qib/qib_eeprom.c
@@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
 			"Board SN %s did not pass functional test: %s\n",
 			dd->serial, ifp->if_comment);
 
-	memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT);
-	/*
-	 * Power-on (actually "active") hours are kept as little-endian value
-	 * in EEPROM, but as seconds in a (possibly as small as 24-bit)
-	 * atomic_t while running.
-	 */
-	atomic_set(&dd->active_time, 0);
-	dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8);
-
 done:
 	vfree(buf);
 
 bail:;
 }
 
-/**
- * qib_update_eeprom_log - copy active-time and error counters to eeprom
- * @dd: the qlogic_ib device
- *
- * Although the time is kept as seconds in the qib_devdata struct, it is
- * rounded to hours for re-write, as we have only 16 bits in EEPROM.
- * First-cut code reads whole (expected) struct qib_flash, modifies,
- * re-writes. Future direction: read/write only what we need, assuming
- * that the EEPROM had to have been "good enough" for driver init, and
- * if not, we aren't making it worse.
- *
- */
-int qib_update_eeprom_log(struct qib_devdata *dd)
-{
-	void *buf;
-	struct qib_flash *ifp;
-	int len, hi_water;
-	uint32_t new_time, new_hrs;
-	u8 csum;
-	int ret, idx;
-	unsigned long flags;
-
-	/* first, check if we actually need to do anything. */
-	ret = 0;
-	for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
-		if (dd->eep_st_new_errs[idx]) {
-			ret = 1;
-			break;
-		}
-	}
-	new_time = atomic_read(&dd->active_time);
-
-	if (ret == 0 && new_time < 3600)
-		goto bail;
-
-	/*
-	 * The quick-check above determined that there is something worthy
-	 * of logging, so get current contents and do a more detailed idea.
-	 * read full flash, not just currently used part, since it may have
-	 * been written with a newer definition
-	 */
-	len = sizeof(struct qib_flash);
-	buf = vmalloc(len);
-	ret = 1;
-	if (!buf) {
-		qib_dev_err(dd,
-			"Couldn't allocate memory to read %u bytes from eeprom for logging\n",
-			len);
-		goto bail;
-	}
-
-	/* Grab semaphore and read current EEPROM. If we get an
-	 * error, let go, but if not, keep it until we finish write.
-	 */
-	ret = mutex_lock_interruptible(&dd->eep_lock);
-	if (ret) {
-		qib_dev_err(dd, "Unable to acquire EEPROM for logging\n");
-		goto free_bail;
-	}
-	ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len);
-	if (ret) {
-		mutex_unlock(&dd->eep_lock);
-		qib_dev_err(dd, "Unable read EEPROM for logging\n");
-		goto free_bail;
-	}
-	ifp = (struct qib_flash *)buf;
-
-	csum = flash_csum(ifp, 0);
-	if (csum != ifp->if_csum) {
-		mutex_unlock(&dd->eep_lock);
-		qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n",
-			    csum, ifp->if_csum);
-		ret = 1;
-		goto free_bail;
-	}
-	hi_water = 0;
-	spin_lock_irqsave(&dd->eep_st_lock, flags);
-	for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
-		int new_val = dd->eep_st_new_errs[idx];
-		if (new_val) {
-			/*
-			 * If we have seen any errors, add to EEPROM values
-			 * We need to saturate at 0xFF (255) and we also
-			 * would need to adjust the checksum if we were
-			 * trying to minimize EEPROM traffic
-			 * Note that we add to actual current count in EEPROM,
-			 * in case it was altered while we were running.
-			 */
-			new_val += ifp->if_errcntp[idx];
-			if (new_val > 0xFF)
-				new_val = 0xFF;
-			if (ifp->if_errcntp[idx] != new_val) {
-				ifp->if_errcntp[idx] = new_val;
-				hi_water = offsetof(struct qib_flash,
-						    if_errcntp) + idx;
-			}
-			/*
-			 * update our shadow (used to minimize EEPROM
-			 * traffic), to match what we are about to write.
-			 */
-			dd->eep_st_errs[idx] = new_val;
-			dd->eep_st_new_errs[idx] = 0;
-		}
-	}
-	/*
-	 * Now update active-time. We would like to round to the nearest hour
-	 * but unless atomic_t are sure to be proper signed ints we cannot,
-	 * because we need to account for what we "transfer" to EEPROM and
-	 * if we log an hour at 31 minutes, then we would need to set
-	 * active_time to -29 to accurately count the _next_ hour.
-	 */
-	if (new_time >= 3600) {
-		new_hrs = new_time / 3600;
-		atomic_sub((new_hrs * 3600), &dd->active_time);
-		new_hrs += dd->eep_hrs;
-		if (new_hrs > 0xFFFF)
-			new_hrs = 0xFFFF;
-		dd->eep_hrs = new_hrs;
-		if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) {
-			ifp->if_powerhour[0] = new_hrs & 0xFF;
-			hi_water = offsetof(struct qib_flash, if_powerhour);
-		}
-		if ((new_hrs >> 8) != ifp->if_powerhour[1]) {
-			ifp->if_powerhour[1] = new_hrs >> 8;
-			hi_water = offsetof(struct qib_flash, if_powerhour) + 1;
-		}
-	}
-	/*
-	 * There is a tiny possibility that we could somehow fail to write
-	 * the EEPROM after updating our shadows, but problems from holding
-	 * the spinlock too long are a much bigger issue.
-	 */
-	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
-	if (hi_water) {
-		/* we made some change to the data, uopdate cksum and write */
-		csum = flash_csum(ifp, 1);
-		ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1);
-	}
-	mutex_unlock(&dd->eep_lock);
-	if (ret)
-		qib_dev_err(dd, "Failed updating EEPROM\n");
-
-free_bail:
-	vfree(buf);
-bail:
-	return ret;
-}
-
-/**
- * qib_inc_eeprom_err - increment one of the four error counters
- * that are logged to EEPROM.
- * @dd: the qlogic_ib device
- * @eidx: 0..3, the counter to increment
- * @incr: how much to add
- *
- * Each counter is 8-bits, and saturates at 255 (0xFF). They
- * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log()
- * is called, but it can only be called in a context that allows sleep.
- * This function can be called even at interrupt level.
- */
-void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr)
-{
-	uint new_val;
-	unsigned long flags;
-
-	spin_lock_irqsave(&dd->eep_st_lock, flags);
-	new_val = dd->eep_st_new_errs[eidx] + incr;
-	if (new_val > 255)
-		new_val = 255;
-	dd->eep_st_new_errs[eidx] = new_val;
-	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
-}
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c
index 84e593d..295f631 100644
--- a/drivers/infiniband/hw/qib/qib_iba6120.c
+++ b/drivers/infiniband/hw/qib/qib_iba6120.c
@@ -2682,8 +2682,6 @@ static void qib_get_6120_faststats(unsigned long opaque)
 	spin_lock_irqsave(&dd->eep_st_lock, flags);
 	traffic_wds -= dd->traffic_wds;
 	dd->traffic_wds += traffic_wds;
-	if (traffic_wds  >= QIB_TRAFFIC_ACTIVE_THRESHOLD)
-		atomic_add(5, &dd->active_time); /* S/B #define */
 	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
 
 	qib_chk_6120_errormask(dd);
diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c
index 454c2e7..c86e71b 100644
--- a/drivers/infiniband/hw/qib/qib_iba7220.c
+++ b/drivers/infiniband/hw/qib/qib_iba7220.c
@@ -3299,8 +3299,6 @@ static void qib_get_7220_faststats(unsigned long opaque)
 	spin_lock_irqsave(&dd->eep_st_lock, flags);
 	traffic_wds -= dd->traffic_wds;
 	dd->traffic_wds += traffic_wds;
-	if (traffic_wds  >= QIB_TRAFFIC_ACTIVE_THRESHOLD)
-		atomic_add(5, &dd->active_time); /* S/B #define */
 	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
 done:
 	mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER);
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index d1bd213..0f8d1f0 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -5191,8 +5191,6 @@ static void qib_get_7322_faststats(unsigned long opaque)
 		spin_lock_irqsave(&ppd->dd->eep_st_lock, flags);
 		traffic_wds -= ppd->dd->traffic_wds;
 		ppd->dd->traffic_wds += traffic_wds;
-		if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD)
-			atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time);
 		spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags);
 		if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active &
 						QIB_IB_QDR) &&
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index 76c3e17..8c9bb6c 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -922,7 +922,6 @@ static void qib_shutdown_device(struct qib_devdata *dd)
 		}
 	}
 
-	qib_update_eeprom_log(dd);
 }
 
 /**
diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c
index 3c8e4e3..b9ccbda 100644
--- a/drivers/infiniband/hw/qib/qib_sysfs.c
+++ b/drivers/infiniband/hw/qib/qib_sysfs.c
@@ -611,28 +611,6 @@ bail:
 	return ret < 0 ? ret : count;
 }
 
-static ssize_t show_logged_errs(struct device *device,
-				struct device_attribute *attr, char *buf)
-{
-	struct qib_ibdev *dev =
-		container_of(device, struct qib_ibdev, ibdev.dev);
-	struct qib_devdata *dd = dd_from_dev(dev);
-	int idx, count;
-
-	/* force consistency with actual EEPROM */
-	if (qib_update_eeprom_log(dd) != 0)
-		return -ENXIO;
-
-	count = 0;
-	for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
-		count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c",
-				   dd->eep_st_errs[idx],
-				   idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' ');
-	}
-
-	return count;
-}
-
 /*
  * Dump tempsense regs. in decimal, to ease shell-scripts.
  */
@@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL);
 static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL);
 static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
 static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL);
-static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL);
 static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL);
 static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL);
 static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset);
@@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = {
 	&dev_attr_nfreectxts,
 	&dev_attr_serial,
 	&dev_attr_boardversion,
-	&dev_attr_logged_errors,
 	&dev_attr_tempsense,
 	&dev_attr_localbus_info,
 	&dev_attr_chip_reset,
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 112/143] md/raid5: Fix livelock when array is both resyncing and degraded.
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (110 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 111/143] IB/qib: Do not write EEPROM Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 113/143] dm: fix a race condition in dm_get_md Kamal Mostafa
                   ` (30 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: NeilBrown <neilb@suse.de>

commit 26ac107378c4742978216be1005b7291b799c7b2 upstream.

Commit a7854487cd7128a30a7f4f5259de9f67d5efb95f:
  md: When RAID5 is dirty, force reconstruct-write instead of read-modify-write.

Causes an RCW cycle to be forced even when the array is degraded.
A degraded array cannot support RCW as that requires reading all data
blocks, and one may be missing.

Forcing an RCW when it is not possible causes a live-lock and the code
spins, repeatedly deciding to do something that cannot succeed.

So change the condition to only force RCW on non-degraded arrays.

Reported-by: Manibalan P <pmanibalan@amiindia.co.in>
Bisected-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Fixes: a7854487cd7128a30a7f4f5259de9f67d5efb95f
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3782c2f..dcdc327 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3079,7 +3079,8 @@ static void handle_stripe_dirtying(struct r5conf *conf,
 	 * generate correct data from the parity.
 	 */
 	if (conf->max_degraded == 2 ||
-	    (recovery_cp < MaxSector && sh->sector >= recovery_cp)) {
+	    (recovery_cp < MaxSector && sh->sector >= recovery_cp &&
+	     s->failed == 0)) {
 		/* Calculate the real rcw later - for now make it
 		 * look like rcw is cheaper
 		 */
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 113/143] dm: fix a race condition in dm_get_md
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (111 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 112/143] md/raid5: Fix livelock when array is both resyncing and degraded Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 114/143] dm snapshot: fix a possible invalid memory access on unload Kamal Mostafa
                   ` (29 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Mike Snitzer, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit 2bec1f4a8832e74ebbe859f176d8a9cb20dd97f4 upstream.

The function dm_get_md finds a device mapper device with a given dev_t,
increases the reference count and returns the pointer.

dm_get_md calls dm_find_md, dm_find_md takes _minor_lock, finds the
device, tests that the device doesn't have DMF_DELETING or DMF_FREEING
flag, drops _minor_lock and returns pointer to the device. dm_get_md then
calls dm_get. dm_get calls BUG if the device has the DMF_FREEING flag,
otherwise it increments the reference count.

There is a possible race condition - after dm_find_md exits and before
dm_get is called, there are no locks held, so the device may disappear or
DMF_FREEING flag may be set, which results in BUG.

To fix this bug, we need to call dm_get while we hold _minor_lock. This
patch renames dm_find_md to dm_get_md and changes it so that it calls
dm_get while holding the lock.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 72859fa..b8570e9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2421,7 +2421,7 @@ int dm_setup_md_queue(struct mapped_device *md)
 	return 0;
 }
 
-static struct mapped_device *dm_find_md(dev_t dev)
+struct mapped_device *dm_get_md(dev_t dev)
 {
 	struct mapped_device *md;
 	unsigned minor = MINOR(dev);
@@ -2432,12 +2432,15 @@ static struct mapped_device *dm_find_md(dev_t dev)
 	spin_lock(&_minor_lock);
 
 	md = idr_find(&_minor_idr, minor);
-	if (md && (md == MINOR_ALLOCED ||
-		   (MINOR(disk_devt(dm_disk(md))) != minor) ||
-		   dm_deleting_md(md) ||
-		   test_bit(DMF_FREEING, &md->flags))) {
-		md = NULL;
-		goto out;
+	if (md) {
+		if ((md == MINOR_ALLOCED ||
+		     (MINOR(disk_devt(dm_disk(md))) != minor) ||
+		     dm_deleting_md(md) ||
+		     test_bit(DMF_FREEING, &md->flags))) {
+			md = NULL;
+			goto out;
+		}
+		dm_get(md);
 	}
 
 out:
@@ -2445,16 +2448,6 @@ out:
 
 	return md;
 }
-
-struct mapped_device *dm_get_md(dev_t dev)
-{
-	struct mapped_device *md = dm_find_md(dev);
-
-	if (md)
-		dm_get(md);
-
-	return md;
-}
 EXPORT_SYMBOL_GPL(dm_get_md);
 
 void *dm_get_mdptr(struct mapped_device *md)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 114/143] dm snapshot: fix a possible invalid memory access on unload
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (112 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 113/143] dm: fix a race condition in dm_get_md Kamal Mostafa
@ 2015-03-31 19:47 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 115/143] cpufreq: s3c: remove incorrect __init annotations Kamal Mostafa
                   ` (28 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Mike Snitzer, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit 22aa66a3ee5b61e0f4a0bfeabcaa567861109ec3 upstream.

When the snapshot target is unloaded, snapshot_dtr() waits until
pending_exceptions_count drops to zero.  Then, it destroys the snapshot.
Therefore, the function that decrements pending_exceptions_count
should not touch the snapshot structure after the decrement.

pending_complete() calls free_pending_exception(), which decrements
pending_exceptions_count, and then it performs up_write(&s->lock) and it
calls retry_origin_bios() which dereferences  s->origin.  These two
memory accesses to the fields of the snapshot may touch the dm_snapshot
struture after it is freed.

This patch moves the call to free_pending_exception() to the end of
pending_complete(), so that the snapshot will not be destroyed while
pending_complete() is in progress.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-snap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 944690b..d892a05 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1439,8 +1439,6 @@ out:
 		full_bio->bi_end_io = pe->full_bio_end_io;
 		full_bio->bi_private = pe->full_bio_private;
 	}
-	free_pending_exception(pe);
-
 	increment_pending_exceptions_done_count();
 
 	up_write(&s->lock);
@@ -1457,6 +1455,8 @@ out:
 	}
 
 	retry_origin_bios(s, origin_bios);
+
+	free_pending_exception(pe);
 }
 
 static void commit_callback(void *context, int success)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 115/143] cpufreq: s3c: remove incorrect __init annotations
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (113 preceding siblings ...)
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 114/143] dm snapshot: fix a possible invalid memory access on unload Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 116/143] libceph: assert both regular and lingering lists in __remove_osd() Kamal Mostafa
                   ` (27 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Rafael J. Wysocki, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Arnd Bergmann <arnd@arndb.de>

commit 61882b63171736571e1139ab5aa929e3bb336016 upstream.

The two functions s3c2416_cpufreq_driver_init and s3c_cpufreq_register
are marked init but are called from a context that might be run after
the __init sections are discarded, as the compiler points out:

WARNING: vmlinux.o(.data+0x1ad9dc): Section mismatch in reference from the variable s3c2416_cpufreq_driver to the function .init.text:s3c2416_cpufreq_driver_init()
WARNING: drivers/built-in.o(.text+0x35b5dc): Section mismatch in reference from the function s3c2410a_cpufreq_add() to the function .init.text:s3c_cpufreq_register()

This removes the __init markings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/cpufreq/s3c2416-cpufreq.c | 4 ++--
 drivers/cpufreq/s3c24xx-cpufreq.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
index 8d904a0..9499306 100644
--- a/drivers/cpufreq/s3c2416-cpufreq.c
+++ b/drivers/cpufreq/s3c2416-cpufreq.c
@@ -263,7 +263,7 @@ out:
 }
 
 #ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE
-static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
+static void s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
 {
 	int count, v, i, found;
 	struct cpufreq_frequency_table *freq;
@@ -335,7 +335,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
 	.notifier_call = s3c2416_cpufreq_reboot_notifier_evt,
 };
 
-static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
+static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
 {
 	struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
 	struct cpufreq_frequency_table *freq;
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c
index 4850882..436a9d8 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq.c
@@ -458,7 +458,7 @@ static struct cpufreq_driver s3c24xx_driver = {
 };
 
 
-int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info)
+int s3c_cpufreq_register(struct s3c_cpufreq_info *info)
 {
 	if (!info || !info->name) {
 		printk(KERN_ERR "%s: failed to pass valid information\n",
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 116/143] libceph: assert both regular and lingering lists in __remove_osd()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (114 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 115/143] cpufreq: s3c: remove incorrect __init annotations Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 117/143] libceph: change from BUG to WARN for __remove_osd() asserts Kamal Mostafa
                   ` (26 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ilya Dryomov, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ilya Dryomov <ilya.dryomov@inktank.com>

commit 7c6e6fc53e7335570ed82f77656cedce1502744e upstream.

It is important that both regular and lingering requests lists are
empty when the OSD is removed.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ceph/osd_client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index e6b2db6..4e24b73 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -976,6 +976,8 @@ static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 {
 	dout("__remove_osd %p\n", osd);
 	BUG_ON(!list_empty(&osd->o_requests));
+	BUG_ON(!list_empty(&osd->o_linger_requests));
+
 	rb_erase(&osd->o_node, &osdc->osds);
 	list_del_init(&osd->o_osd_lru);
 	ceph_con_close(&osd->o_con);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 117/143] libceph: change from BUG to WARN for __remove_osd() asserts
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (115 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 116/143] libceph: assert both regular and lingering lists in __remove_osd() Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 118/143] libceph: fix double __remove_osd() problem Kamal Mostafa
                   ` (25 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ilya Dryomov, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ilya Dryomov <idryomov@redhat.com>

commit cc9f1f518cec079289d11d732efa490306b1ddad upstream.

No reason to use BUG_ON for osd request list assertions.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ceph/osd_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 4e24b73..ba3330e 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -975,8 +975,8 @@ static void put_osd(struct ceph_osd *osd)
 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 {
 	dout("__remove_osd %p\n", osd);
-	BUG_ON(!list_empty(&osd->o_requests));
-	BUG_ON(!list_empty(&osd->o_linger_requests));
+	WARN_ON(!list_empty(&osd->o_requests));
+	WARN_ON(!list_empty(&osd->o_linger_requests));
 
 	rb_erase(&osd->o_node, &osdc->osds);
 	list_del_init(&osd->o_osd_lru);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 118/143] libceph: fix double __remove_osd() problem
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (116 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 117/143] libceph: change from BUG to WARN for __remove_osd() asserts Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 119/143] MIPS: Export FP functions used by lose_fpu(1) for KVM Kamal Mostafa
                   ` (24 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sage Weil, Ilya Dryomov, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Ilya Dryomov <idryomov@gmail.com>

commit 7eb71e0351fbb1b242ae70abb7bb17107fe2f792 upstream.

It turns out it's possible to get __remove_osd() called twice on the
same OSD.  That doesn't sit well with rb_erase() - depending on the
shape of the tree we can get a NULL dereference, a soft lockup or
a random crash at some point in the future as we end up touching freed
memory.  One scenario that I was able to reproduce is as follows:

            <osd3 is idle, on the osd lru list>
<con reset - osd3>
con_fault_finish()
  osd_reset()
                              <osdmap - osd3 down>
                              ceph_osdc_handle_map()
                                <takes map_sem>
                                kick_requests()
                                  <takes request_mutex>
                                  reset_changed_osds()
                                    __reset_osd()
                                      __remove_osd()
                                  <releases request_mutex>
                                <releases map_sem>
    <takes map_sem>
    <takes request_mutex>
    __kick_osd_requests()
      __reset_osd()
        __remove_osd() <-- !!!

A case can be made that osd refcounting is imperfect and reworking it
would be a proper resolution, but for now Sage and I decided to fix
this by adding a safe guard around __remove_osd().

Fixes: http://tracker.ceph.com/issues/8087

Cc: Sage Weil <sage@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ceph/osd_client.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index ba3330e..aab7336 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -974,14 +974,24 @@ static void put_osd(struct ceph_osd *osd)
  */
 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 {
-	dout("__remove_osd %p\n", osd);
+	dout("%s %p osd%d\n", __func__, osd, osd->o_osd);
 	WARN_ON(!list_empty(&osd->o_requests));
 	WARN_ON(!list_empty(&osd->o_linger_requests));
 
-	rb_erase(&osd->o_node, &osdc->osds);
 	list_del_init(&osd->o_osd_lru);
-	ceph_con_close(&osd->o_con);
-	put_osd(osd);
+	rb_erase(&osd->o_node, &osdc->osds);
+	RB_CLEAR_NODE(&osd->o_node);
+}
+
+static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
+{
+	dout("%s %p osd%d\n", __func__, osd, osd->o_osd);
+
+	if (!RB_EMPTY_NODE(&osd->o_node)) {
+		ceph_con_close(&osd->o_con);
+		__remove_osd(osdc, osd);
+		put_osd(osd);
+	}
 }
 
 static void remove_all_osds(struct ceph_osd_client *osdc)
@@ -991,7 +1001,7 @@ static void remove_all_osds(struct ceph_osd_client *osdc)
 	while (!RB_EMPTY_ROOT(&osdc->osds)) {
 		struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds),
 						struct ceph_osd, o_node);
-		__remove_osd(osdc, osd);
+		remove_osd(osdc, osd);
 	}
 	mutex_unlock(&osdc->request_mutex);
 }
@@ -1021,7 +1031,7 @@ static void remove_old_osds(struct ceph_osd_client *osdc)
 	list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) {
 		if (time_before(jiffies, osd->lru_ttl))
 			break;
-		__remove_osd(osdc, osd);
+		remove_osd(osdc, osd);
 	}
 	mutex_unlock(&osdc->request_mutex);
 }
@@ -1036,8 +1046,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 	dout("__reset_osd %p osd%d\n", osd, osd->o_osd);
 	if (list_empty(&osd->o_requests) &&
 	    list_empty(&osd->o_linger_requests)) {
-		__remove_osd(osdc, osd);
-
+		remove_osd(osdc, osd);
 		return -ENODEV;
 	}
 
@@ -1619,6 +1628,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc)
 {
 	struct rb_node *p, *n;
 
+	dout("%s %p\n", __func__, osdc);
 	for (p = rb_first(&osdc->osds); p; p = n) {
 		struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 119/143] MIPS: Export FP functions used by lose_fpu(1) for KVM
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (117 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 118/143] libceph: fix double __remove_osd() problem Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 120/143] kdb: fix incorrect counts in KDB summary command output Kamal Mostafa
                   ` (23 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: James Hogan, Paolo Bonzini, Ralf Baechle, Paul Burton,
	Gleb Natapov, kvm, linux-mips, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

[ Upstream commit 3ce465e04bfd8de9956d515d6e9587faac3375dc ]

Export the _save_fp asm function used by the lose_fpu(1) macro to GPL
modules so that KVM can make use of it when it is built as a module.

This fixes the following build error when CONFIG_KVM=m due to commit
f798217dfd03 ("KVM: MIPS: Don't leak FPU/DSP to guest"):

ERROR: "_save_fp" [arch/mips/kvm/kvm.ko] undefined!

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Fixes: f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest)
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9260/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
[james.hogan@imgtec.com: Only export when CPU_R4K_FPU=y prior to v3.16,
 so as not to break the Octeon build which excludes FPU support. KVM
 depends on MIPS32r2 anyway.]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/mips/kernel/mips_ksyms.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 6e58e97..cedeb56 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -14,6 +14,7 @@
 #include <linux/mm.h>
 #include <asm/uaccess.h>
 #include <asm/ftrace.h>
+#include <asm/fpu.h>
 
 extern void *__bzero(void *__s, size_t __count);
 extern long __strncpy_from_user_nocheck_asm(char *__to,
@@ -26,6 +27,13 @@ extern long __strnlen_user_nocheck_asm(const char *s);
 extern long __strnlen_user_asm(const char *s);
 
 /*
+ * Core architecture code
+ */
+#ifdef CONFIG_CPU_R4K_FPU
+EXPORT_SYMBOL_GPL(_save_fp);
+#endif
+
+/*
  * String functions
  */
 EXPORT_SYMBOL(memset);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 120/143] kdb: fix incorrect counts in KDB summary command output
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (118 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 119/143] MIPS: Export FP functions used by lose_fpu(1) for KVM Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 121/143] blk-throttle: check stats_cpu before reading it from sysfs Kamal Mostafa
                   ` (22 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jay Lan, Jason Wessel, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jay Lan <jlan@sgi.com>

commit 146755923262037fc4c54abc28c04b1103f3cc51 upstream.

The output of KDB 'summary' command should report MemTotal, MemFree
and Buffers output in kB. Current codes report in unit of pages.

A define of K(x) as
is defined in the code, but not used.

This patch would apply the define to convert the values to kB.
Please include me on Cc on replies. I do not subscribe to linux-kernel.

Signed-off-by: Jay Lan <jlan@sgi.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/debug/kdb/kdb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 0b097c8..449518e 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2535,7 +2535,7 @@ static int kdb_summary(int argc, const char **argv)
 #define K(x) ((x) << (PAGE_SHIFT - 10))
 	kdb_printf("\nMemTotal:       %8lu kB\nMemFree:        %8lu kB\n"
 		   "Buffers:        %8lu kB\n",
-		   val.totalram, val.freeram, val.bufferram);
+		   K(val.totalram), K(val.freeram), K(val.bufferram));
 	return 0;
 }
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 121/143] blk-throttle: check stats_cpu before reading it from sysfs
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (119 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 120/143] kdb: fix incorrect counts in KDB summary command output Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 122/143] procfs: fix race between symlink removals and traversals Kamal Mostafa
                   ` (21 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thadeu Lima de Souza Cascardo, Jens Axboe, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>

commit 045c47ca306acf30c740c285a77a4b4bda6be7c5 upstream.

When reading blkio.throttle.io_serviced in a recently created blkio
cgroup, it's possible to race against the creation of a throttle policy,
which delays the allocation of stats_cpu.

Like other functions in the throttle code, just checking for a NULL
stats_cpu prevents the following oops caused by that race.

[ 1117.285199] Unable to handle kernel paging request for data at address 0x7fb4d0020
[ 1117.285252] Faulting instruction address: 0xc0000000003efa2c
[ 1137.733921] Oops: Kernel access of bad area, sig: 11 [#1]
[ 1137.733945] SMP NR_CPUS=2048 NUMA PowerNV
[ 1137.734025] Modules linked in: bridge stp llc kvm_hv kvm binfmt_misc autofs4
[ 1137.734102] CPU: 3 PID: 5302 Comm: blkcgroup Not tainted 3.19.0 #5
[ 1137.734132] task: c000000f1d188b00 ti: c000000f1d210000 task.ti: c000000f1d210000
[ 1137.734167] NIP: c0000000003efa2c LR: c0000000003ef9f0 CTR: c0000000003ef980
[ 1137.734202] REGS: c000000f1d213500 TRAP: 0300   Not tainted  (3.19.0)
[ 1137.734230] MSR: 9000000000009032 <SF,HV,EE,ME,IR,DR,RI>  CR: 42008884  XER: 20000000
[ 1137.734325] CFAR: 0000000000008458 DAR: 00000007fb4d0020 DSISR: 40000000 SOFTE: 0
GPR00: c0000000003ed3a0 c000000f1d213780 c000000000c59538 0000000000000000
GPR04: 0000000000000800 0000000000000000 0000000000000000 0000000000000000
GPR08: ffffffffffffffff 00000007fb4d0020 00000007fb4d0000 c000000000780808
GPR12: 0000000022000888 c00000000fdc0d80 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 000001003e120200 c000000f1d5b0cc0 0000000000000200 0000000000000000
GPR24: 0000000000000001 c000000000c269e0 0000000000000020 c000000f1d5b0c80
GPR28: c000000000ca3a08 c000000000ca3dec c000000f1c667e00 c000000f1d213850
[ 1137.734886] NIP [c0000000003efa2c] .tg_prfill_cpu_rwstat+0xac/0x180
[ 1137.734915] LR [c0000000003ef9f0] .tg_prfill_cpu_rwstat+0x70/0x180
[ 1137.734943] Call Trace:
[ 1137.734952] [c000000f1d213780] [d000000005560520] 0xd000000005560520 (unreliable)
[ 1137.734996] [c000000f1d2138a0] [c0000000003ed3a0] .blkcg_print_blkgs+0xe0/0x1a0
[ 1137.735039] [c000000f1d213960] [c0000000003efb50] .tg_print_cpu_rwstat+0x50/0x70
[ 1137.735082] [c000000f1d2139e0] [c000000000104b48] .cgroup_seqfile_show+0x58/0x150
[ 1137.735125] [c000000f1d213a70] [c0000000002749dc] .kernfs_seq_show+0x3c/0x50
[ 1137.735161] [c000000f1d213ae0] [c000000000218630] .seq_read+0xe0/0x510
[ 1137.735197] [c000000f1d213bd0] [c000000000275b04] .kernfs_fop_read+0x164/0x200
[ 1137.735240] [c000000f1d213c80] [c0000000001eb8e0] .__vfs_read+0x30/0x80
[ 1137.735276] [c000000f1d213cf0] [c0000000001eb9c4] .vfs_read+0x94/0x1b0
[ 1137.735312] [c000000f1d213d90] [c0000000001ebb38] .SyS_read+0x58/0x100
[ 1137.735349] [c000000f1d213e30] [c000000000009218] syscall_exit+0x0/0x98
[ 1137.735383] Instruction dump:
[ 1137.735405] 7c6307b4 7f891800 409d00b8 60000000 60420000 3d420004 392a63b0 786a1f24
[ 1137.735471] 7d49502a e93e01c8 7d495214 7d2ad214 <7cead02a> e9090008 e9490010 e9290018

And here is one code that allows to easily reproduce this, although this
has first been found by running docker.

void run(pid_t pid)
{
	int n;
	int status;
	int fd;
	char *buffer;
	buffer = memalign(BUFFER_ALIGN, BUFFER_SIZE);
	n = snprintf(buffer, BUFFER_SIZE, "%d\n", pid);
	fd = open(CGPATH "/test/tasks", O_WRONLY);
	write(fd, buffer, n);
	close(fd);
	if (fork() > 0) {
		fd = open("/dev/sda", O_RDONLY | O_DIRECT);
		read(fd, buffer, 512);
		close(fd);
		wait(&status);
	} else {
		fd = open(CGPATH "/test/blkio.throttle.io_serviced", O_RDONLY);
		n = read(fd, buffer, BUFFER_SIZE);
		close(fd);
	}
	free(buffer);
	exit(0);
}

void test(void)
{
	int status;
	mkdir(CGPATH "/test", 0666);
	if (fork() > 0)
		wait(&status);
	else
		run(getpid());
	rmdir(CGPATH "/test");
}

int main(int argc, char **argv)
{
	int i;
	for (i = 0; i < NR_TESTS; i++)
		test();
	return 0;
}

Reported-by: Ricardo Marin Matinata <rmm@br.ibm.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 block/blk-throttle.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 0653404..a22b148 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1292,6 +1292,9 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf,
 	struct blkg_rwstat rwstat = { }, tmp;
 	int i, cpu;
 
+	if (tg->stats_cpu == NULL)
+		return 0;
+
 	for_each_possible_cpu(cpu) {
 		struct tg_stats_cpu *sc = per_cpu_ptr(tg->stats_cpu, cpu);
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 122/143] procfs: fix race between symlink removals and traversals
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (120 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 121/143] blk-throttle: check stats_cpu before reading it from sysfs Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 123/143] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation Kamal Mostafa
                   ` (20 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 7e0e953bb0cf649f93277ac8fb67ecbb7f7b04a9 upstream.

use_pde()/unuse_pde() in ->follow_link()/->put_link() resp.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/proc/generic.c  | 12 ------------
 fs/proc/inode.c    | 21 +++++++++++++++++++++
 fs/proc/internal.h |  1 +
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index cca93b6..c8310e5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -19,7 +19,6 @@
 #include <linux/mount.h>
 #include <linux/init.h>
 #include <linux/idr.h>
-#include <linux/namei.h>
 #include <linux/bitops.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -163,17 +162,6 @@ void proc_free_inum(unsigned int inum)
 	spin_unlock_irqrestore(&proc_inum_lock, flags);
 }
 
-static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-	nd_set_link(nd, __PDE_DATA(dentry->d_inode));
-	return NULL;
-}
-
-static const struct inode_operations proc_link_inode_operations = {
-	.readlink	= generic_readlink,
-	.follow_link	= proc_follow_link,
-};
-
 /*
  * Don't create negative dentries here, return -ENOENT by hand
  * instead.
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 124fc43..2f2815f 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/mount.h>
 #include <linux/magic.h>
+#include <linux/namei.h>
 
 #include <asm/uaccess.h>
 
@@ -401,6 +402,26 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
 };
 #endif
 
+static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+	struct proc_dir_entry *pde = PDE(dentry->d_inode);
+	if (unlikely(!use_pde(pde)))
+		return ERR_PTR(-EINVAL);
+	nd_set_link(nd, pde->data);
+	return pde;
+}
+
+static void proc_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
+{
+	unuse_pde(p);
+}
+
+const struct inode_operations proc_link_inode_operations = {
+	.readlink	= generic_readlink,
+	.follow_link	= proc_follow_link,
+	.put_link	= proc_put_link,
+};
+
 struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
 {
 	struct inode *inode = new_inode_pseudo(sb);
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 651d09a..8b8ca1d 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -202,6 +202,7 @@ struct pde_opener {
 	int closing;
 	struct completion *c;
 };
+extern const struct inode_operations proc_link_inode_operations;
 
 extern const struct inode_operations proc_pid_link_inode_operations;
 
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 123/143] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (121 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 122/143] procfs: fix race between symlink removals and traversals Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 124/143] pktgen: fix UDP checksum computation Kamal Mostafa
                   ` (19 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Al Viro, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 0a280962dc6e117e0e4baa668453f753579265d9 upstream.

X-Coverup: just ask spender
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/autofs4/dev-ioctl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 1818ce7..214f1b5 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
  */
 static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
 {
-	struct autofs_dev_ioctl tmp;
+	struct autofs_dev_ioctl tmp, *res;
 
 	if (copy_from_user(&tmp, in, sizeof(tmp)))
 		return ERR_PTR(-EFAULT);
@@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
 	if (tmp.size < sizeof(tmp))
 		return ERR_PTR(-EINVAL);
 
-	return memdup_user(in, tmp.size);
+	res = memdup_user(in, tmp.size);
+	if (!IS_ERR(res))
+		res->size = tmp.size;
+
+	return res;
 }
 
 static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 124/143] pktgen: fix UDP checksum computation
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (122 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 123/143] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 125/143] ipv6: fix ipv6_cow_metrics for non DST_HOST case Kamal Mostafa
                   ` (18 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sabrina Dubroca, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sabrina Dubroca <sd@queasysnail.net>

commit 7744b5f3693cc06695cb9d6667671c790282730f upstream.

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

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

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

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

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


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

* [PATCH 3.13.y-ckt 125/143] ipv6: fix ipv6_cow_metrics for non DST_HOST case
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (123 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 124/143] pktgen: fix UDP checksum computation Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 126/143] clk-gate: fix bit # check in clk_register_gate() Kamal Mostafa
                   ` (17 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin KaFai Lau, David S. Miller, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 3b4711757d7903ab6fa88a9e7ab8901b8227da60 upstream.

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

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

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

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

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

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

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

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


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

* [PATCH 3.13.y-ckt 126/143] clk-gate: fix bit # check in clk_register_gate()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (124 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 125/143] ipv6: fix ipv6_cow_metrics for non DST_HOST case Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 127/143] ALSA: off by one bug in snd_riptide_joystick_probe() Kamal Mostafa
                   ` (16 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Shtylyov, Michael Turquette, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 2e9dcdae4068460c45a308dd891be5248260251c upstream.

In case CLK_GATE_HIWORD_MASK flag is passed to clk_register_gate(), the bit #
should be no higher than 15, however the corresponding check is obviously off-
by-one.

Fixes: 045779942c04 ("clk: gate: add CLK_GATE_HIWORD_MASK")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/clk-gate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c
index 4a58c55..797bab9 100644
--- a/drivers/clk/clk-gate.c
+++ b/drivers/clk/clk-gate.c
@@ -128,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
 	struct clk_init_data init;
 
 	if (clk_gate_flags & CLK_GATE_HIWORD_MASK) {
-		if (bit_idx > 16) {
+		if (bit_idx > 15) {
 			pr_err("gate bit exceeds LOWORD field\n");
 			return ERR_PTR(-EINVAL);
 		}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 127/143] ALSA: off by one bug in snd_riptide_joystick_probe()
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (125 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 126/143] clk-gate: fix bit # check in clk_register_gate() Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 128/143] ath5k: fix spontaneus AR5312 freezes Kamal Mostafa
                   ` (15 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit e4940626defdf6c92da1052ad3f12741c1a28c90 upstream.

The problem here is that we check:

	if (dev >= SNDRV_CARDS)

Then we increment "dev".

       if (!joystick_port[dev++])

Then we use it as an offset into a array with SNDRV_CARDS elements.

	if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {

This has 3 effects:
1) If you use the module option to specify the joystick port then it has
   to be shifted one space over.
2) The wrong error message will be printed on failure if you have over
   32 cards.
3) Static checkers will correctly complain that are off by one.

Fixes: db1005ec6ff8 ('ALSA: riptide - Fix joystick resource handling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/riptide/riptide.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 56cc891..d99c8d3 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -2032,32 +2032,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id)
 {
 	static int dev;
 	struct gameport *gameport;
+	int ret;
 
 	if (dev >= SNDRV_CARDS)
 		return -ENODEV;
+
 	if (!enable[dev]) {
-		dev++;
-		return -ENOENT;
+		ret = -ENOENT;
+		goto inc_dev;
 	}
 
-	if (!joystick_port[dev++])
-		return 0;
+	if (!joystick_port[dev]) {
+		ret = 0;
+		goto inc_dev;
+	}
 
 	gameport = gameport_allocate_port();
-	if (!gameport)
-		return -ENOMEM;
+	if (!gameport) {
+		ret = -ENOMEM;
+		goto inc_dev;
+	}
 	if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {
 		snd_printk(KERN_WARNING
 			   "Riptide: cannot grab gameport 0x%x\n",
 			   joystick_port[dev]);
 		gameport_free_port(gameport);
-		return -EBUSY;
+		ret = -EBUSY;
+		goto inc_dev;
 	}
 
 	gameport->io = joystick_port[dev];
 	gameport_register_port(gameport);
 	pci_set_drvdata(pci, gameport);
-	return 0;
+
+	ret = 0;
+inc_dev:
+	dev++;
+	return ret;
 }
 
 static void snd_riptide_joystick_remove(struct pci_dev *pci)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 128/143] ath5k: fix spontaneus AR5312 freezes
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (126 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 127/143] ALSA: off by one bug in snd_riptide_joystick_probe() Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 129/143] pinctrl: pinctrl-imx: don't use invalid value of conf_reg Kamal Mostafa
                   ` (14 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Slaby, Nick Kossifidis, Luis R. Rodriguez, Sergey Ryazanov,
	Kalle Valo, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Sergey Ryazanov <ryazanov.s.a@gmail.com>

commit 8bfae4f9938b6c1f033a5159febe97e441d6d526 upstream.

Sometimes while CPU have some load and ath5k doing the wireless
interface reset the whole WiSoC completely freezes. Set of tests shows
that using atomic delay function while we wait interface reset helps to
avoid such freezes.

The easiest way to reproduce this issue: create a station interface,
start continous scan with wpa_supplicant and load CPU by something. Or
just create multiple station interfaces and put them all in continous
scan.

This patch partially reverts the commit 1846ac3dbec0 ("ath5k: Use
usleep_range where possible"), which replaces initial udelay()
by usleep_range().

I do not know actual source of this issue, but all looks like that HW
freeze is caused by transaction on internal SoC bus, while wireless
block is in reset state.

Also I should note that I do not know how many chips are affected, but I
did not see this issue with chips, other than AR5312.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Fixes: 1846ac3dbec0 ("ath5k: Use usleep_range where possible")
Reported-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath5k/reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index a3399c4..b9b651e 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags)
 	regval = ioread32(reg);
 	iowrite32(regval | val, reg);
 	regval = ioread32(reg);
-	usleep_range(100, 150);
+	udelay(100);	/* NB: should be atomic */
 
 	/* Bring BB/MAC out of reset */
 	iowrite32(regval & ~val, reg);
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 129/143] pinctrl: pinctrl-imx: don't use invalid value of conf_reg
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (127 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 128/143] ath5k: fix spontaneus AR5312 freezes Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 130/143] ALSA: hda - Add one more node in the EAPD supporting candidate list Kamal Mostafa
                   ` (13 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Linus Walleij, Luis Henriques,
	Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit 4ff0f034e95d65f8f063a362dfcf86e986377a82 upstream.

The right check for conf_reg to be invalid it testing against -1 not 0
as is done in the rest of the driver.

This fixes an oops that can be triggered by:

	cat /sys/kernel/debug/pinctrl/43fac000.iomuxc/*

Fixes: ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[ luis: backported to 3.16:
  - file rename: drivers/pinctrl/freescale/pinctrl-imx.c ->
    drivers/pinctrl/pinctrl-imx.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pinctrl/pinctrl-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 4779b8e..380eeb5 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -365,7 +365,7 @@ static void imx_pinconf_dbg_show(struct pinctrl_dev *pctldev,
 	const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id];
 	unsigned long config;
 
-	if (!pin_reg || !pin_reg->conf_reg) {
+	if (!pin_reg || pin_reg->conf_reg == -1) {
 		seq_printf(s, "N/A");
 		return;
 	}
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 130/143] ALSA: hda - Add one more node in the EAPD supporting candidate list
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (128 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 129/143] pinctrl: pinctrl-imx: don't use invalid value of conf_reg Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 131/143] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Kamal Mostafa
                   ` (12 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Hui Wang, Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Hui Wang <hui.wang@canonical.com>

commit af95b41426e0b58279f8ff0ebe420df49a4e96b8 upstream.

We have a HP machine which use the codec node 0x17 connecting the
internal speaker, and from the node capability, we saw the EAPD,
if we don't set the EAPD on for this node, the internal speaker
can't output any sound.

BugLink: https://bugs.launchpad.net/bugs/1436745
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 113f15c..deec881 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -270,7 +270,7 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
 {
 	/* We currently only handle front, HP */
 	static hda_nid_t pins[] = {
-		0x0f, 0x10, 0x14, 0x15, 0
+		0x0f, 0x10, 0x14, 0x15, 0x17, 0
 	};
 	hda_nid_t *p;
 	for (p = pins; *p; p++)
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 131/143] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (129 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 130/143] ALSA: hda - Add one more node in the EAPD supporting candidate list Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 132/143] drm/i915/bdw: PCI IDs ending in 0xb are ULT Kamal Mostafa
                   ` (11 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Iwai <tiwai@suse.de>

commit 6426460e5d87810e042962281fe3c1e8fc256162 upstream.

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

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

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


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

* [PATCH 3.13.y-ckt 132/143] drm/i915/bdw: PCI IDs ending in 0xb are ULT.
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (130 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 131/143] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 133/143] xfs: Fix quota type in quota structures when reusing quota file Kamal Mostafa
                   ` (10 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jani Nikula, Rodrigo Vivi, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

commit 0dc6f20b9803f09726bbb682649d35cda8ef5b5d upstream.

When reviewing patch that fixes VGA on BDW Halo Jani noticed that
we also had other ULT IDs that weren't listed there.

So this follow-up patch add these pci-ids as halo and fix comments
on i915_pciids.h

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
[ kamal: backport to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 include/drm/i915_pciids.h       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 74c2a37..35f8e47 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1759,6 +1759,7 @@ struct drm_i915_file_private {
 				 ((dev)->pdev->device & 0xFF00) == 0x0C00)
 #define IS_BDW_ULT(dev)		(IS_BROADWELL(dev) && \
 				 (((dev)->pdev->device & 0xf) == 0x6  || \
+				 ((dev)->pdev->device & 0xf) == 0xb  || \
 				 ((dev)->pdev->device & 0xf) == 0xe))
 #define IS_HSW_ULT(dev)		(IS_HASWELL(dev) && \
 				 ((dev)->pdev->device & 0xFF00) == 0x0A00)
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index 940ece4..729a96c 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -214,9 +214,9 @@
 	INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info)
 
 #define _INTEL_BDW_M_IDS(gt, info) \
-	_INTEL_BDW_M(gt, 0x1602, info), /* ULT */ \
+	_INTEL_BDW_M(gt, 0x1602, info), /* Halo */ \
 	_INTEL_BDW_M(gt, 0x1606, info), /* ULT */ \
-	_INTEL_BDW_M(gt, 0x160B, info), /* Iris */ \
+	_INTEL_BDW_M(gt, 0x160B, info), /* ULT */ \
 	_INTEL_BDW_M(gt, 0x160E, info) /* ULX */
 
 #define _INTEL_BDW_D_IDS(gt, info) \
-- 
1.9.1


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

* [PATCH 3.13.y-ckt 133/143] xfs: Fix quota type in quota structures when reusing quota file
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (131 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 132/143] drm/i915/bdw: PCI IDs ending in 0xb are ULT Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 134/143] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Kamal Mostafa
                   ` (9 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jan Kara, Dave Chinner, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Jan Kara <jack@suse.cz>

commit dfcc70a8c868fe03276fa59864149708fb41930b upstream.

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

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

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

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


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

* [PATCH 3.13.y-ckt 134/143] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (132 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 133/143] xfs: Fix quota type in quota structures when reusing quota file Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 135/143] gpio: tps65912: fix wrong container_of arguments Kamal Mostafa
                   ` (8 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans Holmberg, Linus Walleij, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 9cf75e9e4ddd587ac12e88e8751c358b7b27e95f upstream.

The change:

7b8792bbdffdff3abda704f89c6a45ea97afdc62
gpiolib: of: Correct error handling in of_get_named_gpiod_flags

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

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

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


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

* [PATCH 3.13.y-ckt 135/143] gpio: tps65912: fix wrong container_of arguments
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (133 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 134/143] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 136/143] ALSA: pcm: Don't leave PREPARED state after draining Kamal Mostafa
                   ` (7 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolas Saenz Julienne, Linus Walleij, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 2f97c20e5f7c3582c7310f65a04465bfb0fd0e85 upstream.

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

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

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


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

* [PATCH 3.13.y-ckt 136/143] ALSA: pcm: Don't leave PREPARED state after draining
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (134 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 135/143] gpio: tps65912: fix wrong container_of arguments Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 137/143] metag: Fix KSTK_EIP() and KSTK_ESP() macros Kamal Mostafa
                   ` (6 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Takashi Iwai <tiwai@suse.de>

commit 70372a7566b5e552dbe48abdac08c275081d8558 upstream.

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

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

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


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

* [PATCH 3.13.y-ckt 137/143] metag: Fix KSTK_EIP() and KSTK_ESP() macros
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (135 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 136/143] ALSA: pcm: Don't leave PREPARED state after draining Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 138/143] md/raid1: fix read balance when a drive is write-mostly Kamal Mostafa
                   ` (5 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: James Hogan, linux-metag, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit c2996cb29bfb73927a79dc96e598a718e843f01a upstream.

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

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

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

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

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

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

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

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

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

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

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


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

* [PATCH 3.13.y-ckt 138/143] md/raid1: fix read balance when a drive is write-mostly.
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (136 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 137/143] metag: Fix KSTK_EIP() and KSTK_ESP() macros Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 139/143] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Kamal Mostafa
                   ` (4 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit d1901ef099c38afd11add4cfb3312c02ef21ec4a upstream.

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

This behaviour was broken by

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

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

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

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

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

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

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


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

* [PATCH 3.13.y-ckt 139/143] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (137 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 138/143] md/raid1: fix read balance when a drive is write-mostly Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 140/143] drm/radeon: fix 1 RB harvest config setup for TN/RL Kamal Mostafa
                   ` (3 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 3d2d98ee1af0cf6eebfbd6bff4c17d3601ac1284 upstream.

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

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

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


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

* [PATCH 3.13.y-ckt 140/143] drm/radeon: fix 1 RB harvest config setup for TN/RL
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (138 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 139/143] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 141/143] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Kamal Mostafa
                   ` (2 subsequent siblings)
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit dbfb00c3e7e18439f2ebf67fe99bf7a50b5bae1e upstream.

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

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

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


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

* [PATCH 3.13.y-ckt 141/143] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (139 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 140/143] drm/radeon: fix 1 RB harvest config setup for TN/RL Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 142/143] nilfs2: fix potential memory overrun on inode Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 143/143] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Kamal Mostafa
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Catalin Marinas, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 9d42d48a342aee208c1154696196497fdc556bbf upstream.

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

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

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


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

* [PATCH 3.13.y-ckt 142/143] nilfs2: fix potential memory overrun on inode
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (140 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 141/143] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 143/143] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Kamal Mostafa
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ryusuke Konishi, Andrew Morton, Linus Torvalds, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

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

commit 957ed60b53b519064a54988c4e31e0087e47d091 upstream.

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

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

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

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

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

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

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

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


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

* [PATCH 3.13.y-ckt 143/143] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events
  2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
                   ` (141 preceding siblings ...)
  2015-03-31 19:48 ` [PATCH 3.13.y-ckt 142/143] nilfs2: fix potential memory overrun on inode Kamal Mostafa
@ 2015-03-31 19:48 ` Kamal Mostafa
  142 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-03-31 19:48 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Seth Forshee, Jiri Kosina, Kamal Mostafa

3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Seth Forshee <seth.forshee@canonical.com>

commit 6d00f37e49d95e640a3937a4a1ae07dbe92a10cb upstream.

d1c7e29e8d27 (HID: i2c-hid: prevent buffer overflow in early IRQ)
changed hid_get_input() to read ihid->bufsize bytes, which can be
more than wMaxInputLength. This is the case with the Dell XPS 13
9343, and it is causing events to be missed. In some cases the
missed events are releases, which can cause the cursor to jump or
freeze, among other problems. Limit the number of bytes read to
min(wMaxInputLength, ihid->bufsize) to prevent such problems.

Fixes: d1c7e29e8d27 "HID: i2c-hid: prevent buffer overflow in early IRQ"
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hid/i2c-hid/i2c-hid.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 05c2134..cc4b092 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -356,7 +356,10 @@ static int i2c_hid_hwreset(struct i2c_client *client)
 static void i2c_hid_get_input(struct i2c_hid *ihid)
 {
 	int ret, ret_size;
-	int size = ihid->bufsize;
+	int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
+
+	if (size > ihid->bufsize)
+		size = ihid->bufsize;
 
 	ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
 	if (ret != size) {
-- 
1.9.1


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

* Re: [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency
  2015-03-31 19:47 ` [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency Kamal Mostafa
@ 2015-04-01  9:37   ` Luis Henriques
  2015-04-02 17:39     ` Kamal Mostafa
  0 siblings, 1 reply; 146+ messages in thread
From: Luis Henriques @ 2015-04-01  9:37 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: linux-kernel, stable, kernel-team, Felipe Balbi, Arnd Bergmann

On Tue, Mar 31, 2015 at 12:47:01PM -0700, Kamal Mostafa wrote:
> 3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.
>

Arnd reported a regression caused by this patch.  It seems to be fixed
by commit 1c390eb360c3 ("usb: musb: fix Kconfig regression"), also
tagged for stable.  However, it looks like this patch was actually
dropped from all the stable trees as Arnd also pointed out that the
original problem was relatively harmless.

Cheers,
--
Luís

> ------------------
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> commit fbba7db3990cb707ff91cd6507d53a0a730afe97 upstream.
> 
> The omap musb front-end calls into the phy driver directly
> instead of using a generic phy interface, which causes a link
> error when the specific driver is not built-in:
> 
> drivers/built-in.o: In function `omap2430_musb_disable':
> usb/musb/omap2430.c:480: undefined reference to `omap_control_usb_set_mode'
> drivers/built-in.o: In function `omap2430_musb_enable':
> usb/musb/omap2430.c:466: undefined reference to `omap_control_usb_set_mode'
> usb/musb/omap2430.c:447: undefined reference to `omap_control_usb_set_mode'
> drivers/built-in.o: In function `omap_musb_set_mailbox':
> usb/musb/omap2430.c:273: undefined reference to `omap_control_usb_set_mode'
> usb/musb/omap2430.c:304: undefined reference to `omap_control_usb_set_mode'
> drivers/built-in.o:(.debug_addr+0xbd9e0): more undefined references to `omap_control_usb_set_mode' follow
> 
> This adds an explicit dependency.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: ca784be36cc725 ("usb: start using the control module driver")
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  drivers/usb/musb/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
> index a70f46f..ddcbcdd 100644
> --- a/drivers/usb/musb/Kconfig
> +++ b/drivers/usb/musb/Kconfig
> @@ -74,7 +74,7 @@ config USB_MUSB_TUSB6010
>  
>  config USB_MUSB_OMAP2PLUS
>  	tristate "OMAP2430 and onwards"
> -	depends on ARCH_OMAP2PLUS && USB
> +	depends on ARCH_OMAP2PLUS && USB && OMAP_CONTROL_PHY
>  	select GENERIC_PHY
>  
>  config USB_MUSB_AM35X
> -- 
> 1.9.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

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

* Re: [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency
  2015-04-01  9:37   ` Luis Henriques
@ 2015-04-02 17:39     ` Kamal Mostafa
  0 siblings, 0 replies; 146+ messages in thread
From: Kamal Mostafa @ 2015-04-02 17:39 UTC (permalink / raw)
  To: Luis Henriques
  Cc: linux-kernel, stable, kernel-team, Felipe Balbi, Arnd Bergmann

On Wed, 2015-04-01 at 10:37 +0100, Luis Henriques wrote:
> On Tue, Mar 31, 2015 at 12:47:01PM -0700, Kamal Mostafa wrote:
> > 3.13.11-ckt18 -stable review patch.  If anyone has any objections, please let me know.
> >
> 
> Arnd reported a regression caused by this patch.  It seems to be fixed
> by commit 1c390eb360c3 ("usb: musb: fix Kconfig regression"), also
> tagged for stable.  However, it looks like this patch was actually
> dropped from all the stable trees as Arnd also pointed out that the
> original problem was relatively harmless.

Ok, I'll drop it from 3.13-stable as well then.  Thanks Luis and Arnd.

 -Kamal


> Cheers,
> --
> Luís
> 
> > ------------------
> > 
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > commit fbba7db3990cb707ff91cd6507d53a0a730afe97 upstream.
> > 
> > The omap musb front-end calls into the phy driver directly
> > instead of using a generic phy interface, which causes a link
> > error when the specific driver is not built-in:
> > 
> > drivers/built-in.o: In function `omap2430_musb_disable':
> > usb/musb/omap2430.c:480: undefined reference to `omap_control_usb_set_mode'
> > drivers/built-in.o: In function `omap2430_musb_enable':
> > usb/musb/omap2430.c:466: undefined reference to `omap_control_usb_set_mode'
> > usb/musb/omap2430.c:447: undefined reference to `omap_control_usb_set_mode'
> > drivers/built-in.o: In function `omap_musb_set_mailbox':
> > usb/musb/omap2430.c:273: undefined reference to `omap_control_usb_set_mode'
> > usb/musb/omap2430.c:304: undefined reference to `omap_control_usb_set_mode'
> > drivers/built-in.o:(.debug_addr+0xbd9e0): more undefined references to `omap_control_usb_set_mode' follow
> > 
> > This adds an explicit dependency.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: ca784be36cc725 ("usb: start using the control module driver")
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > ---
> >  drivers/usb/musb/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
> > index a70f46f..ddcbcdd 100644
> > --- a/drivers/usb/musb/Kconfig
> > +++ b/drivers/usb/musb/Kconfig
> > @@ -74,7 +74,7 @@ config USB_MUSB_TUSB6010
> >  
> >  config USB_MUSB_OMAP2PLUS
> >  	tristate "OMAP2430 and onwards"
> > -	depends on ARCH_OMAP2PLUS && USB
> > +	depends on ARCH_OMAP2PLUS && USB && OMAP_CONTROL_PHY
> >  	select GENERIC_PHY
> >  
> >  config USB_MUSB_AM35X
> > -- 
> > 1.9.1
> > 
> > 
> > -- 
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



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

end of thread, other threads:[~2015-04-02 17:39 UTC | newest]

Thread overview: 146+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31 19:46 [3.13.y-ckt stable] Linux 3.13.11-ckt18 stable review Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 001/143] quota: Store maximum space limit in bytes Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 002/143] ip: zero sockaddr returned on error queue Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 003/143] net: rps: fix cpu unplug Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 004/143] ipv6: stop sending PTB packets for MTU < 1280 Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 005/143] netxen: fix netxen_nic_poll() logic Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 006/143] udp_diag: Fix socket skipping within chain Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 007/143] ping: Fix race in free in receive path Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 008/143] bnx2x: fix napi poll return value for repoll Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 009/143] net: don't OOPS on socket aio Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 010/143] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 011/143] ipv4: tcp: get rid of ugly unicast_sock Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 012/143] ppp: deflate: never return len larger than output buffer Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 013/143] net: sctp: fix passing wrong parameter header to param_type2af in sctp_process_param Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 014/143] ARM: pxa: add regulator_has_full_constraints to corgi board file Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 015/143] ARM: pxa: add regulator_has_full_constraints to poodle " Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 016/143] ARM: pxa: add regulator_has_full_constraints to spitz " Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 017/143] hx4700: regulator: declare full constraints Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 018/143] HID: input: fix confusion on conflicting mappings Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 019/143] HID: fixup the conflicting keyboard mappings quirk Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 020/143] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 021/143] PCI: Generate uppercase hex for modalias var in uevent Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 022/143] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 023/143] tty/serial: at91: enable peripheral clock before accessing I/O registers Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 024/143] tty/serial: at91: fix error handling in atmel_serial_probe() Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 025/143] axonram: Fix bug in direct_access Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 026/143] ksoftirqd: Enable IRQs and call cond_resched() before poking RCU Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 027/143] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 028/143] char: tpm: Add missing error check for devm_kzalloc Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 029/143] tpm_tis: verify interrupt during init Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 030/143] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 031/143] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 032/143] tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 033/143] mmc: sdhci-pxav3: fix unbalanced clock issues during probe Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 034/143] iwlwifi: mvm: validate tid and sta_id in ba_notif Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 035/143] power: bq24190: Fix ignored supplicants Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 036/143] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 037/143] Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 038/143] cfq-iosched: fix incorrect filing of rt async cfqq Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 039/143] smack: fix possible use after frees in task_security() callers Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 040/143] xfs: ensure buffer types are set correctly Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 041/143] xfs: inode unlink does not set AGI buffer type Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 042/143] xfs: set buf types when converting extent formats Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 043/143] xfs: set superblock buffer type correctly Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 044/143] btrfs: set proper message level for skinny metadata Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 045/143] KVM: s390: base hrtimer on a monotonic clock Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 046/143] PCI: Fix infinite loop with ROM image of size 0 Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 047/143] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 048/143] clk: zynq: Force CPU_2X clock to be ungated Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 049/143] mmc: sdhci-pxav3: Remove checks for mandatory host clock Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 050/143] mmc: sdhci-pxav3: fix race between runtime pm and irq Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 051/143] power_supply: 88pm860x: Fix leaked power supply on probe fail Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 052/143] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 053/143] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Kamal Mostafa
2015-03-31 19:46 ` [PATCH 3.13.y-ckt 054/143] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 055/143] usb: musb: omap2plus bus glue needs USB host support Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 056/143] usb: musb: add omap-control dependency Kamal Mostafa
2015-04-01  9:37   ` Luis Henriques
2015-04-02 17:39     ` Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 057/143] cdc-acm: add sanity checks Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 058/143] USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd) Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 059/143] USB: fix use-after-free bug in usb_hcd_unlink_urb() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 060/143] iwlwifi: mvm: always use mac color zero Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 061/143] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 062/143] vt: provide notifications on selection changes Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 063/143] tty: Prevent untrappable signals from malicious program Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 064/143] cpufreq: Set cpufreq_cpu_data to NULL before putting kobject Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 065/143] [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 066/143] mei: mask interrupt set bit on clean reset bit Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 067/143] mei: me: release hw from reset only during the reset flow Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 068/143] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 069/143] KVM: MIPS: Don't leak FPU/DSP to guest Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 070/143] ALSA: hda - Add the pin fixup for HP Envy TS bass speaker Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 071/143] ALSA: hda - Set up GPIO for Toshiba Satellite S50D Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 072/143] xen/manage: Fix USB interaction issues when resuming Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 073/143] drm/i915: Correct the IOSF Dev_FN field for IOSF transfers Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 074/143] cfq-iosched: handle failure of cfq group allocation Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 075/143] tracing: Fix unmapping loop in tracing_mark_write Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 076/143] fsnotify: fix handling of renames in audit Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 077/143] drm/radeon: workaround for CP HW bug on CIK Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 078/143] drm/radeon: only enable kv/kb dpm interrupts once v3 Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 079/143] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 080/143] cpufreq: speedstep-smi: enable interrupts when waiting Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 081/143] mm/hugetlb: pmd_huge() returns true for non-present hugepage Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 082/143] mm: cleanup follow_page_mask() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 083/143] mm/hugetlb: take page table lock in follow_huge_pmd() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 084/143] mm/hugetlb: fix getting refcount 0 page in hugetlb_fault() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 085/143] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 086/143] mm/hugetlb: add migration entry check in __unmap_hugepage_range Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 087/143] mm: softdirty: unmapped addresses between VMAs are clean Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 088/143] proc/pagemap: walk page tables under pte lock Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 089/143] mm: when stealing freepages, also take pages created by splitting buddy page Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 090/143] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 091/143] mm/nommu.c: " Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 092/143] iscsi-target: Drop problematic active_ts_list usage Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 093/143] target: Fix PR_APTPL_BUF_LEN buffer size limitation Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 094/143] mm/compaction: fix wrong order check in compact_finished() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 095/143] mm/memory.c: actually remap enough memory Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 096/143] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page() Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 097/143] ALSA: hda - enable mute led quirk for one more hp machine Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 098/143] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 099/143] drm/radeon/dp: Set EDP_CONFIGURATION_SET for bridge chips if necessary Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 100/143] drm/radeon: fix voltage setup on hawaii Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 101/143] ALSA: hdspm - Constrain periods to 2 on older cards Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 102/143] jffs2: fix handling of corrupted summary length Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 103/143] dm mirror: do not degrade the mirror on discard error Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 104/143] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 105/143] target: Add missing WRITE_SAME end-of-device sanity check Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 106/143] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 107/143] Btrfs: fix fsync data loss after adding hard link to inode Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 108/143] Added Little Endian support to vtpm module Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 109/143] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 110/143] sg: fix read() error reporting Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 111/143] IB/qib: Do not write EEPROM Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 112/143] md/raid5: Fix livelock when array is both resyncing and degraded Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 113/143] dm: fix a race condition in dm_get_md Kamal Mostafa
2015-03-31 19:47 ` [PATCH 3.13.y-ckt 114/143] dm snapshot: fix a possible invalid memory access on unload Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 115/143] cpufreq: s3c: remove incorrect __init annotations Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 116/143] libceph: assert both regular and lingering lists in __remove_osd() Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 117/143] libceph: change from BUG to WARN for __remove_osd() asserts Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 118/143] libceph: fix double __remove_osd() problem Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 119/143] MIPS: Export FP functions used by lose_fpu(1) for KVM Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 120/143] kdb: fix incorrect counts in KDB summary command output Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 121/143] blk-throttle: check stats_cpu before reading it from sysfs Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 122/143] procfs: fix race between symlink removals and traversals Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 123/143] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 124/143] pktgen: fix UDP checksum computation Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 125/143] ipv6: fix ipv6_cow_metrics for non DST_HOST case Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 126/143] clk-gate: fix bit # check in clk_register_gate() Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 127/143] ALSA: off by one bug in snd_riptide_joystick_probe() Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 128/143] ath5k: fix spontaneus AR5312 freezes Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 129/143] pinctrl: pinctrl-imx: don't use invalid value of conf_reg Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 130/143] ALSA: hda - Add one more node in the EAPD supporting candidate list Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 131/143] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 132/143] drm/i915/bdw: PCI IDs ending in 0xb are ULT Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 133/143] xfs: Fix quota type in quota structures when reusing quota file Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 134/143] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 135/143] gpio: tps65912: fix wrong container_of arguments Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 136/143] ALSA: pcm: Don't leave PREPARED state after draining Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 137/143] metag: Fix KSTK_EIP() and KSTK_ESP() macros Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 138/143] md/raid1: fix read balance when a drive is write-mostly Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 139/143] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 140/143] drm/radeon: fix 1 RB harvest config setup for TN/RL Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 141/143] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 142/143] nilfs2: fix potential memory overrun on inode Kamal Mostafa
2015-03-31 19:48 ` [PATCH 3.13.y-ckt 143/143] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Kamal Mostafa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).