All of lore.kernel.org
 help / color / mirror / Atom feed
* [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review
@ 2013-07-17 22:45 Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 001/145] UBIFS: correct mount message Kamal Mostafa
                   ` (144 more replies)
  0 siblings, 145 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Kamal Mostafa

This is the start of the review cycle for the Linux 3.8.13.5 stable kernel.

This version contains 145 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.8.y-review;a=shortlog

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

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

 -Kamal

--
 Documentation/i2c/busses/i2c-piix4                 |   2 +-
 Documentation/kernel-parameters.txt                |   6 +
 arch/arm/kernel/perf_event.c                       |   1 +
 arch/arm/kernel/smp_twd.c                          |   2 +-
 arch/arm/mach-shmobile/setup-emev2.c               |   8 +-
 arch/mips/cavium-octeon/setup.c                    |   2 +-
 arch/parisc/lib/memcpy.c                           |  79 +++++++-----
 arch/powerpc/kernel/ptrace.c                       |   4 +-
 arch/powerpc/kernel/setup_64.c                     |   2 +-
 arch/powerpc/platforms/pseries/eeh_pe.c            |   3 +-
 arch/x86/boot/compressed/eboot.c                   |  20 ++-
 arch/x86/include/asm/efi.h                         |   9 +-
 arch/x86/include/asm/irq_remapping.h               |   2 +
 arch/x86/kernel/cpu/mtrr/generic.c                 |  21 ++--
 arch/x86/kernel/cpu/mtrr/main.c                    |  16 +--
 arch/x86/kernel/early-quirks.c                     |  20 +++
 arch/x86/kernel/setup.c                            |   3 +-
 arch/x86/platform/efi/efi.c                        | 110 ++++++++++++++++-
 arch/x86/xen/time.c                                |  17 +--
 block/genhd.c                                      |   2 +-
 crypto/algapi.c                                    |   3 +-
 crypto/algboss.c                                   |  15 +--
 crypto/api.c                                       |   6 -
 crypto/internal.h                                  |   6 +
 drivers/acpi/acpica/hwxfsleep.c                    |   8 +-
 drivers/acpi/power.c                               |   4 +-
 drivers/ata/ahci.c                                 |   2 +
 drivers/ata/ata_piix.c                             |   2 +
 drivers/ata/libahci.c                              |   3 +-
 drivers/ata/libata-pmp.c                           |  33 ++---
 drivers/ata/sata_highbank.c                        |  20 ++-
 drivers/block/nbd.c                                |  10 +-
 drivers/cdrom/cdrom.c                              |   2 +-
 drivers/clocksource/dw_apb_timer_of.c              |   2 +-
 drivers/dma/pl330.c                                |   4 +-
 drivers/dma/tegra20-apb-dma.c                      |   1 +
 drivers/firmware/efivars.c                         |  18 +--
 drivers/gpu/drm/i915/i915_gem.c                    |   3 +-
 drivers/gpu/drm/i915/i915_gem_context.c            |   2 +-
 drivers/gpu/drm/i915/i915_reg.h                    |  15 ++-
 .../gpu/drm/nouveau/core/engine/disp/hdminva3.c    |   4 +
 drivers/gpu/drm/nouveau/core/subdev/vm/base.c      |   6 +-
 drivers/gpu/drm/radeon/atombios_encoders.c         |   7 ++
 drivers/hid/hid-apple.c                            |   6 +
 drivers/hid/hid-core.c                             |   6 +
 drivers/hid/hid-ids.h                              |   3 +
 drivers/hv/hv_util.c                               |  12 +-
 drivers/i2c/busses/Kconfig                         |   1 +
 drivers/i2c/busses/i2c-piix4.c                     |   3 +-
 drivers/input/mouse/bcm5974.c                      |  36 +++++-
 drivers/iommu/amd_iommu.c                          |   6 +-
 drivers/iommu/intel_irq_remapping.c                |  10 ++
 drivers/iommu/irq_remapping.c                      |   6 +
 drivers/iommu/irq_remapping.h                      |   2 +
 drivers/md/dm-ioctl.c                              |   3 +
 drivers/md/dm-mpath.c                              |   8 +-
 drivers/md/dm-verity.c                             |   5 +-
 drivers/md/dm.c                                    |   9 +-
 drivers/md/raid10.c                                |   4 +-
 drivers/media/dvb-core/dmxdev.c                    |   8 +-
 drivers/mfd/rtsx_pcr.c                             |   6 +-
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |   8 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.h        |   2 +
 drivers/net/wireless/ath/ath9k/calib.c             |   1 -
 drivers/net/wireless/b43/Kconfig                   |   4 +-
 drivers/net/wireless/iwlwifi/pcie/tx.c             |  13 ++
 drivers/net/wireless/rt2x00/rt2800lib.c            |   4 +-
 drivers/net/wireless/rt2x00/rt61pci.c              |   3 +-
 drivers/net/wireless/rt2x00/rt73usb.c              |   3 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c        |   1 +
 drivers/net/wireless/rtlwifi/rtl8723ae/sw.c        |   6 +-
 drivers/pci/probe.c                                |   8 +-
 drivers/pci/quirks.c                               |   2 +
 drivers/pci/xen-pcifront.c                         |   7 +-
 drivers/pcmcia/at91_cf.c                           |   4 +-
 drivers/power/charger-manager.c                    |   2 +-
 drivers/rtc/rtc-rv3029c2.c                         |   2 +-
 drivers/s390/scsi/zfcp_aux.c                       |   5 +-
 drivers/s390/scsi/zfcp_fsf.c                       |  27 ++--
 drivers/s390/scsi/zfcp_scsi.c                      |  10 +-
 drivers/scsi/aacraid/src.c                         |   3 +
 drivers/scsi/megaraid/megaraid_sas_base.c          |  10 +-
 drivers/scsi/mpt2sas/mpt2sas_base.c                |  14 +--
 drivers/scsi/mpt2sas/mpt2sas_base.h                |   3 +
 drivers/scsi/mpt2sas/mpt2sas_scsih.c               | 136 +++++++++++++++++++--
 drivers/scsi/mpt3sas/mpt3sas_scsih.c               |  30 +++--
 drivers/scsi/osd/osd_uld.c                         |   2 +-
 drivers/scsi/scsi.c                                |   8 +-
 drivers/scsi/sd.c                                  |  48 +++++---
 drivers/scsi/sd.h                                  |   1 +
 drivers/staging/zram/zram_drv.c                    |  36 ++++--
 drivers/staging/zram/zram_drv.h                    |   5 +-
 drivers/staging/zram/zram_sysfs.c                  |   2 +
 drivers/target/iscsi/iscsi_target_configfs.c       |   2 +-
 drivers/tty/serial/8250/8250_pci.c                 |   4 -
 drivers/tty/serial/pch_uart.c                      |   5 +
 drivers/usb/gadget/f_mass_storage.c                |   2 +
 drivers/usb/host/xhci-mem.c                        |   4 +
 drivers/usb/host/xhci-plat.c                       |   1 +
 drivers/usb/serial/option.c                        |   4 -
 drivers/usb/serial/qcserial.c                      |   8 +-
 fs/block_dev.c                                     |   9 +-
 fs/btrfs/ctree.c                                   |  31 +++--
 fs/cifs/cifs_unicode.h                             |   8 +-
 fs/cifs/cifsencrypt.c                              |   6 +-
 fs/cifs/file.c                                     |   9 +-
 fs/cifs/inode.c                                    |   5 +
 fs/exec.c                                          |  16 +--
 fs/ext3/inode.c                                    |   3 +-
 fs/ext3/namei.c                                    |   7 +-
 fs/ext4/extents.c                                  |   4 +-
 fs/ext4/file.c                                     |  14 +--
 fs/ext4/inline.c                                   |   2 +-
 fs/ext4/inode.c                                    |   4 +-
 fs/ext4/mballoc.c                                  |  11 +-
 fs/ext4/namei.c                                    |   7 +-
 fs/ext4/resize.c                                   |   4 +-
 fs/ext4/super.c                                    |   6 -
 fs/hpfs/map.c                                      |   3 +-
 fs/hpfs/super.c                                    |   8 +-
 fs/jbd2/journal.c                                  |   3 +-
 fs/jbd2/transaction.c                              |   2 +-
 fs/lockd/svclock.c                                 |   4 +
 fs/nfsd/nfs4xdr.c                                  |   2 +-
 fs/ocfs2/xattr.c                                   |  10 ++
 fs/ubifs/dir.c                                     |  54 +++++---
 fs/ubifs/super.c                                   |   2 +-
 include/linux/efi.h                                |   9 +-
 include/linux/hugetlb.h                            |  16 +++
 include/linux/nbd.h                                |   1 +
 include/linux/netfilter_ipv6.h                     |  16 +++
 include/net/addrconf.h                             |   2 +-
 kernel/cgroup.c                                    |  34 ++++--
 kernel/events/core.c                               |  28 ++++-
 kernel/futex.c                                     |   3 +-
 kernel/irq/manage.c                                |   6 +-
 kernel/module.c                                    |  34 +++---
 kernel/printk.c                                    |   2 +-
 kernel/time/tick-broadcast.c                       |  10 +-
 kernel/timer.c                                     |   8 +-
 kernel/trace/trace.c                               |  10 +-
 kernel/trace/trace_uprobe.c                        |   4 +-
 mm/hugetlb.c                                       |  17 +++
 mm/page_alloc.c                                    |   4 +
 net/ceph/auth_none.c                               |   6 +
 net/ipv4/netfilter/ipt_ULOG.c                      |   6 +-
 net/ipv6/addrconf.c                                |   2 +-
 net/ipv6/netfilter.c                               |   7 ++
 net/netfilter/core.c                               |   2 +
 net/netfilter/ipvs/ip_vs_core.c                    |  38 +++++-
 net/netfilter/ipvs/ip_vs_ctl.c                     |   1 +
 net/netfilter/nfnetlink_acct.c                     |   7 +-
 net/netfilter/nfnetlink_cttimeout.c                |   7 +-
 net/netfilter/xt_LOG.c                             |   2 +-
 net/netfilter/xt_TCPMSS.c                          |  23 +++-
 net/netfilter/xt_TCPOPTSTRIP.c                     |  19 ++-
 net/netfilter/xt_addrtype.c                        |  27 ++--
 net/sunrpc/svcsock.c                               |   9 +-
 net/sunrpc/xprtrdma/svc_rdma_marshal.c             |  20 ++-
 sound/pci/hda/patch_hdmi.c                         |   2 +-
 sound/soc/codecs/wm8962.c                          |  24 ++--
 161 files changed, 1249 insertions(+), 470 deletions(-)

Al Viro (1):
      ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree()

Alex Deucher (1):
      drm/radeon: add backlight quirk for hybrid mac

Alex Williamson (1):
      iommu/amd: Only unmap large pages from the first pte

Artem Bityutskiy (2):
      UBIFS: prepare to fix a horrid bug
      UBIFS: fix a horrid bug

Axel Lin (1):
      drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq

Bart Van Assche (1):
      timer: Fix jiffies wrap behavior of round_jiffies_common()

Bartlomiej Zolnierkiewicz (1):
      drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()

Baruch Siach (1):
      clocksource: dw_apb: Fix error check

Ben Hutchings (3):
      [SCSI] sd: Fix parsing of 'temporary ' cache mode prefix
      genirq: Fix can_request_irq() for IRQs without an action
      x86/efi: Fix dummy variable buffer allocation

Ben Widawsky (1):
      drm/i915: Fix context sizes on HSW

Bjørn Mork (1):
      [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries

Bu, Yitian (1):
      printk: Fix rq->lock vs logbuf_lock unlock lock inversion

Chen Gang (2):
      powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries
      netfilter: ipt_ULOG: fix non-null terminated string in the nf_log path

Chris Wilson (1):
      drm/i915: Only clear write-domains after a successful wait-seqno

Dan Carpenter (2):
      ipvs: info leak in __ip_vs_get_dest_entries()
      svcrdma: underflow issue in decode_write_list()

Dan Williams (1):
      USB: option,qcserial: move Novatel Gobi1K IDs to qcserial

Daniel Hansel (1):
      [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down

Darren Hart (1):
      pch_uart: Add uart_clk selection for the MinnowBoard

David Daney (1):
      MIPS: Octeon: Don't clobber bootloader data structures.

David Jeffery (1):
      lockd: protect nlm_blocked access in nlmsvc_retry_blocked

Dmitry Osipenko (1):
      dma: tegra: avoid channel lock up after free

Emmanuel Grumbach (2):
      iwlwifi: pcie: fix race in queue unmapping
      iwlwifi: pcie: wake the queue if stopped when being unmapped

Florian Westphal (1):
      netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6

Gabor Juhos (1):
      rt2x00: read 5GHz TX power values from the correct offset

Gavin Shan (1):
      powerpc/eeh: Fix fetching bus for single-dev-PE

George Cherian (1):
      usb: host: xhci-plat: release mem region while removing module

Greg Kroah-Hartman (1):
      Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller"

Grzegorz Lyczba (1):
      ipvs: Fix reuse connection if real server is dead

Hannes Reinecke (1):
      dm mpath: fix ioctl deadlock when no paths

Hauke Mehrtens (1):
      b43: ensue that BCMA is "y" when B43 is "y"

Helge Deller (1):
      parisc: Fix gcc miscompilation in pa_memcpy()

Henrik Rydberg (2):
      HID: apple: Add support for the 2013 Macbook Air
      Input: bcm5974 - add support for the 2013 MacBook Air

Herbert Xu (1):
      crypto: algboss - Hold ref count on larval

Ilia Mirkin (1):
      drm/nva3/disp: Fix HDMI audio regression

J. Bruce Fields (3):
      nfsd4: fix decoding of compounds across page boundaries
      svcrpc: fix handling of too-short rpc's
      svcrpc: don't error out on small tcp fragment

Jan Kara (6):
      ext3: fix data=journal fast mount/umount hang
      ext4: fix overflow when counting used blocks on 32-bit architectures
      ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
      ext4: fix overflows in SEEK_HOLE, SEEK_DATA implementations
      ext4: fix data offset overflow on 32-bit archs in ext4_inline_data_fiemap()
      writeback: Fix periodic writeback after fs mount

Jan Schmidt (1):
      Btrfs: fix unlock after free on rewinded tree blocks

Jason Liu (1):
      ARM: 7778/1: smp_twd: twd_update_frequency need be run on all online CPUs

Jed Davis (1):
      ARM: 7765/1: perf: Record the user-mode PC in the call chain.

Jiang Liu (6):
      zram: avoid invalid memory access in zram_exit()
      zram: use zram->lock to protect zram_free_page() in swap free notify path
      zram: destroy all devices on error recovery path in zram_init()
      zram: avoid access beyond the zram device
      zram: protect sysfs handler from invalid memory access
      PCI: Fix refcount issue in pci_create_root_bus() error recovery path

Jiri Olsa (2):
      perf: Clone child context from parent context pmu
      perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario

Jiri Slaby (1):
      MFD: rtsx_pcr: Fix probe fail path

Joachim Eastwood (1):
      pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status

Jonathan Salwan (1):
      drivers/cdrom/cdrom.c: use kzalloc() for failing hardware

Josef Bacik (2):
      Btrfs: hold the tree mod lock in __tree_mod_log_rewind
      Btrfs: only do the tree_mod_log_free_eb if this is our last ref

Julian Anastasov (1):
      ipvs: SCTP ports should be writable in ICMP packets

Junxiao Bi (1):
      ocfs2: xattr: fix inlined xattr reflink

Jörn Engel (1):
      iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow

K. Y. Srinivasan (1):
      Drivers: hv: Execute shutdown in a thread context

Kees Cook (3):
      block: do not pass disk names as format strings
      crypto: sanitize argument for format string
      charger-manager: Ensure event is not used as format string

Konrad Rzeszutek Wilk (1):
      xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state.

Larry Finger (2):
      rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND
      rtlwifi: rtl8723ae: Fix typo in firmware names

Laszlo Ersek (1):
      xen/time: remove blocked time accounting from xen "clockchip"

Li Zefan (2):
      cgroup: fix umount vs cgroup_cfts_commit() race
      cgroup: fix umount vs cgroup_event_remove() race

Lv Zheng (1):
      ACPICA: Do not use extended sleep registers unless HW-reduced bit is set

Maarten ter Huurne (1):
      ext4: fix corruption when online resizing a fs with 1K block size

Magnus Damm (1):
      ARM: shmobile: emev2 GIO3 resource fix

Mahesh Rajashekhara (1):
      [SCSI] aacraid: Fix for arrays are going offline in the system. System hangs

Marcin Slusarz (1):
      drm/nouveau: use vmalloc for pgt allocation

Mark Langsdorf (1):
      sata_highbank: increase retry count but shorten duration for Calxeda controller

Martin K. Petersen (1):
      [SCSI] sd: Update WRITE SAME heuristics

Mathias Nyman (1):
      xhci: check for failed dma pool allocation

Matt Fleming (1):
      x86, efivars: firmware bug workarounds should be in platform code

Michael Neuling (1):
      powerpc/hw_brk: Fix setting of length for exact mode breakpoints

Michal Kubeček (1):
      netfilter: xt_LOG: fix mark logging for IPv6 packets

Mika Westerberg (1):
      ACPI / power: add missing newline to debug messages

Mikulas Patocka (3):
      hpfs: better test for errors
      dm ioctl: set noio flag to avoid __vmalloc deadlock
      dm verity: fix inability to use a few specific devices sizes

Neil Horman (1):
      iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets

NeilBrown (1):
      md/raid10: fix two bugs affecting RAID10 reshape.

Nicolin Chen (1):
      ASoC: wm8962: Remove remaining direct register cache accesses

Pablo Neira Ayuso (4):
      netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary
      netfilter: nfnetlink_cttimeout: fix incomplete dumping of objects
      netfilter: nfnetlink_acct: fix incomplete dumping of objects
      netfilter: xt_TCPOPTSTRIP: don't use tcp_hdr()

Paul Clements (1):
      nbd: correct disconnect behavior

Pavel Shilovsky (1):
      CIFS: Fix a deadlock when a file is reopened

Peter Zijlstra (1):
      perf: Fix perf_lock_task_context() vs RCU

Phil Oester (3):
      netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option
      netfilter: xt_TCPMSS: Fix missing fragmentation handling
      netfilter: xt_TCPMSS: Fix IPv6 default MSS too

Reddy, Sreekanth (1):
      [SCSI] mpt2sas: Fix for issue Missing delay not getting set during system bootup

Richard Genoud (1):
      UBIFS: correct mount message

Richard Weinberger (2):
      x86,efi: Implement efi_no_storage_paranoia parameter
      Modify UEFI anti-bricking code

Rusty Russell (1):
      module: do percpu allocation after uniqueness check.  No, really!

Satoru Takeuchi (1):
      x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()

Seth Heasley (2):
      ata_piix: IDE-mode SATA patch for Intel Coleto Creek DeviceIDs
      ahci: AHCI-mode SATA patch for Intel Coleto Creek DeviceIDs

Shane Huang (3):
      ahci: Add AMD CZ SATA device ID
      i2c-piix4: Add AMD CZ SMBus device ID
      ahci: remove pmp link online check in FBS EH

Soeren Moch (1):
      [media] media: dmxdev: remove dvb_ringbuffer_flush() on writer side

Sreekanth Reddy (4):
      [SCSI] mpt2sas: Fix for device scan following host reset could get stuck in a infinite loop
      [SCSI] mpt2sas: fix firmware failure with wrong task attribute
      [SCSI] mpt3sas: fix for kernel panic when driver loads with HBA conected to non LUN 0 configured expander
      [SCSI] mpt3sas: Infinite loops can occur if MPI2_IOCSTATUS_CONFIG_INVALID_PAGE is not returned

Steffen Maier (2):
      [SCSI] zfcp: block queue limits with data router
      [SCSI] zfcp: status read buffers on first adapter open with link down

Stephane Eranian (1):
      perf: Disable monitoring on setuid processes for regular users

Steve French (2):
      Handle big endianness in NTLM (ntlmv2) authentication
      [CIFS] use sensible file nlink values if unprovided

Steven Rostedt (Red Hat) (1):
      tracing: Use current_uid() for critical time tracing

Sujith Manoharan (2):
      ath9k_hw: Assign default xlna config for AR9485
      ath9k: Do not assign noise for NULL caldata

Takashi Iwai (1):
      ALSA: hda - Cache the MUX selection for generic HDMI

Tejun Heo (1):
      libata: skip SRST for all SIMG [34]7x port-multipliers

Theodore Ts'o (4):
      jbd2: move superblock checksum calculation to jbd2_write_superblock()
      jbd2: fix theoretical race in jbd2__journal_restart
      ext4: don't show usrquota/grpquota twice in /proc/mounts
      ext4: don't allow ext4_free_blocks() to fail due to ENOMEM

Thomas Gleixner (1):
      tick: Prevent uncontrolled switch to oneshot mode

Tyler Hicks (1):
      libceph: Fix NULL pointer dereference in auth client code

UCHINO Satoshi (1):
      usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed

Wanpeng Li (1):
      mm/memory-hotplug: fix lowmem count overflow when offline pages

Yinghai Lu (1):
      x86: Fix /proc/mtrr with base/size more than 44bits

Zach Bobroff (1):
      x86, efi: retry ExitBootServices() on failure

Zhang Yi (1):
      futex: Take hugepages into account when generating futex_key

zhangwei(Jovi) (1):
      uprobes: Fix return value in error handling path

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

* [PATCH 001/145] UBIFS: correct mount message
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 002/145] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down Kamal Mostafa
                   ` (143 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Richard Genoud, Artem Bityutskiy, Luis Henriques

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

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

From: Richard Genoud <richard.genoud@gmail.com>

commit beadadfa5467e09e36891f39cae1f5d8d3bbf17e upstream.

When mounting an UBIFS R/W volume, we have the message:
UBIFS: mounted UBI device 0, volume 1, name "rootfs"(null)
With this patch, we'll have:
UBIFS: mounted UBI device 0, volume 1, name "rootfs"
Which is, I think, what was intended.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ubifs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 97f6875..d00b7d4 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1412,7 +1412,7 @@ static int mount_ubifs(struct ubifs_info *c)
 
 	ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"%s",
 		  c->vi.ubi_num, c->vi.vol_id, c->vi.name,
-		  c->ro_mount ? ", R/O mode" : NULL);
+		  c->ro_mount ? ", R/O mode" : "");
 	x = (long long)c->main_lebs * c->leb_size;
 	y = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes;
 	ubifs_msg("LEB size: %d bytes (%d KiB), min./max. I/O unit sizes: %d bytes/%d bytes",
-- 
1.8.1.2


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

* [PATCH 002/145] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 001/145] UBIFS: correct mount message Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 003/145] [SCSI] zfcp: block queue limits with data router Kamal Mostafa
                   ` (142 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniel Hansel, Steffen Maier, James Bottomley, Luis Henriques

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

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

From: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>

commit f76ccaac4f82c463a037aa4a1e4ccb85c7011814 upstream.

FCP device remains in status ERP_FAILED when device is switched online
or adapter recovery is triggered  while link to SAN is down.

When Exchange Configuration Data command returns the FSF status
FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE it aborts the exchange process.
The only retries are done during the common error recovery procedure
(i.e. max. 3 retries with 8sec sleep between) and remains in status
ERP_FAILED with QDIO down.

This commit reverts the commit 0df138476c8306478d6e726f044868b4bccf411c
(zfcp: Fix adapter activation on link down).
When FSF status FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE is received the
adapter recovery will be finished without any retries. QDIO will be
up now and status changes such as LINK UP will be received now.

Signed-off-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/s390/scsi/zfcp_fsf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index c96320d..ccff8b2 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -563,6 +563,10 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
 		fc_host_port_type(shost) = FC_PORTTYPE_UNKNOWN;
 		adapter->hydra_version = 0;
 
+		/* avoids adapter shutdown to be able to recognize
+		 * events such as LINK UP */
+		atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
+				&adapter->status);
 		zfcp_fsf_link_down_info_eval(req,
 			&qtcb->header.fsf_status_qual.link_down_info);
 		break;
-- 
1.8.1.2


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

* [PATCH 003/145] [SCSI] zfcp: block queue limits with data router
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 001/145] UBIFS: correct mount message Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 002/145] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 004/145] [SCSI] zfcp: status read buffers on first adapter open with link down Kamal Mostafa
                   ` (141 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Steffen Maier, James Bottomley, Luis Henriques

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

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

From: Steffen Maier <maier@linux.vnet.ibm.com>

commit 5fea4291deacd80188b996d2f555fc6a1940e5d4 upstream.

Commit 86a9668a8d29ea711613e1cb37efa68e7c4db564
"[SCSI] zfcp: support for hardware data router"
reduced the initial block queue limits in the scsi_host_template to the
absolute minimum and adjusted them later on. However, the adjustment was
too late for the BSG devices of Scsi_Host and fc_host.

Therefore, ioctl(..., SG_IO, ...) with request or response size > 4kB to a
BSG device of an fc_host or a Scsi_Host fails with EINVAL. As a result,
users of such ioctl such as HBA_SendCTPassThru() in libzfcphbaapi return
with error HBA_STATUS_ERROR.

Initialize the block queue limits in zfcp_scsi_host_template to the
greatest common denominator (GCD).

While we cannot exploit the slightly enlarged maximum request size with
data router, this should be neglectible. Doing so also avoids running into
trouble after live guest relocation (LGR) / migration from a data router
FCP device to an FCP device that does not support data router. In that
case, zfcp would figure out the new limits on adapter recovery, but the
fc_host and Scsi_Host (plus in fact all sdevs) still exist with the old and
now too large queue limits.

It should also OK, not to use half the size as in the DIX case, because
fc_host and Scsi_Host do not transport FCP requests including SCSI commands
using protection data.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/s390/scsi/zfcp_scsi.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 7b31e3f..7b35364 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -3,7 +3,7 @@
  *
  * Interface to Linux SCSI midlayer.
  *
- * Copyright IBM Corp. 2002, 2010
+ * Copyright IBM Corp. 2002, 2013
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -311,8 +311,12 @@ static struct scsi_host_template zfcp_scsi_host_template = {
 	.proc_name		 = "zfcp",
 	.can_queue		 = 4096,
 	.this_id		 = -1,
-	.sg_tablesize		 = 1, /* adjusted later */
-	.max_sectors		 = 8, /* adjusted later */
+	.sg_tablesize		 = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
+				     * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2),
+				   /* GCD, adjusted later */
+	.max_sectors		 = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
+				     * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8,
+				   /* GCD, adjusted later */
 	.dma_boundary		 = ZFCP_QDIO_SBALE_LEN - 1,
 	.cmd_per_lun		 = 1,
 	.use_clustering		 = 1,
-- 
1.8.1.2


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

* [PATCH 004/145] [SCSI] zfcp: status read buffers on first adapter open with link down
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (2 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 003/145] [SCSI] zfcp: block queue limits with data router Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 005/145] ahci: Add AMD CZ SATA device ID Kamal Mostafa
                   ` (140 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Steffen Maier, James Bottomley, Luis Henriques

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

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

From: Steffen Maier <maier@linux.vnet.ibm.com>

commit 9edf7d75ee5f21663a0183d21f702682d0ef132f upstream.

Commit 64deb6efdc5504ce97b5c1c6f281fffbc150bd93
"[SCSI] zfcp: Use status_read_buf_num provided by FCP channel"
started using a value returned by the channel but only evaluated the value
if the fabric link is up.
Commit 8d88cf3f3b9af4713642caeb221b6d6a42019001
"[SCSI] zfcp: Update status read mempool"
introduced mempool resizings based on the above value.
On setting an FCP device online for the very first time since boot, a new
zeroed adapter object is allocated. If the link is down, the number of
status read requests remains zero. Since just the config data exchange is
incomplete, we proceed with adapter open recovery. However, we
unconditionally call mempool_resize with adapter->stat_read_buf_num == 0 in
this case.

This causes a kernel message "kernel BUG at mm/mempool.c:131!" in process
"zfcperp<FCP-device-bus-ID>" with last function mempool_resize in Krnl PSW
and zfcp_erp_thread in the Call Trace.

Don't evaluate channel values which are invalid on link down. The number of
status read requests is always valid, evaluated, and set to a positive
minimum greater than zero. The adapter open recovery can proceed and the
channel has status read buffers to inform us on a future link up event.
While we are not aware of any other code path that could result in mempool
resize attempts of size zero, we still also initialize the number of status
read buffers to be posted to a static minimum number on adapter object
allocation.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/s390/scsi/zfcp_aux.c |  5 ++++-
 drivers/s390/scsi/zfcp_fsf.c | 23 ++++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index f6adde4..3743ac9 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -3,7 +3,7 @@
  *
  * Module interface and handling of zfcp data structures.
  *
- * Copyright IBM Corp. 2002, 2010
+ * Copyright IBM Corp. 2002, 2013
  */
 
 /*
@@ -23,6 +23,7 @@
  *            Christof Schmitt
  *            Martin Petermann
  *            Sven Schuetz
+ *            Steffen Maier
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -415,6 +416,8 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device)
 	adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN;
 	adapter->ccw_device->dev.dma_parms = &adapter->dma_parms;
 
+	adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM;
+
 	if (!zfcp_scsi_adapter_register(adapter))
 		return adapter;
 
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index ccff8b2..9a6f744 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -3,7 +3,7 @@
  *
  * Implementation of FSF commands.
  *
- * Copyright IBM Corp. 2002, 2010
+ * Copyright IBM Corp. 2002, 2013
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -483,12 +483,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
 
 	fc_host_port_name(shost) = nsp->fl_wwpn;
 	fc_host_node_name(shost) = nsp->fl_wwnn;
-	fc_host_port_id(shost) = ntoh24(bottom->s_id);
-	fc_host_speed(shost) =
-		zfcp_fsf_convert_portspeed(bottom->fc_link_speed);
 	fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
 
-	adapter->hydra_version = bottom->adapter_type;
 	adapter->timer_ticks = bottom->timer_interval & ZFCP_FSF_TIMER_INT_MASK;
 	adapter->stat_read_buf_num = max(bottom->status_read_buf_num,
 					 (u16)FSF_STATUS_READS_RECOM);
@@ -496,6 +492,19 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
 	if (fc_host_permanent_port_name(shost) == -1)
 		fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
 
+	zfcp_scsi_set_prot(adapter);
+
+	/* no error return above here, otherwise must fix call chains */
+	/* do not evaluate invalid fields */
+	if (req->qtcb->header.fsf_status == FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE)
+		return 0;
+
+	fc_host_port_id(shost) = ntoh24(bottom->s_id);
+	fc_host_speed(shost) =
+		zfcp_fsf_convert_portspeed(bottom->fc_link_speed);
+
+	adapter->hydra_version = bottom->adapter_type;
+
 	switch (bottom->fc_topology) {
 	case FSF_TOPO_P2P:
 		adapter->peer_d_id = ntoh24(bottom->peer_d_id);
@@ -517,8 +526,6 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
 		return -EIO;
 	}
 
-	zfcp_scsi_set_prot(adapter);
-
 	return 0;
 }
 
@@ -569,6 +576,8 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
 				&adapter->status);
 		zfcp_fsf_link_down_info_eval(req,
 			&qtcb->header.fsf_status_qual.link_down_info);
+		if (zfcp_fsf_exchange_config_evaluate(req))
+			return;
 		break;
 	default:
 		zfcp_erp_adapter_shutdown(adapter, 0, "fsecdh3");
-- 
1.8.1.2


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

* [PATCH 005/145] ahci: Add AMD CZ SATA device ID
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (3 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 004/145] [SCSI] zfcp: status read buffers on first adapter open with link down Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 006/145] i2c-piix4: Add AMD CZ SMBus " Kamal Mostafa
                   ` (139 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shane Huang, Bjorn Helgaas, Luis Henriques

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

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

From: Shane Huang <shane.huang@amd.com>

commit fafe5c3d82a470d73de53e6b08eb4e28d974d895 upstream.

To add AMD CZ SATA controller device ID of IDE mode.

[bhelgaas: drop pci_ids.h update]
Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/ata/ahci.c   | 1 +
 drivers/pci/quirks.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 72e3e12..c8a38ce 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -308,6 +308,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 
 	/* AMD */
 	{ PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
+	{ PCI_VDEVICE(AMD, 0x7900), board_ahci }, /* AMD CZ */
 	/* AMD is using RAID class only for ahci controllers */
 	{ PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
 	  PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci },
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0369fb6..8b51656 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1062,6 +1062,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk
 DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
 DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
+DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
 
 /*
  *	Serverworks CSB5 IDE does not fully support native mode
-- 
1.8.1.2


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

* [PATCH 006/145] i2c-piix4: Add AMD CZ SMBus device ID
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (4 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 005/145] ahci: Add AMD CZ SATA device ID Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 007/145] sata_highbank: increase retry count but shorten duration for Calxeda controller Kamal Mostafa
                   ` (138 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shane Huang, Bjorn Helgaas, Luis Henriques

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

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

From: Shane Huang <shane.huang@amd.com>

commit b996ac90f595dda271cbd858b136b45557fc1a57 upstream.

To add AMD CZ SMBus controller device ID.

[bhelgaas: drop pci_ids.h update]
Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 Documentation/i2c/busses/i2c-piix4 | 2 +-
 drivers/i2c/busses/Kconfig         | 1 +
 drivers/i2c/busses/i2c-piix4.c     | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/i2c/busses/i2c-piix4 b/Documentation/i2c/busses/i2c-piix4
index 1e6634f..a370b20 100644
--- a/Documentation/i2c/busses/i2c-piix4
+++ b/Documentation/i2c/busses/i2c-piix4
@@ -13,7 +13,7 @@ Supported adapters:
   * AMD SP5100 (SB700 derivative found on some server mainboards)
     Datasheet: Publicly available at the AMD website
     http://support.amd.com/us/Embedded_TechDocs/44413.pdf
-  * AMD Hudson-2
+  * AMD Hudson-2, CZ
     Datasheet: Not publicly available
   * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
     Datasheet: Publicly available at the SMSC website http://www.smsc.com
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index bdca511..699f9da 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -138,6 +138,7 @@ config I2C_PIIX4
 	    ATI SB700/SP5100
 	    ATI SB800
 	    AMD Hudson-2
+	    AMD CZ
 	    Serverworks OSB4
 	    Serverworks CSB5
 	    Serverworks CSB6
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 39ab78c..d05ad59 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -22,7 +22,7 @@
 	Intel PIIX4, 440MX
 	Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100
 	ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800
-	AMD Hudson-2
+	AMD Hudson-2, CZ
 	SMSC Victory66
 
    Note: we assume there can only be one device, with one or more
@@ -522,6 +522,7 @@ static DEFINE_PCI_DEVICE_TABLE(piix4_ids) = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x790b) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
 		     PCI_DEVICE_ID_SERVERWORKS_OSB4) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
-- 
1.8.1.2


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

* [PATCH 007/145] sata_highbank: increase retry count but shorten duration for Calxeda controller
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (5 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 006/145] i2c-piix4: Add AMD CZ SMBus " Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 008/145] clocksource: dw_apb: Fix error check Kamal Mostafa
                   ` (137 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Langsdorf, Tejun Heo, Luis Henriques

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

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

From: Mark Langsdorf <mark.langsdorf@calxeda.com>

commit ddfef5de3d716f77bad32dbbba6b280158dfd721 upstream.

Increase the retry count for the hard reset function to 100 but
shorten the time out period to 500 ms. See the comment for
ahci_highbank_hardreset for the reasons why those vaulues were
chosen.

Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/ata/sata_highbank.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index b1a664a..ecaf1ff 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -196,10 +196,26 @@ static int highbank_initialize_phys(struct device *dev, void __iomem *addr)
 	return 0;
 }
 
+/*
+ * The Calxeda SATA phy intermittently fails to bring up a link with Gen3
+ * Retrying the phy hard reset can work around the issue, but the drive
+ * may fail again. In less than 150 out of 15000 test runs, it took more
+ * than 10 tries for the link to be established (but never more than 35).
+ * Triple the maximum observed retry count to provide plenty of margin for
+ * rare events and to guarantee that the link is established.
+ *
+ * Also, the default 2 second time-out on a failed drive is too long in
+ * this situation. The uboot implementation of the same driver function
+ * uses a much shorter time-out period and never experiences a time out
+ * issue. Reducing the time-out to 500ms improves the responsiveness.
+ * The other timing constants were kept the same as the stock AHCI driver.
+ * This change was also tested 15000 times on 24 drives and none of them
+ * experienced a time out.
+ */
 static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
 				unsigned long deadline)
 {
-	const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+	static const unsigned long timing[] = { 5, 100, 500};
 	struct ata_port *ap = link->ap;
 	struct ahci_port_priv *pp = ap->private_data;
 	u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
@@ -207,7 +223,7 @@ static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
 	bool online;
 	u32 sstatus;
 	int rc;
-	int retry = 10;
+	int retry = 100;
 
 	ahci_stop_engine(ap);
 
-- 
1.8.1.2


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

* [PATCH 008/145] clocksource: dw_apb: Fix error check
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (6 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 007/145] sata_highbank: increase retry count but shorten duration for Calxeda controller Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 009/145] zram: avoid invalid memory access in zram_exit() Kamal Mostafa
                   ` (136 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Baruch Siach, Daniel Lezcano, Luis Henriques

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

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

From: Baruch Siach <baruch@tkos.co.il>

commit 1a33bd2be705cbb3f57d7223b60baea441039307 upstream.

irq_of_parse_and_map() returns 0 on error, while the code checks for NO_IRQ.
This breaks on platforms that have NO_IRQ != 0.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/clocksource/dw_apb_timer_of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index f7dba5b..929e7ce 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -44,7 +44,7 @@ static void add_clockevent(struct device_node *event_timer)
 	u32 irq, rate;
 
 	irq = irq_of_parse_and_map(event_timer, 0);
-	if (irq == NO_IRQ)
+	if (irq == 0)
 		panic("No IRQ for clock event timer");
 
 	timer_get_base_and_rate(event_timer, &iobase, &rate);
-- 
1.8.1.2


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

* [PATCH 009/145] zram: avoid invalid memory access in zram_exit()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (7 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 008/145] clocksource: dw_apb: Fix error check Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 010/145] zram: use zram->lock to protect zram_free_page() in swap free notify path Kamal Mostafa
                   ` (135 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiang Liu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Jiang Liu <liuj97@gmail.com>

commit 6030ea9b35971a4200062f010341ab832e878ac9 upstream.

Memory for zram->disk object may have already been freed after returning
from destroy_device(zram), then it's unsafe for zram_reset_device(zram)
to access zram->disk again.

We can't solve this bug by flipping the order of destroy_device(zram)
and zram_reset_device(zram), that will cause deadlock issues to the
zram sysfs handler.

So fix it by holding an extra reference to zram->disk before calling
destroy_device(zram).

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/zram/zram_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 071e058..c9c1e0e 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -764,9 +764,11 @@ static void __exit zram_exit(void)
 	for (i = 0; i < num_devices; i++) {
 		zram = &zram_devices[i];
 
+		get_disk(zram->disk);
 		destroy_device(zram);
 		if (zram->init_done)
 			zram_reset_device(zram);
+		put_disk(zram->disk);
 	}
 
 	unregister_blkdev(zram_major, "zram");
-- 
1.8.1.2


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

* [PATCH 010/145] zram: use zram->lock to protect zram_free_page() in swap free notify path
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (8 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 009/145] zram: avoid invalid memory access in zram_exit() Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 011/145] zram: destroy all devices on error recovery path in zram_init() Kamal Mostafa
                   ` (134 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiang Liu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Jiang Liu <liuj97@gmail.com>

commit 57ab048532c0d975538cebd4456491b5c34248f4 upstream.

zram_slot_free_notify() is free-running without any protection from
concurrent operations. So there are race conditions between
zram_bvec_read()/zram_bvec_write() and zram_slot_free_notify(),
and possible consequences include:
1) Trigger BUG_ON(!handle) on zram_bvec_write() side.
2) Access to freed pages on zram_bvec_read() side.
3) Break some fields (bad_compress, good_compress, pages_stored)
   in zram->stats if the swap layer makes concurrently call to
   zram_slot_free_notify().

So enhance zram_slot_free_notify() to acquire writer lock on zram->lock
before calling zram_free_page().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/zram/zram_drv.c | 2 ++
 drivers/staging/zram/zram_drv.h | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index c9c1e0e..0113897 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -615,7 +615,9 @@ static void zram_slot_free_notify(struct block_device *bdev,
 	struct zram *zram;
 
 	zram = bdev->bd_disk->private_data;
+	down_write(&zram->lock);
 	zram_free_page(zram, index);
+	up_write(&zram->lock);
 	zram_stat64_inc(zram, &zram->stats.notify_free);
 }
 
diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h
index df2eec4..4265ab4 100644
--- a/drivers/staging/zram/zram_drv.h
+++ b/drivers/staging/zram/zram_drv.h
@@ -92,8 +92,9 @@ struct zram {
 	void *compress_buffer;
 	struct table *table;
 	spinlock_t stat64_lock;	/* protect 64-bit stats */
-	struct rw_semaphore lock; /* protect compression buffers and table
-				   * against concurrent read and writes */
+	struct rw_semaphore lock; /* protect compression buffers, table,
+				   * 32bit stat counters against concurrent
+				   * notifications, reads and writes */
 	struct request_queue *queue;
 	struct gendisk *disk;
 	int init_done;
-- 
1.8.1.2


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

* [PATCH 011/145] zram: destroy all devices on error recovery path in zram_init()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (9 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 010/145] zram: use zram->lock to protect zram_free_page() in swap free notify path Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 012/145] zram: avoid access beyond the zram device Kamal Mostafa
                   ` (133 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiang Liu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Jiang Liu <liuj97@gmail.com>

commit 39a9b8ac9333e4268ecff7da6c9d1ab3823ff243 upstream.

On error recovery path of zram_init(), it leaks the zram device object
causing the failure. So change create_device() to free allocated
resources on error path.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/zram/zram_drv.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 0113897..ff2228e 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -628,7 +628,7 @@ static const struct block_device_operations zram_devops = {
 
 static int create_device(struct zram *zram, int device_id)
 {
-	int ret = 0;
+	int ret = -ENOMEM;
 
 	init_rwsem(&zram->lock);
 	init_rwsem(&zram->init_lock);
@@ -638,7 +638,6 @@ static int create_device(struct zram *zram, int device_id)
 	if (!zram->queue) {
 		pr_err("Error allocating disk queue for device %d\n",
 			device_id);
-		ret = -ENOMEM;
 		goto out;
 	}
 
@@ -648,11 +647,9 @@ static int create_device(struct zram *zram, int device_id)
 	 /* gendisk structure */
 	zram->disk = alloc_disk(1);
 	if (!zram->disk) {
-		blk_cleanup_queue(zram->queue);
 		pr_warn("Error allocating disk structure for device %d\n",
 			device_id);
-		ret = -ENOMEM;
-		goto out;
+		goto out_free_queue;
 	}
 
 	zram->disk->major = zram_major;
@@ -681,11 +678,17 @@ static int create_device(struct zram *zram, int device_id)
 				&zram_disk_attr_group);
 	if (ret < 0) {
 		pr_warn("Error creating sysfs group");
-		goto out;
+		goto out_free_disk;
 	}
 
 	zram->init_done = 0;
+	return 0;
 
+out_free_disk:
+	del_gendisk(zram->disk);
+	put_disk(zram->disk);
+out_free_queue:
+	blk_cleanup_queue(zram->queue);
 out:
 	return ret;
 }
-- 
1.8.1.2


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

* [PATCH 012/145] zram: avoid access beyond the zram device
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (10 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 011/145] zram: destroy all devices on error recovery path in zram_init() Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 013/145] zram: protect sysfs handler from invalid memory access Kamal Mostafa
                   ` (132 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiang Liu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Jiang Liu <liuj97@gmail.com>

commit 12a7ad3b810e77137d0caf97a6dd97591e075b30 upstream.

Function valid_io_request() should verify the entire request are within
the zram device address range. Otherwise it may cause invalid memory
access when accessing/modifying zram->meta->table[index] because the
'index' is out of range. Then it may access non-exist memory, randomly
modify memory belong to other subsystems, which is hard to track down.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/zram/zram_drv.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index ff2228e..62f8276 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -461,13 +461,20 @@ out:
  */
 static inline int valid_io_request(struct zram *zram, struct bio *bio)
 {
-	if (unlikely(
-		(bio->bi_sector >= (zram->disksize >> SECTOR_SHIFT)) ||
-		(bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)) ||
-		(bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))) {
+	u64 start, end, bound;
+	
+	/* unaligned request */
+	if (unlikely(bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)))
+		return 0;
+	if (unlikely(bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))
+		return 0;
 
+	start = bio->bi_sector;
+	end = start + (bio->bi_size >> SECTOR_SHIFT);
+	bound = zram->disksize >> SECTOR_SHIFT;
+	/* out of range range */
+	if (unlikely(start >= bound || end >= bound || start > end))
 		return 0;
-	}
 
 	/* I/O request is valid */
 	return 1;
-- 
1.8.1.2


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

* [PATCH 013/145] zram: protect sysfs handler from invalid memory access
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (11 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 012/145] zram: avoid access beyond the zram device Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 014/145] pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status Kamal Mostafa
                   ` (131 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiang Liu, Greg Kroah-Hartman, Luis Henriques

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

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

From: Jiang Liu <liuj97@gmail.com>

commit 5863e10b441e7ea4b492f930f1be180a97d026f3 upstream.

Use zram->init_lock to protect access to zram->meta, otherwise it
may cause invalid memory access if zram->meta has been freed by
zram_reset_device().

This issue may be triggered by:
Thread 1:
while true; do cat mem_used_total; done
Thread 2:
while true; do echo 8M > disksize; echo 1 > reset; done

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.8:
  - protect access to zram->mem_pool instead of zram->meta ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/staging/zram/zram_sysfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/zram/zram_sysfs.c b/drivers/staging/zram/zram_sysfs.c
index de1eacf..c07687e 100644
--- a/drivers/staging/zram/zram_sysfs.c
+++ b/drivers/staging/zram/zram_sysfs.c
@@ -186,8 +186,10 @@ static ssize_t mem_used_total_show(struct device *dev,
 	u64 val = 0;
 	struct zram *zram = dev_to_zram(dev);
 
+	down_read(&zram->init_lock);
 	if (zram->init_done)
 		val = zs_get_total_size_bytes(zram->mem_pool);
+	up_read(&zram->init_lock);
 
 	return sprintf(buf, "%llu\n", val);
 }
-- 
1.8.1.2


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

* [PATCH 014/145] pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (12 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 013/145] zram: protect sysfs handler from invalid memory access Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 015/145] PCI: Fix refcount issue in pci_create_root_bus() error recovery path Kamal Mostafa
                   ` (130 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joachim Eastwood, Nicolas Ferre, Greg Kroah-Hartman, Luis Henriques

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

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

From: Joachim Eastwood <manabian@gmail.com>

commit e39506b466edcda2a7e9d0174d7987ae654137b7 upstream.

Commit 80af9e6d (pcmcia at91_cf: fix raw gpio number usage) forgot
to change the parameter in gpio_get_value after adding gpio
validation.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pcmcia/at91_cf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 01463c7..1b2c631 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -100,9 +100,9 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
 		int vcc	= gpio_is_valid(cf->board->vcc_pin);
 
 		*sp = SS_DETECT | SS_3VCARD;
-		if (!rdy || gpio_get_value(rdy))
+		if (!rdy || gpio_get_value(cf->board->irq_pin))
 			*sp |= SS_READY;
-		if (!vcc || gpio_get_value(vcc))
+		if (!vcc || gpio_get_value(cf->board->vcc_pin))
 			*sp |= SS_POWERON;
 	} else
 		*sp = 0;
-- 
1.8.1.2


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

* [PATCH 015/145] PCI: Fix refcount issue in pci_create_root_bus() error recovery path
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (13 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 014/145] pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 016/145] ahci: remove pmp link online check in FBS EH Kamal Mostafa
                   ` (129 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiang Liu, Bjorn Helgaas, Luis Henriques

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

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

From: Jiang Liu <liuj97@gmail.com>

commit 343df771e671d821478dd3ef525a0610b808dbf8 upstream.

After calling device_register(&bridge->dev), the bridge is reference-
counted, and it is illegal to call kfree() on it except in the release
function.

[bhelgaas: changelog, use put_device() after device_register() failure]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[ luis: backported to 3.8:
  - adjusted context
  - removed error handling for pcibios_root_bridge_prepare invocation ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pci/probe.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 6186f03..30db275 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1667,8 +1667,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	bridge->dev.release = pci_release_bus_bridge_dev;
 	dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
 	error = device_register(&bridge->dev);
-	if (error)
-		goto bridge_dev_reg_err;
+	if (error) {
+		put_device(&bridge->dev);
+		goto err_out;
+	}
 	b->bridge = get_device(&bridge->dev);
 	device_enable_async_suspend(b->bridge);
 	pci_set_bus_of_node(b);
@@ -1724,8 +1726,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 class_dev_reg_err:
 	put_device(&bridge->dev);
 	device_unregister(&bridge->dev);
-bridge_dev_reg_err:
-	kfree(bridge);
 err_out:
 	kfree(b);
 	return NULL;
-- 
1.8.1.2


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

* [PATCH 016/145] ahci: remove pmp link online check in FBS EH
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (14 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 015/145] PCI: Fix refcount issue in pci_create_root_bus() error recovery path Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 017/145] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed Kamal Mostafa
                   ` (128 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Shane Huang, Tejun Heo, Luis Henriques

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

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

From: Shane Huang <shane.huang@amd.com>

commit 912b9ac683b112615d5605686f1dc086402ce9f7 upstream.

ata_link_online() check in ahci_error_intr() is unnecessary, it should
be removed otherwise may lead to lockup with FBS enabled PMP.
http://marc.info/?l=linux-ide&m=137050421603272&w=2

Reported-by: Yu Liu <liuyu.ac@gmail.com>
Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/ata/libahci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 6cd7805..c86d560 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1560,8 +1560,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
 		u32 fbs = readl(port_mmio + PORT_FBS);
 		int pmp = fbs >> PORT_FBS_DWE_OFFSET;
 
-		if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
-		    ata_link_online(&ap->pmp_link[pmp])) {
+		if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) {
 			link = &ap->pmp_link[pmp];
 			fbs_need_dec = true;
 		}
-- 
1.8.1.2


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

* [PATCH 017/145] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (15 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 016/145] ahci: remove pmp link online check in FBS EH Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 018/145] x86, efi: retry ExitBootServices() on failure Kamal Mostafa
                   ` (127 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: UCHINO Satoshi, Felipe Balbi, Luis Henriques

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

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

From: UCHINO Satoshi <satoshi.uchino@toshiba.co.jp>

commit d68c277b501889b3a50c179d1c3d704db7947b83 upstream.

Without this memory barrier, the file-storage thread may fail to
escape from the following while loop, because it may observe new
common->thread_wakeup_needed and old bh->state which are updated by
the callback functions.

	/* Wait for the CBW to arrive */
	while (bh->state != BUF_STATE_FULL) {
		rc = sleep_thread(common);
		if (rc)
			return rc;
	}

Signed-off-by: UCHINO Satoshi <satoshi.uchino@toshiba.co.jp>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/gadget/f_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 5d027b3..452e4f6 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -427,6 +427,7 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)
 /* Caller must hold fsg->lock */
 static void wakeup_thread(struct fsg_common *common)
 {
+	smp_wmb();	/* ensure the write of bh->state is complete */
 	/* Tell the main thread that something has happened */
 	common->thread_wakeup_needed = 1;
 	if (common->thread_task)
@@ -646,6 +647,7 @@ static int sleep_thread(struct fsg_common *common)
 	}
 	__set_current_state(TASK_RUNNING);
 	common->thread_wakeup_needed = 0;
+	smp_rmb();	/* ensure the latest bh->state is visible */
 	return rc;
 }
 
-- 
1.8.1.2


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

* [PATCH 018/145] x86, efi: retry ExitBootServices() on failure
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (16 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 017/145] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 019/145] libata: skip SRST for all SIMG [34]7x port-multipliers Kamal Mostafa
                   ` (126 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Zach Bobroff, Matt Fleming, Luis Henriques

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

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

From: Zach Bobroff <zacharyb@ami.com>

commit d3768d885c6ccbf8a137276843177d76c49033a7 upstream.

ExitBootServices is absolutely supposed to return a failure if any
ExitBootServices event handler changes the memory map.  Basically the
get_map loop should run again if ExitBootServices returns an error the
first time.  I would say it would be fair that if ExitBootServices gives
an error the second time then Linux would be fine in returning control
back to BIOS.

The second change is the following line:

again:
        size += sizeof(*mem_map) * 2;

Originally you were incrementing it by the size of one memory map entry.
The issue here is all related to the low_alloc routine you are using.
In this routine you are making allocations to get the memory map itself.
Doing this allocation or allocations can affect the memory map by more
than one record.

[ mfleming - changelog, code style ]
Signed-off-by: Zach Bobroff <zacharyb@ami.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/boot/compressed/eboot.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index c205035..d606463 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -992,18 +992,20 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
 	efi_memory_desc_t *mem_map;
 	efi_status_t status;
 	__u32 desc_version;
+	bool called_exit = false;
 	u8 nr_entries;
 	int i;
 
 	size = sizeof(*mem_map) * 32;
 
 again:
-	size += sizeof(*mem_map);
+	size += sizeof(*mem_map) * 2;
 	_size = size;
 	status = low_alloc(size, 1, (unsigned long *)&mem_map);
 	if (status != EFI_SUCCESS)
 		return status;
 
+get_map:
 	status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
 				mem_map, &key, &desc_size, &desc_version);
 	if (status == EFI_BUFFER_TOO_SMALL) {
@@ -1029,8 +1031,20 @@ again:
 	/* Might as well exit boot services now */
 	status = efi_call_phys2(sys_table->boottime->exit_boot_services,
 				handle, key);
-	if (status != EFI_SUCCESS)
-		goto free_mem_map;
+	if (status != EFI_SUCCESS) {
+		/*
+		 * ExitBootServices() will fail if any of the event
+		 * handlers change the memory map. In which case, we
+		 * must be prepared to retry, but only once so that
+		 * we're guaranteed to exit on repeated failures instead
+		 * of spinning forever.
+		 */
+		if (called_exit)
+			goto free_mem_map;
+
+		called_exit = true;
+		goto get_map;
+	}
 
 	/* Historic? */
 	boot_params->alt_mem_k = 32 * 1024;
-- 
1.8.1.2


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

* [PATCH 019/145] libata: skip SRST for all SIMG [34]7x port-multipliers
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (17 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 018/145] x86, efi: retry ExitBootServices() on failure Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 020/145] ASoC: wm8962: Remove remaining direct register cache accesses Kamal Mostafa
                   ` (125 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tejun Heo, Luis Henriques

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

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

From: Tejun Heo <tj@kernel.org>

commit 7a87718d92760fc688628ad6a430643dafa16f1f upstream.

For some reason, a lot of port-multipliers have issues with softreset.
SIMG [34]7x series port-multipliers have been quite erratic in this
regard.  I recall that it was better with some firmware revisions and
the current list of quirks worked fine for a while.  I think it got
worse with later firmwares or maybe my test coverage wasn't good
enough.  Anyways, HPA is reporting that his 3726 setup suffers SRST
failures and then the PMP gets confused and fails to probe the last
port.

The hope was that we try to stick to the standard as much as possible
and soonish the PMPs and their firmwares will improve in quality, so
the quirk list was kept to minimum.  Well, it seems like that's never
gonna happen.

Let's set NO_SRST for all [34]7x PMPs so that whatever remaining
userbase of the device suffer the least.  Maybe we should do the same
for 57xx's but unfortunately I don't have any device left to test and
I'm not even sure 57xx's have ever been made widely available, so
let's leave those alone for now.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/ata/libata-pmp.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index 61c59ee..1c41722 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -389,9 +389,13 @@ static void sata_pmp_quirks(struct ata_port *ap)
 			/* link reports offline after LPM */
 			link->flags |= ATA_LFLAG_NO_LPM;
 
-			/* Class code report is unreliable. */
+			/*
+			 * Class code report is unreliable and SRST times
+			 * out under certain configurations.
+			 */
 			if (link->pmp < 5)
-				link->flags |= ATA_LFLAG_ASSUME_ATA;
+				link->flags |= ATA_LFLAG_NO_SRST |
+					       ATA_LFLAG_ASSUME_ATA;
 
 			/* port 5 is for SEMB device and it doesn't like SRST */
 			if (link->pmp == 5)
@@ -399,20 +403,17 @@ static void sata_pmp_quirks(struct ata_port *ap)
 					       ATA_LFLAG_ASSUME_SEMB;
 		}
 	} else if (vendor == 0x1095 && devid == 0x4723) {
-		/* sil4723 quirks */
-		ata_for_each_link(link, ap, EDGE) {
-			/* link reports offline after LPM */
-			link->flags |= ATA_LFLAG_NO_LPM;
-
-			/* class code report is unreliable */
-			if (link->pmp < 2)
-				link->flags |= ATA_LFLAG_ASSUME_ATA;
-
-			/* the config device at port 2 locks up on SRST */
-			if (link->pmp == 2)
-				link->flags |= ATA_LFLAG_NO_SRST |
-					       ATA_LFLAG_ASSUME_ATA;
-		}
+		/*
+		 * sil4723 quirks
+		 *
+		 * Link reports offline after LPM.  Class code report is
+		 * unreliable.  SIMG PMPs never got SRST reliable and the
+		 * config device at port 2 locks up on SRST.
+		 */
+		ata_for_each_link(link, ap, EDGE)
+			link->flags |= ATA_LFLAG_NO_LPM |
+				       ATA_LFLAG_NO_SRST |
+				       ATA_LFLAG_ASSUME_ATA;
 	} else if (vendor == 0x1095 && devid == 0x4726) {
 		/* sil4726 quirks */
 		ata_for_each_link(link, ap, EDGE) {
-- 
1.8.1.2


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

* [PATCH 020/145] ASoC: wm8962: Remove remaining direct register cache accesses
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (18 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 019/145] libata: skip SRST for all SIMG [34]7x port-multipliers Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 021/145] xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state Kamal Mostafa
                   ` (124 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nicolin Chen, Mark Brown, Luis Henriques

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

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

From: Nicolin Chen <b42378@freescale.com>

commit 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 upstream.

Also fix return values for headphone switch updates.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 sound/soc/codecs/wm8962.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index bd4b0db..1b5bda8 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1600,7 +1600,6 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_value *ucontrol)
 {
 	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-	u16 *reg_cache = codec->reg_cache;
 	int ret;
 
 	/* Apply the update (if any) */
@@ -1609,16 +1608,19 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
 		return 0;
 
 	/* If the left PGA is enabled hit that VU bit... */
-	if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTL_PGA_ENA)
-		return snd_soc_write(codec, WM8962_HPOUTL_VOLUME,
-				     reg_cache[WM8962_HPOUTL_VOLUME]);
+	ret = snd_soc_read(codec, WM8962_PWR_MGMT_2);
+	if (ret & WM8962_HPOUTL_PGA_ENA) {
+		snd_soc_write(codec, WM8962_HPOUTL_VOLUME,
+			      snd_soc_read(codec, WM8962_HPOUTL_VOLUME));
+		return 1;
+	}
 
 	/* ...otherwise the right.  The VU is stereo. */
-	if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTR_PGA_ENA)
-		return snd_soc_write(codec, WM8962_HPOUTR_VOLUME,
-				     reg_cache[WM8962_HPOUTR_VOLUME]);
+	if (ret & WM8962_HPOUTR_PGA_ENA)
+		snd_soc_write(codec, WM8962_HPOUTR_VOLUME,
+			      snd_soc_read(codec, WM8962_HPOUTR_VOLUME));
 
-	return 0;
+	return 1;
 }
 
 /* The VU bits for the speakers are in a different register to the mute
@@ -3378,7 +3380,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
 	int ret;
 	struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
 	struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
-	u16 *reg_cache = codec->reg_cache;
 	int i, trigger, irq_pol;
 	bool dmicclk, dmicdat;
 
@@ -3436,8 +3437,9 @@ static int wm8962_probe(struct snd_soc_codec *codec)
 
 		/* Put the speakers into mono mode? */
 		if (pdata->spk_mono)
-			reg_cache[WM8962_CLASS_D_CONTROL_2]
-				|= WM8962_SPK_MONO;
+			snd_soc_update_bits(codec, WM8962_CLASS_D_CONTROL_2,
+				WM8962_SPK_MONO_MASK, WM8962_SPK_MONO);
+
 
 		/* Micbias setup, detection enable and detection
 		 * threasholds. */
-- 
1.8.1.2


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

* [PATCH 021/145] xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state.
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (19 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 020/145] ASoC: wm8962: Remove remaining direct register cache accesses Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 022/145] ACPICA: Do not use extended sleep registers unless HW-reduced bit is set Kamal Mostafa
                   ` (123 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: linux-pci, Konrad Rzeszutek Wilk, Luis Henriques

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

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

From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

commit 098b1aeaf4d6149953b8f1f8d55c21d85536fbff upstream.

There are two tool-stack that can instruct the Xen PCI frontend
and backend to change states: 'xm' (Python code with a daemon),
and 'xl' (C library - does not keep state changes).

With the 'xm', the path to disconnect a single PCI device (xm pci-detach
<guest> <BDF>) is:

4(Connected)->7(Reconfiguring*)-> 8(Reconfigured)-> 4(Connected)->5(Closing*).

The * is for states that the tool-stack sets. For 'xl', it is similar:

4(Connected)->7(Reconfiguring*)-> 8(Reconfigured)-> 4(Connected)

Both of them also tear down the XenBus structure, so the backend
state ends up going in the 3(Initialised) and calls pcifront_xenbus_remove.

When a PCI device is plugged back in (xm pci-attach <guest> <BDF>)
both of them follow the same pattern:

2(InitWait*), 3(Initialized*), 4(Connected*)->4(Connected).

[xen-pcifront ignores the 2,3 state changes and only acts when
4 (Connected) has been reached]

Note that this is for a _single_ PCI device. If there were two
PCI devices and only one was disconnected 'xm' would show the same
state changes.

The problem is that git commit 3d925320e9e2de162bd138bf97816bda8c3f71be
("xen/pcifront: Use Xen-SWIOTLB when initting if required") introduced
a mechanism to initialize the SWIOTLB when the Xen PCI front moves to
Connected state. It also had some aggressive seatbelt code check that
would warn the user if one tried to change to Connected state without
hitting first the Closing state:

 pcifront pci-0: PCI frontend already installed!

However, that code can be relaxed and we can continue on working
even if the frontend is instructed to be the 'Connected' state with
no devices and then gets tickled to be in 'Connected' state again.

In other words, this 4(Connected)->5(Closing)->4(Connected) state
was expected, while 4(Connected)->.... anything but 5(Closing)->4(Connected)
was not. This patch removes that aggressive check and allows
Xen pcifront to work with the 'xl' toolstack (for one or more
PCI devices) and with 'xm' toolstack (for more than two PCI
devices).

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
[v2: Added in the description about two PCI devices]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pci/xen-pcifront.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 966abc6..f7197a7 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -678,10 +678,9 @@ static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
 	if (!pcifront_dev) {
 		dev_info(&pdev->xdev->dev, "Installing PCI frontend\n");
 		pcifront_dev = pdev;
-	} else {
-		dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n");
+	} else
 		err = -EEXIST;
-	}
+
 	spin_unlock(&pcifront_dev_lock);
 
 	if (!err && !swiotlb_nr_tbl()) {
@@ -848,7 +847,7 @@ static int pcifront_try_connect(struct pcifront_device *pdev)
 		goto out;
 
 	err = pcifront_connect_and_init_dma(pdev);
-	if (err) {
+	if (err && err != -EEXIST) {
 		xenbus_dev_fatal(pdev->xdev, err,
 				 "Error setting up PCI Frontend");
 		goto out;
-- 
1.8.1.2


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

* [PATCH 022/145] ACPICA: Do not use extended sleep registers unless HW-reduced bit is set
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (20 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 021/145] xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 023/145] ALSA: hda - Cache the MUX selection for generic HDMI Kamal Mostafa
                   ` (122 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lv Zheng, Bob Moore, Rafael J. Wysocki, Luis Henriques

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

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

From: Lv Zheng <lv.zheng@intel.com>

commit 7cec7048fe22e3e92389da2cd67098f6c4284e7f upstream.

Previous implementation incorrectly used the ACPI 5.0 extended
sleep registers if they were simply populated. This caused
problems on some non-HW-reduced machines. As per the ACPI spec,
they should only be used if the HW-reduced bit is set.  Lv Zheng,
ACPICA BZ 1020.

References: https://bugzilla.kernel.org/show_bug.cgi?id=54181
References: https://bugs.acpica.org/show_bug.cgi?id=1020
Reported-by: Daniel Rowe <bart@fathom13.com>
Bisected-by: Brint E. Kriebel <kernel@bekit.net>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/acpi/acpica/hwxfsleep.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index ae443fe2..fac67f0 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
 	    &acpi_sleep_dispatch[function_id];
 
 #if (!ACPI_REDUCED_HARDWARE)
-
 	/*
 	 * If the Hardware Reduced flag is set (from the FADT), we must
-	 * use the extended sleep registers
+	 * use the extended sleep registers (FADT). Note: As per the ACPI
+	 * specification, these extended registers are to be used for HW-reduced
+	 * platforms only. They are not general-purpose replacements for the
+	 * legacy PM register sleep support.
 	 */
-	if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) {
+	if (acpi_gbl_reduced_hardware) {
 		status = sleep_functions->extended_function(sleep_state);
 	} else {
 		/* Legacy sleep */
-- 
1.8.1.2


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

* [PATCH 023/145] ALSA: hda - Cache the MUX selection for generic HDMI
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (21 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 022/145] ACPICA: Do not use extended sleep registers unless HW-reduced bit is set Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 024/145] cgroup: fix umount vs cgroup_cfts_commit() race Kamal Mostafa
                   ` (121 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Luis Henriques

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

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

From: Takashi Iwai <tiwai@suse.de>

commit bddee96b5d0db869f47b195fe48c614ca824203c upstream.

When a selection to a converter MUX is changed in hdmi_pcm_open(), it
should be cached so that the given connection can be restored properly
at PM resume.  We need just to replace the corresponding
snd_hda_codec_write() call with snd_hda_codec_write_cache().

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

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index c690b2a..f186897 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1087,7 +1087,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
 	per_cvt->assigned = 1;
 	hinfo->nid = per_cvt->cvt_nid;
 
-	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
+	snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
 			    AC_VERB_SET_CONNECT_SEL,
 			    mux_idx);
 	snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
-- 
1.8.1.2


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

* [PATCH 024/145] cgroup: fix umount vs cgroup_cfts_commit() race
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (22 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 023/145] ALSA: hda - Cache the MUX selection for generic HDMI Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 025/145] cgroup: fix umount vs cgroup_event_remove() race Kamal Mostafa
                   ` (120 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Li Zefan, Tejun Heo, Luis Henriques

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

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

From: Li Zefan <lizefan@huawei.com>

commit 084457f284abf6789d90509ee11dae383842b23b upstream.

cgroup_cfts_commit() uses dget() to keep cgroup alive after cgroup_mutex
is dropped, but dget() won't prevent cgroupfs from being umounted. When
the race happens, vfs will see some dentries with non-zero refcnt while
umount is in process.

Keep running this:
  mount -t cgroup -o blkio xxx /cgroup
  umount /cgroup

And this:
  modprobe cfq-iosched
  rmmod cfs-iosched

After a while, the BUG() in shrink_dcache_for_umount_subtree() may
be triggered:

  BUG: Dentry xxx{i=0,n=blkio.yyy} still in use (1) [umount of cgroup cgroup]

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ luis: backported to 3.8:
  - fixed build error: added '&' to atomic_inc_not_zero parameter;
    this was fixed upstream by commit e8c82d20a9f729cf4b9f73043f7fd4e0872bebfd ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/cgroup.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 02ddadb..b6a1f62 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2813,13 +2813,17 @@ static void cgroup_cfts_commit(struct cgroup_subsys *ss,
 {
 	LIST_HEAD(pending);
 	struct cgroup *cgrp, *n;
+	struct super_block *sb = ss->root->sb;
 
 	/* %NULL @cfts indicates abort and don't bother if @ss isn't attached */
-	if (cfts && ss->root != &rootnode) {
+	if (cfts && ss->root != &rootnode &&
+	    atomic_inc_not_zero(&sb->s_active)) {
 		list_for_each_entry(cgrp, &ss->root->allcg_list, allcg_node) {
 			dget(cgrp->dentry);
 			list_add_tail(&cgrp->cft_q_node, &pending);
 		}
+	} else {
+		sb = NULL;
 	}
 
 	mutex_unlock(&cgroup_mutex);
@@ -2842,6 +2846,9 @@ static void cgroup_cfts_commit(struct cgroup_subsys *ss,
 		dput(cgrp->dentry);
 	}
 
+	if (sb)
+		deactivate_super(sb);
+
 	mutex_unlock(&cgroup_cft_mutex);
 }
 
-- 
1.8.1.2


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

* [PATCH 025/145] cgroup: fix umount vs cgroup_event_remove() race
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (23 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 024/145] cgroup: fix umount vs cgroup_cfts_commit() race Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 026/145] xhci: check for failed dma pool allocation Kamal Mostafa
                   ` (119 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Li Zefan, Tejun Heo, Luis Henriques

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

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

From: Li Zefan <lizefan@huawei.com>

commit 1c8158eeae0f37d0eee9f1fbe68080df6a408df2 upstream.

 commit 5db9a4d99b0157a513944e9a44d29c9cec2e91dc
 Author: Tejun Heo <tj@kernel.org>
 Date:   Sat Jul 7 16:08:18 2012 -0700

     cgroup: fix cgroup hierarchy umount race

This commit fixed a race caused by the dput() in css_dput_fn(), but
the dput() in cgroup_event_remove() can also lead to the same BUG().

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/cgroup.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b6a1f62..754b917 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3755,6 +3755,23 @@ static int cgroup_write_notify_on_release(struct cgroup *cgrp,
 }
 
 /*
+ * When dput() is called asynchronously, if umount has been done and
+ * then deactivate_super() in cgroup_free_fn() kills the superblock,
+ * there's a small window that vfs will see the root dentry with non-zero
+ * refcnt and trigger BUG().
+ *
+ * That's why we hold a reference before dput() and drop it right after.
+ */
+static void cgroup_dput(struct cgroup *cgrp)
+{
+	struct super_block *sb = cgrp->root->sb;
+
+	atomic_inc(&sb->s_active);
+	dput(cgrp->dentry);
+	deactivate_super(sb);
+}
+
+/*
  * Unregister event and free resources.
  *
  * Gets called from workqueue.
@@ -3769,7 +3786,7 @@ static void cgroup_event_remove(struct work_struct *work)
 
 	eventfd_ctx_put(event->eventfd);
 	kfree(event);
-	dput(cgrp->dentry);
+	cgroup_dput(cgrp);
 }
 
 /*
@@ -4031,12 +4048,8 @@ static void css_dput_fn(struct work_struct *work)
 {
 	struct cgroup_subsys_state *css =
 		container_of(work, struct cgroup_subsys_state, dput_work);
-	struct dentry *dentry = css->cgroup->dentry;
-	struct super_block *sb = dentry->d_sb;
 
-	atomic_inc(&sb->s_active);
-	dput(dentry);
-	deactivate_super(sb);
+	cgroup_dput(css->cgroup);
 }
 
 static void init_cgroup_css(struct cgroup_subsys_state *css,
-- 
1.8.1.2


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

* [PATCH 026/145] xhci: check for failed dma pool allocation
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (24 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 025/145] cgroup: fix umount vs cgroup_event_remove() race Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 027/145] powerpc/eeh: Fix fetching bus for single-dev-PE Kamal Mostafa
                   ` (118 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mathias Nyman, Sarah Sharp, John Youn, Greg Kroah-Hartman,
	Luis Henriques

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

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

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

commit 025f880cb2e4d7218d0422d4b07bea1a68959c38 upstream.

Fail and free the container context in case dma_pool_alloc() can't allocate
the raw context data part of it

This patch should be backported to kernels as old as 2.6.31, that
contain the commit d115b04818e57bdbc7ccde4d0660b15e33013dc8 "USB: xhci:
Support for 64-byte contexts".

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: John Youn <johnyoun@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-mem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 0618f25..1ffbbfb 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -369,6 +369,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci
 		ctx->size += CTX_SIZE(xhci->hcc_params);
 
 	ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma);
+	if (!ctx->bytes) {
+		kfree(ctx);
+		return NULL;
+	}
 	memset(ctx->bytes, 0, ctx->size);
 	return ctx;
 }
-- 
1.8.1.2


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

* [PATCH 027/145] powerpc/eeh: Fix fetching bus for single-dev-PE
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (25 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 026/145] xhci: check for failed dma pool allocation Kamal Mostafa
@ 2013-07-17 22:45 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 028/145] ata_piix: IDE-mode SATA patch for Intel Coleto Creek DeviceIDs Kamal Mostafa
                   ` (117 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:45 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Steve Best, Gavin Shan, Benjamin Herrenschmidt, Luis Henriques

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

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

From: Gavin Shan <shangw@linux.vnet.ibm.com>

commit 5fb621698e94e3af8b413d9439041fde48e2784d upstream.

While running Linux as guest on top of phyp, we possiblly have
PE that includes single PCI device. However, we didn't return
its PCI bus correctly and it leads to failure on recovery from
EEH errors for single-dev-PE. The patch fixes the issue.

Cc: Steve Best <sbest@us.ibm.com>
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/platforms/pseries/eeh_pe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/platforms/pseries/eeh_pe.c
index fe43d1a..9d4a9e8 100644
--- a/arch/powerpc/platforms/pseries/eeh_pe.c
+++ b/arch/powerpc/platforms/pseries/eeh_pe.c
@@ -639,7 +639,8 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
 
 	if (pe->type & EEH_PE_PHB) {
 		bus = pe->phb->bus;
-	} else if (pe->type & EEH_PE_BUS) {
+	} else if (pe->type & EEH_PE_BUS ||
+		   pe->type & EEH_PE_DEVICE) {
 		edev = list_first_entry(&pe->edevs, struct eeh_dev, list);
 		pdev = eeh_dev_to_pci_dev(edev);
 		if (pdev)
-- 
1.8.1.2


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

* [PATCH 028/145] ata_piix: IDE-mode SATA patch for Intel Coleto Creek DeviceIDs
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (26 preceding siblings ...)
  2013-07-17 22:45 ` [PATCH 027/145] powerpc/eeh: Fix fetching bus for single-dev-PE Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 029/145] ahci: AHCI-mode " Kamal Mostafa
                   ` (116 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Seth Heasley, Tejun Heo, Luis Henriques

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

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

From: Seth Heasley <seth.heasley@intel.com>

commit c7e8695bfa0611b39493a9dfe8bab9f63f9809bd upstream.

This patch adds the IDE-mode SATA DeviceIDs for the Intel Coleto Creek PCH.

Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/ata/ata_piix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 12fb576..c70942f 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -338,6 +338,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
 	/* SATA Controller IDE (BayTrail) */
 	{ 0x8086, 0x0F20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },
 	{ 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },
+	/* SATA Controller IDE (Coleto Creek) */
+	{ 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
 
 	{ }	/* terminate list */
 };
-- 
1.8.1.2


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

* [PATCH 029/145] ahci: AHCI-mode SATA patch for Intel Coleto Creek DeviceIDs
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (27 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 028/145] ata_piix: IDE-mode SATA patch for Intel Coleto Creek DeviceIDs Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 030/145] ARM: 7765/1: perf: Record the user-mode PC in the call chain Kamal Mostafa
                   ` (115 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Seth Heasley, Tejun Heo, Luis Henriques

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

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

From: Seth Heasley <seth.heasley@intel.com>

commit 1cfc7df3de10c40ed459e13cce6de616023bf41c upstream.

This patch adds the AHCI-mode SATA DeviceIDs for the Intel Coleto Creek PCH.

Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/ata/ahci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index c8a38ce..d340976 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -289,6 +289,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */
 	{ PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
 	{ PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
+	{ PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
 
 	/* JMicron 360/1/3/5/6, match class to avoid IDE function */
 	{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-- 
1.8.1.2


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

* [PATCH 030/145] ARM: 7765/1: perf: Record the user-mode PC in the call chain.
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (28 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 029/145] ahci: AHCI-mode " Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 031/145] [SCSI] mpt2sas: Fix for issue Missing delay not getting set during system bootup Kamal Mostafa
                   ` (114 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jed Davis, Will Deacon, Russell King, Luis Henriques

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

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

From: Jed Davis <jld@mozilla.com>

commit c5f927a6f62196226915f12194c9d0df4e2210d7 upstream.

With this change, we no longer lose the innermost entry in the user-mode
part of the call chain.  See also the x86 port, which includes the ip.

It's possible to partially work around this problem by post-processing
the data to use the PERF_SAMPLE_IP value, but this works only if the CPU
wasn't in the kernel when the sample was taken.

Signed-off-by: Jed Davis <jld@mozilla.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/arm/kernel/perf_event.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 23fa6a2..5da31bb 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -579,6 +579,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
 		return;
 	}
 
+	perf_callchain_store(entry, regs->ARM_pc);
 	tail = (struct frame_tail __user *)regs->ARM_fp - 1;
 
 	while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
-- 
1.8.1.2


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

* [PATCH 031/145] [SCSI] mpt2sas: Fix for issue Missing delay not getting set during system bootup
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (29 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 030/145] ARM: 7765/1: perf: Record the user-mode PC in the call chain Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 032/145] [SCSI] mpt2sas: Fix for device scan following host reset could get stuck in a infinite loop Kamal Mostafa
                   ` (113 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sreekanth Reddy, James Bottomley, Luis Henriques

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

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

From: "Reddy, Sreekanth" <Sreekanth.Reddy@lsi.com>

commit b0df96a0068daee4f9c2189c29b9053eb6e46b17 upstream.

Missing delay is not getting set properly. The reason is that it is not
defined in the same file from where it is being invoked.  The fix is to move
the missing delay module parameter from mpt2sas_base.c to mpt2sas_scsh.c.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/mpt2sas/mpt2sas_base.c  | 14 +++-----------
 drivers/scsi/mpt2sas/mpt2sas_base.h  |  3 +++
 drivers/scsi/mpt2sas/mpt2sas_scsih.c |  8 +++++++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index ffd85c5..db49cd2 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -80,10 +80,6 @@ static int msix_disable = -1;
 module_param(msix_disable, int, 0);
 MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
 
-static int missing_delay[2] = {-1, -1};
-module_param_array(missing_delay, int, NULL, 0);
-MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay");
-
 static int mpt2sas_fwfault_debug;
 MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault "
 	"and halt firmware - (default=0)");
@@ -2175,7 +2171,7 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
 }
 
 /**
- * _base_update_missing_delay - change the missing delay timers
+ * mpt2sas_base_update_missing_delay - change the missing delay timers
  * @ioc: per adapter object
  * @device_missing_delay: amount of time till device is reported missing
  * @io_missing_delay: interval IO is returned when there is a missing device
@@ -2186,8 +2182,8 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
  * delay, as well as the io missing delay. This should be called at driver
  * load time.
  */
-static void
-_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc,
+void
+mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc,
 	u16 device_missing_delay, u8 io_missing_delay)
 {
 	u16 dmd, dmd_new, dmd_orignal;
@@ -4383,10 +4379,6 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 	if (r)
 		goto out_free_resources;
 
-	if (missing_delay[0] != -1 && missing_delay[1] != -1)
-		_base_update_missing_delay(ioc, missing_delay[0],
-		    missing_delay[1]);
-
 	return 0;
 
  out_free_resources:
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 543d8d6..514dddc 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -1048,6 +1048,9 @@ void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_ty
 
 void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc);
 
+void mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc,
+	u16 device_missing_delay, u8 io_missing_delay);
+
 int mpt2sas_port_enable(struct MPT2SAS_ADAPTER *ioc);
 
 /* scsih shared API */
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index c6bdc92..116e201 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -101,6 +101,10 @@ static ushort max_sectors = 0xFFFF;
 module_param(max_sectors, ushort, 0);
 MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767  default=32767");
 
+static int missing_delay[2] = {-1, -1};
+module_param_array(missing_delay, int, NULL, 0);
+MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay");
+
 /* scsi-mid layer global parmeter is max_report_luns, which is 511 */
 #define MPT2SAS_MAX_LUN (16895)
 static int max_lun = MPT2SAS_MAX_LUN;
@@ -7303,7 +7307,9 @@ _firmware_event_work(struct work_struct *work)
 	case MPT2SAS_PORT_ENABLE_COMPLETE:
 		ioc->start_scan = 0;
 
-
+		if (missing_delay[0] != -1 && missing_delay[1] != -1)
+			mpt2sas_base_update_missing_delay(ioc, missing_delay[0],
+				missing_delay[1]);
 
 		dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete "
 		    "from worker thread\n", ioc->name));
-- 
1.8.1.2


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

* [PATCH 032/145] [SCSI] mpt2sas: Fix for device scan following host reset could get stuck in a infinite loop
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (30 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 031/145] [SCSI] mpt2sas: Fix for issue Missing delay not getting set during system bootup Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 033/145] [SCSI] mpt2sas: fix firmware failure with wrong task attribute Kamal Mostafa
                   ` (112 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sreekanth Reddy, James Bottomley, Luis Henriques

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

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

From: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>

commit 6241f22ca12a26ee149cbe31b27bac97dbdc8bc4 upstream.

Modified device scan routine so each configuration page read breaks from the
while loop when the ioc_status is not equal to MPI2_IOCSTATUS_SUCCESS.

[jejb: checkpatch fixes]
Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 122 +++++++++++++++++++++++++++++++++--
 1 file changed, 117 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 116e201..01dfbab 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -7097,12 +7097,15 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 	struct _sas_device *sas_device;
 	struct _sas_node *expander_device;
 	static struct _raid_device *raid_device;
+	u8 retry_count;
 	unsigned long flags;
 
 	printk(MPT2SAS_INFO_FMT "scan devices: start\n", ioc->name);
 
 	_scsih_sas_host_refresh(ioc);
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices: expanders start\n",
+		ioc->name);
 	/* expanders */
 	handle = 0xFFFF;
 	while (!(mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,
@@ -7111,6 +7114,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		    MPI2_IOCSTATUS_MASK;
 		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
 			break;
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+			printk(MPT2SAS_INFO_FMT "\tbreak from expander scan: "
+				"ioc_status(0x%04x), loginfo(0x%08x)\n",
+				ioc->name, ioc_status,
+				le32_to_cpu(mpi_reply.IOCLogInfo));
+			break;
+		}
 		handle = le16_to_cpu(expander_pg0.DevHandle);
 		spin_lock_irqsave(&ioc->sas_node_lock, flags);
 		expander_device = mpt2sas_scsih_expander_find_by_sas_address(
@@ -7119,13 +7129,26 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		if (expander_device)
 			_scsih_refresh_expander_links(ioc, expander_device,
 			    handle);
-		else
+		else {
+			printk(MPT2SAS_INFO_FMT "\tBEFORE adding expander: "
+				"handle (0x%04x), sas_addr(0x%016llx)\n",
+				ioc->name, handle, (unsigned long long)
+				le64_to_cpu(expander_pg0.SASAddress));
 			_scsih_expander_add(ioc, handle);
+			printk(MPT2SAS_INFO_FMT "\tAFTER adding expander: "
+				"handle (0x%04x), sas_addr(0x%016llx)\n",
+				ioc->name, handle, (unsigned long long)
+				le64_to_cpu(expander_pg0.SASAddress));
+		}
 	}
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices: expanders complete\n",
+		ioc->name);
+
 	if (!ioc->ir_firmware)
 		goto skip_to_sas;
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices phys disk start\n", ioc->name);
 	/* phys disk */
 	phys_disk_num = 0xFF;
 	while (!(mpt2sas_config_get_phys_disk_pg0(ioc, &mpi_reply,
@@ -7135,6 +7158,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		    MPI2_IOCSTATUS_MASK;
 		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
 			break;
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+			printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan:"
+				"ioc_status(0x%04x), loginfo(0x%08x)\n",
+				ioc->name, ioc_status,
+				le32_to_cpu(mpi_reply.IOCLogInfo));
+			break;
+		}
 		phys_disk_num = pd_pg0.PhysDiskNum;
 		handle = le16_to_cpu(pd_pg0.DevHandle);
 		spin_lock_irqsave(&ioc->sas_device_lock, flags);
@@ -7146,17 +7176,46 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		    &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
 		    handle) != 0)
 			continue;
+		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+			MPI2_IOCSTATUS_MASK;
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+			printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan "
+				"ioc_status(0x%04x), loginfo(0x%08x)\n",
+				ioc->name, ioc_status,
+				le32_to_cpu(mpi_reply.IOCLogInfo));
+			break;
+		}
 		parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
 		if (!_scsih_get_sas_address(ioc, parent_handle,
 		    &sas_address)) {
+			printk(MPT2SAS_INFO_FMT "\tBEFORE adding phys disk: "
+				" handle (0x%04x), sas_addr(0x%016llx)\n",
+				ioc->name, handle, (unsigned long long)
+				le64_to_cpu(sas_device_pg0.SASAddress));
 			mpt2sas_transport_update_links(ioc, sas_address,
 			    handle, sas_device_pg0.PhyNum,
 			    MPI2_SAS_NEG_LINK_RATE_1_5);
 			set_bit(handle, ioc->pd_handles);
-			_scsih_add_device(ioc, handle, 0, 1);
+			retry_count = 0;
+			/* This will retry adding the end device.
+			* _scsih_add_device() will decide on retries and
+			* return "1" when it should be retried
+			*/
+			while (_scsih_add_device(ioc, handle, retry_count++,
+				1)) {
+					ssleep(1);
+			}
+			printk(MPT2SAS_INFO_FMT "\tAFTER adding phys disk: "
+				" handle (0x%04x), sas_addr(0x%016llx)\n",
+				ioc->name, handle, (unsigned long long)
+				le64_to_cpu(sas_device_pg0.SASAddress));
 		}
 	}
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices: phys disk complete\n",
+		ioc->name);
+
+	printk(MPT2SAS_INFO_FMT "\tscan devices: volumes start\n", ioc->name);
 	/* volumes */
 	handle = 0xFFFF;
 	while (!(mpt2sas_config_get_raid_volume_pg1(ioc, &mpi_reply,
@@ -7165,6 +7224,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		    MPI2_IOCSTATUS_MASK;
 		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
 			break;
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+			printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: "
+				"ioc_status(0x%04x), loginfo(0x%08x)\n",
+				ioc->name, ioc_status,
+				le32_to_cpu(mpi_reply.IOCLogInfo));
+			break;
+		}
 		handle = le16_to_cpu(volume_pg1.DevHandle);
 		spin_lock_irqsave(&ioc->raid_device_lock, flags);
 		raid_device = _scsih_raid_device_find_by_wwid(ioc,
@@ -7176,18 +7242,38 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		    &volume_pg0, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
 		     sizeof(Mpi2RaidVolPage0_t)))
 			continue;
+		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
+			MPI2_IOCSTATUS_MASK;
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+			printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: "
+				"ioc_status(0x%04x), loginfo(0x%08x)\n",
+				ioc->name, ioc_status,
+				le32_to_cpu(mpi_reply.IOCLogInfo));
+			break;
+		}
 		if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL ||
 		    volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_ONLINE ||
 		    volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_DEGRADED) {
 			memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t));
 			element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED;
 			element.VolDevHandle = volume_pg1.DevHandle;
+			printk(MPT2SAS_INFO_FMT "\tBEFORE adding volume: "
+				" handle (0x%04x)\n", ioc->name,
+				volume_pg1.DevHandle);
 			_scsih_sas_volume_add(ioc, &element);
+			printk(MPT2SAS_INFO_FMT "\tAFTER adding volume: "
+				" handle (0x%04x)\n", ioc->name,
+				volume_pg1.DevHandle);
 		}
 	}
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices: volumes complete\n",
+		ioc->name);
+
  skip_to_sas:
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices: end devices start\n",
+		ioc->name);
 	/* sas devices */
 	handle = 0xFFFF;
 	while (!(mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply,
@@ -7197,6 +7283,13 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 		    MPI2_IOCSTATUS_MASK;
 		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
 			break;
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
+			printk(MPT2SAS_INFO_FMT "\tbreak from end device scan:"
+				" ioc_status(0x%04x), loginfo(0x%08x)\n",
+				ioc->name, ioc_status,
+				le32_to_cpu(mpi_reply.IOCLogInfo));
+				break;
+		}
 		handle = le16_to_cpu(sas_device_pg0.DevHandle);
 		if (!(_scsih_is_end_device(
 		    le32_to_cpu(sas_device_pg0.DeviceInfo))))
@@ -7209,12 +7302,31 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
 			continue;
 		parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
 		if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) {
+			printk(MPT2SAS_INFO_FMT "\tBEFORE adding end device: "
+				"handle (0x%04x), sas_addr(0x%016llx)\n",
+				ioc->name, handle, (unsigned long long)
+				le64_to_cpu(sas_device_pg0.SASAddress));
 			mpt2sas_transport_update_links(ioc, sas_address, handle,
 			    sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
-			_scsih_add_device(ioc, handle, 0, 0);
+			retry_count = 0;
+			/* This will retry adding the end device.
+			 * _scsih_add_device() will decide on retries and
+			 * return "1" when it should be retried
+			 */
+			while (_scsih_add_device(ioc, handle, retry_count++,
+				0)) {
+					ssleep(1);
+			}
+			printk(MPT2SAS_INFO_FMT "\tAFTER adding end device: "
+				"handle (0x%04x), sas_addr(0x%016llx)\n",
+				ioc->name, handle, (unsigned long long)
+				le64_to_cpu(sas_device_pg0.SASAddress));
 		}
 	}
 
+	printk(MPT2SAS_INFO_FMT "\tscan devices: end devices complete\n",
+		ioc->name);
+
 	printk(MPT2SAS_INFO_FMT "scan devices: complete\n", ioc->name);
 }
 
@@ -8076,8 +8188,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (max_sectors != 0xFFFF) {
 		if (max_sectors < 64) {
 			shost->max_sectors = 64;
-			printk(MPT2SAS_WARN_FMT "Invalid value %d passed "\
-			    "for max_sectors, range is 64 to 32767. Assigning "\
+			printk(MPT2SAS_WARN_FMT "Invalid value %d passed "
+			    "for max_sectors, range is 64 to 32767. Assigning "
 			    "value of 64.\n", ioc->name, max_sectors);
 		} else if (max_sectors > 32767) {
 			shost->max_sectors = 32767;
-- 
1.8.1.2


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

* [PATCH 033/145] [SCSI] mpt2sas: fix firmware failure with wrong task attribute
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (31 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 032/145] [SCSI] mpt2sas: Fix for device scan following host reset could get stuck in a infinite loop Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 034/145] usb: host: xhci-plat: release mem region while removing module Kamal Mostafa
                   ` (111 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sreekanth Reddy, James Bottomley, Luis Henriques

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

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

From: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>

commit 48ba2efc382f94fae16ca8ca011e5961a81ad1ea upstream.

When SCSI command is received with task attribute not set, set it to SIMPLE.
Previously it is set to untagged. This causes the firmware to fail the commands.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 01dfbab..c78216c 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3998,11 +3998,7 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
 			else
 				mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
 		} else
-/* MPI Revision I (UNIT = 0xA) - removed MPI2_SCSIIO_CONTROL_UNTAGGED */
-/*			mpi_control |= MPI2_SCSIIO_CONTROL_UNTAGGED;
- */
-			mpi_control |= (0x500);
-
+			mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
 	} else
 		mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
 	/* Make sure Device is not raid volume.
-- 
1.8.1.2


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

* [PATCH 034/145] usb: host: xhci-plat: release mem region while removing module
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (32 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 033/145] [SCSI] mpt2sas: fix firmware failure with wrong task attribute Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 035/145] USB: option,qcserial: move Novatel Gobi1K IDs to qcserial Kamal Mostafa
                   ` (110 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: George Cherian, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit 5388a3a5faba8dfa69e5f06c3a415d373c1a4316 upstream.

Do a release_mem_region of the hcd resource. Without this the
subsequent insertion of module fails in request_mem_region.

Signed-off-by: George Cherian <george.cherian@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/host/xhci-plat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index df90fe5..93ad67e 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -179,6 +179,7 @@ static int xhci_plat_remove(struct platform_device *dev)
 
 	usb_remove_hcd(hcd);
 	iounmap(hcd->regs);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
 	usb_put_hcd(hcd);
 	kfree(xhci);
 
-- 
1.8.1.2


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

* [PATCH 035/145] USB: option,qcserial: move Novatel Gobi1K IDs to qcserial
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (33 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 034/145] usb: host: xhci-plat: release mem region while removing module Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 036/145] powerpc/hw_brk: Fix setting of length for exact mode breakpoints Kamal Mostafa
                   ` (109 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Williams, Greg Kroah-Hartman, Luis Henriques

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

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

From: Dan Williams <dcbw@redhat.com>

commit a254810a86aaaac4ac6ba44fa934558b042a17a7 upstream.

These devices are all Gobi1K devices (according to the Windows INF
files) and should be handled by qcserial instead of option.  Their
network port is handled by qmi_wwan.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/usb/serial/option.c   | 4 ----
 drivers/usb/serial/qcserial.c | 8 +++++++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9162db2..c94fe3e 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -159,8 +159,6 @@ static void option_instat_callback(struct urb *urb);
 #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED	0x9000
 #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED	0x9001
 #define NOVATELWIRELESS_PRODUCT_E362		0x9010
-#define NOVATELWIRELESS_PRODUCT_G1		0xA001
-#define NOVATELWIRELESS_PRODUCT_G1_M		0xA002
 #define NOVATELWIRELESS_PRODUCT_G2		0xA010
 #define NOVATELWIRELESS_PRODUCT_MC551		0xB001
 
@@ -730,8 +728,6 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC547) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED) },
-	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) },
-	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) },
 	/* Novatel Ovation MC551 a.k.a. Verizon USB551L */
 	{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index bd794b4..c65437c 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -35,7 +35,13 @@ static const struct usb_device_id id_table[] = {
 	{DEVICE_G1K(0x04da, 0x250c)},	/* Panasonic Gobi QDL device */
 	{DEVICE_G1K(0x413c, 0x8172)},	/* Dell Gobi Modem device */
 	{DEVICE_G1K(0x413c, 0x8171)},	/* Dell Gobi QDL device */
-	{DEVICE_G1K(0x1410, 0xa001)},	/* Novatel Gobi Modem device */
+	{DEVICE_G1K(0x1410, 0xa001)},	/* Novatel/Verizon USB-1000 */
+	{DEVICE_G1K(0x1410, 0xa002)},	/* Novatel Gobi Modem device */
+	{DEVICE_G1K(0x1410, 0xa003)},	/* Novatel Gobi Modem device */
+	{DEVICE_G1K(0x1410, 0xa004)},	/* Novatel Gobi Modem device */
+	{DEVICE_G1K(0x1410, 0xa005)},	/* Novatel Gobi Modem device */
+	{DEVICE_G1K(0x1410, 0xa006)},	/* Novatel Gobi Modem device */
+	{DEVICE_G1K(0x1410, 0xa007)},	/* Novatel Gobi Modem device */
 	{DEVICE_G1K(0x1410, 0xa008)},	/* Novatel Gobi QDL device */
 	{DEVICE_G1K(0x0b05, 0x1776)},	/* Asus Gobi Modem device */
 	{DEVICE_G1K(0x0b05, 0x1774)},	/* Asus Gobi QDL device */
-- 
1.8.1.2


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

* [PATCH 036/145] powerpc/hw_brk: Fix setting of length for exact mode breakpoints
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (34 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 035/145] USB: option,qcserial: move Novatel Gobi1K IDs to qcserial Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46   ` Kamal Mostafa
                   ` (108 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Neuling, Benjamin Herrenschmidt, Luis Henriques

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

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

From: Michael Neuling <mikey@neuling.org>

commit b0b0aa9c7faf94e92320eabd8a1786c7747e40a8 upstream.

The smallest match region for both the DABR and DAWR is 8 bytes, so the
kernel needs to filter matches when users want to look at regions smaller than
this.

Currently we set the length of PPC_BREAKPOINT_MODE_EXACT breakpoints to 8.
This is wrong as in exact mode we should only match on 1 address, hence the
length should be 1.

This ensures that the kernel will filter out any exact mode hardware breakpoint
matches on any addresses other than the requested one.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Reported-by: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/ptrace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index c497000..33ff9be 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1413,7 +1413,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
 	 */
 	if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
 		len = bp_info->addr2 - bp_info->addr;
-	} else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
+	} else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
+		len = 1;
+	else {
 		ptrace_put_breakpoints(child);
 		return -EINVAL;
 	}
-- 
1.8.1.2


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

* [PATCH 037/145] crypto: algboss - Hold ref count on larval
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
@ 2013-07-17 22:46   ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 002/145] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down Kamal Mostafa
                     ` (143 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herbert Xu, Luis Henriques

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

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

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

commit 939e17799619e31331d2433041196529515a86a6 upstream.

On Thu, Jun 20, 2013 at 10:00:21AM +0200, Daniel Borkmann wrote:
> After having fixed a NULL pointer dereference in SCTP 1abd165e ("net:
> sctp: fix NULL pointer dereference in socket destruction"), I ran into
> the following NULL pointer dereference in the crypto subsystem with
> the same reproducer, easily hit each time:
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [<ffffffff81070321>] __wake_up_common+0x31/0x90
> PGD 0
> Oops: 0000 [#1] SMP
> Modules linked in: padlock_sha(F-) sha256_generic(F) sctp(F) libcrc32c(F) [..]
> CPU: 6 PID: 3326 Comm: cryptomgr_probe Tainted: GF            3.10.0-rc5+ #1
> Hardware name: Dell Inc. PowerEdge T410/0H19HD, BIOS 1.6.3 02/01/2011
> task: ffff88007b6cf4e0 ti: ffff88007b7cc000 task.ti: ffff88007b7cc000
> RIP: 0010:[<ffffffff81070321>]  [<ffffffff81070321>] __wake_up_common+0x31/0x90
> RSP: 0018:ffff88007b7cde08  EFLAGS: 00010082
> RAX: ffffffffffffffe8 RBX: ffff88003756c130 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffff88003756c130
> RBP: ffff88007b7cde48 R08: 0000000000000000 R09: ffff88012b173200
> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000282
> R13: ffff88003756c138 R14: 0000000000000000 R15: 0000000000000000
> FS:  0000000000000000(0000) GS:ffff88012fc60000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000000007e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> Stack:
>  ffff88007b7cde28 0000000300000000 ffff88007b7cde28 ffff88003756c130
>  0000000000000282 ffff88003756c128 ffffffff81227670 0000000000000000
>  ffff88007b7cde78 ffffffff810722b7 ffff88007cdcf000 ffffffff81a90540
> Call Trace:
>  [<ffffffff81227670>] ? crypto_alloc_pcomp+0x20/0x20
>  [<ffffffff810722b7>] complete_all+0x47/0x60
>  [<ffffffff81227708>] cryptomgr_probe+0x98/0xc0
>  [<ffffffff81227670>] ? crypto_alloc_pcomp+0x20/0x20
>  [<ffffffff8106760e>] kthread+0xce/0xe0
>  [<ffffffff81067540>] ? kthread_freezable_should_stop+0x70/0x70
>  [<ffffffff815450dc>] ret_from_fork+0x7c/0xb0
>  [<ffffffff81067540>] ? kthread_freezable_should_stop+0x70/0x70
> Code: 41 56 41 55 41 54 53 48 83 ec 18 66 66 66 66 90 89 75 cc 89 55 c8
>       4c 8d 6f 08 48 8b 57 08 41 89 cf 4d 89 c6 48 8d 42 e
> RIP  [<ffffffff81070321>] __wake_up_common+0x31/0x90
>  RSP <ffff88007b7cde08>
> CR2: 0000000000000000
> ---[ end trace b495b19270a4d37e ]---
>
> My assumption is that the following is happening: the minimal SCTP
> tool runs under ``echo 1 > /proc/sys/net/sctp/auth_enable'', hence
> it's making use of crypto_alloc_hash() via sctp_auth_init_hmacs().
> It forks itself, heavily allocates, binds, listens and waits in
> accept on sctp sockets, and then randomly kills some of them (no
> need for an actual client in this case to hit this). Then, again,
> allocating, binding, etc, and then killing child processes.
>
> The problem that might be happening here is that cryptomgr requests
> the module to probe/load through cryptomgr_schedule_probe(), but
> before the thread handler cryptomgr_probe() returns, we return from
> the wait_for_completion_interruptible() function and probably already
> have cleared up larval, thus we run into a NULL pointer dereference
> when in cryptomgr_probe() complete_all() is being called.
>
> If we wait with wait_for_completion() instead, this panic will not
> occur anymore. This is valid, because in case a signal is pending,
> cryptomgr_probe() returns from probing anyway with properly calling
> complete_all().

The use of wait_for_completion_interruptible is intentional so that
we don't lock up the thread if a bug causes us to never wake up.

This bug is caused by the helper thread using the larval without
holding a reference count on it.  If the helper thread completes
after the original thread requesting for help has gone away and
destroyed the larval, then we get the crash above.

So the fix is to hold a reference count on the larval.

Reported-by: Daniel Borkmann <dborkman@redhat.com>
Tested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 crypto/algboss.c  | 15 ++++++++-------
 crypto/api.c      |  6 ------
 crypto/internal.h |  6 ++++++
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 769219b..76fc0b2 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -45,10 +45,9 @@ struct cryptomgr_param {
 		} nu32;
 	} attrs[CRYPTO_MAX_ATTRS];
 
-	char larval[CRYPTO_MAX_ALG_NAME];
 	char template[CRYPTO_MAX_ALG_NAME];
 
-	struct completion *completion;
+	struct crypto_larval *larval;
 
 	u32 otype;
 	u32 omask;
@@ -87,7 +86,8 @@ static int cryptomgr_probe(void *data)
 	crypto_tmpl_put(tmpl);
 
 out:
-	complete_all(param->completion);
+	complete_all(&param->larval->completion);
+	crypto_alg_put(&param->larval->alg);
 	kfree(param);
 	module_put_and_exit(0);
 }
@@ -187,18 +187,19 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
 	param->otype = larval->alg.cra_flags;
 	param->omask = larval->mask;
 
-	memcpy(param->larval, larval->alg.cra_name, CRYPTO_MAX_ALG_NAME);
-
-	param->completion = &larval->completion;
+	crypto_alg_get(&larval->alg);
+	param->larval = larval;
 
 	thread = kthread_run(cryptomgr_probe, param, "cryptomgr_probe");
 	if (IS_ERR(thread))
-		goto err_free_param;
+		goto err_put_larval;
 
 	wait_for_completion_interruptible(&larval->completion);
 
 	return NOTIFY_STOP;
 
+err_put_larval:
+	crypto_alg_put(&larval->alg);
 err_free_param:
 	kfree(param);
 err_put_module:
diff --git a/crypto/api.c b/crypto/api.c
index 033a714..3b61803 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -34,12 +34,6 @@ EXPORT_SYMBOL_GPL(crypto_alg_sem);
 BLOCKING_NOTIFIER_HEAD(crypto_chain);
 EXPORT_SYMBOL_GPL(crypto_chain);
 
-static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
-{
-	atomic_inc(&alg->cra_refcnt);
-	return alg;
-}
-
 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg)
 {
 	return try_module_get(alg->cra_module) ? crypto_alg_get(alg) : NULL;
diff --git a/crypto/internal.h b/crypto/internal.h
index 9ebedae..bd39bfc 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -103,6 +103,12 @@ int crypto_register_notifier(struct notifier_block *nb);
 int crypto_unregister_notifier(struct notifier_block *nb);
 int crypto_probing_notify(unsigned long val, void *v);
 
+static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
+{
+	atomic_inc(&alg->cra_refcnt);
+	return alg;
+}
+
 static inline void crypto_alg_put(struct crypto_alg *alg)
 {
 	if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy)
-- 
1.8.1.2


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

* [PATCH 037/145] crypto: algboss - Hold ref count on larval
@ 2013-07-17 22:46   ` Kamal Mostafa
  0 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herbert Xu, Luis Henriques

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

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

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

commit 939e17799619e31331d2433041196529515a86a6 upstream.

On Thu, Jun 20, 2013 at 10:00:21AM +0200, Daniel Borkmann wrote:
> After having fixed a NULL pointer dereference in SCTP 1abd165e ("net:
> sctp: fix NULL pointer dereference in socket destruction"), I ran into
> the following NULL pointer dereference in the crypto subsystem with
> the same reproducer, easily hit each time:
>
> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: [<ffffffff81070321>] __wake_up_common+0x31/0x90
> PGD 0
> Oops: 0000 [#1] SMP
> Modules linked in: padlock_sha(F-) sha256_generic(F) sctp(F) libcrc32c(F) [..]
> CPU: 6 PID: 3326 Comm: cryptomgr_probe Tainted: GF            3.10.0-rc5+ #1
> Hardware name: Dell Inc. PowerEdge T410/0H19HD, BIOS 1.6.3 02/01/2011
> task: ffff88007b6cf4e0 ti: ffff88007b7cc000 task.ti: ffff88007b7cc000
> RIP: 0010:[<ffffffff81070321>]  [<ffffffff81070321>] __wake_up_common+0x31/0x90
> RSP: 0018:ffff88007b7cde08  EFLAGS: 00010082
> RAX: ffffffffffffffe8 RBX: ffff88003756c130 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffff88003756c130
> RBP: ffff88007b7cde48 R08: 0000000000000000 R09: ffff88012b173200
> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000282
> R13: ffff88003756c138 R14: 0000000000000000 R15: 0000000000000000
> FS:  0000000000000000(0000) GS:ffff88012fc60000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000000007e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> Stack:
>  ffff88007b7cde28 0000000300000000 ffff88007b7cde28 ffff88003756c130
>  0000000000000282 ffff88003756c128 ffffffff81227670 0000000000000000
>  ffff88007b7cde78 ffffffff810722b7 ffff88007cdcf000 ffffffff81a90540
> Call Trace:
>  [<ffffffff81227670>] ? crypto_alloc_pcomp+0x20/0x20
>  [<ffffffff810722b7>] complete_all+0x47/0x60
>  [<ffffffff81227708>] cryptomgr_probe+0x98/0xc0
>  [<ffffffff81227670>] ? crypto_alloc_pcomp+0x20/0x20
>  [<ffffffff8106760e>] kthread+0xce/0xe0
>  [<ffffffff81067540>] ? kthread_freezable_should_stop+0x70/0x70
>  [<ffffffff815450dc>] ret_from_fork+0x7c/0xb0
>  [<ffffffff81067540>] ? kthread_freezable_should_stop+0x70/0x70
> Code: 41 56 41 55 41 54 53 48 83 ec 18 66 66 66 66 90 89 75 cc 89 55 c8
>       4c 8d 6f 08 48 8b 57 08 41 89 cf 4d 89 c6 48 8d 42 e
> RIP  [<ffffffff81070321>] __wake_up_common+0x31/0x90
>  RSP <ffff88007b7cde08>
> CR2: 0000000000000000
> ---[ end trace b495b19270a4d37e ]---
>
> My assumption is that the following is happening: the minimal SCTP
> tool runs under ``echo 1 > /proc/sys/net/sctp/auth_enable'', hence
> it's making use of crypto_alloc_hash() via sctp_auth_init_hmacs().
> It forks itself, heavily allocates, binds, listens and waits in
> accept on sctp sockets, and then randomly kills some of them (no
> need for an actual client in this case to hit this). Then, again,
> allocating, binding, etc, and then killing child processes.
>
> The problem that might be happening here is that cryptomgr requests
> the module to probe/load through cryptomgr_schedule_probe(), but
> before the thread handler cryptomgr_probe() returns, we return from
> the wait_for_completion_interruptible() function and probably already
> have cleared up larval, thus we run into a NULL pointer dereference
> when in cryptomgr_probe() complete_all() is being called.
>
> If we wait with wait_for_completion() instead, this panic will not
> occur anymore. This is valid, because in case a signal is pending,
> cryptomgr_probe() returns from probing anyway with properly calling
> complete_all().

The use of wait_for_completion_interruptible is intentional so that
we don't lock up the thread if a bug causes us to never wake up.

This bug is caused by the helper thread using the larval without
holding a reference count on it.  If the helper thread completes
after the original thread requesting for help has gone away and
destroyed the larval, then we get the crash above.

So the fix is to hold a reference count on the larval.

Reported-by: Daniel Borkmann <dborkman@redhat.com>
Tested-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 crypto/algboss.c  | 15 ++++++++-------
 crypto/api.c      |  6 ------
 crypto/internal.h |  6 ++++++
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 769219b..76fc0b2 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -45,10 +45,9 @@ struct cryptomgr_param {
 		} nu32;
 	} attrs[CRYPTO_MAX_ATTRS];
 
-	char larval[CRYPTO_MAX_ALG_NAME];
 	char template[CRYPTO_MAX_ALG_NAME];
 
-	struct completion *completion;
+	struct crypto_larval *larval;
 
 	u32 otype;
 	u32 omask;
@@ -87,7 +86,8 @@ static int cryptomgr_probe(void *data)
 	crypto_tmpl_put(tmpl);
 
 out:
-	complete_all(param->completion);
+	complete_all(&param->larval->completion);
+	crypto_alg_put(&param->larval->alg);
 	kfree(param);
 	module_put_and_exit(0);
 }
@@ -187,18 +187,19 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
 	param->otype = larval->alg.cra_flags;
 	param->omask = larval->mask;
 
-	memcpy(param->larval, larval->alg.cra_name, CRYPTO_MAX_ALG_NAME);
-
-	param->completion = &larval->completion;
+	crypto_alg_get(&larval->alg);
+	param->larval = larval;
 
 	thread = kthread_run(cryptomgr_probe, param, "cryptomgr_probe");
 	if (IS_ERR(thread))
-		goto err_free_param;
+		goto err_put_larval;
 
 	wait_for_completion_interruptible(&larval->completion);
 
 	return NOTIFY_STOP;
 
+err_put_larval:
+	crypto_alg_put(&larval->alg);
 err_free_param:
 	kfree(param);
 err_put_module:
diff --git a/crypto/api.c b/crypto/api.c
index 033a714..3b61803 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -34,12 +34,6 @@ EXPORT_SYMBOL_GPL(crypto_alg_sem);
 BLOCKING_NOTIFIER_HEAD(crypto_chain);
 EXPORT_SYMBOL_GPL(crypto_chain);
 
-static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
-{
-	atomic_inc(&alg->cra_refcnt);
-	return alg;
-}
-
 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg)
 {
 	return try_module_get(alg->cra_module) ? crypto_alg_get(alg) : NULL;
diff --git a/crypto/internal.h b/crypto/internal.h
index 9ebedae..bd39bfc 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -103,6 +103,12 @@ int crypto_register_notifier(struct notifier_block *nb);
 int crypto_unregister_notifier(struct notifier_block *nb);
 int crypto_probing_notify(unsigned long val, void *v);
 
+static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
+{
+	atomic_inc(&alg->cra_refcnt);
+	return alg;
+}
+
 static inline void crypto_alg_put(struct crypto_alg *alg)
 {
 	if (atomic_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy)
-- 
1.8.1.2


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

* [PATCH 038/145] x86: Fix /proc/mtrr with base/size more than 44bits
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (36 preceding siblings ...)
  2013-07-17 22:46   ` Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 039/145] futex: Take hugepages into account when generating futex_key Kamal Mostafa
                   ` (106 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yinghai Lu, H. Peter Anvin, Luis Henriques

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

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

From: Yinghai Lu <yinghai@kernel.org>

commit d5c78673b1b28467354c2c30c3d4f003666ff385 upstream.

On one sytem that mtrr range is more then 44bits, in dmesg we have
[    0.000000] MTRR default type: write-back
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-DFFFF write-through
[    0.000000]   E0000-FFFFF write-protect
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 [000080000000-0000FFFFFFFF] mask 3FFF80000000 uncachable
[    0.000000]   1 [380000000000-38FFFFFFFFFF] mask 3F0000000000 uncachable
[    0.000000]   2 [000099000000-000099FFFFFF] mask 3FFFFF000000 write-through
[    0.000000]   3 [00009A000000-00009AFFFFFF] mask 3FFFFF000000 write-through
[    0.000000]   4 [381FFA000000-381FFBFFFFFF] mask 3FFFFE000000 write-through
[    0.000000]   5 [381FFC000000-381FFC0FFFFF] mask 3FFFFFF00000 write-through
[    0.000000]   6 [0000AD000000-0000ADFFFFFF] mask 3FFFFF000000 write-through
[    0.000000]   7 [0000BD000000-0000BDFFFFFF] mask 3FFFFF000000 write-through
[    0.000000]   8 disabled
[    0.000000]   9 disabled

but /proc/mtrr report wrong:
reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
reg01: base=0x80000000000 (8388608MB), size=1048576MB, count=1: uncachable
reg02: base=0x099000000 ( 2448MB), size=   16MB, count=1: write-through
reg03: base=0x09a000000 ( 2464MB), size=   16MB, count=1: write-through
reg04: base=0x81ffa000000 (8519584MB), size=   32MB, count=1: write-through
reg05: base=0x81ffc000000 (8519616MB), size=    1MB, count=1: write-through
reg06: base=0x0ad000000 ( 2768MB), size=   16MB, count=1: write-through
reg07: base=0x0bd000000 ( 3024MB), size=   16MB, count=1: write-through
reg08: base=0x09b000000 ( 2480MB), size=   16MB, count=1: write-combining

so bit 44 and bit 45 get cut off.

We have problems in arch/x86/kernel/cpu/mtrr/generic.c::generic_get_mtrr().
1. for base, we miss cast base_lo to 64bit before shifting.
Fix that by adding u64 casting.

2. for size, it only can handle 44 bits aka 32bits + page_shift
Fix that with 64bit mask instead of 32bit mask_lo, then range could be
more than 44bits.
At the same time, we need to update size_or_mask for old cpus that does
support cpuid 0x80000008 to get phys_addr. Need to set high 32bits
to all 1s, otherwise will not get correct size for them.

Also fix mtrr_add_page: it should check base and (base + size - 1)
instead of base and size, as base and size could be small but
base + size could bigger enough to be out of boundary. We can
use boot_cpu_data.x86_phys_bits directly to avoid size_or_mask.

So When are we going to have size more than 44bits? that is 16TiB.

after patch we have right ouput:
reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
reg01: base=0x380000000000 (58720256MB), size=1048576MB, count=1: uncachable
reg02: base=0x099000000 ( 2448MB), size=   16MB, count=1: write-through
reg03: base=0x09a000000 ( 2464MB), size=   16MB, count=1: write-through
reg04: base=0x381ffa000000 (58851232MB), size=   32MB, count=1: write-through
reg05: base=0x381ffc000000 (58851264MB), size=    1MB, count=1: write-through
reg06: base=0x0ad000000 ( 2768MB), size=   16MB, count=1: write-through
reg07: base=0x0bd000000 ( 3024MB), size=   16MB, count=1: write-through
reg08: base=0x09b000000 ( 2480MB), size=   16MB, count=1: write-combining

-v2: simply checking in mtrr_add_page according to hpa.

[ hpa: This probably wants to go into -stable only after having sat in
  mainline for a bit.  It is not a regression. ]

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1371162815-29931-1-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/kernel/cpu/mtrr/generic.c | 21 +++++++++++----------
 arch/x86/kernel/cpu/mtrr/main.c    | 16 +++++++++-------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index e9fe907..5ac2152 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -510,8 +510,9 @@ generic_get_free_region(unsigned long base, unsigned long size, int replace_reg)
 static void generic_get_mtrr(unsigned int reg, unsigned long *base,
 			     unsigned long *size, mtrr_type *type)
 {
-	unsigned int mask_lo, mask_hi, base_lo, base_hi;
-	unsigned int tmp, hi;
+	u32 mask_lo, mask_hi, base_lo, base_hi;
+	unsigned int hi;
+	u64 tmp, mask;
 
 	/*
 	 * get_mtrr doesn't need to update mtrr_state, also it could be called
@@ -532,18 +533,18 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
 	rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi);
 
 	/* Work out the shifted address mask: */
-	tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
-	mask_lo = size_or_mask | tmp;
+	tmp = (u64)mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
+	mask = size_or_mask | tmp;
 
 	/* Expand tmp with high bits to all 1s: */
-	hi = fls(tmp);
+	hi = fls64(tmp);
 	if (hi > 0) {
-		tmp |= ~((1<<(hi - 1)) - 1);
+		tmp |= ~((1ULL<<(hi - 1)) - 1);
 
-		if (tmp != mask_lo) {
+		if (tmp != mask) {
 			printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n");
 			add_taint(TAINT_FIRMWARE_WORKAROUND);
-			mask_lo = tmp;
+			mask = tmp;
 		}
 	}
 
@@ -551,8 +552,8 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
 	 * This works correctly if size is a power of two, i.e. a
 	 * contiguous range:
 	 */
-	*size = -mask_lo;
-	*base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT;
+	*size = -mask;
+	*base = (u64)base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT;
 	*type = base_lo & 0xff;
 
 out_put_cpu:
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 726bf96..ca22b73 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -305,7 +305,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,
 		return -EINVAL;
 	}
 
-	if (base & size_or_mask || size & size_or_mask) {
+	if ((base | (base + size - 1)) >>
+	    (boot_cpu_data.x86_phys_bits - PAGE_SHIFT)) {
 		pr_warning("mtrr: base or size exceeds the MTRR width\n");
 		return -EINVAL;
 	}
@@ -583,6 +584,7 @@ static struct syscore_ops mtrr_syscore_ops = {
 
 int __initdata changed_by_mtrr_cleanup;
 
+#define SIZE_OR_MASK_BITS(n)  (~((1ULL << ((n) - PAGE_SHIFT)) - 1))
 /**
  * mtrr_bp_init - initialize mtrrs on the boot CPU
  *
@@ -600,7 +602,7 @@ void __init mtrr_bp_init(void)
 
 	if (cpu_has_mtrr) {
 		mtrr_if = &generic_mtrr_ops;
-		size_or_mask = 0xff000000;			/* 36 bits */
+		size_or_mask = SIZE_OR_MASK_BITS(36);
 		size_and_mask = 0x00f00000;
 		phys_addr = 36;
 
@@ -619,7 +621,7 @@ void __init mtrr_bp_init(void)
 			     boot_cpu_data.x86_mask == 0x4))
 				phys_addr = 36;
 
-			size_or_mask = ~((1ULL << (phys_addr - PAGE_SHIFT)) - 1);
+			size_or_mask = SIZE_OR_MASK_BITS(phys_addr);
 			size_and_mask = ~size_or_mask & 0xfffff00000ULL;
 		} else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
 			   boot_cpu_data.x86 == 6) {
@@ -627,7 +629,7 @@ void __init mtrr_bp_init(void)
 			 * VIA C* family have Intel style MTRRs,
 			 * but don't support PAE
 			 */
-			size_or_mask = 0xfff00000;		/* 32 bits */
+			size_or_mask = SIZE_OR_MASK_BITS(32);
 			size_and_mask = 0;
 			phys_addr = 32;
 		}
@@ -637,21 +639,21 @@ void __init mtrr_bp_init(void)
 			if (cpu_has_k6_mtrr) {
 				/* Pre-Athlon (K6) AMD CPU MTRRs */
 				mtrr_if = mtrr_ops[X86_VENDOR_AMD];
-				size_or_mask = 0xfff00000;	/* 32 bits */
+				size_or_mask = SIZE_OR_MASK_BITS(32);
 				size_and_mask = 0;
 			}
 			break;
 		case X86_VENDOR_CENTAUR:
 			if (cpu_has_centaur_mcr) {
 				mtrr_if = mtrr_ops[X86_VENDOR_CENTAUR];
-				size_or_mask = 0xfff00000;	/* 32 bits */
+				size_or_mask = SIZE_OR_MASK_BITS(32);
 				size_and_mask = 0;
 			}
 			break;
 		case X86_VENDOR_CYRIX:
 			if (cpu_has_cyrix_arr) {
 				mtrr_if = mtrr_ops[X86_VENDOR_CYRIX];
-				size_or_mask = 0xfff00000;	/* 32 bits */
+				size_or_mask = SIZE_OR_MASK_BITS(32);
 				size_and_mask = 0;
 			}
 			break;
-- 
1.8.1.2


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

* [PATCH 039/145] futex: Take hugepages into account when generating futex_key
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (37 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 038/145] x86: Fix /proc/mtrr with base/size more than 44bits Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 040/145] pch_uart: Add uart_clk selection for the MinnowBoard Kamal Mostafa
                   ` (105 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Zhang Yi, 'Peter Zijlstra', Thomas Gleixner, Luis Henriques

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

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

From: Zhang Yi <wetpzy@gmail.com>

commit 13d60f4b6ab5b702dc8d2ee20999f98a93728aec upstream.

The futex_keys of process shared futexes are generated from the page
offset, the mapping host and the mapping index of the futex user space
address. This should result in an unique identifier for each futex.

Though this is not true when futexes are located in different subpages
of an hugepage. The reason is, that the mapping index for all those
futexes evaluates to the index of the base page of the hugetlbfs
mapping. So a futex at offset 0 of the hugepage mapping and another
one at offset PAGE_SIZE of the same hugepage mapping have identical
futex_keys. This happens because the futex code blindly uses
page->index.

Steps to reproduce the bug:

1. Map a file from hugetlbfs. Initialize pthread_mutex1 at offset 0
   and pthread_mutex2 at offset PAGE_SIZE of the hugetlbfs
   mapping.

   The mutexes must be initialized as PTHREAD_PROCESS_SHARED because
   PTHREAD_PROCESS_PRIVATE mutexes are not affected by this issue as
   their keys solely depend on the user space address.

2. Lock mutex1 and mutex2

3. Create thread1 and in the thread function lock mutex1, which
   results in thread1 blocking on the locked mutex1.

4. Create thread2 and in the thread function lock mutex2, which
   results in thread2 blocking on the locked mutex2.

5. Unlock mutex2. Despite the fact that mutex2 got unlocked, thread2
   still blocks on mutex2 because the futex_key points to mutex1.

To solve this issue we need to take the normal page index of the page
which contains the futex into account, if the futex is in an hugetlbfs
mapping. In other words, we calculate the normal page mapping index of
the subpage in the hugetlbfs mapping.

Mappings which are not based on hugetlbfs are not affected and still
use page->index.

Thanks to Mel Gorman who provided a patch for adding proper evaluation
functions to the hugetlbfs code to avoid exposing hugetlbfs specific
details to the futex code.

[ tglx: Massaged changelog ]

Signed-off-by: Zhang Yi <zhang.yi20@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Tested-by: Ma Chenggong <ma.chenggong@zte.com.cn>
Reviewed-by: 'Mel Gorman' <mgorman@suse.de>
Acked-by: 'Darren Hart' <dvhart@linux.intel.com>
Cc: 'Peter Zijlstra' <peterz@infradead.org>
Link: http://lkml.kernel.org/r/000101ce71a6%24a83c5880%24f8b50980%24@com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/hugetlb.h | 16 ++++++++++++++++
 kernel/futex.c          |  3 ++-
 mm/hugetlb.c            | 17 +++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index db695d5..57e2b53 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -354,6 +354,17 @@ static inline int hstate_index(struct hstate *h)
 	return h - hstates;
 }
 
+pgoff_t __basepage_index(struct page *page);
+
+/* Return page->index in PAGE_SIZE units */
+static inline pgoff_t basepage_index(struct page *page)
+{
+	if (!PageCompound(page))
+		return page->index;
+
+	return __basepage_index(page);
+}
+
 #else	/* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
@@ -374,6 +385,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
 }
 #define hstate_index_to_shift(index) 0
 #define hstate_index(h) 0
+
+static inline pgoff_t basepage_index(struct page *page)
+{
+	return page->index;
+}
 #endif	/* CONFIG_HUGETLB_PAGE */
 
 #endif /* _LINUX_HUGETLB_H */
diff --git a/kernel/futex.c b/kernel/futex.c
index 8879430..f0ee318 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -60,6 +60,7 @@
 #include <linux/pid.h>
 #include <linux/nsproxy.h>
 #include <linux/ptrace.h>
+#include <linux/hugetlb.h>
 
 #include <asm/futex.h>
 
@@ -363,7 +364,7 @@ again:
 	} else {
 		key->both.offset |= FUT_OFF_INODE; /* inode-based key */
 		key->shared.inode = page_head->mapping->host;
-		key->shared.pgoff = page_head->index;
+		key->shared.pgoff = basepage_index(page);
 	}
 
 	get_futex_key_refs(key);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index dc66048..430dca0 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -690,6 +690,23 @@ int PageHuge(struct page *page)
 }
 EXPORT_SYMBOL_GPL(PageHuge);
 
+pgoff_t __basepage_index(struct page *page)
+{
+	struct page *page_head = compound_head(page);
+	pgoff_t index = page_index(page_head);
+	unsigned long compound_idx;
+
+	if (!PageHuge(page_head))
+		return page_index(page);
+
+	if (compound_order(page_head) >= MAX_ORDER)
+		compound_idx = page_to_pfn(page) - page_to_pfn(page_head);
+	else
+		compound_idx = page - page_head;
+
+	return (index << compound_order(page_head)) + compound_idx;
+}
+
 static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
 {
 	struct page *page;
-- 
1.8.1.2


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

* [PATCH 040/145] pch_uart: Add uart_clk selection for the MinnowBoard
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (38 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 039/145] futex: Take hugepages into account when generating futex_key Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 041/145] perf: Disable monitoring on setuid processes for regular users Kamal Mostafa
                   ` (104 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Darren Hart, Jiri Slaby, H. Peter Anvin, Peter Waskiewicz,
	Andy Shevchenko, Greg Kroah-Hartman, Luis Henriques

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

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

From: Darren Hart <dvhart@linux.intel.com>

commit 29692d05647cb7ecea56242241f77291d5624b95 upstream.

Use DMI_BOARD_NAME to determine if we are running on a MinnowBoard and
set the uart clock to 50MHz if so. This removes the need to pass the
user_uartclk to the kernel at boot time.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Waskiewicz <peter.p.waskiewicz.jr@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/serial/pch_uart.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 8318925..a9e4be7 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -214,6 +214,7 @@ enum {
 #define FRI2_64_UARTCLK  64000000 /*  64.0000 MHz */
 #define FRI2_48_UARTCLK  48000000 /*  48.0000 MHz */
 #define NTC1_UARTCLK     64000000 /*  64.0000 MHz */
+#define MINNOW_UARTCLK   50000000 /*  50.0000 MHz */
 
 struct pch_uart_buffer {
 	unsigned char *buf;
@@ -395,6 +396,10 @@ static int pch_uart_get_uartclk(void)
 		    strstr(cmp, "nanoETXexpress-TT")))
 		return NTC1_UARTCLK;
 
+	cmp = dmi_get_system_info(DMI_BOARD_NAME);
+	if (cmp && strstr(cmp, "MinnowBoard"))
+		return MINNOW_UARTCLK;
+
 	return DEFAULT_UARTCLK;
 }
 
-- 
1.8.1.2


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

* [PATCH 041/145] perf: Disable monitoring on setuid processes for regular users
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (39 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 040/145] pch_uart: Add uart_clk selection for the MinnowBoard Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 042/145] [SCSI] sd: Fix parsing of 'temporary ' cache mode prefix Kamal Mostafa
                   ` (103 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stephane Eranian, Ingo Molnar, Luis Henriques

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

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

From: Stephane Eranian <eranian@google.com>

commit 2976b10f05bd7f6dab9f9e7524451ddfed656a89 upstream.

There was a a bug in setup_new_exec(), whereby
the test to disabled perf monitoring was not
correct because the new credentials for the
process were not yet committed and therefore
the get_dumpable() test was never firing.

The patch fixes the problem by moving the
perf_event test until after the credentials
are committed.

Signed-off-by: Stephane Eranian <eranian@google.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/exec.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index ac014f1..ea5dc8d 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1136,13 +1136,6 @@ void setup_new_exec(struct linux_binprm * bprm)
 			set_dumpable(current->mm, suid_dumpable);
 	}
 
-	/*
-	 * Flush performance counters when crossing a
-	 * security domain:
-	 */
-	if (!get_dumpable(current->mm))
-		perf_event_exit_task(current);
-
 	/* An exec changes our domain. We are no longer part of the thread
 	   group */
 
@@ -1206,6 +1199,15 @@ void install_exec_creds(struct linux_binprm *bprm)
 
 	commit_creds(bprm->cred);
 	bprm->cred = NULL;
+
+	/*
+	 * Disable monitoring for regular users
+	 * when executing setuid binaries. Must
+	 * wait until new credentials are committed
+	 * by commit_creds() above
+	 */
+	if (get_dumpable(current->mm) != SUID_DUMP_USER)
+		perf_event_exit_task(current);
 	/*
 	 * cred_guard_mutex must be held at least to this point to prevent
 	 * ptrace_attach() from altering our determination of the task's
-- 
1.8.1.2


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

* [PATCH 042/145] [SCSI] sd: Fix parsing of 'temporary ' cache mode prefix
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (40 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 041/145] perf: Disable monitoring on setuid processes for regular users Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 043/145] Handle big endianness in NTLM (ntlmv2) authentication Kamal Mostafa
                   ` (102 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Hutchings, James Bottomley, Luis Henriques

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

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

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

commit 2ee3e26c673e75c05ef8b914f54fadee3d7b9c88 upstream.

Commit 39c60a0948cc '[SCSI] sd: fix array cache flushing bug causing
performance problems' added temp as a pointer to "temporary " and used
sizeof(temp) - 1 as its length.  But sizeof(temp) is the size of the
pointer, not the size of the string constant.  Change temp to a static
array so that sizeof() does what was intended.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 82910cc..0f0370f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -142,7 +142,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 	char *buffer_data;
 	struct scsi_mode_data data;
 	struct scsi_sense_hdr sshdr;
-	const char *temp = "temporary ";
+	static const char temp[] = "temporary ";
 	int len;
 
 	if (sdp->type != TYPE_DISK)
-- 
1.8.1.2


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

* [PATCH 043/145] Handle big endianness in NTLM (ntlmv2) authentication
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (41 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 042/145] [SCSI] sd: Fix parsing of 'temporary ' cache mode prefix Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 044/145] [SCSI] sd: Update WRITE SAME heuristics Kamal Mostafa
                   ` (101 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shirish Pargaonkar, Steve French, Luis Henriques

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

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

From: Steve French <smfrench@us.ibm.com>

commit fdf96a907c1fbb93c633e2b7ede3b8df26d6a4c0 upstream.

This is RH bug 970891
Uppercasing of username during calculation of ntlmv2 hash fails
because UniStrupr function does not handle big endian wchars.

Also fix a comment in the same code to reflect its correct usage.

[To make it easier for stable (rather than require 2nd patch) fixed
this patch of Shirish's to remove endian warning generated
by sparse -- steve f.]

Reported-by: steve <sanpatr1@in.ibm.com>
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/cifs/cifs_unicode.h | 8 ++++----
 fs/cifs/cifsencrypt.c  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h
index 4fb0974..fe8d627 100644
--- a/fs/cifs/cifs_unicode.h
+++ b/fs/cifs/cifs_unicode.h
@@ -327,14 +327,14 @@ UniToupper(register wchar_t uc)
 /*
  * UniStrupr:  Upper case a unicode string
  */
-static inline wchar_t *
-UniStrupr(register wchar_t *upin)
+static inline __le16 *
+UniStrupr(register __le16 *upin)
 {
-	register wchar_t *up;
+	register __le16 *up;
 
 	up = upin;
 	while (*up) {		/* For all characters */
-		*up = UniToupper(*up);
+		*up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
 		up++;
 	}
 	return upin;		/* Return input pointer */
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 652f505..6d718c3 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -415,7 +415,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
 	int rc = 0;
 	int len;
 	char nt_hash[CIFS_NTHASH_SIZE];
-	wchar_t *user;
+	__le16 *user;
 	wchar_t *domain;
 	wchar_t *server;
 
@@ -440,7 +440,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
 		return rc;
 	}
 
-	/* convert ses->user_name to unicode and uppercase */
+	/* convert ses->user_name to unicode */
 	len = ses->user_name ? strlen(ses->user_name) : 0;
 	user = kmalloc(2 + (len * 2), GFP_KERNEL);
 	if (user == NULL) {
@@ -450,7 +450,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
 	}
 
 	if (len) {
-		len = cifs_strtoUTF16((__le16 *)user, ses->user_name, len, nls_cp);
+		len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp);
 		UniStrupr(user);
 	} else {
 		memset(user, '\0', 2);
-- 
1.8.1.2


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

* [PATCH 044/145] [SCSI] sd: Update WRITE SAME heuristics
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (42 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 043/145] Handle big endianness in NTLM (ntlmv2) authentication Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 045/145] [SCSI] aacraid: Fix for arrays are going offline in the system. System hangs Kamal Mostafa
                   ` (100 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin K. Petersen, James Bottomley, Luis Henriques

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

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

From: "Martin K. Petersen" <martin.petersen@oracle.com>

commit 66c28f97120e8a621afd5aa7a31c4b85c547d33d upstream.

SATA drives located behind a SAS controller would incorrectly receive
WRITE SAME commands. Tweak the heuristics so that:

 - If REPORT SUPPORTED OPERATION CODES is provided we will use that to
   choose between WRITE SAME(16), WRITE SAME(10) and disabled. This also
   fixes an issue with the old code which would issue WRITE SAME(10)
   despite the command not being whitelisted in REPORT SUPPORTED
   OPERATION CODES.

 - If REPORT SUPPORTED OPERATION CODES is not provided we will fall back
   to WRITE SAME(10) unless the device has an ATA Information VPD page.
   The assumption is that a SATL which is smart enough to implement
   WRITE SAME would also provide REPORT SUPPORTED OPERATION CODES.

To facilitate the new heuristics scsi_report_opcode() has been modified
to so we can distinguish between "operation not supported" and "RSOC not
supported".

Reported-by: H. Peter Anvin <hpa@zytor.com>
Tested-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/scsi.c |  8 ++++----
 drivers/scsi/sd.c   | 46 ++++++++++++++++++++++++++++++++--------------
 drivers/scsi/sd.h   |  1 +
 3 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 2c0d0ec..3b1ea34 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1070,8 +1070,8 @@ EXPORT_SYMBOL_GPL(scsi_get_vpd_page);
  * @opcode:	opcode for command to look up
  *
  * Uses the REPORT SUPPORTED OPERATION CODES to look up the given
- * opcode. Returns 0 if RSOC fails or if the command opcode is
- * unsupported. Returns 1 if the device claims to support the command.
+ * opcode. Returns -EINVAL if RSOC fails, 0 if the command opcode is
+ * unsupported and 1 if the device claims to support the command.
  */
 int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
 		       unsigned int len, unsigned char opcode)
@@ -1081,7 +1081,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
 	int result;
 
 	if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3)
-		return 0;
+		return -EINVAL;
 
 	memset(cmd, 0, 16);
 	cmd[0] = MAINTENANCE_IN;
@@ -1097,7 +1097,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
 	if (result && scsi_sense_valid(&sshdr) &&
 	    sshdr.sense_key == ILLEGAL_REQUEST &&
 	    (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00)
-		return 0;
+		return -EINVAL;
 
 	if ((buffer[1] & 3) == 3) /* Command supported */
 		return 1;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0f0370f..f5fcf65 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -442,8 +442,10 @@ sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
 
 	if (max == 0)
 		sdp->no_write_same = 1;
-	else if (max <= SD_MAX_WS16_BLOCKS)
+	else if (max <= SD_MAX_WS16_BLOCKS) {
+		sdp->no_write_same = 0;
 		sdkp->max_ws_blocks = max;
+	}
 
 	sd_config_write_same(sdkp);
 
@@ -740,7 +742,6 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
 {
 	struct request_queue *q = sdkp->disk->queue;
 	unsigned int logical_block_size = sdkp->device->sector_size;
-	unsigned int blocks = 0;
 
 	if (sdkp->device->no_write_same) {
 		sdkp->max_ws_blocks = 0;
@@ -752,18 +753,20 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
 	 * blocks per I/O unless the device explicitly advertises a
 	 * bigger limit.
 	 */
-	if (sdkp->max_ws_blocks == 0)
-		sdkp->max_ws_blocks = SD_MAX_WS10_BLOCKS;
-
-	if (sdkp->ws16 || sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS)
-		blocks = min_not_zero(sdkp->max_ws_blocks,
-				      (u32)SD_MAX_WS16_BLOCKS);
-	else
-		blocks = min_not_zero(sdkp->max_ws_blocks,
-				      (u32)SD_MAX_WS10_BLOCKS);
+	if (sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS)
+		sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks,
+						   (u32)SD_MAX_WS16_BLOCKS);
+	else if (sdkp->ws16 || sdkp->ws10 || sdkp->device->no_report_opcodes)
+		sdkp->max_ws_blocks = min_not_zero(sdkp->max_ws_blocks,
+						   (u32)SD_MAX_WS10_BLOCKS);
+	else {
+		sdkp->device->no_write_same = 1;
+		sdkp->max_ws_blocks = 0;
+	}
 
 out:
-	blk_queue_max_write_same_sectors(q, blocks * (logical_block_size >> 9));
+	blk_queue_max_write_same_sectors(q, sdkp->max_ws_blocks *
+					 (logical_block_size >> 9));
 }
 
 /**
@@ -2647,9 +2650,24 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp)
 
 static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
 {
-	if (scsi_report_opcode(sdkp->device, buffer, SD_BUF_SIZE,
-			       WRITE_SAME_16))
+	struct scsi_device *sdev = sdkp->device;
+
+	if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) {
+		sdev->no_report_opcodes = 1;
+
+		/* Disable WRITE SAME if REPORT SUPPORTED OPERATION
+		 * CODES is unsupported and the device has an ATA
+		 * Information VPD page (SAT).
+		 */
+		if (!scsi_get_vpd_page(sdev, 0x89, buffer, SD_BUF_SIZE))
+			sdev->no_write_same = 1;
+	}
+
+	if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME_16) == 1)
 		sdkp->ws16 = 1;
+
+	if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME) == 1)
+		sdkp->ws10 = 1;
 }
 
 static int sd_try_extended_inquiry(struct scsi_device *sdp)
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 2386aeb..7a049de 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -84,6 +84,7 @@ struct scsi_disk {
 	unsigned	lbpws : 1;
 	unsigned	lbpws10 : 1;
 	unsigned	lbpvpd : 1;
+	unsigned	ws10 : 1;
 	unsigned	ws16 : 1;
 };
 #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
-- 
1.8.1.2


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

* [PATCH 045/145] [SCSI] aacraid: Fix for arrays are going offline in the system. System hangs
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (43 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 044/145] [SCSI] sd: Update WRITE SAME heuristics Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 046/145] genirq: Fix can_request_irq() for IRQs without an action Kamal Mostafa
                   ` (99 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mahesh Rajashekhara, James Bottomley, Luis Henriques

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

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

From: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

commit c5bebd829dd95602c15f8da8cc50fa938b5e0254 upstream.

One of the customer had reported that the set of raid logical arrays will
become unavailable (I/O offline) after a long hours of IO stress test.  The OS
wouldn`t be accessible afterwards and require a hard reset.

This driver patch has a fix for race condition between the doorbell and the
circular buffer. The driver is modified to do an extra read after clearing the
doorbell in case there had been a completion posted during the small timing
window.

With this fix, we ran IO stress for ~13 days. There were no IO failures.

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/scsi/aacraid/src.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 3b021ec..e34418f 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -93,6 +93,9 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id)
 			int send_it = 0;
 			extern int aac_sync_mode;
 
+			src_writel(dev, MUnit.ODR_C, bellbits);
+			src_readl(dev, MUnit.ODR_C);
+
 			if (!aac_sync_mode) {
 				src_writel(dev, MUnit.ODR_C, bellbits);
 				src_readl(dev, MUnit.ODR_C);
-- 
1.8.1.2


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

* [PATCH 046/145] genirq: Fix can_request_irq() for IRQs without an action
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (44 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 045/145] [SCSI] aacraid: Fix for arrays are going offline in the system. System hangs Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 047/145] timer: Fix jiffies wrap behavior of round_jiffies_common() Kamal Mostafa
                   ` (98 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Hutchings, 709647, Thomas Gleixner, Luis Henriques

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

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

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

commit 2779db8d37d4b542d9ca2575f5f178dbeaca6c86 upstream.

Commit 02725e7471b8 ('genirq: Use irq_get/put functions'),
inadvertently changed can_request_irq() to return 0 for IRQs that have
no action.  This causes pcibios_lookup_irq() to select only IRQs that
already have an action with IRQF_SHARED set, or to fail if there are
none.  Change can_request_irq() to return 1 for IRQs that have no
action (if the first two conditions are met).

Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Tested-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is> (against 3.2)
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: 709647@bugs.debian.org
Link: http://bugs.debian.org/709647
Link: http://lkml.kernel.org/r/1372383630.23847.40.camel@deadeye.wl.decadent.org.uk
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/irq/manage.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index e49a288..a9302d0 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -554,9 +554,9 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
 		return 0;
 
 	if (irq_settings_can_request(desc)) {
-		if (desc->action)
-			if (irqflags & desc->action->flags & IRQF_SHARED)
-				canrequest =1;
+		if (!desc->action ||
+		    irqflags & desc->action->flags & IRQF_SHARED)
+			canrequest = 1;
 	}
 	irq_put_desc_unlock(desc, flags);
 	return canrequest;
-- 
1.8.1.2


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

* [PATCH 047/145] timer: Fix jiffies wrap behavior of round_jiffies_common()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (45 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 046/145] genirq: Fix can_request_irq() for IRQs without an action Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 048/145] xen/time: remove blocked time accounting from xen "clockchip" Kamal Mostafa
                   ` (97 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, Arjan van de Ven, Stephen Rothwell,
	Thomas Gleixner, Luis Henriques

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

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

From: Bart Van Assche <bart.vanassche@gmail.com>

commit 9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1 upstream.

Direct compare of jiffies related values does not work in the wrap
around case. Replace it with time_is_after_jiffies().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Link: http://lkml.kernel.org/r/519BC066.5080600@acm.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/timer.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index 18f6b85..1f8a6bd 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -147,9 +147,11 @@ static unsigned long round_jiffies_common(unsigned long j, int cpu,
 	/* now that we have rounded, subtract the extra skew again */
 	j -= cpu * 3;
 
-	if (j <= jiffies) /* rounding ate our timeout entirely; */
-		return original;
-	return j;
+	/*
+	 * Make sure j is still in the future. Otherwise return the
+	 * unmodified value.
+	 */
+	return time_is_after_jiffies(j) ? j : original;
 }
 
 /**
-- 
1.8.1.2


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

* [PATCH 048/145] xen/time: remove blocked time accounting from xen "clockchip"
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (46 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 047/145] timer: Fix jiffies wrap behavior of round_jiffies_common() Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 049/145] UBIFS: prepare to fix a horrid bug Kamal Mostafa
                   ` (96 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Laszlo Ersek, John Haxby, Konrad Rzeszutek Wilk, Luis Henriques

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

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

From: Laszlo Ersek <lersek@redhat.com>

commit 0b0c002c340e78173789f8afaa508070d838cf3d upstream.

... because the "clock_event_device framework" already accounts for idle
time through the "event_handler" function pointer in
xen_timer_interrupt().

The patch is intended as the completion of [1]. It should fix the double
idle times seen in PV guests' /proc/stat [2]. It should be orthogonal to
stolen time accounting (the removed code seems to be isolated).

The approach may be completely misguided.

[1] https://lkml.org/lkml/2011/10/6/10
[2] http://lists.xensource.com/archives/html/xen-devel/2010-08/msg01068.html

John took the time to retest this patch on top of v3.10 and reported:
"idle time is correctly incremented for pv and hvm for the normal
case, nohz=off and nohz=idle." so lets put this patch in.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/xen/time.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 054cc01..d50a821 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
 /* snapshots of runstate info */
 static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
 
-/* unused ns of stolen and blocked time */
+/* unused ns of stolen time */
 static DEFINE_PER_CPU(u64, xen_residual_stolen);
-static DEFINE_PER_CPU(u64, xen_residual_blocked);
 
 /* return an consistent snapshot of 64-bit time/counter value */
 static u64 get64(const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
 {
 	struct vcpu_runstate_info state;
 	struct vcpu_runstate_info *snap;
-	s64 blocked, runnable, offline, stolen;
+	s64 runnable, offline, stolen;
 	cputime_t ticks;
 
 	get_runstate_snapshot(&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
 	snap = &__get_cpu_var(xen_runstate_snapshot);
 
 	/* work out how much time the VCPU has not been runn*ing*  */
-	blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
 	runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
 	offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
 
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
 	ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
 	__this_cpu_write(xen_residual_stolen, stolen);
 	account_steal_ticks(ticks);
-
-	/* Add the appropriate number of ticks of blocked time,
-	   including any left-overs from last time. */
-	blocked += __this_cpu_read(xen_residual_blocked);
-
-	if (blocked < 0)
-		blocked = 0;
-
-	ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
-	__this_cpu_write(xen_residual_blocked, blocked);
-	account_idle_ticks(ticks);
 }
 
 /* Get the TSC speed from Xen */
-- 
1.8.1.2


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

* [PATCH 049/145] UBIFS: prepare to fix a horrid bug
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (47 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 048/145] xen/time: remove blocked time accounting from xen "clockchip" Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 050/145] UBIFS: " Kamal Mostafa
                   ` (95 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Artem Bityutskiy, Al Viro, Luis Henriques

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

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

From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

commit 33f1a63ae84dfd9ad298cf275b8f1887043ced36 upstream.

Al Viro pointed me to the fact that '->readdir()' and '->llseek()' have no
mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
in the middle of 'ubifs_readdir()'.

First of all, this means that 'file->private_data' can be freed while
'ubifs_readdir()' uses it.  But this particular patch does not fix the problem.
This patch is only a preparation, and the fix will follow next.

In this patch we make 'ubifs_readdir()' stop using 'file->f_pos' directly,
because 'file->f_pos' can be changed by '->llseek()' at any point. This may
lead 'ubifs_readdir()' to returning inconsistent data: directory entry names
may correspond to incorrect file positions.

So here we introduce a local variable 'pos', read 'file->f_pose' once at very
the beginning, and then stick to 'pos'. The result of this is that when
'ubifs_dir_llseek()' changes 'file->f_pos' while we are in the middle of
'ubifs_readdir()', the latter "wins".

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ubifs/dir.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 8a57477..62d0256 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -349,15 +349,16 @@ static unsigned int vfs_dent_type(uint8_t type)
 static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 {
 	int err, over = 0;
+	loff_t pos = file->f_pos;
 	struct qstr nm;
 	union ubifs_key key;
 	struct ubifs_dent_node *dent;
 	struct inode *dir = file->f_path.dentry->d_inode;
 	struct ubifs_info *c = dir->i_sb->s_fs_info;
 
-	dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, file->f_pos);
+	dbg_gen("dir ino %lu, f_pos %#llx", dir->i_ino, pos);
 
-	if (file->f_pos > UBIFS_S_KEY_HASH_MASK || file->f_pos == 2)
+	if (pos > UBIFS_S_KEY_HASH_MASK || pos == 2)
 		/*
 		 * The directory was seek'ed to a senseless position or there
 		 * are no more entries.
@@ -365,15 +366,15 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		return 0;
 
 	/* File positions 0 and 1 correspond to "." and ".." */
-	if (file->f_pos == 0) {
+	if (pos == 0) {
 		ubifs_assert(!file->private_data);
 		over = filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR);
 		if (over)
 			return 0;
-		file->f_pos = 1;
+		file->f_pos = pos = 1;
 	}
 
-	if (file->f_pos == 1) {
+	if (pos == 1) {
 		ubifs_assert(!file->private_data);
 		over = filldir(dirent, "..", 2, 1,
 			       parent_ino(file->f_path.dentry), DT_DIR);
@@ -389,7 +390,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 			goto out;
 		}
 
-		file->f_pos = key_hash_flash(c, &dent->key);
+		file->f_pos = pos = key_hash_flash(c, &dent->key);
 		file->private_data = dent;
 	}
 
@@ -397,17 +398,16 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 	if (!dent) {
 		/*
 		 * The directory was seek'ed to and is now readdir'ed.
-		 * Find the entry corresponding to @file->f_pos or the
-		 * closest one.
+		 * Find the entry corresponding to @pos or the closest one.
 		 */
-		dent_key_init_hash(c, &key, dir->i_ino, file->f_pos);
+		dent_key_init_hash(c, &key, dir->i_ino, pos);
 		nm.name = NULL;
 		dent = ubifs_tnc_next_ent(c, &key, &nm);
 		if (IS_ERR(dent)) {
 			err = PTR_ERR(dent);
 			goto out;
 		}
-		file->f_pos = key_hash_flash(c, &dent->key);
+		file->f_pos = pos = key_hash_flash(c, &dent->key);
 		file->private_data = dent;
 	}
 
@@ -419,7 +419,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 			     ubifs_inode(dir)->creat_sqnum);
 
 		nm.len = le16_to_cpu(dent->nlen);
-		over = filldir(dirent, dent->name, nm.len, file->f_pos,
+		over = filldir(dirent, dent->name, nm.len, pos,
 			       le64_to_cpu(dent->inum),
 			       vfs_dent_type(dent->type));
 		if (over)
@@ -435,7 +435,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		}
 
 		kfree(file->private_data);
-		file->f_pos = key_hash_flash(c, &dent->key);
+		file->f_pos = pos = key_hash_flash(c, &dent->key);
 		file->private_data = dent;
 		cond_resched();
 	}
-- 
1.8.1.2


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

* [PATCH 050/145] UBIFS: fix a horrid bug
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (48 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 049/145] UBIFS: prepare to fix a horrid bug Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 051/145] Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller" Kamal Mostafa
                   ` (94 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Artem Bityutskiy, Al Viro, Luis Henriques

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

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

From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

commit 605c912bb843c024b1ed173dc427cd5c08e5d54d upstream.

Al Viro pointed me to the fact that '->readdir()' and '->llseek()' have no
mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
in the middle of 'ubifs_readdir()'.

This means that 'file->private_data' can be freed while 'ubifs_readdir()' uses
it, and this is a very bad bug: not only 'ubifs_readdir()' can return garbage,
but this may corrupt memory and lead to all kinds of problems like crashes an
security holes.

This patch fixes the problem by using the 'file->f_version' field, which
'->llseek()' always unconditionally sets to zero. We set it to 1 in
'ubifs_readdir()' and whenever we detect that it became 0, we know there was a
seek and it is time to clear the state saved in 'file->private_data'.

I tested this patch by writing a user-space program which runds readdir and
seek in parallell. I could easily crash the kernel without these patches, but
could not crash it with these patches.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ubifs/dir.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 62d0256..c90ea6f 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -365,6 +365,24 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		 */
 		return 0;
 
+	if (file->f_version == 0) {
+		/*
+		 * The file was seek'ed, which means that @file->private_data
+		 * is now invalid. This may also be just the first
+		 * 'ubifs_readdir()' invocation, in which case
+		 * @file->private_data is NULL, and the below code is
+		 * basically a no-op.
+		 */
+		kfree(file->private_data);
+		file->private_data = NULL;
+	}
+
+	/*
+	 * 'generic_file_llseek()' unconditionally sets @file->f_version to
+	 * zero, and we use this for detecting whether the file was seek'ed.
+	 */
+	file->f_version = 1;
+
 	/* File positions 0 and 1 correspond to "." and ".." */
 	if (pos == 0) {
 		ubifs_assert(!file->private_data);
@@ -438,6 +456,14 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 		file->f_pos = pos = key_hash_flash(c, &dent->key);
 		file->private_data = dent;
 		cond_resched();
+
+		if (file->f_version == 0)
+			/*
+			 * The file was seek'ed meanwhile, lets return and start
+			 * reading direntries from the new position on the next
+			 * invocation.
+			 */
+			return 0;
 	}
 
 out:
@@ -448,15 +474,13 @@ out:
 
 	kfree(file->private_data);
 	file->private_data = NULL;
+	/* 2 is a special value indicating that there are no more direntries */
 	file->f_pos = 2;
 	return 0;
 }
 
-/* If a directory is seeked, we have to free saved readdir() state */
 static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int whence)
 {
-	kfree(file->private_data);
-	file->private_data = NULL;
 	return generic_file_llseek(file, offset, whence);
 }
 
-- 
1.8.1.2


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

* [PATCH 051/145] Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller"
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (49 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 050/145] UBIFS: " Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 052/145] powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries Kamal Mostafa
                   ` (93 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wang YanQing, Greg Kroah-Hartman, Luis Henriques

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

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

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

commit 828c6a102b1f2b8583fadc0e779c46b31d448f0b upstream.

This reverts commit 8d2f8cd424ca0b99001f3ff4f5db87c4e525f366.

As reported by Stefan, this device already works with the parport_serial
driver, so the 8250_pci driver should not also try to grab it as well.

Reported-by: Stefan Seyfried <stefan.seyfried@googlemail.com>
Cc: Wang YanQing <udknight@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/tty/serial/8250/8250_pci.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 5cdb092..67950ca 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -4446,10 +4446,6 @@ static struct pci_device_id serial_pci_tbl[] = {
 		PCI_VENDOR_ID_IBM, 0x0299,
 		0, 0, pbn_b0_bt_2_115200 },
 
-	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
-		0x1000, 0x0012,
-		0, 0, pbn_b0_bt_2_115200 },
-
 	{	PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
 		0xA000, 0x1000,
 		0, 0, pbn_b0_1_115200 },
-- 
1.8.1.2


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

* [PATCH 052/145] powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (50 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 051/145] Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller" Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 053/145] ext4: fix corruption when online resizing a fs with 1K block size Kamal Mostafa
                   ` (92 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Gang, Benjamin Herrenschmidt, Luis Henriques

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

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

From: Chen Gang <gang.chen@asianux.com>

commit 8246aca7058f3f2c2ae503081777965cd8df7b90 upstream.

the smp_release_cpus is a normal funciton and called in normal environments,
  but it calls the __initdata spinning_secondaries.
  need modify spinning_secondaries to match smp_release_cpus.

the related warning:
  (the linker report boot_paca.33377, but it should be spinning_secondaries)

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

WARNING: arch/powerpc/kernel/built-in.o(.text+0x23176): Section mismatch in reference from the function .smp_release_cpus() to the variable .init.data:boot_paca.33377
The function .smp_release_cpus() references
the variable __initdata boot_paca.33377.
This is often because .smp_release_cpus lacks a __initdata
annotation or the annotation of boot_paca.33377 is wrong.

WARNING: arch/powerpc/kernel/built-in.o(.text+0x231fe): Section mismatch in reference from the function .smp_release_cpus() to the variable .init.data:boot_paca.33377
The function .smp_release_cpus() references
the variable __initdata boot_paca.33377.
This is often because .smp_release_cpus lacks a __initdata
annotation or the annotation of boot_paca.33377 is wrong.

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

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/kernel/setup_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 8d97eb4..7960d9c 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -76,7 +76,7 @@
 #endif
 
 int boot_cpuid = 0;
-int __initdata spinning_secondaries;
+int spinning_secondaries;
 u64 ppc64_pft_size;
 
 /* Pick defaults since we might want to patch instructions
-- 
1.8.1.2


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

* [PATCH 053/145] ext4: fix corruption when online resizing a fs with 1K block size
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (51 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 052/145] powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 054/145] jbd2: move superblock checksum calculation to jbd2_write_superblock() Kamal Mostafa
                   ` (91 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maarten ter Huurne, Theodore Ts'o, Luis Henriques

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

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

From: Maarten ter Huurne <maarten@treewalker.org>

commit 6ca792edc13c409e8d4eb9001e048264c6a2eb64 upstream.

Subtracting the number of the first data block places the superblock
backups one block too early, corrupting the file system. When the block
size is larger than 1K, the first data block is 0, so the subtraction
has no effect and no corruption occurs.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/resize.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 0cfa2f4..28d5f2c 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1654,12 +1654,10 @@ errout:
 		err = err2;
 
 	if (!err) {
-		ext4_fsblk_t first_block;
-		first_block = ext4_group_first_block_no(sb, 0);
 		if (test_opt(sb, DEBUG))
 			printk(KERN_DEBUG "EXT4-fs: extended group to %llu "
 			       "blocks\n", ext4_blocks_count(es));
-		update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr - first_block,
+		update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr,
 			       (char *)es, sizeof(struct ext4_super_block), 0);
 	}
 	return err;
-- 
1.8.1.2


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

* [PATCH 054/145] jbd2: move superblock checksum calculation to jbd2_write_superblock()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (52 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 053/145] ext4: fix corruption when online resizing a fs with 1K block size Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 055/145] ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree() Kamal Mostafa
                   ` (90 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Theodore Ts'o, Darrick J. Wong, Luis Henriques

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

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

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

commit fe52d17cdd343ac43c85cf72940a58865b9d3bfb upstream.

Some of the functions which modify the jbd2 superblock were not
updating the checksum before calling jbd2_write_superblock().  Move
the call to jbd2_superblock_csum_set() to jbd2_write_superblock(), so
that the checksum is calculated consistently.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/jbd2/journal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 42f8cf6c..ea9feb9 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1303,6 +1303,7 @@ static int journal_reset(journal_t *journal)
 static void jbd2_write_superblock(journal_t *journal, int write_op)
 {
 	struct buffer_head *bh = journal->j_sb_buffer;
+	journal_superblock_t *sb = journal->j_superblock;
 	int ret;
 
 	trace_jbd2_write_superblock(journal, write_op);
@@ -1324,6 +1325,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)
 		clear_buffer_write_io_error(bh);
 		set_buffer_uptodate(bh);
 	}
+	jbd2_superblock_csum_set(journal, sb);
 	get_bh(bh);
 	bh->b_end_io = end_buffer_write_sync;
 	ret = submit_bh(write_op, bh);
@@ -1420,7 +1422,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal)
 	jbd_debug(1, "JBD2: updating superblock error (errno %d)\n",
 		  journal->j_errno);
 	sb->s_errno    = cpu_to_be32(journal->j_errno);
-	jbd2_superblock_csum_set(journal, sb);
 	read_unlock(&journal->j_state_lock);
 
 	jbd2_write_superblock(journal, WRITE_SYNC);
-- 
1.8.1.2


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

* [PATCH 055/145] ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (53 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 054/145] jbd2: move superblock checksum calculation to jbd2_write_superblock() Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 056/145] jbd2: fix theoretical race in jbd2__journal_restart Kamal Mostafa
                   ` (89 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Al Viro, Theodore Ts'o, Luis Henriques

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

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

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

commit 64cb927371cd2ec43758d8a094a003d27bc3d0dc upstream.

Both ext3 and ext4 htree_dirblock_to_tree() is just filling the
in-core rbtree for use by call_filldir().  All updates of ->f_pos are
done by the latter; bumping it here (on error) is obviously wrong - we
might very well have it nowhere near the block we'd found an error in.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext3/namei.c | 7 ++-----
 fs/ext4/namei.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 890b894..3c7b413 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -577,11 +577,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
 		if (!ext3_check_dir_entry("htree_dirblock_to_tree", dir, de, bh,
 					(block<<EXT3_BLOCK_SIZE_BITS(dir->i_sb))
 						+((char *)de - bh->b_data))) {
-			/* On error, skip the f_pos to the next block. */
-			dir_file->f_pos = (dir_file->f_pos |
-					(dir->i_sb->s_blocksize - 1)) + 1;
-			brelse (bh);
-			return count;
+			/* silently ignore the rest of the block */
+			break;
 		}
 		ext3fs_dirhash(de->name, de->name_len, hinfo);
 		if ((hinfo->hash < start_hash) ||
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index f9ed946..6cda31e 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -890,11 +890,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
 				bh->b_data, bh->b_size,
 				(block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb))
 					 + ((char *)de - bh->b_data))) {
-			/* On error, skip the f_pos to the next block. */
-			dir_file->f_pos = (dir_file->f_pos |
-					(dir->i_sb->s_blocksize - 1)) + 1;
-			brelse(bh);
-			return count;
+			/* silently ignore the rest of the block */
+			break;
 		}
 		ext4fs_dirhash(de->name, de->name_len, hinfo);
 		if ((hinfo->hash < start_hash) ||
-- 
1.8.1.2


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

* [PATCH 056/145] jbd2: fix theoretical race in jbd2__journal_restart
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (54 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 055/145] ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree() Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 057/145] tick: Prevent uncontrolled switch to oneshot mode Kamal Mostafa
                   ` (88 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Luis Henriques

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

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

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

commit 39c04153fda8c32e85b51c96eb5511a326ad7609 upstream.

Once we decrement transaction->t_updates, if this is the last handle
holding the transaction from closing, and once we release the
t_handle_lock spinlock, it's possible for the transaction to commit
and be released.  In practice with normal kernels, this probably won't
happen, since the commit happens in a separate kernel thread and it's
unlikely this could all happen within the space of a few CPU cycles.

On the other hand, with a real-time kernel, this could potentially
happen, so save the tid found in transaction->t_tid before we release
t_handle_lock.  It would require an insane configuration, such as one
where the jbd2 thread was set to a very high real-time priority,
perhaps because a high priority real-time thread is trying to read or
write to a file system.  But some people who use real-time kernels
have been known to do insane things, including controlling
laser-wielding industrial robots.  :-)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/jbd2/transaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 73b9253..2f78ba3 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -500,10 +500,10 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask)
 		   &transaction->t_outstanding_credits);
 	if (atomic_dec_and_test(&transaction->t_updates))
 		wake_up(&journal->j_wait_updates);
+	tid = transaction->t_tid;
 	spin_unlock(&transaction->t_handle_lock);
 
 	jbd_debug(2, "restarting handle %p\n", handle);
-	tid = transaction->t_tid;
 	need_to_start = !tid_geq(journal->j_commit_request, tid);
 	read_unlock(&journal->j_state_lock);
 	if (need_to_start)
-- 
1.8.1.2


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

* [PATCH 057/145] tick: Prevent uncontrolled switch to oneshot mode
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (55 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 056/145] jbd2: fix theoretical race in jbd2__journal_restart Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 058/145] md/raid10: fix two bugs affecting RAID10 reshape Kamal Mostafa
                   ` (87 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: John Stultz, Mark Rutland, Thomas Gleixner, Luis Henriques

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

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

From: Thomas Gleixner <tglx@linutronix.de>

commit 1f73a9806bdd07a5106409bbcab3884078bd34fe upstream.

When the system switches from periodic to oneshot mode, the broadcast
logic causes a possibility that a CPU which has not yet switched to
oneshot mode puts its own clock event device into oneshot mode without
updating the state and the timer handler.

CPU0				CPU1
				per cpu tickdev is in periodic mode
				and switched to broadcast

Switch to oneshot mode
 tick_broadcast_switch_to_oneshot()
  cpumask_copy(tick_oneshot_broacast_mask,
	       tick_broadcast_mask);

  broadcast device mode = oneshot

				Timer interrupt

				irq_enter()
				 tick_check_oneshot_broadcast()
				  dev->set_mode(ONESHOT);

				tick_handle_periodic()
				 if (dev->mode == ONESHOT)
				   dev->next_event += period;
				   FAIL.

We fail, because dev->next_event contains KTIME_MAX, if the device was
in periodic mode before the uncontrolled switch to oneshot happened.

We must copy the broadcast bits over to the oneshot mask, because
otherwise a CPU which relies on the broadcast would not been woken up
anymore after the broadcast device switched to oneshot mode.

So we need to verify in tick_check_oneshot_broadcast() whether the CPU
has already switched to oneshot mode. If not, leave the device
untouched and let the CPU switch controlled into oneshot mode.

This is a long standing bug, which was never noticed, because the main
user of the broadcast x86 cannot run into that scenario, AFAICT. The
nonarchitected timer mess of ARM creates a gazillion of differently
broken abominations which trigger the shortcomings of that broadcast
code, which better had never been necessary in the first place.

Reported-and-tested-by: Stehle Vincent-B46079 <B46079@freescale.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: John Stultz <john.stultz@linaro.org>,
Cc: Mark Rutland <mark.rutland@arm.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1307012153060.4013@ionos.tec.linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/time/tick-broadcast.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 239a323..f8961bf 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -400,7 +400,15 @@ void tick_check_oneshot_broadcast(int cpu)
 	if (cpumask_test_cpu(cpu, to_cpumask(tick_broadcast_oneshot_mask))) {
 		struct tick_device *td = &per_cpu(tick_cpu_device, cpu);
 
-		clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_ONESHOT);
+		/*
+		 * We might be in the middle of switching over from
+		 * periodic to oneshot. If the CPU has not yet
+		 * switched over, leave the device alone.
+		 */
+		if (td->mode == TICKDEV_MODE_ONESHOT) {
+			clockevents_set_mode(td->evtdev,
+					     CLOCK_EVT_MODE_ONESHOT);
+		}
 	}
 }
 
-- 
1.8.1.2


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

* [PATCH 058/145] md/raid10: fix two bugs affecting RAID10 reshape.
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (56 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 057/145] tick: Prevent uncontrolled switch to oneshot mode Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 059/145] HID: apple: Add support for the 2013 Macbook Air Kamal Mostafa
                   ` (86 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Luis Henriques

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

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

From: NeilBrown <neilb@suse.de>

commit 78eaa0d4cbcdb345992fa3dd22b3bcbb473cc064 upstream.

1/ If a RAID10 is being reshaped to a fewer number of devices
 and is stopped while this is ongoing, then when the array is
 reassembled the 'mirrors' array will be allocated too small.
 This will lead to an access error or memory corruption.

2/ A sanity test for a reshaping RAID10 array is restarted
 is slightly incorrect.

Due to the first bug, this is suitable for any -stable
kernel since 3.5 where this code was introduced.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/md/raid10.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 2f4be3c..7187dbd 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3501,7 +3501,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
 
 	/* FIXME calc properly */
 	conf->mirrors = kzalloc(sizeof(struct raid10_info)*(mddev->raid_disks +
-							    max(0,mddev->delta_disks)),
+							    max(0,-mddev->delta_disks)),
 				GFP_KERNEL);
 	if (!conf->mirrors)
 		goto out;
@@ -3660,7 +3660,7 @@ static int run(struct mddev *mddev)
 		    conf->geo.far_offset == 0)
 			goto out_free_conf;
 		if (conf->prev.far_copies != 1 &&
-		    conf->geo.far_offset == 0)
+		    conf->prev.far_offset == 0)
 			goto out_free_conf;
 	}
 
-- 
1.8.1.2


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

* [PATCH 059/145] HID: apple: Add support for the 2013 Macbook Air
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (57 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 058/145] md/raid10: fix two bugs affecting RAID10 reshape Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 060/145] Input: bcm5974 - add support for the 2013 MacBook Air Kamal Mostafa
                   ` (85 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Henrik Rydberg, Jiri Kosina, Dmitry Torokhov, Luis Henriques

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

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

From: Henrik Rydberg <rydberg@euromail.se>

commit 9d9a04ee758b4c1fcc7586d065cdde7a7607e156 upstream.

This patch adds keyboard support for MacbookAir6,2 as WELLSPRING8
(0x0291, 0x0292, 0x0293). The touchpad is handled in a separate
bcm5974 patch, as usual.

Reported-and-tested-by: Brad Ford <plymouthffl@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hid/hid-apple.c | 6 ++++++
 drivers/hid/hid-core.c  | 6 ++++++
 drivers/hid/hid-ids.h   | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index d0f7662..a6c4da3 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -529,6 +529,12 @@ static const struct hid_device_id apple_devices[] = {
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
+		.driver_data = APPLE_HAS_FN },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
+		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
+		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index ceb3040..08eb32a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1562,6 +1562,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -2172,6 +2175,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ }
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 160a309..720c8c1 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -135,6 +135,9 @@
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI  0x0255
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO   0x0256
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI	0x0291
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO	0x0292
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS	0x0293
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY	0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY	0x030b
 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL	0x8241
-- 
1.8.1.2


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

* [PATCH 060/145] Input: bcm5974 - add support for the 2013 MacBook Air
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (58 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 059/145] HID: apple: Add support for the 2013 Macbook Air Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 061/145] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() Kamal Mostafa
                   ` (84 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Henrik Rydberg, Dmitry Torokhov, Luis Henriques

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

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

From: Henrik Rydberg <rydberg@euromail.se>

commit 148c1c8ad3c4170186ebe6ea5900adde27d2a0e7 upstream.

The June 2013 Macbook Air (13'') has a new trackpad protocol; four new
values are inserted in the header, and the mode switch is no longer
needed. This patch adds support for the new devices.

Reported-and-tested-by: Brad Ford <plymouthffl@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/input/mouse/bcm5974.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 2baff1b..4ef4d5e 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -88,6 +88,10 @@
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI	0x0259
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO	0x025a
 #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS	0x025b
+/* MacbookAir6,2 (unibody, June 2013) */
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI	0x0291
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO	0x0292
+#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS	0x0293
 
 #define BCM5974_DEVICE(prod) {					\
 	.match_flags = (USB_DEVICE_ID_MATCH_DEVICE |		\
@@ -145,6 +149,10 @@ static const struct usb_device_id bcm5974_table[] = {
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
+	/* MacbookAir6,2 */
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
 	/* Terminating entry */
 	{}
 };
@@ -172,15 +180,18 @@ struct bt_data {
 /* trackpad header types */
 enum tp_type {
 	TYPE1,			/* plain trackpad */
-	TYPE2			/* button integrated in trackpad */
+	TYPE2,			/* button integrated in trackpad */
+	TYPE3			/* additional header fields since June 2013 */
 };
 
 /* trackpad finger data offsets, le16-aligned */
 #define FINGER_TYPE1		(13 * sizeof(__le16))
 #define FINGER_TYPE2		(15 * sizeof(__le16))
+#define FINGER_TYPE3		(19 * sizeof(__le16))
 
 /* trackpad button data offsets */
 #define BUTTON_TYPE2		15
+#define BUTTON_TYPE3		23
 
 /* list of device capability bits */
 #define HAS_INTEGRATED_BUTTON	1
@@ -400,6 +411,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
 		{ SN_COORD, -150, 6730 },
 		{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
 	},
+	{
+		USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI,
+		USB_DEVICE_ID_APPLE_WELLSPRING8_ISO,
+		USB_DEVICE_ID_APPLE_WELLSPRING8_JIS,
+		HAS_INTEGRATED_BUTTON,
+		0, sizeof(struct bt_data),
+		0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS,
+		{ SN_PRESSURE, 0, 300 },
+		{ SN_WIDTH, 0, 2048 },
+		{ SN_COORD, -4620, 5140 },
+		{ SN_COORD, -150, 6600 },
+		{ SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
+	},
 	{}
 };
 
@@ -557,6 +581,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 		input_report_key(input, BTN_LEFT, ibt);
 	}
 
+	if (c->tp_type == TYPE3)
+		input_report_key(input, BTN_LEFT, dev->tp_data[BUTTON_TYPE3]);
+
 	input_sync(input);
 
 	return 0;
@@ -572,9 +599,14 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 
 static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
 {
-	char *data = kmalloc(8, GFP_KERNEL);
 	int retval = 0, size;
+	char *data;
+
+	/* Type 3 does not require a mode switch */
+	if (dev->cfg.tp_type == TYPE3)
+		return 0;
 
+	data = kmalloc(8, GFP_KERNEL);
 	if (!data) {
 		dev_err(&dev->intf->dev, "out of memory\n");
 		retval = -ENOMEM;
-- 
1.8.1.2


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

* [PATCH 061/145] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (59 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 060/145] Input: bcm5974 - add support for the 2013 MacBook Air Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 062/145] ocfs2: xattr: fix inlined xattr reflink Kamal Mostafa
                   ` (83 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bartlomiej Zolnierkiewicz, Kyungmin Park, Vinod Koul,
	Tomasz Figa, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

commit da331ba8e9c5de72a27e50f71105395bba6eebe0 upstream.

tasklet_kill() may sleep so call it before taking pch->lock.

Fixes following lockup:

  BUG: scheduling while atomic: cat/2383/0x00000002
  Modules linked in:
    unwind_backtrace+0x0/0xfc
    __schedule_bug+0x4c/0x58
    __schedule+0x690/0x6e0
    sys_sched_yield+0x70/0x78
    tasklet_kill+0x34/0x8c
    pl330_free_chan_resources+0x24/0x88
    dma_chan_put+0x4c/0x50
  [...]
  BUG: spinlock lockup suspected on CPU#0, swapper/0/0
   lock: 0xe52aa04c, .magic: dead4ead, .owner: cat/2383, .owner_cpu: 1
    unwind_backtrace+0x0/0xfc
    do_raw_spin_lock+0x194/0x204
    _raw_spin_lock_irqsave+0x20/0x28
    pl330_tasklet+0x2c/0x5a8
    tasklet_action+0xfc/0x114
    __do_softirq+0xe4/0x19c
    irq_exit+0x98/0x9c
    handle_IPI+0x124/0x16c
    gic_handle_irq+0x64/0x68
    __irq_svc+0x40/0x70
    cpuidle_wrap_enter+0x4c/0xa0
    cpuidle_enter_state+0x18/0x68
    cpuidle_idle_call+0xac/0xe0
    cpu_idle+0xac/0xf0

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Vinod Koul <vinod.koul@linux.intel.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/dma/pl330.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 80680ee..4bed3f1 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2459,10 +2459,10 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
 	struct dma_pl330_chan *pch = to_pchan(chan);
 	unsigned long flags;
 
-	spin_lock_irqsave(&pch->lock, flags);
-
 	tasklet_kill(&pch->task);
 
+	spin_lock_irqsave(&pch->lock, flags);
+
 	pl330_release_channel(pch->pl330_chid);
 	pch->pl330_chid = NULL;
 
-- 
1.8.1.2


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

* [PATCH 062/145] ocfs2: xattr: fix inlined xattr reflink
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (60 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 061/145] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 063/145] block: do not pass disk names as format strings Kamal Mostafa
                   ` (82 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Junxiao Bi, Mark Fasheh, Sunil Mushran, Andrew Morton,
	Linus Torvalds, Luis Henriques

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

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

From: Junxiao Bi <junxiao.bi@oracle.com>

commit ef962df057aaafd714f5c22ba3de1be459571fdf upstream.

Inlined xattr shared free space of inode block with inlined data or data
extent record, so the size of the later two should be adjusted when
inlined xattr is enabled.  See ocfs2_xattr_ibody_init().  But this isn't
done well when reflink.  For inode with inlined data, its max inlined
data size is adjusted in ocfs2_duplicate_inline_data(), no problem.  But
for inode with data extent record, its record count isn't adjusted.  Fix
it, or data extent record and inlined xattr may overwrite each other,
then cause data corruption or xattr failure.

One panic caused by this bug in our test environment is the following:

  kernel BUG at fs/ocfs2/xattr.c:1435!
  invalid opcode: 0000 [#1] SMP
  Pid: 10871, comm: multi_reflink_t Not tainted 2.6.39-300.17.1.el5uek #1
  RIP: ocfs2_xa_offset_pointer+0x17/0x20 [ocfs2]
  RSP: e02b:ffff88007a587948  EFLAGS: 00010283
  RAX: 0000000000000000 RBX: 0000000000000010 RCX: 00000000000051e4
  RDX: ffff880057092060 RSI: 0000000000000f80 RDI: ffff88007a587a68
  RBP: ffff88007a587948 R08: 00000000000062f4 R09: 0000000000000000
  R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000010
  R13: ffff88007a587a68 R14: 0000000000000001 R15: ffff88007a587c68
  FS:  00007fccff7f06e0(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
  CS:  e033 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 00000000015cf000 CR3: 000000007aa76000 CR4: 0000000000000660
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
  Process multi_reflink_t
  Call Trace:
    ocfs2_xa_reuse_entry+0x60/0x280 [ocfs2]
    ocfs2_xa_prepare_entry+0x17e/0x2a0 [ocfs2]
    ocfs2_xa_set+0xcc/0x250 [ocfs2]
    ocfs2_xattr_ibody_set+0x98/0x230 [ocfs2]
    __ocfs2_xattr_set_handle+0x4f/0x700 [ocfs2]
    ocfs2_xattr_set+0x6c6/0x890 [ocfs2]
    ocfs2_xattr_user_set+0x46/0x50 [ocfs2]
    generic_setxattr+0x70/0x90
    __vfs_setxattr_noperm+0x80/0x1a0
    vfs_setxattr+0xa9/0xb0
    setxattr+0xc3/0x120
    sys_fsetxattr+0xa8/0xd0
    system_call_fastpath+0x16/0x1b

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Sunil Mushran <sunil.mushran@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ocfs2/xattr.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 2e3ea30..5b8d944 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -6499,6 +6499,16 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args)
 	}
 
 	new_oi = OCFS2_I(args->new_inode);
+	/*
+	 * Adjust extent record count to reserve space for extended attribute.
+	 * Inline data count had been adjusted in ocfs2_duplicate_inline_data().
+	 */
+	if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
+	    !(ocfs2_inode_is_fast_symlink(args->new_inode))) {
+		struct ocfs2_extent_list *el = &new_di->id2.i_list;
+		le16_add_cpu(&el->l_count, -(inline_size /
+					sizeof(struct ocfs2_extent_rec)));
+	}
 	spin_lock(&new_oi->ip_lock);
 	new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL;
 	new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features);
-- 
1.8.1.2


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

* [PATCH 063/145] block: do not pass disk names as format strings
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (61 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 062/145] ocfs2: xattr: fix inlined xattr reflink Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46   ` Kamal Mostafa
                   ` (81 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kees Cook, Jens Axboe, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Kees Cook <keescook@chromium.org>

commit ffc8b30866879ed9ba62bd0a86fecdbd51cd3d19 upstream.

Disk names may contain arbitrary strings, so they must not be
interpreted as format strings.  It seems that only md allows arbitrary
strings to be used for disk names, but this could allow for a local
memory corruption from uid 0 into ring 0.

CVE-2013-2851

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 block/genhd.c              | 2 +-
 drivers/block/nbd.c        | 3 ++-
 drivers/scsi/osd/osd_uld.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 7dcfdd8..b596dfc 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -520,7 +520,7 @@ static void register_disk(struct gendisk *disk)
 
 	ddev->parent = disk->driverfs_dev;
 
-	dev_set_name(ddev, disk->disk_name);
+	dev_set_name(ddev, "%s", disk->disk_name);
 
 	/* delay uevents, until we scanned partition table */
 	dev_set_uevent_suppress(ddev, 1);
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index eb591fb..0f9262e 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -694,7 +694,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 			queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
 				nbd->disk->queue);
 
-		thread = kthread_create(nbd_thread, nbd, nbd->disk->disk_name);
+		thread = kthread_create(nbd_thread, nbd, "%s",
+					nbd->disk->disk_name);
 		if (IS_ERR(thread)) {
 			mutex_lock(&nbd->tx_lock);
 			return PTR_ERR(thread);
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index 4375417..599415e 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -493,7 +493,7 @@ static int osd_probe(struct device *dev)
 	oud->class_dev.class = &osd_uld_class;
 	oud->class_dev.parent = dev;
 	oud->class_dev.release = __remove;
-	error = dev_set_name(&oud->class_dev, disk->disk_name);
+	error = dev_set_name(&oud->class_dev, "%s", disk->disk_name);
 	if (error) {
 		OSD_ERR("dev_set_name failed => %d\n", error);
 		goto err_put_cdev;
-- 
1.8.1.2


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

* [PATCH 064/145] crypto: sanitize argument for format string
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
@ 2013-07-17 22:46   ` Kamal Mostafa
  2013-07-17 22:45 ` [PATCH 002/145] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down Kamal Mostafa
                     ` (143 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kees Cook, Herbert Xu, David S. Miller, Andrew Morton,
	Linus Torvalds, Luis Henriques

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

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

From: Kees Cook <keescook@chromium.org>

commit 1c8fca1d92e14859159a82b8a380d220139b7344 upstream.

The template lookup interface does not provide a way to use format
strings, so make sure that the interface cannot be abused accidentally.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
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>
---
 crypto/algapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/algapi.c b/crypto/algapi.c
index c3b9bfe..13e5766 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -495,7 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)
 
 struct crypto_template *crypto_lookup_template(const char *name)
 {
-	return try_then_request_module(__crypto_lookup_template(name), name);
+	return try_then_request_module(__crypto_lookup_template(name), "%s",
+				       name);
 }
 EXPORT_SYMBOL_GPL(crypto_lookup_template);
 
-- 
1.8.1.2


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

* [PATCH 064/145] crypto: sanitize argument for format string
@ 2013-07-17 22:46   ` Kamal Mostafa
  0 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kees Cook, Herbert Xu, David S. Miller, Andrew Morton,
	Linus Torvalds, Luis Henriques

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

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

From: Kees Cook <keescook@chromium.org>

commit 1c8fca1d92e14859159a82b8a380d220139b7344 upstream.

The template lookup interface does not provide a way to use format
strings, so make sure that the interface cannot be abused accidentally.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
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>
---
 crypto/algapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/algapi.c b/crypto/algapi.c
index c3b9bfe..13e5766 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -495,7 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)
 
 struct crypto_template *crypto_lookup_template(const char *name)
 {
-	return try_then_request_module(__crypto_lookup_template(name), name);
+	return try_then_request_module(__crypto_lookup_template(name), "%s",
+				       name);
 }
 EXPORT_SYMBOL_GPL(crypto_lookup_template);
 
-- 
1.8.1.2


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

* [PATCH 065/145] mm/memory-hotplug: fix lowmem count overflow when offline pages
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (63 preceding siblings ...)
  2013-07-17 22:46   ` Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 066/145] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq Kamal Mostafa
                   ` (79 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wanpeng Li, KAMEZAWA Hiroyuki, David Rientjes, Andrew Morton,
	Linus Torvalds, Luis Henriques

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

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

From: Wanpeng Li <liwanp@linux.vnet.ibm.com>

commit cea27eb2a202959783f81254c48c250ddd80e129 upstream.

The logic for the memory-remove code fails to correctly account the
Total High Memory when a memory block which contains High Memory is
offlined as shown in the example below.  The following patch fixes it.

Before logic memory remove:

MemTotal:        7603740 kB
MemFree:         6329612 kB
Buffers:           94352 kB
Cached:           872008 kB
SwapCached:            0 kB
Active:           626932 kB
Inactive:         519216 kB
Active(anon):     180776 kB
Inactive(anon):   222944 kB
Active(file):     446156 kB
Inactive(file):   296272 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:       7294672 kB
HighFree:        5704696 kB
LowTotal:         309068 kB
LowFree:          624916 kB

After logic memory remove:

MemTotal:        7079452 kB
MemFree:         5805976 kB
Buffers:           94372 kB
Cached:           872000 kB
SwapCached:            0 kB
Active:           626936 kB
Inactive:         519236 kB
Active(anon):     180780 kB
Inactive(anon):   222944 kB
Active(file):     446156 kB
Inactive(file):   296292 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:       7294672 kB
HighFree:        5181024 kB
LowTotal:       4294752076 kB
LowFree:          624952 kB

[mhocko@suse.cz: fix CONFIG_HIGHMEM=n build]
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 mm/page_alloc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7d77c57..7708f66 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6056,6 +6056,10 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
 		list_del(&page->lru);
 		rmv_page_order(page);
 		zone->free_area[order].nr_free--;
+#ifdef CONFIG_HIGHMEM
+		if (PageHighMem(page))
+			totalhigh_pages -= 1 << order;
+#endif
 		for (i = 0; i < (1 << order); i++)
 			SetPageReserved((page+i));
 		pfn += (1 << order);
-- 
1.8.1.2


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

* [PATCH 066/145] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (64 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 065/145] mm/memory-hotplug: fix lowmem count overflow when offline pages Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 067/145] nbd: correct disconnect behavior Kamal Mostafa
                   ` (78 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Axel Lin <axel.lin@ingics.com>

commit 29ecd78c0fd6ee05f2c6b07b23823a6ae43c13ff upstream.

In the disable AIE irq code path, current code passes "1" to enable
parameter of rv3029c2_rtc_i2c_alarm_set_irq().  Thus it does not disable
AIE irq.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Heiko Schocher <hs@denx.de>
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>
---
 drivers/rtc/rtc-rv3029c2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index f8ee8ad..a7869c8 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -310,7 +310,7 @@ static int rv3029c2_rtc_i2c_set_alarm(struct i2c_client *client,
 		dev_dbg(&client->dev, "alarm IRQ armed\n");
 	} else {
 		/* disable AIE irq */
-		ret = rv3029c2_rtc_i2c_alarm_set_irq(client, 1);
+		ret = rv3029c2_rtc_i2c_alarm_set_irq(client, 0);
 		if (ret)
 			return ret;
 
-- 
1.8.1.2


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

* [PATCH 067/145] nbd: correct disconnect behavior
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (65 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 066/145] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 068/145] hpfs: better test for errors Kamal Mostafa
                   ` (77 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paul Clements, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Paul Clements <paul.clements@steeleye.com>

commit c378f70adbc1bbecd9e6db145019f14b2f688c7c upstream.

Currently, when a disconnect is requested by the user (via NBD_DISCONNECT
ioctl) the return from NBD_DO_IT is undefined (it is usually one of
several error codes).  This means that nbd-client does not know if a
manual disconnect was performed or whether a network error occurred.
Because of this, nbd-client's persist mode (which tries to reconnect after
error, but not after manual disconnect) does not always work correctly.

This change fixes this by causing NBD_DO_IT to always return 0 if a user
requests a disconnect.  This means that nbd-client can correctly either
persist the connection (if an error occurred) or disconnect (if the user
requested it).

Signed-off-by: Paul Clements <paul.clements@steeleye.com>
Acked-by: Rob Landley <rob@landley.net>
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>
---
 drivers/block/nbd.c | 7 ++++++-
 include/linux/nbd.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 0f9262e..e6ea105 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -609,8 +609,10 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 		if (!nbd->sock)
 			return -EINVAL;
 
+		nbd->disconnect = 1;
+
 		nbd_send_req(nbd, &sreq);
-                return 0;
+		return 0;
 	}
  
 	case NBD_CLEAR_SOCK: {
@@ -640,6 +642,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 				nbd->sock = SOCKET_I(inode);
 				if (max_part > 0)
 					bdev->bd_invalidated = 1;
+				nbd->disconnect = 0; /* we're connected now */
 				return 0;
 			} else {
 				fput(file);
@@ -721,6 +724,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 		set_capacity(nbd->disk, 0);
 		if (max_part > 0)
 			ioctl_by_bdev(bdev, BLKRRPART, 0);
+		if (nbd->disconnect) /* user requested, ignore socket errors */
+			return 0;
 		return nbd->harderror;
 	}
 
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 4871170..ae4981e 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -41,6 +41,7 @@ struct nbd_device {
 	u64 bytesize;
 	pid_t pid; /* pid of nbd-client, if attached */
 	int xmit_timeout;
+	int disconnect; /* a disconnect has been requested by user */
 };
 
 #endif
-- 
1.8.1.2


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

* [PATCH 068/145] hpfs: better test for errors
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (66 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 067/145] nbd: correct disconnect behavior Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 069/145] Drivers: hv: Execute shutdown in a thread context Kamal Mostafa
                   ` (76 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Linus Torvalds, Luis Henriques

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

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

From: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>

commit 3ebacb05044f82c5f0bb456a894eb9dc57d0ed90 upstream.

The test if bitmap access is out of bound could errorneously pass if the
device size is divisible by 16384 sectors and we are asking for one bitmap
after the end.

Check for invalid size in the superblock. Invalid size could cause integer
overflows in the rest of the code.

Signed-off-by: Mikulas Patocka <mpatocka@artax.karlin.mff.cuni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/hpfs/map.c   | 3 ++-
 fs/hpfs/super.c | 8 +++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c
index 4acb19d..803d3da 100644
--- a/fs/hpfs/map.c
+++ b/fs/hpfs/map.c
@@ -17,7 +17,8 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
 			 struct quad_buffer_head *qbh, char *id)
 {
 	secno sec;
-	if (hpfs_sb(s)->sb_chk) if (bmp_block * 16384 > hpfs_sb(s)->sb_fs_size) {
+	unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
+	if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) {
 		hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id);
 		return NULL;
 	}
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index a307622..ebc2e79 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -558,7 +558,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
 	sbi->sb_cp_table = NULL;
 	sbi->sb_c_bitmap = -1;
 	sbi->sb_max_fwd_alloc = 0xffffff;
-	
+
+	if (sbi->sb_fs_size >= 0x80000000) {
+		hpfs_error(s, "invalid size in superblock: %08x",
+			(unsigned)sbi->sb_fs_size);
+		goto bail4;
+	}
+
 	/* Load bitmap directory */
 	if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps))))
 		goto bail4;
-- 
1.8.1.2


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

* [PATCH 069/145] Drivers: hv: Execute shutdown in a thread context
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (67 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 068/145] hpfs: better test for errors Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 070/145] ext3: fix data=journal fast mount/umount hang Kamal Mostafa
                   ` (75 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, Greg Kroah-Hartman, Joseph Salisbury, Luis Henriques

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

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

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit 3dd6cb497198a0533a2530b6a345c60c9a29b9bc upstream.

Execute the shutdown code in a thread context. With recent changes made to the
shutdown code, shutdown code cannot be invoked from an interrupt context.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hv/hv_util.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index a0667de..c64be4f 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -49,6 +49,16 @@ static struct hv_util_service util_kvp = {
 	.util_deinit = hv_kvp_deinit,
 };
 
+static void perform_shutdown(struct work_struct *dummy)
+{
+	orderly_poweroff(true);
+}
+
+/*
+ * Perform the shutdown operation in a thread context.
+ */
+static DECLARE_WORK(shutdown_work, perform_shutdown);
+
 static void shutdown_onchannelcallback(void *context)
 {
 	struct vmbus_channel *channel = context;
@@ -106,7 +116,7 @@ static void shutdown_onchannelcallback(void *context)
 	}
 
 	if (execute_shutdown == true)
-		orderly_poweroff(true);
+		schedule_work(&shutdown_work);
 }
 
 /*
-- 
1.8.1.2


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

* [PATCH 070/145] ext3: fix data=journal fast mount/umount hang
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (68 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 069/145] Drivers: hv: Execute shutdown in a thread context Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 071/145] netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary Kamal Mostafa
                   ` (74 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Benjamin LaHaise, Luis Henriques

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

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

From: Jan Kara <jack@suse.cz>

commit e643692138cfa33528f054b071ba2583509bb217 upstream.

In data=journal mode, if we unmount the file system before a
transaction has a chance to complete, when the journal inode is being
evicted, we can end up calling into log_wait_commit() for the
last transaction, after the journalling machinery has been shut down.
That triggers the WARN_ONCE in __log_start_commit().

Arguably we should adjust ext3_should_journal_data() to return FALSE
for the journal inode, but the only place it matters is
ext3_evict_inode(), and so it's to save a bit of CPU time, and to make
the patch much more obviously correct by inspection(tm), we'll fix it
by explicitly not trying to waiting for a journal commit when we are
evicting the journal inode, since it's guaranteed to never succeed in
this case.

This can be easily replicated via:

     mount -t ext3 -o data=journal /dev/vdb /vdb ; umount /vdb

This is a port of ext4 fix from Ted Ts'o.

Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext3/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index b176d42..f790d6e 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -218,7 +218,8 @@ void ext3_evict_inode (struct inode *inode)
 	 */
 	if (inode->i_nlink && ext3_should_journal_data(inode) &&
 	    EXT3_SB(inode->i_sb)->s_journal &&
-	    (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
+	    (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
+	    inode->i_ino != EXT3_JOURNAL_INO) {
 		tid_t commit_tid = atomic_read(&ei->i_datasync_tid);
 		journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
 
-- 
1.8.1.2


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

* [PATCH 071/145] netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (69 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 070/145] ext3: fix data=journal fast mount/umount hang Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 072/145] netfilter: ipt_ULOG: fix non-null terminated string in the nf_log path Kamal Mostafa
                   ` (73 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Pablo Neira Ayuso, Luis Henriques

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

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

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

commit bc6bcb59dd7c184d229f9e86d08aa56059938a4c upstream.

This target assumes that tcph->doff is well-formed, that may be well
not the case. Add extra sanity checkings to avoid possible crash due
to read/write out of the real packet boundary. After this patch, the
default action on malformed TCP packets is to drop them. Moreover,
fragments are skipped.

Reported-by: Rafal Kupka <rkupka@telemetry.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_TCPOPTSTRIP.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/xt_TCPOPTSTRIP.c b/net/netfilter/xt_TCPOPTSTRIP.c
index 25fd1c4..1eb1a44 100644
--- a/net/netfilter/xt_TCPOPTSTRIP.c
+++ b/net/netfilter/xt_TCPOPTSTRIP.c
@@ -30,17 +30,28 @@ static inline unsigned int optlen(const u_int8_t *opt, unsigned int offset)
 
 static unsigned int
 tcpoptstrip_mangle_packet(struct sk_buff *skb,
-			  const struct xt_tcpoptstrip_target_info *info,
+			  const struct xt_action_param *par,
 			  unsigned int tcphoff, unsigned int minlen)
 {
+	const struct xt_tcpoptstrip_target_info *info = par->targinfo;
 	unsigned int optl, i, j;
 	struct tcphdr *tcph;
 	u_int16_t n, o;
 	u_int8_t *opt;
+	int len;
+
+	/* This is a fragment, no TCP header is available */
+	if (par->fragoff != 0)
+		return XT_CONTINUE;
 
 	if (!skb_make_writable(skb, skb->len))
 		return NF_DROP;
 
+	len = skb->len - tcphoff;
+	if (len < (int)sizeof(struct tcphdr) ||
+	    tcp_hdr(skb)->doff * 4 > len)
+		return NF_DROP;
+
 	tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);
 	opt  = (u_int8_t *)tcph;
 
@@ -76,7 +87,7 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb,
 static unsigned int
 tcpoptstrip_tg4(struct sk_buff *skb, const struct xt_action_param *par)
 {
-	return tcpoptstrip_mangle_packet(skb, par->targinfo, ip_hdrlen(skb),
+	return tcpoptstrip_mangle_packet(skb, par, ip_hdrlen(skb),
 	       sizeof(struct iphdr) + sizeof(struct tcphdr));
 }
 
@@ -94,7 +105,7 @@ tcpoptstrip_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 	if (tcphoff < 0)
 		return NF_DROP;
 
-	return tcpoptstrip_mangle_packet(skb, par->targinfo, tcphoff,
+	return tcpoptstrip_mangle_packet(skb, par, tcphoff,
 	       sizeof(*ipv6h) + sizeof(struct tcphdr));
 }
 #endif
-- 
1.8.1.2


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

* [PATCH 072/145] netfilter: ipt_ULOG: fix non-null terminated string in the nf_log path
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (70 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 071/145] netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 073/145] netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6 Kamal Mostafa
                   ` (72 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chen Gang, Pablo Neira Ayuso, Luis Henriques

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

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

From: Chen Gang <gang.chen@asianux.com>

commit 4f36ea6eed2081340c7a7aa98c73187ecfccebff upstream.

If nf_log uses ipt_ULOG as logging output, we can deliver non-null
terminated strings to user-space since the maximum length of the
prefix that is passed by nf_log is NF_LOG_PREFIXLEN but pm->prefix
is 32 bytes long (ULOG_PREFIX_LEN).

This is actually happening already from nf_conntrack_tcp if ipt_ULOG
is used, since it is passing strings longer than 32 bytes.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv4/netfilter/ipt_ULOG.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index b5ef3cb..db5f368 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -217,8 +217,10 @@ static void ipt_ulog_packet(unsigned int hooknum,
 	put_unaligned(tv.tv_usec, &pm->timestamp_usec);
 	put_unaligned(skb->mark, &pm->mark);
 	pm->hook = hooknum;
-	if (prefix != NULL)
-		strncpy(pm->prefix, prefix, sizeof(pm->prefix));
+	if (prefix != NULL) {
+		strncpy(pm->prefix, prefix, sizeof(pm->prefix) - 1);
+		pm->prefix[sizeof(pm->prefix) - 1] = '\0';
+	}
 	else if (loginfo->prefix[0] != '\0')
 		strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix));
 	else
-- 
1.8.1.2


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

* [PATCH 073/145] netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (71 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 072/145] netfilter: ipt_ULOG: fix non-null terminated string in the nf_log path Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 074/145] ipvs: Fix reuse connection if real server is dead Kamal Mostafa
                   ` (71 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Westphal, Pablo Neira Ayuso, Luis Henriques

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

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

From: Florian Westphal <fw@strlen.de>

commit 2a7851bffb008ff4882eee673da74718997b4265 upstream.

Quoting https://bugzilla.netfilter.org/show_bug.cgi?id=812:

[ ip6tables -m addrtype ]
When I tried to use in the nat/PREROUTING it messes up the
routing cache even if the rule didn't matched at all.
[..]
If I remove the --limit-iface-in from the non-working scenario, so just
use the -m addrtype --dst-type LOCAL it works!

This happens when LOCAL type matching is requested with --limit-iface-in,
and the default ipv6 route is via the interface the packet we test
arrived on.

Because xt_addrtype uses ip6_route_output, the ipv6 routing implementation
creates an unwanted cached entry, and the packet won't make it to the
real/expected destination.

Silently ignoring --limit-iface-in makes the routing work but it breaks
rule matching (--dst-type LOCAL with limit-iface-in is supposed to only
match if the dst address is configured on the incoming interface;
without --limit-iface-in it will match if the address is reachable
via lo).

The test should call ipv6_chk_addr() instead.  However, this would add
a link-time dependency on ipv6.

There are two possible solutions:

1) Revert the commit that moved ipt_addrtype to xt_addrtype,
   and put ipv6 specific code into ip6t_addrtype.
2) add new "nf_ipv6_ops" struct to register pointers to ipv6 functions.

While the former might seem preferable, Pablo pointed out that there
are more xt modules with link-time dependeny issues regarding ipv6,
so lets go for 2).

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 include/linux/netfilter_ipv6.h | 16 ++++++++++++++++
 include/net/addrconf.h         |  2 +-
 net/ipv6/addrconf.c            |  2 +-
 net/ipv6/netfilter.c           |  7 +++++++
 net/netfilter/core.c           |  2 ++
 net/netfilter/xt_addrtype.c    | 27 ++++++++++++++++-----------
 6 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 98ffb54..2d4df6ce 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -17,6 +17,22 @@ extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
 
 extern int ipv6_netfilter_init(void);
 extern void ipv6_netfilter_fini(void);
+
+/*
+ * Hook functions for ipv6 to allow xt_* modules to be built-in even
+ * if IPv6 is a module.
+ */
+struct nf_ipv6_ops {
+	int (*chk_addr)(struct net *net, const struct in6_addr *addr,
+			const struct net_device *dev, int strict);
+};
+
+extern const struct nf_ipv6_ops __rcu *nf_ipv6_ops;
+static inline const struct nf_ipv6_ops *nf_get_ipv6_ops(void)
+{
+	return rcu_dereference(nf_ipv6_ops);
+}
+
 #else /* CONFIG_NETFILTER */
 static inline int ipv6_netfilter_init(void) { return 0; }
 static inline void ipv6_netfilter_fini(void) { return; }
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index df4ef94..594abec 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -61,7 +61,7 @@ extern int			addrconf_set_dstaddr(struct net *net,
 
 extern int			ipv6_chk_addr(struct net *net,
 					      const struct in6_addr *addr,
-					      struct net_device *dev,
+					      const struct net_device *dev,
 					      int strict);
 
 #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index b4b756c..d1d6915 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1409,7 +1409,7 @@ static int ipv6_count_addresses(struct inet6_dev *idev)
 }
 
 int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
-		  struct net_device *dev, int strict)
+		  const struct net_device *dev, int strict)
 {
 	struct inet6_ifaddr *ifp;
 	struct hlist_node *node;
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 429089c..52d31a0 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -4,6 +4,7 @@
 #include <linux/netfilter.h>
 #include <linux/netfilter_ipv6.h>
 #include <linux/export.h>
+#include <net/addrconf.h>
 #include <net/dst.h>
 #include <net/ipv6.h>
 #include <net/ip6_route.h>
@@ -180,6 +181,10 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
 	return csum;
 };
 
+static const struct nf_ipv6_ops ipv6ops = {
+	.chk_addr	= ipv6_chk_addr,
+};
+
 static const struct nf_afinfo nf_ip6_afinfo = {
 	.family			= AF_INET6,
 	.checksum		= nf_ip6_checksum,
@@ -192,6 +197,7 @@ static const struct nf_afinfo nf_ip6_afinfo = {
 
 int __init ipv6_netfilter_init(void)
 {
+	RCU_INIT_POINTER(nf_ipv6_ops, &ipv6ops);
 	return nf_register_afinfo(&nf_ip6_afinfo);
 }
 
@@ -200,5 +206,6 @@ int __init ipv6_netfilter_init(void)
  */
 void ipv6_netfilter_fini(void)
 {
+	RCU_INIT_POINTER(nf_ipv6_ops, NULL);
 	nf_unregister_afinfo(&nf_ip6_afinfo);
 }
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index a9c488b..3fbdbba 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -29,6 +29,8 @@ static DEFINE_MUTEX(afinfo_mutex);
 
 const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO] __read_mostly;
 EXPORT_SYMBOL(nf_afinfo);
+const struct nf_ipv6_ops __rcu *nf_ipv6_ops __read_mostly;
+EXPORT_SYMBOL_GPL(nf_ipv6_ops);
 
 int nf_register_afinfo(const struct nf_afinfo *afinfo)
 {
diff --git a/net/netfilter/xt_addrtype.c b/net/netfilter/xt_addrtype.c
index 49c5ff7..68ff29f 100644
--- a/net/netfilter/xt_addrtype.c
+++ b/net/netfilter/xt_addrtype.c
@@ -22,6 +22,7 @@
 #include <net/ip6_fib.h>
 #endif
 
+#include <linux/netfilter_ipv6.h>
 #include <linux/netfilter/xt_addrtype.h>
 #include <linux/netfilter/x_tables.h>
 
@@ -33,12 +34,12 @@ MODULE_ALIAS("ip6t_addrtype");
 
 #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
 static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
-			    const struct in6_addr *addr)
+			    const struct in6_addr *addr, u16 mask)
 {
 	const struct nf_afinfo *afinfo;
 	struct flowi6 flow;
 	struct rt6_info *rt;
-	u32 ret;
+	u32 ret = 0;
 	int route_err;
 
 	memset(&flow, 0, sizeof(flow));
@@ -49,12 +50,19 @@ static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
 	rcu_read_lock();
 
 	afinfo = nf_get_afinfo(NFPROTO_IPV6);
-	if (afinfo != NULL)
+	if (afinfo != NULL) {
+		const struct nf_ipv6_ops *v6ops;
+
+		if (dev && (mask & XT_ADDRTYPE_LOCAL)) {
+			v6ops = nf_get_ipv6_ops();
+			if (v6ops && v6ops->chk_addr(net, addr, dev, true))
+				ret = XT_ADDRTYPE_LOCAL;
+		}
 		route_err = afinfo->route(net, (struct dst_entry **)&rt,
-					flowi6_to_flowi(&flow), !!dev);
-	else
+					  flowi6_to_flowi(&flow), false);
+	} else {
 		route_err = 1;
-
+	}
 	rcu_read_unlock();
 
 	if (route_err)
@@ -62,15 +70,12 @@ static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
 
 	if (rt->rt6i_flags & RTF_REJECT)
 		ret = XT_ADDRTYPE_UNREACHABLE;
-	else
-		ret = 0;
 
-	if (rt->rt6i_flags & RTF_LOCAL)
+	if (dev == NULL && rt->rt6i_flags & RTF_LOCAL)
 		ret |= XT_ADDRTYPE_LOCAL;
 	if (rt->rt6i_flags & RTF_ANYCAST)
 		ret |= XT_ADDRTYPE_ANYCAST;
 
-
 	dst_release(&rt->dst);
 	return ret;
 }
@@ -90,7 +95,7 @@ static bool match_type6(struct net *net, const struct net_device *dev,
 
 	if ((XT_ADDRTYPE_LOCAL | XT_ADDRTYPE_ANYCAST |
 	     XT_ADDRTYPE_UNREACHABLE) & mask)
-		return !!(mask & match_lookup_rt6(net, dev, addr));
+		return !!(mask & match_lookup_rt6(net, dev, addr, mask));
 	return true;
 }
 
-- 
1.8.1.2


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

* [PATCH 074/145] ipvs: Fix reuse connection if real server is dead
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (72 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 073/145] netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6 Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 075/145] netfilter: xt_LOG: fix mark logging for IPv6 packets Kamal Mostafa
                   ` (70 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Grzegorz Lyczba, Simon Horman, Pablo Neira Ayuso, Luis Henriques

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

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

From: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>

commit dc7b3eb900aab02e5cafbca3948d005be13fb4a5 upstream.

Expire cached connection for new TCP/SCTP connection if real
server is down. Otherwise, IPVS uses the dead server for the
reused connection, instead of a new working one.

Signed-off-by: Grzegorz Lyczba <grzegorz.lyczba@gmail.com>
Acked-by: Hans Schillstrom <hans@schillstrom.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/ipvs/ip_vs_core.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 47edf5a..85972e4 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1002,6 +1002,32 @@ static inline int is_tcp_reset(const struct sk_buff *skb, int nh_len)
 	return th->rst;
 }
 
+static inline bool is_new_conn(const struct sk_buff *skb,
+			       struct ip_vs_iphdr *iph)
+{
+	switch (iph->protocol) {
+	case IPPROTO_TCP: {
+		struct tcphdr _tcph, *th;
+
+		th = skb_header_pointer(skb, iph->len, sizeof(_tcph), &_tcph);
+		if (th == NULL)
+			return false;
+		return th->syn;
+	}
+	case IPPROTO_SCTP: {
+		sctp_chunkhdr_t *sch, schunk;
+
+		sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t),
+					 sizeof(schunk), &schunk);
+		if (sch == NULL)
+			return false;
+		return sch->type == SCTP_CID_INIT;
+	}
+	default:
+		return false;
+	}
+}
+
 /* Handle response packets: rewrite addresses and send away...
  */
 static unsigned int
@@ -1627,6 +1653,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
 	 * Check if the packet belongs to an existing connection entry
 	 */
 	cp = pp->conn_in_get(af, skb, &iph, 0);
+
+	if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp && cp->dest &&
+	    unlikely(!atomic_read(&cp->dest->weight)) && !iph.fragoffs &&
+	    is_new_conn(skb, &iph)) {
+		ip_vs_conn_expire_now(cp);
+		__ip_vs_conn_put(cp);
+		cp = NULL;
+	}
+
 	if (unlikely(!cp) && !iph.fragoffs) {
 		/* No (second) fragments need to enter here, as nf_defrag_ipv6
 		 * replayed fragment zero will already have created the cp
-- 
1.8.1.2


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

* [PATCH 075/145] netfilter: xt_LOG: fix mark logging for IPv6 packets
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (73 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 074/145] ipvs: Fix reuse connection if real server is dead Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 076/145] ipvs: info leak in __ip_vs_get_dest_entries() Kamal Mostafa
                   ` (69 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kubecek, Pablo Neira Ayuso, Luis Henriques

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

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

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

commit d660164d79b67f879db35a7d61e47d3b99bc714e upstream.

In dump_ipv6_packet(), the "recurse" parameter is zero only if
dumping contents of a packet embedded into an ICMPv6 error
message. Therefore we want to log packet mark if recurse is
non-zero, not when it is zero.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_LOG.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
index fa40096..ca402a7 100644
--- a/net/netfilter/xt_LOG.c
+++ b/net/netfilter/xt_LOG.c
@@ -730,7 +730,7 @@ static void dump_ipv6_packet(struct sbuff *m,
 		dump_sk_uid_gid(m, skb->sk);
 
 	/* Max length: 16 "MARK=0xFFFFFFFF " */
-	if (!recurse && skb->mark)
+	if (recurse && skb->mark)
 		sb_add(m, "MARK=0x%x ", skb->mark);
 }
 
-- 
1.8.1.2


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

* [PATCH 076/145] ipvs: info leak in __ip_vs_get_dest_entries()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (74 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 075/145] netfilter: xt_LOG: fix mark logging for IPv6 packets Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 077/145] netfilter: nfnetlink_cttimeout: fix incomplete dumping of objects Kamal Mostafa
                   ` (68 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Simon Horman, Pablo Neira Ayuso, Luis Henriques

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

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

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

commit a8241c63517ec0b900695daa9003cddc41c536a1 upstream.

The entry struct has a 2 byte hole after ->port and another 4 byte
hole after ->stats.outpkts.  You must have CAP_NET_ADMIN in your
namespace to hit this information leak.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/ipvs/ip_vs_ctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index ec664cb..5f929a7 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -2556,6 +2556,7 @@ __ip_vs_get_dest_entries(struct net *net, const struct ip_vs_get_dests *get,
 		struct ip_vs_dest *dest;
 		struct ip_vs_dest_entry entry;
 
+		memset(&entry, 0, sizeof(entry));
 		list_for_each_entry(dest, &svc->destinations, n_list) {
 			if (count >= get->num_dests)
 				break;
-- 
1.8.1.2


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

* [PATCH 077/145] netfilter: nfnetlink_cttimeout: fix incomplete dumping of objects
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (75 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 076/145] ipvs: info leak in __ip_vs_get_dest_entries() Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 078/145] netfilter: nfnetlink_acct: " Kamal Mostafa
                   ` (67 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Pablo Neira Ayuso, Luis Henriques

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

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

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

commit 37bc4f8dfa72fb43b84381abca39cfdbbc8ff2df upstream.

Fix broken incomplete object dumping if the list of objects does not
fit into one single netlink message.

Reported-by: Gabriel Lazar <Gabriel.Lazar@com.utcluj.ro>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nfnetlink_cttimeout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c
index 701c88a..65074df 100644
--- a/net/netfilter/nfnetlink_cttimeout.c
+++ b/net/netfilter/nfnetlink_cttimeout.c
@@ -220,9 +220,12 @@ ctnl_timeout_dump(struct sk_buff *skb, struct netlink_callback *cb)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(cur, &cttimeout_list, head) {
-		if (last && cur != last)
-			continue;
+		if (last) {
+			if (cur != last)
+				continue;
 
+			last = NULL;
+		}
 		if (ctnl_timeout_fill_info(skb, NETLINK_CB(cb->skb).portid,
 					   cb->nlh->nlmsg_seq,
 					   NFNL_MSG_TYPE(cb->nlh->nlmsg_type),
-- 
1.8.1.2


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

* [PATCH 078/145] netfilter: nfnetlink_acct: fix incomplete dumping of objects
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (76 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 077/145] netfilter: nfnetlink_cttimeout: fix incomplete dumping of objects Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 079/145] netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option Kamal Mostafa
                   ` (66 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Pablo Neira Ayuso, Luis Henriques

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

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

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

commit 991a6b735ff47710769545b11e481bb140b2e6f7 upstream.

Fix broken incomplete object dumping if the list of objects does not
fit into one single netlink message.

Reported-by: Gabriel Lazar <Gabriel.Lazar@com.utcluj.ro>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/nfnetlink_acct.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 589d686..125bd35 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -147,9 +147,12 @@ nfnl_acct_dump(struct sk_buff *skb, struct netlink_callback *cb)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(cur, &nfnl_acct_list, head) {
-		if (last && cur != last)
-			continue;
+		if (last) {
+			if (cur != last)
+				continue;
 
+			last = NULL;
+		}
 		if (nfnl_acct_fill_info(skb, NETLINK_CB(cb->skb).portid,
 				       cb->nlh->nlmsg_seq,
 				       NFNL_MSG_TYPE(cb->nlh->nlmsg_type),
-- 
1.8.1.2


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

* [PATCH 079/145] netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (77 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 078/145] netfilter: nfnetlink_acct: " Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 080/145] netfilter: xt_TCPOPTSTRIP: don't use tcp_hdr() Kamal Mostafa
                   ` (65 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Phil Oester, Pablo Neira Ayuso, Luis Henriques

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

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

From: Phil Oester <kernel@linuxace.com>

commit 409b545ac10d9548929557a75ad86540f59a2c83 upstream.

The clamp-mss-to-pmtu option of the xt_TCPMSS target can cause issues
connecting to websites if there was no MSS option present in the
original SYN packet from the client. In these cases, it may add a
MSS higher than the default specified in RFC879. Fix this by never
setting a value > 536 if no MSS option was specified by the client.

This closes netfilter's bugzilla #662.

Signed-off-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_TCPMSS.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 71a266d..4960b66 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -124,6 +124,12 @@ tcpmss_mangle_packet(struct sk_buff *skb,
 
 	skb_put(skb, TCPOLEN_MSS);
 
+	/* RFC 879 states that the default MSS is 536 without specific
+	 * knowledge that the destination host is prepared to accept larger.
+	 * Since no MSS was provided, we MUST NOT set a value > 536.
+	 */
+	newmss = min(newmss, (u16)536);
+
 	opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
 	memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
 
-- 
1.8.1.2


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

* [PATCH 080/145] netfilter: xt_TCPOPTSTRIP: don't use tcp_hdr()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (78 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 079/145] netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 081/145] netfilter: xt_TCPMSS: Fix missing fragmentation handling Kamal Mostafa
                   ` (64 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Westphal, Pablo Neira Ayuso, Luis Henriques

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

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

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

commit ed82c437320c48a4032492f4a55a7e2c934158b6 upstream.

In (bc6bcb5 netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond
packet boundary), the use of tcp_hdr was introduced. However, we
cannot assume that skb->transport_header is set for non-local packets.

Cc: Florian Westphal <fw@strlen.de>
Reported-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_TCPOPTSTRIP.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/xt_TCPOPTSTRIP.c b/net/netfilter/xt_TCPOPTSTRIP.c
index 1eb1a44..b68fa19 100644
--- a/net/netfilter/xt_TCPOPTSTRIP.c
+++ b/net/netfilter/xt_TCPOPTSTRIP.c
@@ -48,11 +48,13 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb,
 		return NF_DROP;
 
 	len = skb->len - tcphoff;
-	if (len < (int)sizeof(struct tcphdr) ||
-	    tcp_hdr(skb)->doff * 4 > len)
+	if (len < (int)sizeof(struct tcphdr))
 		return NF_DROP;
 
 	tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff);
+	if (tcph->doff * 4 > len)
+		return NF_DROP;
+
 	opt  = (u_int8_t *)tcph;
 
 	/*
-- 
1.8.1.2


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

* [PATCH 081/145] netfilter: xt_TCPMSS: Fix missing fragmentation handling
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (79 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 080/145] netfilter: xt_TCPOPTSTRIP: don't use tcp_hdr() Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 082/145] netfilter: xt_TCPMSS: Fix IPv6 default MSS too Kamal Mostafa
                   ` (63 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Phil Oester, Pablo Neira Ayuso, Luis Henriques

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

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

From: Phil Oester <kernel@linuxace.com>

commit b396966c4688522863572927cb30aa874b3ec504 upstream.

Similar to commit bc6bcb59 ("netfilter: xt_TCPOPTSTRIP: fix
possible mangling beyond packet boundary"), add safe fragment
handling to xt_TCPMSS.

Signed-off-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_TCPMSS.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 4960b66..a77d786 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -55,6 +55,10 @@ tcpmss_mangle_packet(struct sk_buff *skb,
 	u16 newmss;
 	u8 *opt;
 
+	/* This is a fragment, no TCP header is available */
+	if (par->fragoff != 0)
+		return XT_CONTINUE;
+
 	if (!skb_make_writable(skb, skb->len))
 		return -1;
 
-- 
1.8.1.2


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

* [PATCH 082/145] netfilter: xt_TCPMSS: Fix IPv6 default MSS too
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (80 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 081/145] netfilter: xt_TCPMSS: Fix missing fragmentation handling Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 083/145] ipvs: SCTP ports should be writable in ICMP packets Kamal Mostafa
                   ` (62 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Phil Oester, Pablo Neira Ayuso, Luis Henriques

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

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

From: Phil Oester <kernel@linuxace.com>

commit 70d19f805f8c047fc0a28dec9306b3773971c8d9 upstream.

As a followup to commit 409b545a ("netfilter: xt_TCPMSS: Fix violation
of RFC879 in absence of MSS option"), John Heffner points out that IPv6
has a higher MTU than IPv4, and thus a higher minimum MSS. Update TCPMSS
target to account for this, and update RFC comment.

While at it, point to more recent reference RFC1122 instead of RFC879.

Signed-off-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/xt_TCPMSS.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index a77d786..cc2b572 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -44,11 +44,12 @@ optlen(const u_int8_t *opt, unsigned int offset)
 
 static int
 tcpmss_mangle_packet(struct sk_buff *skb,
-		     const struct xt_tcpmss_info *info,
+		     const struct xt_action_param *par,
 		     unsigned int in_mtu,
 		     unsigned int tcphoff,
 		     unsigned int minlen)
 {
+	const struct xt_tcpmss_info *info = par->targinfo;
 	struct tcphdr *tcph;
 	unsigned int tcplen, i;
 	__be16 oldval;
@@ -128,11 +129,17 @@ tcpmss_mangle_packet(struct sk_buff *skb,
 
 	skb_put(skb, TCPOLEN_MSS);
 
-	/* RFC 879 states that the default MSS is 536 without specific
-	 * knowledge that the destination host is prepared to accept larger.
-	 * Since no MSS was provided, we MUST NOT set a value > 536.
+	/*
+	 * IPv4: RFC 1122 states "If an MSS option is not received at
+	 * connection setup, TCP MUST assume a default send MSS of 536".
+	 * IPv6: RFC 2460 states IPv6 has a minimum MTU of 1280 and a minimum
+	 * length IPv6 header of 60, ergo the default MSS value is 1220
+	 * Since no MSS was provided, we must use the default values
 	 */
-	newmss = min(newmss, (u16)536);
+	if (par->family == NFPROTO_IPV4)
+		newmss = min(newmss, (u16)536);
+	else
+		newmss = min(newmss, (u16)1220);
 
 	opt = (u_int8_t *)tcph + sizeof(struct tcphdr);
 	memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr));
@@ -191,7 +198,7 @@ tcpmss_tg4(struct sk_buff *skb, const struct xt_action_param *par)
 	__be16 newlen;
 	int ret;
 
-	ret = tcpmss_mangle_packet(skb, par->targinfo,
+	ret = tcpmss_mangle_packet(skb, par,
 				   tcpmss_reverse_mtu(skb, PF_INET),
 				   iph->ihl * 4,
 				   sizeof(*iph) + sizeof(struct tcphdr));
@@ -220,7 +227,7 @@ tcpmss_tg6(struct sk_buff *skb, const struct xt_action_param *par)
 	tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr, &frag_off);
 	if (tcphoff < 0)
 		return NF_DROP;
-	ret = tcpmss_mangle_packet(skb, par->targinfo,
+	ret = tcpmss_mangle_packet(skb, par,
 				   tcpmss_reverse_mtu(skb, PF_INET6),
 				   tcphoff,
 				   sizeof(*ipv6h) + sizeof(struct tcphdr));
-- 
1.8.1.2


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

* [PATCH 083/145] ipvs: SCTP ports should be writable in ICMP packets
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (81 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 082/145] netfilter: xt_TCPMSS: Fix IPv6 default MSS too Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 084/145] tracing: Use current_uid() for critical time tracing Kamal Mostafa
                   ` (61 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Julian Anastasov, Simon Horman, Pablo Neira Ayuso, Luis Henriques

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

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

From: Julian Anastasov <ja@ssi.bg>

commit 06f3d7f973ec04290d86b7dd91b48d38d90433dc upstream.

Make sure that SCTP ports are writable when embedded in ICMP
from client, so that ip_vs_nat_icmp can translate them safely.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/netfilter/ipvs/ip_vs_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 85972e4..a9e07fe 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1458,7 +1458,8 @@ ignore_ipip:
 
 	/* do the statistics and put it back */
 	ip_vs_in_stats(cp, skb);
-	if (IPPROTO_TCP == cih->protocol || IPPROTO_UDP == cih->protocol)
+	if (IPPROTO_TCP == cih->protocol || IPPROTO_UDP == cih->protocol ||
+	    IPPROTO_SCTP == cih->protocol)
 		offset += 2 * sizeof(__u16);
 	verdict = ip_vs_icmp_xmit(skb, cp, pp, offset, hooknum, &ciph);
 
-- 
1.8.1.2


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

* [PATCH 084/145] tracing: Use current_uid() for critical time tracing
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (82 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 083/145] ipvs: SCTP ports should be writable in ICMP packets Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 085/145] ext4: fix overflow when counting used blocks on 32-bit architectures Kamal Mostafa
                   ` (60 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Luis Henriques

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

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

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

commit f17a5194859a82afe4164e938b92035b86c55794 upstream.

The irqsoff tracer records the max time that interrupts are disabled.
There are hooks in the assembly code that calls back into the tracer when
interrupts are disabled or enabled.

When they are enabled, the tracer checks if the amount of time they
were disabled is larger than the previous recorded max interrupts off
time. If it is, it creates a snapshot of the currently running trace
to store where the last largest interrupts off time was held and how
it happened.

During testing, this RCU lockdep dump appeared:

[ 1257.829021] ===============================
[ 1257.829021] [ INFO: suspicious RCU usage. ]
[ 1257.829021] 3.10.0-rc1-test+ #171 Tainted: G        W
[ 1257.829021] -------------------------------
[ 1257.829021] /home/rostedt/work/git/linux-trace.git/include/linux/rcupdate.h:780 rcu_read_lock() used illegally while idle!
[ 1257.829021]
[ 1257.829021] other info that might help us debug this:
[ 1257.829021]
[ 1257.829021]
[ 1257.829021] RCU used illegally from idle CPU!
[ 1257.829021] rcu_scheduler_active = 1, debug_locks = 0
[ 1257.829021] RCU used illegally from extended quiescent state!
[ 1257.829021] 2 locks held by trace-cmd/4831:
[ 1257.829021]  #0:  (max_trace_lock){......}, at: [<ffffffff810e2b77>] stop_critical_timing+0x1a3/0x209
[ 1257.829021]  #1:  (rcu_read_lock){.+.+..}, at: [<ffffffff810dae5a>] __update_max_tr+0x88/0x1ee
[ 1257.829021]
[ 1257.829021] stack backtrace:
[ 1257.829021] CPU: 3 PID: 4831 Comm: trace-cmd Tainted: G        W    3.10.0-rc1-test+ #171
[ 1257.829021] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007
[ 1257.829021]  0000000000000001 ffff880065f49da8 ffffffff8153dd2b ffff880065f49dd8
[ 1257.829021]  ffffffff81092a00 ffff88006bd78680 ffff88007add7500 0000000000000003
[ 1257.829021]  ffff88006bd78680 ffff880065f49e18 ffffffff810daebf ffffffff810dae5a
[ 1257.829021] Call Trace:
[ 1257.829021]  [<ffffffff8153dd2b>] dump_stack+0x19/0x1b
[ 1257.829021]  [<ffffffff81092a00>] lockdep_rcu_suspicious+0x109/0x112
[ 1257.829021]  [<ffffffff810daebf>] __update_max_tr+0xed/0x1ee
[ 1257.829021]  [<ffffffff810dae5a>] ? __update_max_tr+0x88/0x1ee
[ 1257.829021]  [<ffffffff811002b9>] ? user_enter+0xfd/0x107
[ 1257.829021]  [<ffffffff810dbf85>] update_max_tr_single+0x11d/0x12d
[ 1257.829021]  [<ffffffff811002b9>] ? user_enter+0xfd/0x107
[ 1257.829021]  [<ffffffff810e2b15>] stop_critical_timing+0x141/0x209
[ 1257.829021]  [<ffffffff8109569a>] ? trace_hardirqs_on+0xd/0xf
[ 1257.829021]  [<ffffffff811002b9>] ? user_enter+0xfd/0x107
[ 1257.829021]  [<ffffffff810e3057>] time_hardirqs_on+0x2a/0x2f
[ 1257.829021]  [<ffffffff811002b9>] ? user_enter+0xfd/0x107
[ 1257.829021]  [<ffffffff8109550c>] trace_hardirqs_on_caller+0x16/0x197
[ 1257.829021]  [<ffffffff8109569a>] trace_hardirqs_on+0xd/0xf
[ 1257.829021]  [<ffffffff811002b9>] user_enter+0xfd/0x107
[ 1257.829021]  [<ffffffff810029b4>] do_notify_resume+0x92/0x97
[ 1257.829021]  [<ffffffff8154bdca>] int_signal+0x12/0x17

What happened was entering into the user code, the interrupts were enabled
and a max interrupts off was recorded. The trace buffer was saved along with
various information about the task: comm, pid, uid, priority, etc.

The uid is recorded with task_uid(tsk). But this is a macro that uses rcu_read_lock()
to retrieve the data, and this happened to happen where RCU is blind (user_enter).

As only the preempt and irqs off tracers can have this happen, and they both
only have the tsk == current, if tsk == current, use current_uid() instead of
task_uid(), as current_uid() does not use RCU as only current can change its uid.

This fixes the RCU suspicious splat.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/trace.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 55a9d05..98937b6 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -682,7 +682,15 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
 
 	memcpy(max_data->comm, tsk->comm, TASK_COMM_LEN);
 	max_data->pid = tsk->pid;
-	max_data->uid = task_uid(tsk);
+	/*
+	 * If tsk == current, then use current_uid(), as that does not use
+	 * RCU. The irq tracer can be called out of RCU scope.
+	 */
+	if (tsk == current)
+		max_data->uid = current_uid();
+	else
+		max_data->uid = task_uid(tsk);
+
 	max_data->nice = tsk->static_prio - 20 - MAX_RT_PRIO;
 	max_data->policy = tsk->policy;
 	max_data->rt_priority = tsk->rt_priority;
-- 
1.8.1.2


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

* [PATCH 085/145] ext4: fix overflow when counting used blocks on 32-bit architectures
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (83 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 084/145] tracing: Use current_uid() for critical time tracing Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 086/145] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs Kamal Mostafa
                   ` (59 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Luis Henriques

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

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

From: Jan Kara <jack@suse.cz>

commit 8af8eecc1331dbf5e8c662022272cf667e213da5 upstream.

The arithmetics adding delalloc blocks to the number of used blocks in
ext4_getattr() can easily overflow on 32-bit archs as we first multiply
number of blocks by blocksize and then divide back by 512. Make the
arithmetics more clever and also use proper type (unsigned long long
instead of unsigned long).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c0fbd96..1ec8761 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4523,7 +4523,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
 		 struct kstat *stat)
 {
 	struct inode *inode;
-	unsigned long delalloc_blocks;
+	unsigned long long delalloc_blocks;
 
 	inode = dentry->d_inode;
 	generic_fillattr(inode, stat);
@@ -4541,7 +4541,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
 	delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
 				EXT4_I(inode)->i_reserved_data_blocks);
 
-	stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
+	stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits-9);
 	return 0;
 }
 
-- 
1.8.1.2


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

* [PATCH 086/145] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (84 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 085/145] ext4: fix overflow when counting used blocks on 32-bit architectures Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:46 ` [PATCH 087/145] ext4: fix overflows in SEEK_HOLE, SEEK_DATA implementations Kamal Mostafa
                   ` (58 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Luis Henriques

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

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

From: Jan Kara <jack@suse.cz>

commit a60697f411eb365fb09e639e6f183fe33d1eb796 upstream.

On 32-bit architectures with 32-bit sector_t computation of data offset
in ext4_xattr_fiemap() can overflow resulting in reporting bogus data
location. Fix the problem by typing block number to proper type before
shifting.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/extents.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 4d315a0..a5ce6ce 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4618,7 +4618,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
 		error = ext4_get_inode_loc(inode, &iloc);
 		if (error)
 			return error;
-		physical = iloc.bh->b_blocknr << blockbits;
+		physical = (__u64)iloc.bh->b_blocknr << blockbits;
 		offset = EXT4_GOOD_OLD_INODE_SIZE +
 				EXT4_I(inode)->i_extra_isize;
 		physical += offset;
@@ -4626,7 +4626,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
 		flags |= FIEMAP_EXTENT_DATA_INLINE;
 		brelse(iloc.bh);
 	} else { /* external block */
-		physical = EXT4_I(inode)->i_file_acl << blockbits;
+		physical = (__u64)EXT4_I(inode)->i_file_acl << blockbits;
 		length = inode->i_sb->s_blocksize;
 	}
 
-- 
1.8.1.2


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

* [PATCH 087/145] ext4: fix overflows in SEEK_HOLE, SEEK_DATA implementations
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (85 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 086/145] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs Kamal Mostafa
@ 2013-07-17 22:46 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 088/145] ext4: fix data offset overflow on 32-bit archs in ext4_inline_data_fiemap() Kamal Mostafa
                   ` (57 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:46 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Luis Henriques

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

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

From: Jan Kara <jack@suse.cz>

commit e7293fd146846e2a44d29e0477e0860c60fb856b upstream.

ext4_lblk_t is just u32 so multiplying it by blocksize can easily
overflow for files larger than 4 GB. Fix that by properly typing the
block offsets before shifting.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
[ luis: backported to 3.8: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/file.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 405565a..216a633 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -311,7 +311,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
 	blkbits = inode->i_sb->s_blocksize_bits;
 	startoff = *offset;
 	lastoff = startoff;
-	endoff = (map->m_lblk + map->m_len) << blkbits;
+	endoff = (loff_t)(map->m_lblk + map->m_len) << blkbits;
 
 	index = startoff >> PAGE_CACHE_SHIFT;
 	end = endoff >> PAGE_CACHE_SHIFT;
@@ -456,7 +456,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
 		ret = ext4_map_blocks(NULL, inode, &map, 0);
 		if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
 			if (last != start)
-				dataoff = last << blkbits;
+				dataoff = (loff_t)last << blkbits;
 			break;
 		}
 
@@ -469,7 +469,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
 		if (last >= es.start &&
 		    last < es.start + es.len) {
 			if (last != start)
-				dataoff = last << blkbits;
+				dataoff = (loff_t)last << blkbits;
 			break;
 		}
 
@@ -487,7 +487,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
 		}
 
 		last++;
-		dataoff = last << blkbits;
+		dataoff = (loff_t)last << blkbits;
 	} while (last <= end);
 
 	mutex_unlock(&inode->i_mutex);
@@ -541,7 +541,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
 		ret = ext4_map_blocks(NULL, inode, &map, 0);
 		if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
 			last += ret;
-			holeoff = last << blkbits;
+			holeoff = (loff_t)last << blkbits;
 			continue;
 		}
 
@@ -554,7 +554,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
 		if (last >= es.start &&
 		    last < es.start + es.len) {
 			last = es.start + es.len;
-			holeoff = last << blkbits;
+			holeoff = (loff_t)last << blkbits;
 			continue;
 		}
 
@@ -569,7 +569,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
 							      &map, &holeoff);
 			if (!unwritten) {
 				last += ret;
-				holeoff = last << blkbits;
+				holeoff = (loff_t)last << blkbits;
 				continue;
 			}
 		}
-- 
1.8.1.2


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

* [PATCH 088/145] ext4: fix data offset overflow on 32-bit archs in ext4_inline_data_fiemap()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (86 preceding siblings ...)
  2013-07-17 22:46 ` [PATCH 087/145] ext4: fix overflows in SEEK_HOLE, SEEK_DATA implementations Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets Kamal Mostafa
                   ` (56 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jan Kara, Theodore Ts'o, Luis Henriques

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

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

From: Jan Kara <jack@suse.cz>

commit eaf3793728d07d995f1e74250b2d0005f7ae98b5 upstream.

On 32-bit archs when sector_t is defined as 32-bit the logic computing
data offset in ext4_inline_data_fiemap(). Fix that by properly typing
the shifted value.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/ext4/inline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 93a3408..f33fcb6 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1702,7 +1702,7 @@ int ext4_inline_data_fiemap(struct inode *inode,
 	if (error)
 		goto out;
 
-	physical = iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;
+	physical = (__u64)iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;
 	physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
 	physical += offsetof(struct ext4_inode, i_block);
 	length = i_size_read(inode);
-- 
1.8.1.2


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

* [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (87 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 088/145] ext4: fix data offset overflow on 32-bit archs in ext4_inline_data_fiemap() Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-18  8:02   ` Thomas Backlund
  2013-07-17 22:47 ` [PATCH 090/145] dma: tegra: avoid channel lock up after free Kamal Mostafa
                   ` (55 subsequent siblings)
  144 siblings, 1 reply; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Neil Horman, Prarit Bhargava, Don Zickus, Don Dutile,
	Bjorn Helgaas, Asit Mallick, David Woodhouse, linux-pci,
	Joerg Roedel, Konrad Rzeszutek Wilk, Arkadiusz Miśkiewicz,
	Luis Henriques

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

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

From: Neil Horman <nhorman@tuxdriver.com>

commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 upstream.

A few years back intel published a spec update:
http://www.intel.com/content/dam/doc/specification-update/5520-and-5500-chipset-ioh-specification-update.pdf

For the 5520 and 5500 chipsets which contained an errata (specificially errata
53), which noted that these chipsets can't properly do interrupt remapping, and
as a result the recommend that interrupt remapping be disabled in bios.  While
many vendors have a bios update to do exactly that, not all do, and of course
not all users update their bios to a level that corrects the problem.  As a
result, occasionally interrupts can arrive at a cpu even after affinity for that
interrupt has be moved, leading to lost or spurrious interrupts (usually
characterized by the message:
kernel: do_IRQ: 7.71 No irq handler for vector (irq -1)

There have been several incidents recently of people seeing this error, and
investigation has shown that they have system for which their BIOS level is such
that this feature was not properly turned off.  As such, it would be good to
give them a reminder that their systems are vulnurable to this problem.  For
details of those that reported the problem, please see:
https://bugzilla.redhat.com/show_bug.cgi?id=887006

[ Joerg: Removed CONFIG_IRQ_REMAP ifdef from early-quirks.c ]

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Prarit Bhargava <prarit@redhat.com>
CC: Don Zickus <dzickus@redhat.com>
CC: Don Dutile <ddutile@redhat.com>
CC: Bjorn Helgaas <bhelgaas@google.com>
CC: Asit Mallick <asit.k.mallick@intel.com>
CC: David Woodhouse <dwmw2@infradead.org>
CC: linux-pci@vger.kernel.org
CC: Joerg Roedel <joro@8bytes.org>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/include/asm/irq_remapping.h |  2 ++
 arch/x86/kernel/early-quirks.c       | 20 ++++++++++++++++++++
 drivers/iommu/intel_irq_remapping.c  | 10 ++++++++++
 drivers/iommu/irq_remapping.c        |  6 ++++++
 drivers/iommu/irq_remapping.h        |  2 ++
 5 files changed, 40 insertions(+)

diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 5fb9bbb..38477e6 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -30,6 +30,7 @@ extern int irq_remapping_enabled;
 
 extern void setup_irq_remapping_ops(void);
 extern int irq_remapping_supported(void);
+extern void set_irq_remapping_broken(void);
 extern int irq_remapping_prepare(void);
 extern int irq_remapping_enable(void);
 extern void irq_remapping_disable(void);
@@ -58,6 +59,7 @@ extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
 
 static inline void setup_irq_remapping_ops(void) { }
 static inline int irq_remapping_supported(void) { return 0; }
+static inline void set_irq_remapping_broken(void) { }
 static inline int irq_remapping_prepare(void) { return -ENODEV; }
 static inline int irq_remapping_enable(void) { return -ENODEV; }
 static inline void irq_remapping_disable(void) { }
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 3755ef4..94ab6b9 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -18,6 +18,7 @@
 #include <asm/apic.h>
 #include <asm/iommu.h>
 #include <asm/gart.h>
+#include <asm/irq_remapping.h>
 
 static void __init fix_hypertransport_config(int num, int slot, int func)
 {
@@ -192,6 +193,21 @@ static void __init ati_bugs_contd(int num, int slot, int func)
 }
 #endif
 
+static void __init intel_remapping_check(int num, int slot, int func)
+{
+	u8 revision;
+
+	revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID);
+
+	/*
+	 * Revision 0x13 of this chipset supports irq remapping
+	 * but has an erratum that breaks its behavior, flag it as such
+	 */
+	if (revision == 0x13)
+		set_irq_remapping_broken();
+
+}
+
 #define QFLAG_APPLY_ONCE 	0x1
 #define QFLAG_APPLIED		0x2
 #define QFLAG_DONE		(QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -221,6 +237,10 @@ static struct chipset early_qrk[] __initdata = {
 	  PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
 	  PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
+	{ PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST,
+	  PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
+	{ PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST,
+	  PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
 	{}
 };
 
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index af8904d..4c9379c 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -509,6 +509,16 @@ static int __init intel_irq_remapping_supported(void)
 
 	if (disable_irq_remap)
 		return 0;
+	if (irq_remap_broken) {
+		WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
+			   "This system BIOS has enabled interrupt remapping\n"
+			   "on a chipset that contains an erratum making that\n"
+			   "feature unstable.  To maintain system stability\n"
+			   "interrupt remapping is being disabled.  Please\n"
+			   "contact your BIOS vendor for an update\n");
+		disable_irq_remap = 1;
+		return 0;
+	}
 
 	if (!dmar_ir_support())
 		return 0;
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index faf85d6..018382c 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -12,6 +12,7 @@
 int irq_remapping_enabled;
 
 int disable_irq_remap;
+int irq_remap_broken;
 int disable_sourceid_checking;
 int no_x2apic_optout;
 
@@ -58,6 +59,11 @@ void __init setup_irq_remapping_ops(void)
 #endif
 }
 
+void set_irq_remapping_broken(void)
+{
+	irq_remap_broken = 1;
+}
+
 int irq_remapping_supported(void)
 {
 	if (disable_irq_remap)
diff --git a/drivers/iommu/irq_remapping.h b/drivers/iommu/irq_remapping.h
index 95363ac..23bdea1 100644
--- a/drivers/iommu/irq_remapping.h
+++ b/drivers/iommu/irq_remapping.h
@@ -32,6 +32,7 @@ struct pci_dev;
 struct msi_msg;
 
 extern int disable_irq_remap;
+extern int irq_remap_broken;
 extern int disable_sourceid_checking;
 extern int no_x2apic_optout;
 
@@ -88,6 +89,7 @@ extern struct irq_remap_ops amd_iommu_irq_ops;
 
 #define irq_remapping_enabled 0
 #define disable_irq_remap     1
+#define irq_remap_broken      0
 
 #endif /* CONFIG_IRQ_REMAP */
 
-- 
1.8.1.2


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

* [PATCH 090/145] dma: tegra: avoid channel lock up after free
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (88 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 091/145] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware Kamal Mostafa
                   ` (54 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Osipenko, Vinod Koul, Jonghwan Choi, Luis Henriques

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

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

From: Dmitry Osipenko <digetx@gmail.com>

commit 7bdc1e272a471062e8f310137c896e2355b46d13 upstream.

Lock scenario: Channel 1 was allocated and prepared as slave_sg, used and freed.
Now preparation of cyclic dma on channel 1 will fail with err "DMA configuration
conflict" because tdc->isr_handler still setted to handle_once_dma_done.

This happens because tegra_dma_abort_all() won't be called on channel freeing
if pending list is empty and channel not busy. We need to clear isr_handler
on channel freeing to avoid locking.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/dma/tegra20-apb-dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 3cad856..b9e32fe 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1158,6 +1158,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
 	list_splice_init(&tdc->free_dma_desc, &dma_desc_list);
 	INIT_LIST_HEAD(&tdc->cb_desc);
 	tdc->config_init = false;
+	tdc->isr_handler = NULL;
 	spin_unlock_irqrestore(&tdc->lock, flags);
 
 	while (!list_empty(&dma_desc_list)) {
-- 
1.8.1.2


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

* [PATCH 091/145] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (89 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 090/145] dma: tegra: avoid channel lock up after free Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 092/145] printk: Fix rq->lock vs logbuf_lock unlock lock inversion Kamal Mostafa
                   ` (53 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Jens Axboe, Andrew Morton, Linus Torvalds, Luis Henriques

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

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

From: Jonathan Salwan <jonathan.salwan@gmail.com>

commit 542db01579fbb7ea7d1f7bb9ddcef1559df660b2 upstream.

In drivers/cdrom/cdrom.c mmc_ioctl_cdrom_read_data() allocates a memory
area with kmalloc in line 2885.

  2885         cgc->buffer = kmalloc(blocksize, GFP_KERNEL);
  2886         if (cgc->buffer == NULL)
  2887                 return -ENOMEM;

In line 2908 we can find the copy_to_user function:

  2908         if (!ret && copy_to_user(arg, cgc->buffer, blocksize))

The cgc->buffer is never cleaned and initialized before this function.
If ret = 0 with the previous basic block, it's possible to display some
memory bytes in kernel space from userspace.

When we read a block from the disk it normally fills the ->buffer but if
the drive is malfunctioning there is a chance that it would only be
partially filled.  The result is an leak information to userspace.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jens Axboe <axboe@kernel.dk>
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>
---
 drivers/cdrom/cdrom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index d620b44..8a3aff7 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2882,7 +2882,7 @@ static noinline int mmc_ioctl_cdrom_read_data(struct cdrom_device_info *cdi,
 	if (lba < 0)
 		return -EINVAL;
 
-	cgc->buffer = kmalloc(blocksize, GFP_KERNEL);
+	cgc->buffer = kzalloc(blocksize, GFP_KERNEL);
 	if (cgc->buffer == NULL)
 		return -ENOMEM;
 
-- 
1.8.1.2


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

* [PATCH 092/145] printk: Fix rq->lock vs logbuf_lock unlock lock inversion
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (90 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 091/145] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 093/145] charger-manager: Ensure event is not used as format string Kamal Mostafa
                   ` (52 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: ybu, Peter Zijlstra, Thomas Gleixner, Kamal Mostafa

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

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

From: "Bu, Yitian" <ybu@qti.qualcomm.com>

commit dbda92d16f8655044e082930e4e9d244b87fde77 upstream.

commit 07354eb1a74d1 ("locking printk: Annotate logbuf_lock as raw")
reintroduced a lock inversion problem which was fixed in commit
0b5e1c5255 ("printk: Release console_sem after logbuf_lock"). This
happened probably when fixing up patch rejects.

Restore the ordering and unlock logbuf_lock before releasing
console_sem.

Signed-off-by: ybu <ybu@qti.qualcomm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/E807E903FE6CBE4D95E420FBFCC273B827413C@nasanexd01h.na.qualcomm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 0f0ac58..37425c3 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1367,9 +1367,9 @@ static int console_trylock_for_printk(unsigned int cpu)
 		}
 	}
 	logbuf_cpu = UINT_MAX;
+	raw_spin_unlock(&logbuf_lock);
 	if (wake)
 		up(&console_sem);
-	raw_spin_unlock(&logbuf_lock);
 	return retval;
 }
 
-- 
1.8.1.2


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

* [PATCH 093/145] charger-manager: Ensure event is not used as format string
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (91 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 092/145] printk: Fix rq->lock vs logbuf_lock unlock lock inversion Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 094/145] drm/radeon: add backlight quirk for hybrid mac Kamal Mostafa
                   ` (51 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kees Cook, Anton Vorontsov, David Woodhouse, Anton Vorontsov,
	Kamal Mostafa

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

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

From: Kees Cook <keescook@chromium.org>

commit 3594f4c0d7bc51e3a7e6d73c44e368ae079e42f3 upstream.

The exposed interface for cm_notify_event() could result in the event msg
string being parsed as a format string. Make sure it is only used as a
literal string.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/power/charger-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 6ba047f..002df70 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -450,7 +450,7 @@ static void uevent_notify(struct charger_manager *cm, const char *event)
 	strncpy(env_str, event, UEVENT_BUF_SIZE);
 	kobject_uevent(&cm->dev->kobj, KOBJ_CHANGE);
 
-	dev_info(cm->dev, event);
+	dev_info(cm->dev, "%s", event);
 }
 
 /**
-- 
1.8.1.2


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

* [PATCH 094/145] drm/radeon: add backlight quirk for hybrid mac
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (92 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 093/145] charger-manager: Ensure event is not used as format string Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 095/145] b43: ensue that BCMA is "y" when B43 is "y" Kamal Mostafa
                   ` (50 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

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

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

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

commit 80101790670385a85aca35ecae4b89e3f2fceecc upstream.

Mac laptops with multiple GPUs apparently use the gmux
driver for backlight control.  Don't register a radeon
backlight interface.  We may need to add other pci ids
for other hybrid mac laptops.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=65377

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 6cf2b52..8efd7e2 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -186,6 +186,13 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
 	u8 backlight_level;
 	char bl_name[16];
 
+	/* Mac laptops with multiple GPUs use the gmux driver for backlight
+	 * so don't register a backlight device
+	 */
+	if ((rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) &&
+	    (rdev->pdev->device == 0x6741))
+		return;
+
 	if (!radeon_encoder->enc_priv)
 		return;
 
-- 
1.8.1.2


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

* [PATCH 095/145] b43: ensue that BCMA is "y" when B43 is "y"
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (93 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 094/145] drm/radeon: add backlight quirk for hybrid mac Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 096/145] ath9k_hw: Assign default xlna config for AR9485 Kamal Mostafa
                   ` (49 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hauke Mehrtens, John W. Linville, Kamal Mostafa

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

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

From: Hauke Mehrtens <hauke@hauke-m.de>

commit 693026ef2e751fd94d2e6c71028e68343cc875d5 upstream.

When b43 gets build into the kernel and it should use bcma we have to
ensure that bcma was also build into the kernel and not as a module.
In this patch this is also done for SSB, although you can not
build b43 without ssb support for now.

This fixes a build problem reported by Randy Dunlap in
5187EB95.2060605@infradead.org

Reported-By: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/b43/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 7a28d21..9c927be 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -28,7 +28,7 @@ config B43
 
 config B43_BCMA
 	bool "Support for BCMA bus"
-	depends on B43 && BCMA
+	depends on B43 && (BCMA = y || BCMA = B43)
 	default y
 
 config B43_BCMA_EXTRA
@@ -39,7 +39,7 @@ config B43_BCMA_EXTRA
 
 config B43_SSB
 	bool
-	depends on B43 && SSB
+	depends on B43 && (SSB = y || SSB = B43)
 	default y
 
 # Auto-select SSB PCI-HOST support, if possible
-- 
1.8.1.2


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

* [PATCH 096/145] ath9k_hw: Assign default xlna config for AR9485
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (94 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 095/145] b43: ensue that BCMA is "y" when B43 is "y" Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 097/145] ath9k: Do not assign noise for NULL caldata Kamal Mostafa
                   ` (48 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sujith Manoharan, John W. Linville, Kamal Mostafa

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

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

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

commit 30d5b709da23f4ab9836c7f66d2d2e780a69cf12 upstream.

For AR9485 boards with XLNA, the default gpio config
is not set correctly, fix this.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 8 ++++++--
 drivers/net/wireless/ath/ath9k/ar9003_phy.h    | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 562186c..92e761a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3563,14 +3563,18 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
 {
 	struct ath9k_hw_capabilities *pCap = &ah->caps;
 	int chain;
-	u32 regval;
+	u32 regval, value;
 	static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = {
 			AR_PHY_SWITCH_CHAIN_0,
 			AR_PHY_SWITCH_CHAIN_1,
 			AR_PHY_SWITCH_CHAIN_2,
 	};
 
-	u32 value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
+	if (AR_SREV_9485(ah) && (ar9003_hw_get_rx_gain_idx(ah) == 0))
+		ath9k_hw_cfg_output(ah, AR9300_EXT_LNA_CTL_GPIO_AR9485,
+				    AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED);
+
+	value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
 
 	if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
 		REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index 1079562..6bf7652 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -351,6 +351,8 @@
 
 #define AR_PHY_CCA_NOM_VAL_9330_2GHZ          -118
 
+#define AR9300_EXT_LNA_CTL_GPIO_AR9485 9
+
 /*
  * AGC Field Definitions
  */
-- 
1.8.1.2


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

* [PATCH 097/145] ath9k: Do not assign noise for NULL caldata
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (95 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 096/145] ath9k_hw: Assign default xlna config for AR9485 Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 098/145] iwlwifi: pcie: fix race in queue unmapping Kamal Mostafa
                   ` (47 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sujith Manoharan, John W. Linville, Kamal Mostafa

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

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

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

commit d3bcb7b24bbf09fde8405770e676fe0c11c79662 upstream.

ah->noise is maintained globally and not per-channel. This
is updated in the reset() routine after the NF history has been
filled for the *current channel*, just before switching to
the new channel. There is no need to do it inside getnf(), since
ah->noise must contain a value for the new channel.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath9k/calib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 1e85085..a393e87 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -389,7 +389,6 @@ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
 
 	if (!caldata) {
 		chan->noisefloor = nf;
-		ah->noise = ath9k_hw_getchan_noise(ah, chan);
 		return false;
 	}
 
-- 
1.8.1.2


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

* [PATCH 098/145] iwlwifi: pcie: fix race in queue unmapping
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (96 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 097/145] ath9k: Do not assign noise for NULL caldata Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 099/145] iwlwifi: pcie: wake the queue if stopped when being unmapped Kamal Mostafa
                   ` (46 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Emmanuel Grumbach, Johannes Berg, Kamal Mostafa

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

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

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

commit b967613d7e7c7bad176f5627c55e2d8c5aa2480e upstream.

When a queue is disabled, it frees all its entries. Later,
the op_mode might still get notifications from the firmware
that triggers to free entries in the tx queue. The transport
should be prepared for these races and know to ignore
reclaim calls on queues that have been disabled and whose
entries have been freed.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/iwlwifi/pcie/tx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index d760da9..c93a7cd 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -574,9 +574,12 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id)
 
 	spin_lock_bh(&txq->lock);
 	while (q->write_ptr != q->read_ptr) {
+		IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n",
+				   txq_id, q->read_ptr);
 		iwl_pcie_txq_free_tfd(trans, txq, dma_dir);
 		q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
 	}
+	txq->active = false;
 	spin_unlock_bh(&txq->lock);
 }
 
@@ -907,6 +910,12 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
 
 	spin_lock(&txq->lock);
 
+	if (!txq->active) {
+		IWL_DEBUG_TX_QUEUES(trans, "Q %d inactive - ignoring idx %d\n",
+				    txq_id, ssn);
+		goto out;
+	}
+
 	if (txq->q.read_ptr == tfd_num)
 		goto out;
 
@@ -1083,6 +1092,7 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
 		       (fifo << SCD_QUEUE_STTS_REG_POS_TXF) |
 		       (1 << SCD_QUEUE_STTS_REG_POS_WSL) |
 		       SCD_QUEUE_STTS_REG_MSK);
+	trans_pcie->txq[txq_id].active = true;
 	IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d on FIFO %d WrPtr: %d\n",
 			    txq_id, fifo, ssn & 0xff);
 }
-- 
1.8.1.2


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

* [PATCH 099/145] iwlwifi: pcie: wake the queue if stopped when being unmapped
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (97 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 098/145] iwlwifi: pcie: fix race in queue unmapping Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 100/145] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND Kamal Mostafa
                   ` (45 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Emmanuel Grumbach, Johannes Berg, Kamal Mostafa

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

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

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

commit 8a487b1a7432b20ff3f82387a8ce7555a964b44e upstream.

When the queue is unmapped while it was so loaded that
mac80211's was stopped, we need to wake the queue after
having freed all the packets in the queue.
Not doing so can result in weird stuff like:

* run lots of traffic (mac80211's queue gets stopped)
* RFKILL
* de-assert RFKILL
* no traffic

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

diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index c93a7cd..e4345e3 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -581,6 +581,9 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id)
 	}
 	txq->active = false;
 	spin_unlock_bh(&txq->lock);
+
+	/* just in case - this queue may have been stopped */
+	iwl_wake_queue(trans, txq);
 }
 
 /*
-- 
1.8.1.2


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

* [PATCH 100/145] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (98 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 099/145] iwlwifi: pcie: wake the queue if stopped when being unmapped Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 101/145] [media] media: dmxdev: remove dvb_ringbuffer_flush() on writer side Kamal Mostafa
                   ` (44 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, Tobias Kluge, John W. Linville, Kamal Mostafa

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

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

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

commit c4d827c5ccc3a49227dbf9d4b248a2e86f388023 upstream.

This is a new device for this driver.

Reported-by: Tobias Kluge <zielscheibe@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Tobias Kluge <zielscheibe@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index b450931..5212ad2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -358,6 +358,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
 	{RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
 	{RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
 	{RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
+	{RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
 	{RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/
 	{}
 };
-- 
1.8.1.2


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

* [PATCH 101/145] [media] media: dmxdev: remove dvb_ringbuffer_flush() on writer side
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (99 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 100/145] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 102/145] MIPS: Octeon: Don't clobber bootloader data structures Kamal Mostafa
                   ` (43 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Soeren Moch, Mauro Carvalho Chehab, Kamal Mostafa

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

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

From: Soeren Moch <smoch@web.de>

commit 414abbd2cd4c2618895f02ed3a76ec6647281436 upstream.

In dvb_ringbuffer lock-less synchronizationof reader and writer threads is done
with separateread and write pointers. Sincedvb_ringbuffer_flush() modifies the
read pointer, this function must not be called from the writer thread.
This patch removes the dvb_ringbuffer_flush() calls in the dmxdev ringbuffer
write functions, this fixes Oopses "Unable to handle kernel paging request"
I could observe for the call chaindvb_demux_read ->dvb_dmxdev_buffer_read ->
dvb_ringbuffer_read_user -> __copy_to_user (the reader side of the ringbuffer).
The flush calls at the write side are not necessary anyway since ringbuffer_flush
is also called in dvb_dmxdev_buffer_read() when an error condition is set in the
ringbuffer.
This patch should also be applied to stable kernels.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/dvb-core/dmxdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
index d81dbb2..f847c9e 100644
--- a/drivers/media/dvb-core/dmxdev.c
+++ b/drivers/media/dvb-core/dmxdev.c
@@ -377,10 +377,8 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
 		ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer2,
 					      buffer2_len);
 	}
-	if (ret < 0) {
-		dvb_ringbuffer_flush(&dmxdevfilter->buffer);
+	if (ret < 0)
 		dmxdevfilter->buffer.error = ret;
-	}
 	if (dmxdevfilter->params.sec.flags & DMX_ONESHOT)
 		dmxdevfilter->state = DMXDEV_STATE_DONE;
 	spin_unlock(&dmxdevfilter->dev->lock);
@@ -416,10 +414,8 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
 	ret = dvb_dmxdev_buffer_write(buffer, buffer1, buffer1_len);
 	if (ret == buffer1_len)
 		ret = dvb_dmxdev_buffer_write(buffer, buffer2, buffer2_len);
-	if (ret < 0) {
-		dvb_ringbuffer_flush(buffer);
+	if (ret < 0)
 		buffer->error = ret;
-	}
 	spin_unlock(&dmxdevfilter->dev->lock);
 	wake_up(&buffer->queue);
 	return 0;
-- 
1.8.1.2


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

* [PATCH 102/145] MIPS: Octeon: Don't clobber bootloader data structures.
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (100 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 101/145] [media] media: dmxdev: remove dvb_ringbuffer_flush() on writer side Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 103/145] iommu/amd: Only unmap large pages from the first pte Kamal Mostafa
                   ` (42 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Daney, linux-mips, Ralf Baechle, Kamal Mostafa

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

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

From: David Daney <david.daney@cavium.com>

commit d949b4fe6d23dd92b5fa48cbf7af90ca32beed2e upstream.

Commit abe77f90dc (MIPS: Octeon: Add kexec and kdump support) added a
bootmem region for the kernel image itself.  The problem is that this
is rounded up to a 0x100000 boundary, which is memory that may not be
owned by the kernel.  Depending on the kernel's configuration based
size, this 'extra' memory may contain data passed from the bootloader
to the kernel itself, which if clobbered makes the kernel crash in
various ways.

The fix: Quit rounding the size up, so that we only use memory
assigned to the kernel.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5449/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/mips/cavium-octeon/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index d7e0a09..1271047 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -990,7 +990,7 @@ void __init plat_mem_setup(void)
 	cvmx_bootmem_unlock();
 	/* Add the memory region for the kernel. */
 	kernel_start = (unsigned long) _text;
-	kernel_size = ALIGN(_end - _text, 0x100000);
+	kernel_size = _end - _text;
 
 	/* Adjust for physical offset. */
 	kernel_start &= ~0xffffffff80000000ULL;
-- 
1.8.1.2


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

* [PATCH 103/145] iommu/amd: Only unmap large pages from the first pte
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (101 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 102/145] MIPS: Octeon: Don't clobber bootloader data structures Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 104/145] rt2x00: read 5GHz TX power values from the correct offset Kamal Mostafa
                   ` (41 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alex Williamson, Joerg Roedel, Kamal Mostafa

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

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

From: Alex Williamson <alex.williamson@redhat.com>

commit 60d0ca3cfd199b6612bbbbf4999a3470dad38bb1 upstream.

If we use a large mapping, the expectation is that only unmaps from
the first pte in the superpage are supported.  Unmaps from offsets
into the superpage should fail (ie. return zero sized unmap).  In the
current code, unmapping from an offset clears the size of the full
mapping starting from an offset.  For instance, if we map a 16k
physically contiguous range at IOVA 0x0 with a large page, then
attempt to unmap 4k at offset 12k, 4 ptes are cleared (12k - 28k) and
the unmap returns 16k unmapped.  This potentially incorrectly clears
valid mappings and confuses drivers like VFIO that use the unmap size
to release pinned pages.

Fix by refusing to unmap from offsets into the page.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/iommu/amd_iommu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 409b171..895902e6 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1508,6 +1508,10 @@ static unsigned long iommu_unmap_page(struct protection_domain *dom,
 
 			/* Large PTE found which maps this address */
 			unmap_size = PTE_PAGE_SIZE(*pte);
+
+			/* Only unmap from the first pte in the page */
+			if ((unmap_size - 1) & bus_addr)
+				break;
 			count      = PAGE_SIZE_PTE_COUNT(unmap_size);
 			for (i = 0; i < count; i++)
 				pte[i] = 0ULL;
@@ -1517,7 +1521,7 @@ static unsigned long iommu_unmap_page(struct protection_domain *dom,
 		unmapped += unmap_size;
 	}
 
-	BUG_ON(!is_power_of_2(unmapped));
+	BUG_ON(unmapped && !is_power_of_2(unmapped));
 
 	return unmapped;
 }
-- 
1.8.1.2


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

* [PATCH 104/145] rt2x00: read 5GHz TX power values from the correct offset
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (102 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 103/145] iommu/amd: Only unmap large pages from the first pte Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 105/145] rtlwifi: rtl8723ae: Fix typo in firmware names Kamal Mostafa
                   ` (40 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Gabor Juhos, John W. Linville, Kamal Mostafa

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

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

From: Gabor Juhos <juhosg@openwrt.org>

commit 0a6f3a8ebaf13407523c2c7d575b4ca2debd23ba upstream.

The current code uses the same index value both
for the channel information array and for the TX
power table. The index starts from 14, however the
index of the TX power table must start from zero.

Fix it, in order to get the correct TX power value
for a given channel.

The changes in rt61pci.c and rt73usb.c are compile
tested only.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/rt2x00/rt2800lib.c | 4 ++--
 drivers/net/wireless/rt2x00/rt61pci.c   | 3 ++-
 drivers/net/wireless/rt2x00/rt73usb.c   | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index e9a440f..4f6514a 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -5232,8 +5232,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
 
 		for (i = 14; i < spec->num_channels; i++) {
-			info[i].default_power1 = default_power1[i];
-			info[i].default_power2 = default_power2[i];
+			info[i].default_power1 = default_power1[i - 14];
+			info[i].default_power2 = default_power2[i - 14];
 		}
 	}
 
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index f95792c..8e4116b 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2822,7 +2822,8 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
 		for (i = 14; i < spec->num_channels; i++) {
 			info[i].max_power = MAX_TXPOWER;
-			info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
+			info[i].default_power1 =
+					TXPOWER_FROM_DEV(tx_power[i - 14]);
 		}
 	}
 
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 24eec66..7976eb9 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2167,7 +2167,8 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
 		for (i = 14; i < spec->num_channels; i++) {
 			info[i].max_power = MAX_TXPOWER;
-			info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
+			info[i].default_power1 =
+					TXPOWER_FROM_DEV(tx_power[i - 14]);
 		}
 	}
 
-- 
1.8.1.2


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

* [PATCH 105/145] rtlwifi: rtl8723ae: Fix typo in firmware names
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (103 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 104/145] rt2x00: read 5GHz TX power values from the correct offset Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 106/145] writeback: Fix periodic writeback after fs mount Kamal Mostafa
                   ` (39 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, John W. Linville, Kamal Mostafa

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

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

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

commit 73e088ed17c2880a963cc760a78af8a06d4a4d9d upstream.

The driver loads its firmware from files rtlwifi/rtl8723fw*.bin, but the
MODULE_FIRMWARE macros refer to rtlwifi/RTL8723aefw*.bin.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Axel Köllhofer <AxelKoellhofer@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/rtlwifi/rtl8723ae/sw.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index bb7cc90..2b2a522 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -251,7 +251,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
 	.bar_id = 2,
 	.write_readback = true,
 	.name = "rtl8723ae_pci",
-	.fw_name = "rtlwifi/rtl8723aefw.bin",
+	.fw_name = "rtlwifi/rtl8723fw.bin",
 	.ops = &rtl8723ae_hal_ops,
 	.mod_params = &rtl8723ae_mod_params,
 	.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
@@ -353,8 +353,8 @@ MODULE_AUTHOR("Realtek WlanFAE	<wlanfae@realtek.com>");
 MODULE_AUTHOR("Larry Finger	<Larry.Finger@lwfinger.net>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek 8723E 802.11n PCI wireless");
-MODULE_FIRMWARE("rtlwifi/rtl8723aefw.bin");
-MODULE_FIRMWARE("rtlwifi/rtl8723aefw_B.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8723fw.bin");
+MODULE_FIRMWARE("rtlwifi/rtl8723fw_B.bin");
 
 module_param_named(swenc, rtl8723ae_mod_params.sw_crypto, bool, 0444);
 module_param_named(debug, rtl8723ae_mod_params.debug, int, 0444);
-- 
1.8.1.2


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

* [PATCH 106/145] writeback: Fix periodic writeback after fs mount
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (104 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 105/145] rtlwifi: rtl8723ae: Fix typo in firmware names Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 107/145] drm/i915: Fix context sizes on HSW Kamal Mostafa
                   ` (38 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jan Kara, Jens Axboe, Kamal Mostafa

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

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

From: Jan Kara <jack@suse.cz>

commit a5faeaf9109578e65e1a32e2a3e76c8b47e7dcb6 upstream.

Code in blkdev.c moves a device inode to default_backing_dev_info when
the last reference to the device is put and moves the device inode back
to its bdi when the first reference is acquired. This includes moving to
wb.b_dirty list if the device inode is dirty. The code however doesn't
setup timer to wake corresponding flusher thread and while wb.b_dirty
list is non-empty __mark_inode_dirty() will not set it up either. Thus
periodic writeback is effectively disabled until a sync(2) call which can
lead to unexpected data loss in case of crash or power failure.

Fix the problem by setting up a timer for periodic writeback in case we
add the first dirty inode to wb.b_dirty list in bdev_inode_switch_bdi().

Reported-by: Bert De Jonghe <Bert.DeJonghe@amplidata.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/block_dev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 883dc49..33f984f 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -57,17 +57,24 @@ static void bdev_inode_switch_bdi(struct inode *inode,
 			struct backing_dev_info *dst)
 {
 	struct backing_dev_info *old = inode->i_data.backing_dev_info;
+	bool wakeup_bdi = false;
 
 	if (unlikely(dst == old))		/* deadlock avoidance */
 		return;
 	bdi_lock_two(&old->wb, &dst->wb);
 	spin_lock(&inode->i_lock);
 	inode->i_data.backing_dev_info = dst;
-	if (inode->i_state & I_DIRTY)
+	if (inode->i_state & I_DIRTY) {
+		if (bdi_cap_writeback_dirty(dst) && !wb_has_dirty_io(&dst->wb))
+			wakeup_bdi = true;
 		list_move(&inode->i_wb_list, &dst->wb.b_dirty);
+	}
 	spin_unlock(&inode->i_lock);
 	spin_unlock(&old->wb.list_lock);
 	spin_unlock(&dst->wb.list_lock);
+
+	if (wakeup_bdi)
+		bdi_wakeup_thread_delayed(dst);
 }
 
 /* Kill _all_ buffers and pagecache , dirty or not.. */
-- 
1.8.1.2


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

* [PATCH 107/145] drm/i915: Fix context sizes on HSW
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (105 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 106/145] writeback: Fix periodic writeback after fs mount Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 108/145] drm/i915: Only clear write-domains after a successful wait-seqno Kamal Mostafa
                   ` (37 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Widawsky, Daniel Vetter, Kamal Mostafa

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

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

From: Ben Widawsky <ben@bwidawsk.net>

commit a0de80a0e07032a111230ec92eca563f9d93648d upstream.

With updates to the spec, we can actually see the context layout, and
how many dwords are allocated. That table suggests we need 70720 bytes
per HW context. Rounded up, this is 18 pages. Looking at what lives
after the current 4 pages we use, I can't see too much important (mostly
it's d3d related), but there are a couple of things which look scary. I
am hopeful this can explain some of our odd HSW failures.

v2: Make the context only 17 pages. The power context space isn't used
ever, and execlists aren't used in our driver, making the actual total
66944 bytes.

v3: Add a comment to the code. (Jesse & Paulo)

Reported-by: "Azad, Vinit" <vinit.azad@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c |  2 +-
 drivers/gpu/drm/i915/i915_reg.h         | 15 +++++++--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index d8ac0a3..a80bba9 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -113,7 +113,7 @@ static int get_context_size(struct drm_device *dev)
 	case 7:
 		reg = I915_READ(GEN7_CXT_SIZE);
 		if (IS_HASWELL(dev))
-			ret = HSW_CXT_TOTAL_SIZE(reg) * 64;
+			ret = HSW_CXT_TOTAL_SIZE;
 		else
 			ret = GEN7_CXT_TOTAL_SIZE(reg) * 64;
 		break;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index ce70f0a..b7315e3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1523,14 +1523,13 @@
 					 GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \
 					 GEN7_CXT_GT1_SIZE(ctx_reg) + \
 					 GEN7_CXT_VFSTATE_SIZE(ctx_reg))
-#define HSW_CXT_POWER_SIZE(ctx_reg)	((ctx_reg >> 26) & 0x3f)
-#define HSW_CXT_RING_SIZE(ctx_reg)	((ctx_reg >> 23) & 0x7)
-#define HSW_CXT_RENDER_SIZE(ctx_reg)	((ctx_reg >> 15) & 0xff)
-#define HSW_CXT_TOTAL_SIZE(ctx_reg)	(HSW_CXT_POWER_SIZE(ctx_reg) + \
-					 HSW_CXT_RING_SIZE(ctx_reg) + \
-					 HSW_CXT_RENDER_SIZE(ctx_reg) + \
-					 GEN7_CXT_VFSTATE_SIZE(ctx_reg))
-
+/* Haswell does have the CXT_SIZE register however it does not appear to be
+ * valid. Now, docs explain in dwords what is in the context object. The full
+ * size is 70720 bytes, however, the power context and execlist context will
+ * never be saved (power context is stored elsewhere, and execlists don't work
+ * on HSW) - so the final size is 66944 bytes, which rounds to 17 pages.
+ */
+#define HSW_CXT_TOTAL_SIZE		(17 * PAGE_SIZE)
 
 /*
  * Overlay regs
-- 
1.8.1.2


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

* [PATCH 108/145] drm/i915: Only clear write-domains after a successful wait-seqno
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (106 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 107/145] drm/i915: Fix context sizes on HSW Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 109/145] nfsd4: fix decoding of compounds across page boundaries Kamal Mostafa
                   ` (36 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Wilson, Daniel Vetter, Kamal Mostafa

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

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

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

commit daa13e1ca587bc773c1aae415ed1af6554117bd4 upstream.

In the introduction of the non-blocking wait, I cut'n'pasted the wait
completion code from normal locked path. Unfortunately, this neglected
that the normal path returned early if the wait returned early. The
result is that read-only waits may return whilst the GPU is still
writing to the bo.

Fixes regression from
commit 3236f57a0162391f84b93f39fc1882c49a8998c7 [v3.7]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 24 09:35:09 2012 +0100

    drm/i915: Use a non-blocking wait for set-to-domain ioctl

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66163
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3b9d18b..80bc298 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1164,7 +1164,8 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj,
 	/* Manually manage the write flush as we may have not yet
 	 * retired the buffer.
 	 */
-	if (obj->last_write_seqno &&
+	if (ret == 0 &&
+	    obj->last_write_seqno &&
 	    i915_seqno_passed(seqno, obj->last_write_seqno)) {
 		obj->last_write_seqno = 0;
 		obj->base.write_domain &= ~I915_GEM_GPU_DOMAINS;
-- 
1.8.1.2


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

* [PATCH 109/145] nfsd4: fix decoding of compounds across page boundaries
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (107 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 108/145] drm/i915: Only clear write-domains after a successful wait-seqno Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 110/145] svcrpc: fix handling of too-short rpc's Kamal Mostafa
                   ` (35 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: J. Bruce Fields, Kamal Mostafa

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

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

From: "J. Bruce Fields" <bfields@redhat.com>

commit 247500820ebd02ad87525db5d9b199e5b66f6636 upstream.

A freebsd NFSv4.0 client was getting rare IO errors expanding a tarball.
A network trace showed the server returning BAD_XDR on the final getattr
of a getattr+write+getattr compound.  The final getattr started on a
page boundary.

I believe the Linux client ignores errors on the post-write getattr, and
that that's why we haven't seen this before.

Reported-by: Rick Macklem <rmacklem@uoguelph.ca>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/nfsd/nfs4xdr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index cd5e6c1..859d145 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -162,8 +162,8 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
 	 */
 	memcpy(p, argp->p, avail);
 	/* step to next page */
-	argp->p = page_address(argp->pagelist[0]);
 	argp->pagelist++;
+	argp->p = page_address(argp->pagelist[0]);
 	if (argp->pagelen < PAGE_SIZE) {
 		argp->end = argp->p + (argp->pagelen>>2);
 		argp->pagelen = 0;
-- 
1.8.1.2


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

* [PATCH 110/145] svcrpc: fix handling of too-short rpc's
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (108 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 109/145] nfsd4: fix decoding of compounds across page boundaries Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 111/145] svcrpc: don't error out on small tcp fragment Kamal Mostafa
                   ` (34 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: J. Bruce Fields, Kamal Mostafa

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

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

From: "J. Bruce Fields" <bfields@redhat.com>

commit cf3aa02cb4a0c5af5557dd47f15a08a7df33182a upstream.

If we detect that an rpc is too short, we abort and close the
connection.  Except, there's a bug here: we're leaving sk_datalen
nonzero without leaving any pages in the sk_pages array.  The most
likely result of the inconsistency is a subsequent crash in
svc_tcp_clear_pages.

Also demote the BUG_ON in svc_tcp_clear_pages to a WARN.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sunrpc/svcsock.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 0f679df..df74919 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -917,7 +917,10 @@ static void svc_tcp_clear_pages(struct svc_sock *svsk)
 	len = svsk->sk_datalen;
 	npages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	for (i = 0; i < npages; i++) {
-		BUG_ON(svsk->sk_pages[i] == NULL);
+		if (svsk->sk_pages[i] == NULL) {
+			WARN_ON_ONCE(1);
+			continue;
+		}
 		put_page(svsk->sk_pages[i]);
 		svsk->sk_pages[i] = NULL;
 	}
@@ -1092,8 +1095,10 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
 		goto err_noclose;
 	}
 
-	if (svc_sock_reclen(svsk) < 8)
+	if (svc_sock_reclen(svsk) < 8) {
+		svsk->sk_datalen = 0;
 		goto err_delete; /* client is nuts. */
+	}
 
 	rqstp->rq_arg.len = svsk->sk_datalen;
 	rqstp->rq_arg.page_base = 0;
-- 
1.8.1.2


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

* [PATCH 111/145] svcrpc: don't error out on small tcp fragment
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (109 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 110/145] svcrpc: fix handling of too-short rpc's Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 112/145] ARM: shmobile: emev2 GIO3 resource fix Kamal Mostafa
                   ` (33 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: J. Bruce Fields, Kamal Mostafa

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

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

From: "J. Bruce Fields" <bfields@redhat.com>

commit 1f691b07c5dc51b2055834f58c0f351defd97f27 upstream.

Though clients we care about mostly don't do this, it is possible for
rpc requests to be sent in multiple fragments.  Here we have a sanity
check to ensure that the final received rpc isn't too small--except that
the number we're actually checking is the length of just the final
fragment, not of the whole rpc.  So a perfectly legal rpc that's
unluckily fragmented could cause the server to close the connection
here.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sunrpc/svcsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index df74919..305374d 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1095,7 +1095,7 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
 		goto err_noclose;
 	}
 
-	if (svc_sock_reclen(svsk) < 8) {
+	if (svsk->sk_datalen < 8) {
 		svsk->sk_datalen = 0;
 		goto err_delete; /* client is nuts. */
 	}
-- 
1.8.1.2


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

* [PATCH 112/145] ARM: shmobile: emev2 GIO3 resource fix
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (110 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 111/145] svcrpc: don't error out on small tcp fragment Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 113/145] Btrfs: fix unlock after free on rewinded tree blocks Kamal Mostafa
                   ` (32 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Magnus Damm, Simon Horman, Kamal Mostafa

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

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

From: Magnus Damm <damm@opensource.se>

commit 1eb14ea1e6bcd11d6d0ba937fc39808bb4d3453e upstream.

Fix GIO3 base addresses for EMEV2.

This bug was introduced by 088efd9273b5076a0aead479aa31f1066d182b3e
("mach-shmobile: Emma Mobile EV2 GPIO support V3") which was included in v3.5.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-shmobile/setup-emev2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index a47beeb..c02a9fd 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -287,14 +287,14 @@ static struct gpio_em_config gio3_config = {
 static struct resource gio3_resources[] = {
 	[0] = {
 		.name	= "GIO_096",
-		.start	= 0xe0050100,
-		.end	= 0xe005012b,
+		.start	= 0xe0050180,
+		.end	= 0xe00501ab,
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
 		.name	= "GIO_096",
-		.start	= 0xe0050140,
-		.end	= 0xe005015f,
+		.start	= 0xe00501c0,
+		.end	= 0xe00501df,
 		.flags	= IORESOURCE_MEM,
 	},
 	[2] = {
-- 
1.8.1.2


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

* [PATCH 113/145] Btrfs: fix unlock after free on rewinded tree blocks
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (111 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 112/145] ARM: shmobile: emev2 GIO3 resource fix Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 114/145] Btrfs: hold the tree mod lock in __tree_mod_log_rewind Kamal Mostafa
                   ` (31 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jan Schmidt, Josef Bacik, Kamal Mostafa

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

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

From: Jan Schmidt <list.btrfs@jan-o-sch.net>

commit 47fb091fb787420cd195e66f162737401cce023f upstream.

When tree_mod_log_rewind decides to make a copy of the current tree buffer
for its modifications, it subsequently freed the buffer before unlocking it.
Obviously, those operations are required in reverse order.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/btrfs/ctree.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index ce1c169..f28b330 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1189,6 +1189,13 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
 	btrfs_set_header_nritems(eb, n);
 }
 
+/*
+ * Called with eb read locked. If the buffer cannot be rewinded, the same buffer
+ * is returned. If rewind operations happen, a fresh buffer is returned. The
+ * returned buffer is always read-locked. If the returned buffer is not the
+ * input buffer, the lock on the input buffer is released and the input buffer
+ * is freed (its refcount is decremented).
+ */
 static struct extent_buffer *
 tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
 		    u64 time_seq)
@@ -1222,8 +1229,11 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
 	}
 
 	extent_buffer_get(eb_rewin);
+	btrfs_tree_read_unlock(eb);
 	free_extent_buffer(eb);
 
+	extent_buffer_get(eb_rewin);
+	btrfs_tree_read_lock(eb_rewin);
 	__tree_mod_log_rewind(eb_rewin, time_seq, tm);
 	WARN_ON(btrfs_header_nritems(eb_rewin) >
 		BTRFS_NODEPTRS_PER_BLOCK(fs_info->fs_root));
@@ -2800,15 +2810,9 @@ again:
 				btrfs_clear_path_blocking(p, b,
 							  BTRFS_READ_LOCK);
 			}
+			b = tree_mod_log_rewind(root->fs_info, b, time_seq);
 			p->locks[level] = BTRFS_READ_LOCK;
 			p->nodes[level] = b;
-			b = tree_mod_log_rewind(root->fs_info, b, time_seq);
-			if (b != p->nodes[level]) {
-				btrfs_tree_unlock_rw(p->nodes[level],
-						     p->locks[level]);
-				p->locks[level] = 0;
-				p->nodes[level] = b;
-			}
 		} else {
 			p->slots[level] = slot;
 			unlock_up(p, level, lowest_unlock, 0, NULL);
-- 
1.8.1.2


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

* [PATCH 114/145] Btrfs: hold the tree mod lock in __tree_mod_log_rewind
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (112 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 113/145] Btrfs: fix unlock after free on rewinded tree blocks Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 115/145] Btrfs: only do the tree_mod_log_free_eb if this is our last ref Kamal Mostafa
                   ` (30 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Josef Bacik, Kamal Mostafa

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

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

From: Josef Bacik <jbacik@fusionio.com>

commit f1ca7e98a67da618d8595866e0860308525154da upstream.

We need to hold the tree mod log lock in __tree_mod_log_rewind since we walk
forward in the tree mod entries, otherwise we'll end up with random entries and
trip the BUG_ON() at the front of __tree_mod_log_rewind.  This fixes the panics
people were seeing when running

find /whatever -type f -exec btrfs fi defrag {} \;

Thansk,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/btrfs/ctree.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index f28b330..7a11fb7 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1122,8 +1122,8 @@ __tree_mod_log_oldest_root(struct btrfs_fs_info *fs_info,
  * time_seq).
  */
 static void
-__tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
-		      struct tree_mod_elem *first_tm)
+__tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
+		      u64 time_seq, struct tree_mod_elem *first_tm)
 {
 	u32 n;
 	struct rb_node *next;
@@ -1133,6 +1133,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
 	unsigned long p_size = sizeof(struct btrfs_key_ptr);
 
 	n = btrfs_header_nritems(eb);
+	tree_mod_log_read_lock(fs_info);
 	while (tm && tm->seq >= time_seq) {
 		/*
 		 * all the operations are recorded with the operator used for
@@ -1186,6 +1187,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
 		if (tm->index != first_tm->index)
 			break;
 	}
+	tree_mod_log_read_unlock(fs_info);
 	btrfs_set_header_nritems(eb, n);
 }
 
@@ -1234,7 +1236,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
 
 	extent_buffer_get(eb_rewin);
 	btrfs_tree_read_lock(eb_rewin);
-	__tree_mod_log_rewind(eb_rewin, time_seq, tm);
+	__tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm);
 	WARN_ON(btrfs_header_nritems(eb_rewin) >
 		BTRFS_NODEPTRS_PER_BLOCK(fs_info->fs_root));
 
@@ -1308,7 +1310,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
 		btrfs_set_header_generation(eb, old_generation);
 	}
 	if (tm)
-		__tree_mod_log_rewind(eb, time_seq, tm);
+		__tree_mod_log_rewind(root->fs_info, eb, time_seq, tm);
 	else
 		WARN_ON(btrfs_header_level(eb) != 0);
 	WARN_ON(btrfs_header_nritems(eb) > BTRFS_NODEPTRS_PER_BLOCK(root));
-- 
1.8.1.2


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

* [PATCH 115/145] Btrfs: only do the tree_mod_log_free_eb if this is our last ref
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (113 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 114/145] Btrfs: hold the tree mod lock in __tree_mod_log_rewind Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 116/145] uprobes: Fix return value in error handling path Kamal Mostafa
                   ` (29 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Josef Bacik, Kamal Mostafa

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

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

From: Josef Bacik <jbacik@fusionio.com>

commit 7fb7d76f96bfcbea25007d190ba828b18e13d29d upstream.

There is another bug in the tree mod log stuff in that we're calling
tree_mod_log_free_eb every single time a block is cow'ed.  The problem with this
is that if this block is shared by multiple snapshots we will call this multiple
times per block, so if we go to rewind the mod log for this block we'll BUG_ON()
in __tree_mod_log_rewind because we try to rewind a free twice.  We only want to
call tree_mod_log_free_eb if we are actually freeing the block.  With this patch
I no longer hit the panic in __tree_mod_log_rewind.  Thanks,

Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/btrfs/ctree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 7a11fb7..d24e546 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1049,7 +1049,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
 		btrfs_set_node_ptr_generation(parent, parent_slot,
 					      trans->transid);
 		btrfs_mark_buffer_dirty(parent);
-		tree_mod_log_free_eb(root->fs_info, buf);
+		if (last_ref)
+			tree_mod_log_free_eb(root->fs_info, buf);
 		btrfs_free_tree_block(trans, root, buf, parent_start,
 				      last_ref);
 	}
-- 
1.8.1.2


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

* [PATCH 116/145] uprobes: Fix return value in error handling path
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (114 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 115/145] Btrfs: only do the tree_mod_log_free_eb if this is our last ref Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 117/145] module: do percpu allocation after uniqueness check. No, really! Kamal Mostafa
                   ` (28 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Frederic Weisbecker, srikar, zhangwei(Jovi),
	Steven Rostedt, Kamal Mostafa

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

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

From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>

commit fa44063f9ef163c3a4c8d8c0465bb8a056b42035 upstream.

When wrong argument is passed into uprobe_events it does not return
an error:

[root@jovi tracing]# echo 'p:myprobe /bin/bash' > uprobe_events
[root@jovi tracing]#

The proper response is:

[root@jovi tracing]# echo 'p:myprobe /bin/bash' > uprobe_events
-bash: echo: write error: Invalid argument

Link: http://lkml.kernel.org/r/51B964FF.5000106@huawei.com

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: <srikar@linux.vnet.ibm.com>
Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/trace/trace_uprobe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c86e6d4..c3946f9 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -244,8 +244,10 @@ static int create_trace_uprobe(int argc, char **argv)
 		return -EINVAL;
 	}
 	arg = strchr(argv[1], ':');
-	if (!arg)
+	if (!arg) {
+		ret = -EINVAL;
 		goto fail_address_parse;
+	}
 
 	*arg++ = '\0';
 	filename = argv[1];
-- 
1.8.1.2


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

* [PATCH 117/145] module: do percpu allocation after uniqueness check.  No, really!
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (115 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 116/145] uprobes: Fix return value in error handling path Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 118/145] libceph: Fix NULL pointer dereference in auth client code Kamal Mostafa
                   ` (27 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rusty Russell, Kamal Mostafa

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

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

From: Rusty Russell <rusty@rustcorp.com.au>

commit 8d8022e8aba85192e937f1f0f7450e256d66ae5c upstream.

v3.8-rc1-5-g1fb9341 was supposed to stop parallel kvm loads exhausting
percpu memory on large machines:

    Now we have a new state MODULE_STATE_UNFORMED, we can insert the
    module into the list (and thus guarantee its uniqueness) before we
    allocate the per-cpu region.

In my defence, it didn't actually say the patch did this.  Just that
we "can".

This patch actually *does* it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Tested-by: Jim Hull <jim.hull@hp.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/module.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index eab0827..af2c7e6 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2930,7 +2930,6 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
 {
 	/* Module within temporary copy. */
 	struct module *mod;
-	Elf_Shdr *pcpusec;
 	int err;
 
 	mod = setup_load_info(info, flags);
@@ -2945,17 +2944,10 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
 	err = module_frob_arch_sections(info->hdr, info->sechdrs,
 					info->secstrings, mod);
 	if (err < 0)
-		goto out;
+		return ERR_PTR(err);
 
-	pcpusec = &info->sechdrs[info->index.pcpu];
-	if (pcpusec->sh_size) {
-		/* We have a special allocation for this section. */
-		err = percpu_modalloc(mod,
-				      pcpusec->sh_size, pcpusec->sh_addralign);
-		if (err)
-			goto out;
-		pcpusec->sh_flags &= ~(unsigned long)SHF_ALLOC;
-	}
+	/* We will do a special allocation for per-cpu sections later. */
+	info->sechdrs[info->index.pcpu].sh_flags &= ~(unsigned long)SHF_ALLOC;
 
 	/* Determine total sizes, and put offsets in sh_entsize.  For now
 	   this is done generically; there doesn't appear to be any
@@ -2966,17 +2958,22 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
 	/* Allocate and move to the final place */
 	err = move_module(mod, info);
 	if (err)
-		goto free_percpu;
+		return ERR_PTR(err);
 
 	/* Module has been copied to its final place now: return it. */
 	mod = (void *)info->sechdrs[info->index.mod].sh_addr;
 	kmemleak_load_module(mod, info);
 	return mod;
+}
 
-free_percpu:
-	percpu_modfree(mod);
-out:
-	return ERR_PTR(err);
+static int alloc_module_percpu(struct module *mod, struct load_info *info)
+{
+	Elf_Shdr *pcpusec = &info->sechdrs[info->index.pcpu];
+	if (!pcpusec->sh_size)
+		return 0;
+
+	/* We have a special allocation for this section. */
+	return percpu_modalloc(mod, pcpusec->sh_size, pcpusec->sh_addralign);
 }
 
 /* mod is no longer valid after this! */
@@ -3196,6 +3193,11 @@ again:
 		add_taint_module(mod, TAINT_FORCED_MODULE);
 #endif
 
+	/* To avoid stressing percpu allocator, do this once we're unique. */
+	err = alloc_module_percpu(mod, info);
+	if (err)
+		goto unlink_mod;
+
 	/* Now module is in final location, initialize linked lists, etc. */
 	err = module_unload_init(mod);
 	if (err)
-- 
1.8.1.2


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

* [PATCH 118/145] libceph: Fix NULL pointer dereference in auth client code
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (116 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 117/145] module: do percpu allocation after uniqueness check. No, really! Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 119/145] [CIFS] use sensible file nlink values if unprovided Kamal Mostafa
                   ` (26 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tyler Hicks, Kamal Mostafa

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

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

From: Tyler Hicks <tyhicks@canonical.com>

commit 2cb33cac622afde897aa02d3dcd9fbba8bae839e upstream.

A malicious monitor can craft an auth reply message that could cause a
NULL function pointer dereference in the client's kernel.

To prevent this, the auth_none protocol handler needs an empty
ceph_auth_client_ops->build_request() function.

CVE-2013-1059

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Chanam Park <chanam.park@hkpco.kr>
Reviewed-by: Seth Arnold <seth.arnold@canonical.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ceph/auth_none.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ceph/auth_none.c b/net/ceph/auth_none.c
index 925ca58..8c93fa8 100644
--- a/net/ceph/auth_none.c
+++ b/net/ceph/auth_none.c
@@ -39,6 +39,11 @@ static int should_authenticate(struct ceph_auth_client *ac)
 	return xi->starting;
 }
 
+static int build_request(struct ceph_auth_client *ac, void *buf, void *end)
+{
+	return 0;
+}
+
 /*
  * the generic auth code decode the global_id, and we carry no actual
  * authenticate state, so nothing happens here.
@@ -106,6 +111,7 @@ static const struct ceph_auth_client_ops ceph_auth_none_ops = {
 	.destroy = destroy,
 	.is_authenticated = is_authenticated,
 	.should_authenticate = should_authenticate,
+	.build_request = build_request,
 	.handle_reply = handle_reply,
 	.create_authorizer = ceph_auth_none_create_authorizer,
 	.destroy_authorizer = ceph_auth_none_destroy_authorizer,
-- 
1.8.1.2


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

* [PATCH 119/145] [CIFS] use sensible file nlink values if unprovided
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (117 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 118/145] libceph: Fix NULL pointer dereference in auth client code Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 120/145] drm/nouveau: use vmalloc for pgt allocation Kamal Mostafa
                   ` (25 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Disseldorp, Steve French, Kamal Mostafa

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

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

From: Steve French <smfrench@gmail.com>

commit 6658b9f70ebca5fc0795b1d6d733996af1e2caa7 upstream.

Certain servers may not set the NumberOfLinks field in query file/path
info responses. In such a case, cifs_inode_needs_reval() assumes that
all regular files are hardlinks and triggers revalidation, leading to
excessive and unnecessary network traffic.

This change hardcodes cf_nlink (and subsequently i_nlink) when not
returned by the server, similar to what already occurs in cifs_mkdir().

Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Steve French <smfrench@gmail.com>
[ kamal: backport to 3.8 ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cifs/inode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 5c669f4..2de6ce5 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -546,6 +546,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
 			fattr->cf_mode &= ~(S_IWUGO);
 
 		fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
+		if (fattr->cf_nlink < 1) {
+			cFYI(1, "replacing bogus file nlink value %u\n",
+				fattr->cf_nlink);
+			fattr->cf_nlink = 1;
+		}
 	}
 
 	fattr->cf_uid = cifs_sb->mnt_uid;
-- 
1.8.1.2


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

* [PATCH 120/145] drm/nouveau: use vmalloc for pgt allocation
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (118 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 119/145] [CIFS] use sensible file nlink values if unprovided Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 121/145] drm/nva3/disp: Fix HDMI audio regression Kamal Mostafa
                   ` (24 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Slusarz, Ben Skeggs, Kamal Mostafa

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

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

From: Marcin Slusarz <marcin.slusarz@gmail.com>

commit d005f51eb93d71cd40ebd11dd377453fa8c8a42a upstream.

Page tables on nv50 take 48kB, which can be hard to allocate in one piece.
Let's use vmalloc.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 77c67fc..e66fb77 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -362,7 +362,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
 	vm->fpde = offset >> (vmm->pgt_bits + 12);
 	vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12);
 
-	vm->pgt  = kcalloc(vm->lpde - vm->fpde + 1, sizeof(*vm->pgt), GFP_KERNEL);
+	vm->pgt  = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt));
 	if (!vm->pgt) {
 		kfree(vm);
 		return -ENOMEM;
@@ -371,7 +371,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
 	ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12,
 			      block >> 12);
 	if (ret) {
-		kfree(vm->pgt);
+		vfree(vm->pgt);
 		kfree(vm);
 		return ret;
 	}
@@ -446,7 +446,7 @@ nouveau_vm_del(struct nouveau_vm *vm)
 	}
 
 	nouveau_mm_fini(&vm->mm);
-	kfree(vm->pgt);
+	vfree(vm->pgt);
 	kfree(vm);
 }
 
-- 
1.8.1.2


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

* [PATCH 121/145] drm/nva3/disp: Fix HDMI audio regression
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (119 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 120/145] drm/nouveau: use vmalloc for pgt allocation Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 122/145] ACPI / power: add missing newline to debug messages Kamal Mostafa
                   ` (23 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ilia Mirkin, Ben Skeggs, Kamal Mostafa

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

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

From: Ilia Mirkin <imirkin@alum.mit.edu>

commit bf03d1b293cc556df53545e318110505014d805e upstream.

This is the nva3 counterpart to commit beba44b17 (drm/nv84/disp: Fix
HDMI audio regression). The regression happened as a result of
refactoring in commit 8e9e3d2de (drm/nv84/disp: move hdmi control into
core).

Reported-and-tested-by: Max Baldwin <archerseven@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
index f065fc2..db8c6fd 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
@@ -55,6 +55,10 @@ nva3_hdmi_ctrl(struct nv50_disp_priv *priv, int head, int or, u32 data)
 	nv_wr32(priv, 0x61c510 + soff, 0x00000000);
 	nv_mask(priv, 0x61c500 + soff, 0x00000001, 0x00000001);
 
+	nv_mask(priv, 0x61c5d0 + soff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */
+	nv_mask(priv, 0x61c568 + soff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */
+	nv_mask(priv, 0x61c578 + soff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */
+
 	/* ??? */
 	nv_mask(priv, 0x61733c, 0x00100000, 0x00100000); /* RESETF */
 	nv_mask(priv, 0x61733c, 0x10000000, 0x10000000); /* LOOKUP_EN */
-- 
1.8.1.2


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

* [PATCH 122/145] ACPI / power: add missing newline to debug messages
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (120 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 121/145] drm/nva3/disp: Fix HDMI audio regression Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 123/145] [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries Kamal Mostafa
                   ` (22 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mika Westerberg, Rafael J. Wysocki, Kamal Mostafa

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

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

From: Mika Westerberg <mika.westerberg@linux.intel.com>

commit 10a0b6176b9f8b026ce07acd8f755297653c443c upstream.

There are few places in power.c where debug messages have no newline
at the end.  Reading such debug messages from dmesg is not fun, so
fix this by adding the missing newlines.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/power.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 6e7b9d5..45eac3d 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -256,7 +256,7 @@ static int acpi_power_on(acpi_handle handle)
 
 	if (resource->ref_count++) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-				  "Power resource [%s] already on",
+				  "Power resource [%s] already on\n",
 				  resource->name));
 	} else {
 		result = __acpi_power_on(resource);
@@ -298,7 +298,7 @@ static int acpi_power_off(acpi_handle handle)
 
 	if (!resource->ref_count) {
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-				  "Power resource [%s] already off",
+				  "Power resource [%s] already off\n",
 				  resource->name));
 		goto unlock;
 	}
-- 
1.8.1.2


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

* [PATCH 123/145] [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (121 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 122/145] ACPI / power: add missing newline to debug messages Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 124/145] iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow Kamal Mostafa
                   ` (21 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, James Bottomley, Kamal Mostafa

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

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

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

commit 7a6a731bd00ca90d0e250867c3b9c05b5ff0fa49 upstream.

commit 98cb7e44 ([SCSI] megaraid_sas: Sanity check user
supplied length before passing it to dma_alloc_coherent())
introduced a memory leak.  Memory allocated for entries
following zero length SGL entries will not be freed.

Reference: http://bugs.debian.org/688198

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 66a0fec..996a314 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4852,10 +4852,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 				    sense, sense_handle);
 	}
 
-	for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
-		dma_free_coherent(&instance->pdev->dev,
-				    kern_sge32[i].length,
-				    kbuff_arr[i], kern_sge32[i].phys_addr);
+	for (i = 0; i < ioc->sge_count; i++) {
+		if (kbuff_arr[i])
+			dma_free_coherent(&instance->pdev->dev,
+					  kern_sge32[i].length,
+					  kbuff_arr[i],
+					  kern_sge32[i].phys_addr);
 	}
 
 	megasas_return_cmd(instance, cmd);
-- 
1.8.1.2


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

* [PATCH 124/145] iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (122 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 123/145] [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 125/145] [SCSI] mpt3sas: fix for kernel panic when driver loads with HBA conected to non LUN 0 configured expander Kamal Mostafa
                   ` (20 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joern Engel, Nicholas Bellinger, Kamal Mostafa

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

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

From: =?UTF-8?q?J=C3=B6rn=20Engel?= <joern@logfs.org>

commit 0fbfc46fb0b2f543a8b539e94c6c293ebc0b05a6 upstream.

This patch fixes a potential buffer overflow while processing
iscsi_node_auth input for configfs attributes within NodeACL
tfc_tpg_nacl_auth_cit context.

Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/iscsi/iscsi_target_configfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 78d75c8..56064a0 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -393,7 +393,7 @@ static ssize_t __iscsi_##prefix##_store_##name(				\
 	if (!capable(CAP_SYS_ADMIN))					\
 		return -EPERM;						\
 									\
-	snprintf(auth->name, PAGE_SIZE, "%s", page);			\
+	snprintf(auth->name, sizeof(auth->name), "%s", page);		\
 	if (!strncmp("NULL", auth->name, 4))				\
 		auth->naf_flags &= ~flags;				\
 	else								\
-- 
1.8.1.2


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

* [PATCH 125/145] [SCSI] mpt3sas: fix for kernel panic when driver loads with HBA conected to non LUN 0 configured expander
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (123 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 124/145] iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 126/145] [SCSI] mpt3sas: Infinite loops can occur if MPI2_IOCSTATUS_CONFIG_INVALID_PAGE is not returned Kamal Mostafa
                   ` (19 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sreekanth Reddy, James Bottomley, Kamal Mostafa

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

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

From: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>

commit b65cfedf4560af65305bd7b3b9f26c02c6fb3660 upstream.

With some enclosures when LUN 0 is not created but LUN 1 or LUN X is created
then SCSI scan procedure calls target_alloc, slave_alloc call back functions
for LUN 0 and slave_destory() for same LUN 0.

In these kind of cases within slave_destroy, pointer to scsi_target in
_sas_device structure is set to NULL, following which when slave_alloc for LUN
1 is called then starget would not be set properly for this LUN.  So,
scsi_target pointer pointing to NULL value would lead to a crash later in the
discovery procedure.

To solve this issue set the sas_device's scsi_target pointer to scsi_device's
scsi_target if it is NULL earlier in slave_alloc callback function.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 6421a06..34b229a 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1274,6 +1274,7 @@ _scsih_slave_alloc(struct scsi_device *sdev)
 	struct MPT3SAS_DEVICE *sas_device_priv_data;
 	struct scsi_target *starget;
 	struct _raid_device *raid_device;
+	struct _sas_device *sas_device;
 	unsigned long flags;
 
 	sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
@@ -1302,6 +1303,19 @@ _scsih_slave_alloc(struct scsi_device *sdev)
 		spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
 	}
 
+	if (!(sas_target_priv_data->flags & MPT_TARGET_FLAGS_VOLUME)) {
+		spin_lock_irqsave(&ioc->sas_device_lock, flags);
+		sas_device = mpt3sas_scsih_sas_device_find_by_sas_address(ioc,
+					sas_target_priv_data->sas_address);
+		if (sas_device && (sas_device->starget == NULL)) {
+			sdev_printk(KERN_INFO, sdev,
+			"%s : sas_device->starget set to starget @ %d\n",
+				__func__, __LINE__);
+			sas_device->starget = starget;
+		}
+		spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
+	}
+
 	return 0;
 }
 
-- 
1.8.1.2


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

* [PATCH 126/145] [SCSI] mpt3sas: Infinite loops can occur if MPI2_IOCSTATUS_CONFIG_INVALID_PAGE is not returned
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (124 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 125/145] [SCSI] mpt3sas: fix for kernel panic when driver loads with HBA conected to non LUN 0 configured expander Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 127/145] parisc: Fix gcc miscompilation in pa_memcpy() Kamal Mostafa
                   ` (18 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sreekanth Reddy, James Bottomley, Kamal Mostafa

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

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

From: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>

commit 14be49ac965ebd3f8561d57e01ddb22f93f9b454 upstream.

Infinite loop can occur if IOCStatus is not equal to
MPI2_IOCSTATUS_CONFIG_INVALID_PAGE value in the while loops in functions
_scsih_search_responding_sas_devices,
_scsih_search_responding_raid_devices and
_scsih_search_responding_expanders

So, Instead of checking for MPI2_IOCSTATUS_CONFIG_INVALID_PAGE value,
in this patch code is modified to check for IOCStatus not equals to
MPI2_IOCSTATUS_SUCCESS to break the while loop.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 34b229a..1d70b08 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -6409,7 +6409,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc)
 	    handle))) {
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
 			break;
 		handle = le16_to_cpu(sas_device_pg0.DevHandle);
 		device_info = le32_to_cpu(sas_device_pg0.DeviceInfo);
@@ -6511,7 +6511,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc)
 	    &volume_pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
 			break;
 		handle = le16_to_cpu(volume_pg1.DevHandle);
 
@@ -6535,7 +6535,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc)
 		    phys_disk_num))) {
 			ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 			    MPI2_IOCSTATUS_MASK;
-			if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
+			if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
 				break;
 			phys_disk_num = pd_pg0.PhysDiskNum;
 			handle = le16_to_cpu(pd_pg0.DevHandle);
@@ -6614,7 +6614,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc)
 
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
+		if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
 			break;
 
 		handle = le16_to_cpu(expander_pg0.DevHandle);
@@ -6759,8 +6759,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
 	    MPI2_SAS_EXPAND_PGAD_FORM_GET_NEXT_HNDL, handle))) {
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-			break;
 		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
 			pr_info(MPT3SAS_FMT "\tbreak from expander scan: " \
 			    "ioc_status(0x%04x), loginfo(0x%08x)\n",
@@ -6804,8 +6802,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
 	    phys_disk_num))) {
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-			break;
 		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
 			pr_info(MPT3SAS_FMT "\tbreak from phys disk scan: "\
 			    "ioc_status(0x%04x), loginfo(0x%08x)\n",
@@ -6871,8 +6867,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
 	    &volume_pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-			break;
 		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
 			pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \
 			    "ioc_status(0x%04x), loginfo(0x%08x)\n",
@@ -6931,8 +6925,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
 	    handle))) {
 		ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
 		    MPI2_IOCSTATUS_MASK;
-		if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-			break;
 		if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
 			pr_info(MPT3SAS_FMT "\tbreak from end device scan:"\
 			    " ioc_status(0x%04x), loginfo(0x%08x)\n",
-- 
1.8.1.2


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

* [PATCH 127/145] parisc: Fix gcc miscompilation in pa_memcpy()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (125 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 126/145] [SCSI] mpt3sas: Infinite loops can occur if MPI2_IOCSTATUS_CONFIG_INVALID_PAGE is not returned Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 128/145] ARM: 7778/1: smp_twd: twd_update_frequency need be run on all online CPUs Kamal Mostafa
                   ` (17 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Helge Deller, John David Anglin, Kamal Mostafa

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

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

From: Helge Deller <deller@gmx.de>

commit 5b879d78bc0818aa710f5d4d9abbfc2aca075cc3 upstream.

When running the LTP testsuite one may hit this kernel BUG() with the
write06 testcase:

kernel BUG at mm/filemap.c:2023!
CPU: 1 PID: 8614 Comm: writev01 Not tainted 3.10.0-rc7-64bit-c3000+ #6
IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401e6e84 00000000401e6e88
 IIR: 03ffe01f    ISR: 0000000010340000  IOR: 000001fbe0380820
 CPU:        1   CR30: 00000000bef80000 CR31: ffffffffffffffff
 ORIG_R28: 00000000bdc192c0
 IAOQ[0]: iov_iter_advance+0x3c/0xc0
 IAOQ[1]: iov_iter_advance+0x40/0xc0
 RP(r2): generic_file_buffered_write+0x204/0x3f0
Backtrace:
 [<00000000401e764c>] generic_file_buffered_write+0x204/0x3f0
 [<00000000401eab24>] __generic_file_aio_write+0x244/0x448
 [<00000000401eadc0>] generic_file_aio_write+0x98/0x150
 [<000000004024f460>] do_sync_readv_writev+0xc0/0x130
 [<000000004025037c>] compat_do_readv_writev+0x12c/0x340
 [<00000000402505f8>] compat_writev+0x68/0xa0
 [<0000000040251d88>] compat_SyS_writev+0x98/0xf8

Reason for this crash is a gcc miscompilation in the fault handlers of
pa_memcpy() which return the fault address instead of the copied bytes.
Since this seems to be a generic problem with gcc-4.7.x (and below), it's
better to simplify the fault handlers in pa_memcpy to avoid this problem.

Here is a simple reproducer for the problem:

int main(int argc, char **argv)
{
	int fd, nbytes;
	struct iovec wr_iovec[] = {
		{ "TEST STRING                     ",32},
		{ (char*)0x40005000,32} }; // random memory.
	fd = open(DATA_FILE, O_RDWR | O_CREAT, 0666);
	nbytes = writev(fd, wr_iovec, 2);
	printf("return value = %d, errno %d (%s)\n",
		nbytes, errno, strerror(errno));
	return 0;
}

In addition, John David Anglin wrote:
There is no gcc PR as pa_memcpy is not legitimate C code. There is an
implicit assumption that certain variables will contain correct values
when an exception occurs and the code randomly jumps to one of the
exception blocks.  There is no guarantee of this.  If a PR was filed, it
would likely be marked as invalid.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/parisc/lib/memcpy.c | 79 ++++++++++++++++++++++++++++++------------------
 1 file changed, 50 insertions(+), 29 deletions(-)

diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index 1dbca5c..8d5c48b 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -2,6 +2,7 @@
  *    Optimized memory copy routines.
  *
  *    Copyright (C) 2004 Randolph Chung <tausq@debian.org>
+ *    Copyright (C) 2013 Helge Deller <deller@gmx.de>
  *
  *    This program is free software; you can redistribute it and/or modify
  *    it under the terms of the GNU General Public License as published by
@@ -153,17 +154,21 @@ static inline void prefetch_dst(const void *addr)
 #define prefetch_dst(addr) do { } while(0)
 #endif
 
+#define PA_MEMCPY_OK		0
+#define PA_MEMCPY_LOAD_ERROR	1
+#define PA_MEMCPY_STORE_ERROR	2
+
 /* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words
  * per loop.  This code is derived from glibc. 
  */
-static inline unsigned long copy_dstaligned(unsigned long dst, unsigned long src, unsigned long len, unsigned long o_dst, unsigned long o_src, unsigned long o_len)
+static inline unsigned long copy_dstaligned(unsigned long dst,
+					unsigned long src, unsigned long len)
 {
 	/* gcc complains that a2 and a3 may be uninitialized, but actually
 	 * they cannot be.  Initialize a2/a3 to shut gcc up.
 	 */
 	register unsigned int a0, a1, a2 = 0, a3 = 0;
 	int sh_1, sh_2;
-	struct exception_data *d;
 
 	/* prefetch_src((const void *)src); */
 
@@ -197,7 +202,7 @@ static inline unsigned long copy_dstaligned(unsigned long dst, unsigned long src
 			goto do2;
 		case 0:
 			if (len == 0)
-				return 0;
+				return PA_MEMCPY_OK;
 			/* a3 = ((unsigned int *) src)[0];
 			   a0 = ((unsigned int *) src)[1]; */
 			ldw(s_space, 0, src, a3, cda_ldw_exc);
@@ -256,42 +261,35 @@ do0:
 	preserve_branch(handle_load_error);
 	preserve_branch(handle_store_error);
 
-	return 0;
+	return PA_MEMCPY_OK;
 
 handle_load_error:
 	__asm__ __volatile__ ("cda_ldw_exc:\n");
-	d = &__get_cpu_var(exception_data);
-	DPRINTF("cda_ldw_exc: o_len=%lu fault_addr=%lu o_src=%lu ret=%lu\n",
-		o_len, d->fault_addr, o_src, o_len - d->fault_addr + o_src);
-	return o_len * 4 - d->fault_addr + o_src;
+	return PA_MEMCPY_LOAD_ERROR;
 
 handle_store_error:
 	__asm__ __volatile__ ("cda_stw_exc:\n");
-	d = &__get_cpu_var(exception_data);
-	DPRINTF("cda_stw_exc: o_len=%lu fault_addr=%lu o_dst=%lu ret=%lu\n",
-		o_len, d->fault_addr, o_dst, o_len - d->fault_addr + o_dst);
-	return o_len * 4 - d->fault_addr + o_dst;
+	return PA_MEMCPY_STORE_ERROR;
 }
 
 
-/* Returns 0 for success, otherwise, returns number of bytes not transferred. */
-static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)
+/* Returns PA_MEMCPY_OK, PA_MEMCPY_LOAD_ERROR or PA_MEMCPY_STORE_ERROR.
+ * In case of an access fault the faulty address can be read from the per_cpu
+ * exception data struct. */
+static unsigned long pa_memcpy_internal(void *dstp, const void *srcp,
+					unsigned long len)
 {
 	register unsigned long src, dst, t1, t2, t3;
 	register unsigned char *pcs, *pcd;
 	register unsigned int *pws, *pwd;
 	register double *pds, *pdd;
-	unsigned long ret = 0;
-	unsigned long o_dst, o_src, o_len;
-	struct exception_data *d;
+	unsigned long ret;
 
 	src = (unsigned long)srcp;
 	dst = (unsigned long)dstp;
 	pcs = (unsigned char *)srcp;
 	pcd = (unsigned char *)dstp;
 
-	o_dst = dst; o_src = src; o_len = len;
-
 	/* prefetch_src((const void *)srcp); */
 
 	if (len < THRESHOLD)
@@ -401,7 +399,7 @@ byte_copy:
 		len--;
 	}
 
-	return 0;
+	return PA_MEMCPY_OK;
 
 unaligned_copy:
 	/* possibly we are aligned on a word, but not on a double... */
@@ -438,8 +436,7 @@ unaligned_copy:
 		src = (unsigned long)pcs;
 	}
 
-	ret = copy_dstaligned(dst, src, len / sizeof(unsigned int), 
-		o_dst, o_src, o_len);
+	ret = copy_dstaligned(dst, src, len / sizeof(unsigned int));
 	if (ret)
 		return ret;
 
@@ -454,17 +451,41 @@ unaligned_copy:
 
 handle_load_error:
 	__asm__ __volatile__ ("pmc_load_exc:\n");
-	d = &__get_cpu_var(exception_data);
-	DPRINTF("pmc_load_exc: o_len=%lu fault_addr=%lu o_src=%lu ret=%lu\n",
-		o_len, d->fault_addr, o_src, o_len - d->fault_addr + o_src);
-	return o_len - d->fault_addr + o_src;
+	return PA_MEMCPY_LOAD_ERROR;
 
 handle_store_error:
 	__asm__ __volatile__ ("pmc_store_exc:\n");
+	return PA_MEMCPY_STORE_ERROR;
+}
+
+
+/* Returns 0 for success, otherwise, returns number of bytes not transferred. */
+static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)
+{
+	unsigned long ret, fault_addr, reference;
+	struct exception_data *d;
+
+	ret = pa_memcpy_internal(dstp, srcp, len);
+	if (likely(ret == PA_MEMCPY_OK))
+		return 0;
+
+	/* if a load or store fault occured we can get the faulty addr */
 	d = &__get_cpu_var(exception_data);
-	DPRINTF("pmc_store_exc: o_len=%lu fault_addr=%lu o_dst=%lu ret=%lu\n",
-		o_len, d->fault_addr, o_dst, o_len - d->fault_addr + o_dst);
-	return o_len - d->fault_addr + o_dst;
+	fault_addr = d->fault_addr;
+
+	/* error in load or store? */
+	if (ret == PA_MEMCPY_LOAD_ERROR)
+		reference = (unsigned long) srcp;
+	else
+		reference = (unsigned long) dstp;
+
+	DPRINTF("pa_memcpy: fault type = %lu, len=%lu fault_addr=%lu ref=%lu\n",
+		ret, len, fault_addr, reference);
+
+	if (fault_addr >= reference)
+		return len - (fault_addr - reference);
+	else
+		return len;
 }
 
 #ifdef __KERNEL__
-- 
1.8.1.2


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

* [PATCH 128/145] ARM: 7778/1: smp_twd: twd_update_frequency need be run on all online CPUs
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (126 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 127/145] parisc: Fix gcc miscompilation in pa_memcpy() Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 129/145] dm mpath: fix ioctl deadlock when no paths Kamal Mostafa
                   ` (16 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Linus Walleij, Rob Herring, Shawn Guo, Arnd Bergmann, Jason Liu,
	Russell King, Kamal Mostafa

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

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

From: Jason Liu <r64343@freescale.com>

commit cbbe6f82b489e7ceba4ad7c833bd3a76cd0084cb upstream.

When the local timer freq changed, the twd_update_frequency function
should be run all the CPUs include itself, otherwise, the twd freq will
not get updated and the local timer will not run correcttly.

smp_call_function will run functions on all other CPUs, but not include
himself, this is not correct,use on_each_cpu instead to fix this issue.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Jason Liu <r64343@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/smp_twd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 49f335d..64ac3f1 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -121,7 +121,7 @@ static int twd_rate_change(struct notifier_block *nb,
 	 * changing cpu.
 	 */
 	if (flags == POST_RATE_CHANGE)
-		smp_call_function(twd_update_frequency,
+		on_each_cpu(twd_update_frequency,
 				  (void *)&cnd->new_rate, 1);
 
 	return NOTIFY_OK;
-- 
1.8.1.2


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

* [PATCH 129/145] dm mpath: fix ioctl deadlock when no paths
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (127 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 128/145] ARM: 7778/1: smp_twd: twd_update_frequency need be run on all online CPUs Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 130/145] dm ioctl: set noio flag to avoid __vmalloc deadlock Kamal Mostafa
                   ` (15 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hannes Reinecke, Mike Snitzer, Alasdair G Kergon, Kamal Mostafa

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

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

From: Hannes Reinecke <hare@suse.de>

commit 6c182cd88d179cbbd06f4f8a8a19b6977940753f upstream.

When multipath needs to retry an ioctl the reference to the
current live table needs to be dropped. Otherwise a deadlock
occurs when all paths are down:
- dm_blk_ioctl takes a reference to the current table
  and spins in multipath_ioctl().
- A new table is being loaded, but upon resume the process
  hangs in dm_table_destroy() waiting for references to
  drop to zero.

With this patch the reference to the old table is dropped
prior to retry, thereby avoiding the deadlock.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-mpath.c | 8 ++------
 drivers/md/dm.c       | 9 ++++++++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index d267bb5..9f330c1 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1560,7 +1560,6 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
 	unsigned long flags;
 	int r;
 
-again:
 	bdev = NULL;
 	mode = 0;
 	r = 0;
@@ -1578,7 +1577,7 @@ again:
 	}
 
 	if ((pgpath && m->queue_io) || (!pgpath && m->queue_if_no_path))
-		r = -EAGAIN;
+		r = -ENOTCONN;
 	else if (!bdev)
 		r = -EIO;
 
@@ -1590,11 +1589,8 @@ again:
 	if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT)
 		r = scsi_verify_blk_ioctl(NULL, cmd);
 
-	if (r == -EAGAIN && !fatal_signal_pending(current)) {
+	if (r == -ENOTCONN && !fatal_signal_pending(current))
 		queue_work(kmultipathd, &m->process_queued_ios);
-		msleep(10);
-		goto again;
-	}
 
 	return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
 }
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 0d8f086..6a82721 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -404,10 +404,12 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
 			unsigned int cmd, unsigned long arg)
 {
 	struct mapped_device *md = bdev->bd_disk->private_data;
-	struct dm_table *map = dm_get_live_table(md);
+	struct dm_table *map;
 	struct dm_target *tgt;
 	int r = -ENOTTY;
 
+retry:
+	map = dm_get_live_table(md);
 	if (!map || !dm_table_get_size(map))
 		goto out;
 
@@ -428,6 +430,11 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
 out:
 	dm_table_put(map);
 
+	if (r == -ENOTCONN) {
+		msleep(10);
+		goto retry;
+	}
+
 	return r;
 }
 
-- 
1.8.1.2


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

* [PATCH 130/145] dm ioctl: set noio flag to avoid __vmalloc deadlock
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (128 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 129/145] dm mpath: fix ioctl deadlock when no paths Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 131/145] dm verity: fix inability to use a few specific devices sizes Kamal Mostafa
                   ` (14 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Alasdair G Kergon, Kamal Mostafa

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

Set noio flag while calling __vmalloc() because it doesn't fully respect
gfp flags to avoid a possible deadlock (see commit
502624bdad3dba45dfaacaf36b7d83e39e74b2d2).

This should be backported to stable kernels 3.8 and newer. The kernel 3.8
doesn't have memalloc_noio_save(), so we should set and restore process
flag PF_MEMALLOC instead.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
[ kamal: backport to 3.8 (memalloc_noio_save is available in linux-3.8.y.z) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index eee353d..4c260aa 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1585,7 +1585,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param, in
 		dmi = kmalloc(tmp.data_size, GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
 
 	if (!dmi) {
+		unsigned noio_flag;
+		noio_flag = memalloc_noio_save();
 		dmi = __vmalloc(tmp.data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH, PAGE_KERNEL);
+		memalloc_noio_restore(noio_flag);
 		*param_flags |= DM_PARAMS_VMALLOC;
 	}
 
-- 
1.8.1.2


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

* [PATCH 131/145] dm verity: fix inability to use a few specific devices sizes
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (129 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 130/145] dm ioctl: set noio flag to avoid __vmalloc deadlock Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 132/145] CIFS: Fix a deadlock when a file is reopened Kamal Mostafa
                   ` (13 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mikulas Patocka, Milan Broz, Alasdair G Kergon, Kamal Mostafa

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

commit b1bf2de07271932326af847a3c6a01fdfd29d4be upstream.

Fix a boundary condition that caused failure for certain device sizes.

The problem is reported at
  http://code.google.com/p/cryptsetup/issues/detail?id=160

For certain device sizes the number of hashes at a specific level was
calculated incorrectly.

It happens for example for a device with data and metadata block size 4096
that has 16385 blocks and algorithm sha256.

The user can test if he is affected by this bug by running the
"veritysetup verify" command and also by activating the dm-verity kernel
driver and reading the whole block device. If it passes without an error,
then the user is not affected.

The condition for the bug is:

Split the total number of data blocks (data_block_bits) into bit strings,
each string has hash_per_block_bits bits. hash_per_block_bits is
rounddown(log2(metadata_block_size/hash_digest_size)). Equivalently, you
can say that you convert data_blocks_bits to 2^hash_per_block_bits base.

If there some zero bit string below the most significant bit string and at
least one bit below this zero bit string is set, then the bug happens.

The same bug exists in the userspace veritysetup tool, so you must use
fixed veritysetup too if you want to use devices that are affected by
this boundary condition.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-verity.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c
index a746f1d..4112d90 100644
--- a/drivers/md/dm-verity.c
+++ b/drivers/md/dm-verity.c
@@ -831,9 +831,8 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	for (i = v->levels - 1; i >= 0; i--) {
 		sector_t s;
 		v->hash_level_block[i] = hash_position;
-		s = verity_position_at_level(v, v->data_blocks, i);
-		s = (s >> v->hash_per_block_bits) +
-		    !!(s & ((1 << v->hash_per_block_bits) - 1));
+		s = (v->data_blocks + ((sector_t)1 << ((i + 1) * v->hash_per_block_bits)) - 1)
+					>> ((i + 1) * v->hash_per_block_bits);
 		if (hash_position + s < hash_position) {
 			ti->error = "Hash device offset overflow";
 			r = -E2BIG;
-- 
1.8.1.2


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

* [PATCH 132/145] CIFS: Fix a deadlock when a file is reopened
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (130 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 131/145] dm verity: fix inability to use a few specific devices sizes Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 133/145] perf: Clone child context from parent context pmu Kamal Mostafa
                   ` (12 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pavel Shilovsky, Steve French, Kamal Mostafa

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

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

From: Pavel Shilovsky <pshilovsky@samba.org>

commit 689c3db4d57a73bee6c5ad7797fce7b54d32a87c upstream.

If we request reading or writing on a file that needs to be
reopened, it causes the deadlock: we are already holding rw
semaphore for reading and then we try to acquire it for writing
in cifs_relock_file. Fix this by acquiring the semaphore for
reading in cifs_relock_file due to we don't make any changes in
locks and don't need a write access.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cifs/file.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 1d93ee8..ae62632 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -551,11 +551,10 @@ cifs_relock_file(struct cifsFileInfo *cfile)
 	struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
 	int rc = 0;
 
-	/* we are going to update can_cache_brlcks here - need a write access */
-	down_write(&cinode->lock_sem);
+	down_read(&cinode->lock_sem);
 	if (cinode->can_cache_brlcks) {
-		/* can cache locks - no need to push them */
-		up_write(&cinode->lock_sem);
+		/* can cache locks - no need to relock */
+		up_read(&cinode->lock_sem);
 		return rc;
 	}
 
@@ -566,7 +565,7 @@ cifs_relock_file(struct cifsFileInfo *cfile)
 	else
 		rc = tcon->ses->server->ops->push_mand_locks(cfile);
 
-	up_write(&cinode->lock_sem);
+	up_read(&cinode->lock_sem);
 	return rc;
 }
 
-- 
1.8.1.2


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

* [PATCH 133/145] perf: Clone child context from parent context pmu
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (131 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 132/145] CIFS: Fix a deadlock when a file is reopened Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 134/145] perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario Kamal Mostafa
                   ` (11 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Arnaldo Carvalho de Melo,
	Peter Zijlstra, Ingo Molnar, Kamal Mostafa

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

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

From: Jiri Olsa <jolsa@redhat.com>

commit 734df5ab549ca44f40de0f07af1c8803856dfb18 upstream.

Currently when the child context for inherited events is
created, it's based on the pmu object of the first event
of the parent context.

This is wrong for the following scenario:

  - HW context having HW and SW event
  - HW event got removed (closed)
  - SW event stays in HW context as the only event
    and its pmu is used to clone the child context

The issue starts when the cpu context object is touched
based on the pmu context object (__get_cpu_context). In
this case the HW context will work with SW cpu context
ending up with following WARN below.

Fixing this by using parent context pmu object to clone
from child context.

Addresses the following warning reported by Vince Weaver:

[ 2716.472065] ------------[ cut here ]------------
[ 2716.476035] WARNING: at kernel/events/core.c:2122 task_ctx_sched_out+0x3c/0x)
[ 2716.476035] Modules linked in: nfsd auth_rpcgss oid_registry nfs_acl nfs locn
[ 2716.476035] CPU: 0 PID: 3164 Comm: perf_fuzzer Not tainted 3.10.0-rc4 #2
[ 2716.476035] Hardware name: AOpen   DE7000/nMCP7ALPx-DE R1.06 Oct.19.2012, BI2
[ 2716.476035]  0000000000000000 ffffffff8102e215 0000000000000000 ffff88011fc18
[ 2716.476035]  ffff8801175557f0 0000000000000000 ffff880119fda88c ffffffff810ad
[ 2716.476035]  ffff880119fda880 ffffffff810af02a 0000000000000009 ffff880117550
[ 2716.476035] Call Trace:
[ 2716.476035]  [<ffffffff8102e215>] ? warn_slowpath_common+0x5b/0x70
[ 2716.476035]  [<ffffffff810ab2bd>] ? task_ctx_sched_out+0x3c/0x5f
[ 2716.476035]  [<ffffffff810af02a>] ? perf_event_exit_task+0xbf/0x194
[ 2716.476035]  [<ffffffff81032a37>] ? do_exit+0x3e7/0x90c
[ 2716.476035]  [<ffffffff810cd5ab>] ? __do_fault+0x359/0x394
[ 2716.476035]  [<ffffffff81032fe6>] ? do_group_exit+0x66/0x98
[ 2716.476035]  [<ffffffff8103dbcd>] ? get_signal_to_deliver+0x479/0x4ad
[ 2716.476035]  [<ffffffff810ac05c>] ? __perf_event_task_sched_out+0x230/0x2d1
[ 2716.476035]  [<ffffffff8100205d>] ? do_signal+0x3c/0x432
[ 2716.476035]  [<ffffffff810abbf9>] ? ctx_sched_in+0x43/0x141
[ 2716.476035]  [<ffffffff810ac2ca>] ? perf_event_context_sched_in+0x7a/0x90
[ 2716.476035]  [<ffffffff810ac311>] ? __perf_event_task_sched_in+0x31/0x118
[ 2716.476035]  [<ffffffff81050dd9>] ? mmdrop+0xd/0x1c
[ 2716.476035]  [<ffffffff81051a39>] ? finish_task_switch+0x7d/0xa6
[ 2716.476035]  [<ffffffff81002473>] ? do_notify_resume+0x20/0x5d
[ 2716.476035]  [<ffffffff813654f5>] ? retint_signal+0x3d/0x78
[ 2716.476035] ---[ end trace 827178d8a5966c3d ]---

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1373384651-6109-1-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 1df07c2..e133177 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7137,7 +7137,7 @@ inherit_task_group(struct perf_event *event, struct task_struct *parent,
 		 * child.
 		 */
 
-		child_ctx = alloc_perf_context(event->pmu, child);
+		child_ctx = alloc_perf_context(parent_ctx->pmu, child);
 		if (!child_ctx)
 			return -ENOMEM;
 
-- 
1.8.1.2


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

* [PATCH 134/145] perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (132 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 133/145] perf: Clone child context from parent context pmu Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 135/145] perf: Fix perf_lock_task_context() vs RCU Kamal Mostafa
                   ` (10 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Arnaldo Carvalho de Melo,
	Peter Zijlstra, Ingo Molnar, Kamal Mostafa

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

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

From: Jiri Olsa <jolsa@redhat.com>

commit 06f417968beac6e6b614e17b37d347aa6a6b1d30 upstream.

The '!ctx->is_active' check has a valid scenario, so
there's no need for the warning.

The reason is that there's a time window between the
'ctx->is_active' check in the perf_event_enable() function
and the __perf_event_enable() function having:

  - IRQs on
  - ctx->lock unlocked

where the task could be killed and 'ctx' deactivated by
perf_event_exit_task(), ending up with the warning below.

So remove the WARN_ON_ONCE() check and add comments to
explain it all.

This addresses the following warning reported by Vince Weaver:

[  324.983534] ------------[ cut here ]------------
[  324.984420] WARNING: at kernel/events/core.c:1953 __perf_event_enable+0x187/0x190()
[  324.984420] Modules linked in:
[  324.984420] CPU: 19 PID: 2715 Comm: nmi_bug_snb Not tainted 3.10.0+ #246
[  324.984420] Hardware name: Supermicro X8DTN/X8DTN, BIOS 4.6.3 01/08/2010
[  324.984420]  0000000000000009 ffff88043fce3ec8 ffffffff8160ea0b ffff88043fce3f00
[  324.984420]  ffffffff81080ff0 ffff8802314fdc00 ffff880231a8f800 ffff88043fcf7860
[  324.984420]  0000000000000286 ffff880231a8f800 ffff88043fce3f10 ffffffff8108103a
[  324.984420] Call Trace:
[  324.984420]  <IRQ>  [<ffffffff8160ea0b>] dump_stack+0x19/0x1b
[  324.984420]  [<ffffffff81080ff0>] warn_slowpath_common+0x70/0xa0
[  324.984420]  [<ffffffff8108103a>] warn_slowpath_null+0x1a/0x20
[  324.984420]  [<ffffffff81134437>] __perf_event_enable+0x187/0x190
[  324.984420]  [<ffffffff81130030>] remote_function+0x40/0x50
[  324.984420]  [<ffffffff810e51de>] generic_smp_call_function_single_interrupt+0xbe/0x130
[  324.984420]  [<ffffffff81066a47>] smp_call_function_single_interrupt+0x27/0x40
[  324.984420]  [<ffffffff8161fd2f>] call_function_single_interrupt+0x6f/0x80
[  324.984420]  <EOI>  [<ffffffff816161a1>] ? _raw_spin_unlock_irqrestore+0x41/0x70
[  324.984420]  [<ffffffff8113799d>] perf_event_exit_task+0x14d/0x210
[  324.984420]  [<ffffffff810acd04>] ? switch_task_namespaces+0x24/0x60
[  324.984420]  [<ffffffff81086946>] do_exit+0x2b6/0xa40
[  324.984420]  [<ffffffff8161615c>] ? _raw_spin_unlock_irq+0x2c/0x30
[  324.984420]  [<ffffffff81087279>] do_group_exit+0x49/0xc0
[  324.984420]  [<ffffffff81096854>] get_signal_to_deliver+0x254/0x620
[  324.984420]  [<ffffffff81043057>] do_signal+0x57/0x5a0
[  324.984420]  [<ffffffff8161a164>] ? __do_page_fault+0x2a4/0x4e0
[  324.984420]  [<ffffffff8161665c>] ? retint_restore_args+0xe/0xe
[  324.984420]  [<ffffffff816166cd>] ? retint_signal+0x11/0x84
[  324.984420]  [<ffffffff81043605>] do_notify_resume+0x65/0x80
[  324.984420]  [<ffffffff81616702>] retint_signal+0x46/0x84
[  324.984420] ---[ end trace 442ec2f04db3771a ]---

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1373384651-6109-2-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/events/core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index e133177..d28d8d0 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1723,7 +1723,16 @@ static int __perf_event_enable(void *info)
 	struct perf_cpu_context *cpuctx = __get_cpu_context(ctx);
 	int err;
 
-	if (WARN_ON_ONCE(!ctx->is_active))
+	/*
+	 * There's a time window between 'ctx->is_active' check
+	 * in perf_event_enable function and this place having:
+	 *   - IRQs on
+	 *   - ctx->lock unlocked
+	 *
+	 * where the task could be killed and 'ctx' deactivated
+	 * by perf_event_exit_task.
+	 */
+	if (!ctx->is_active)
 		return -EINVAL;
 
 	raw_spin_lock(&ctx->lock);
-- 
1.8.1.2


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

* [PATCH 135/145] perf: Fix perf_lock_task_context() vs RCU
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (133 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 134/145] perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 136/145] MFD: rtsx_pcr: Fix probe fail path Kamal Mostafa
                   ` (9 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Zijlstra, Ingo Molnar, Kamal Mostafa

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

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

From: Peter Zijlstra <peterz@infradead.org>

commit 058ebd0eba3aff16b144eabf4510ed9510e1416e upstream.

Jiri managed to trigger this warning:

 [] ======================================================
 [] [ INFO: possible circular locking dependency detected ]
 [] 3.10.0+ #228 Tainted: G        W
 [] -------------------------------------------------------
 [] p/6613 is trying to acquire lock:
 []  (rcu_node_0){..-...}, at: [<ffffffff810ca797>] rcu_read_unlock_special+0xa7/0x250
 []
 [] but task is already holding lock:
 []  (&ctx->lock){-.-...}, at: [<ffffffff810f2879>] perf_lock_task_context+0xd9/0x2c0
 []
 [] which lock already depends on the new lock.
 []
 [] the existing dependency chain (in reverse order) is:
 []
 [] -> #4 (&ctx->lock){-.-...}:
 [] -> #3 (&rq->lock){-.-.-.}:
 [] -> #2 (&p->pi_lock){-.-.-.}:
 [] -> #1 (&rnp->nocb_gp_wq[1]){......}:
 [] -> #0 (rcu_node_0){..-...}:

Paul was quick to explain that due to preemptible RCU we cannot call
rcu_read_unlock() while holding scheduler (or nested) locks when part
of the read side critical section was preemptible.

Therefore solve it by making the entire RCU read side non-preemptible.

Also pull out the retry from under the non-preempt to play nice with RT.

Reported-by: Jiri Olsa <jolsa@redhat.com>
Helped-out-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/events/core.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d28d8d0..9c53789 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -729,8 +729,18 @@ perf_lock_task_context(struct task_struct *task, int ctxn, unsigned long *flags)
 {
 	struct perf_event_context *ctx;
 
-	rcu_read_lock();
 retry:
+	/*
+	 * One of the few rules of preemptible RCU is that one cannot do
+	 * rcu_read_unlock() while holding a scheduler (or nested) lock when
+	 * part of the read side critical section was preemptible -- see
+	 * rcu_read_unlock_special().
+	 *
+	 * Since ctx->lock nests under rq->lock we must ensure the entire read
+	 * side critical section is non-preemptible.
+	 */
+	preempt_disable();
+	rcu_read_lock();
 	ctx = rcu_dereference(task->perf_event_ctxp[ctxn]);
 	if (ctx) {
 		/*
@@ -746,6 +756,8 @@ retry:
 		raw_spin_lock_irqsave(&ctx->lock, *flags);
 		if (ctx != rcu_dereference(task->perf_event_ctxp[ctxn])) {
 			raw_spin_unlock_irqrestore(&ctx->lock, *flags);
+			rcu_read_unlock();
+			preempt_enable();
 			goto retry;
 		}
 
@@ -755,6 +767,7 @@ retry:
 		}
 	}
 	rcu_read_unlock();
+	preempt_enable();
 	return ctx;
 }
 
-- 
1.8.1.2


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

* [PATCH 136/145] MFD: rtsx_pcr: Fix probe fail path
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (134 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 135/145] perf: Fix perf_lock_task_context() vs RCU Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 137/145] x86, efivars: firmware bug workarounds should be in platform code Kamal Mostafa
                   ` (8 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jiri Slaby, Samuel Ortiz, Kamal Mostafa

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

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

From: Jiri Slaby <jslaby@suse.cz>

commit 9d66b568a215fe2da2a9db736ebf9b8d66082d88 upstream.

When rtsx_pci_acquire_irq fails in rtsx_pci_probe, we forget to
disable an MSI (if we enabled it). This results in this warning on the
next attempt to load the module:
WARNING: at drivers/pci/msi.c:834 pci_enable_msi_block+0x2a4/0x2b0()
Hardware name: HP EliteBook 840 G1
Modules linked in: rtsx_pci(+) ...
Pid: 4056, comm: modprobe Tainted: G          I  3.8.0-9405-gd895cb1-1-vanilla #1
Call Trace:
 [<ffffffff81045c6a>] warn_slowpath_common+0x7a/0xc0
 [<ffffffff81045cc5>] warn_slowpath_null+0x15/0x20
 [<ffffffff81302544>] pci_enable_msi_block+0x2a4/0x2b0
 [<ffffffffa05e335a>] rtsx_pci_probe+0x55a/0x720 [rtsx_pci]
...

So properly disable MSI in that case.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mfd/rtsx_pcr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 1e2d120..148aa18 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -1136,7 +1136,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
 
 	ret = rtsx_pci_acquire_irq(pcr);
 	if (ret < 0)
-		goto free_dma;
+		goto disable_msi;
 
 	pci_set_master(pcidev);
 	synchronize_irq(pcr->irq);
@@ -1160,7 +1160,9 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
 
 disable_irq:
 	free_irq(pcr->irq, (void *)pcr);
-free_dma:
+disable_msi:
+	if (pcr->msi_en)
+		pci_disable_msi(pcr->pci);
 	dma_free_coherent(&(pcr->pci->dev), RTSX_RESV_BUF_LEN,
 			pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr);
 unmap:
-- 
1.8.1.2


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

* [PATCH 137/145] x86, efivars: firmware bug workarounds should be in platform code
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (135 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 136/145] MFD: rtsx_pcr: Fix probe fail path Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 138/145] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native() Kamal Mostafa
                   ` (7 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: H. Peter Anvin, Matthew Garrett, Matt Fleming, Sergey Vlasov,
	Kamal Mostafa

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

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

From: Matt Fleming <matt.fleming@intel.com>

commit a6e4d5a03e9e3587e88aba687d8f225f4f04c792 upstream.
commit 3668011d4ad556224f7c012c1e870a6eaa0e59da upstream.

Let's not burden ia64 with checks in the common efivars code that we're not
writing too much data to the variable store. That kind of thing is an x86
firmware bug, plain and simple.

efi_query_variable_store() provides platforms with a wrapper in which they can
perform checks and workarounds for EFI variable storage bugs.

Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ kamal: backport to 3.8 as prereq for "Modify UEFI anti-bricking code";
  merged 3668011 "efi: Export efi_query_variable_store() for efivars.ko" ]
Cc: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/platform/efi/efi.c | 26 ++++++++++++++++++++++++++
 drivers/firmware/efivars.c  | 18 +++---------------
 include/linux/efi.h         |  9 ++++++++-
 3 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index e2cd38f..ce51ed0 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1005,3 +1005,29 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 	}
 	return 0;
 }
+
+/*
+ * Some firmware has serious problems when using more than 50% of the EFI
+ * variable store, i.e. it triggers bugs that can brick machines. Ensure that
+ * we never use more than this safe limit.
+ *
+ * Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable
+ * store.
+ */
+efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
+{
+	efi_status_t status;
+	u64 storage_size, remaining_size, max_size;
+
+	status = efi.query_variable_info(attributes, &storage_size,
+					 &remaining_size, &max_size);
+	if (status != EFI_SUCCESS)
+		return status;
+
+	if (!storage_size || size > remaining_size || size > max_size ||
+	    (remaining_size - size) < (storage_size / 2))
+		return EFI_OUT_OF_RESOURCES;
+
+	return EFI_SUCCESS;
+}
+EXPORT_SYMBOL_GPL(efi_query_variable_store);
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index b07cb37..e3e95dd 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -428,24 +428,12 @@ static efi_status_t
 check_var_size_locked(struct efivars *efivars, u32 attributes,
 			unsigned long size)
 {
-	u64 storage_size, remaining_size, max_size;
-	efi_status_t status;
 	const struct efivar_operations *fops = efivars->ops;
 
-	if (!efivars->ops->query_variable_info)
+	if (!efivars->ops->query_variable_store)
 		return EFI_UNSUPPORTED;
 
-	status = fops->query_variable_info(attributes, &storage_size,
-					   &remaining_size, &max_size);
-
-	if (status != EFI_SUCCESS)
-		return status;
-
-	if (!storage_size || size > remaining_size || size > max_size ||
-	    (remaining_size - size) < (storage_size / 2))
-		return EFI_OUT_OF_RESOURCES;
-
-	return status;
+	return fops->query_variable_store(attributes, size);
 }
 
 
@@ -2059,7 +2047,7 @@ efivars_init(void)
 	ops.get_variable = efi.get_variable;
 	ops.set_variable = efi.set_variable;
 	ops.get_next_variable = efi.get_next_variable;
-	ops.query_variable_info = efi.query_variable_info;
+	ops.query_variable_store = efi_query_variable_store;
 
 	error = register_efivars(&__efivars, &ops, efi_kobj);
 	if (error)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 7a9498a..fd703f0 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -333,6 +333,7 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
 					      unsigned long count,
 					      u64 *max_size,
 					      int *reset_type);
+typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size);
 
 /*
  *  EFI Configuration Table and GUID definitions
@@ -575,9 +576,15 @@ extern void efi_enter_virtual_mode (void);	/* switch EFI to virtual mode, if pos
 #ifdef CONFIG_X86
 extern void efi_late_init(void);
 extern void efi_free_boot_services(void);
+extern efi_status_t efi_query_variable_store(u32 attributes, unsigned long size);
 #else
 static inline void efi_late_init(void) {}
 static inline void efi_free_boot_services(void) {}
+
+static inline efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
+{
+	return EFI_SUCCESS;
+}
 #endif
 extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);
 extern u64 efi_get_iobase (void);
@@ -731,7 +738,7 @@ struct efivar_operations {
 	efi_get_variable_t *get_variable;
 	efi_get_next_variable_t *get_next_variable;
 	efi_set_variable_t *set_variable;
-	efi_query_variable_info_t *query_variable_info;
+	efi_query_variable_store_t *query_variable_store;
 };
 
 struct efivars {
-- 
1.8.1.2


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

* [PATCH 138/145] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (136 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 137/145] x86, efivars: firmware bug workarounds should be in platform code Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 139/145] x86,efi: Implement efi_no_storage_paranoia parameter Kamal Mostafa
                   ` (6 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Satoru Takeuchi, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Olof Johansson, Matt Fleming, Kamal Mostafa

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

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

From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

commit 6b59e366e074d3962e04f01efb8acc10a33c0e1e upstream.

The check, "IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)",
in setup_arch() can be replaced by efi_is_enabled(). This change
remove duplicate code and improve readability.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ kamal: backport to 3.8 as prereq for "Modify UEFI anti-bricking code" ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/include/asm/efi.h  | 9 ++++++++-
 arch/x86/kernel/setup.c     | 3 +--
 arch/x86/platform/efi/efi.c | 5 -----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 28677c5..60c89f3 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void);
 extern void efi_unmap_memmap(void);
 extern void efi_memory_uc(u64 addr, unsigned long size);
 
-#ifndef CONFIG_EFI
+#ifdef CONFIG_EFI
+
+static inline bool efi_is_native(void)
+{
+	return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
+}
+
+#else
 /*
  * IF EFI is not configured, have the EFI calls return -ENOSYS.
  */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 8b24289..1abb796 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1135,8 +1135,7 @@ void __init setup_arch(char **cmdline_p)
 	 * mismatched firmware/kernel archtectures since there is no
 	 * support for runtime services.
 	 */
-	if (efi_enabled(EFI_BOOT) &&
-	    IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
+	if (efi_enabled(EFI_BOOT) && !efi_is_native()) {
 		pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
 		efi_unmap_memmap();
 	}
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index ce51ed0..27ff3b0 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -69,11 +69,6 @@ struct efi_memory_map memmap;
 static struct efi efi_phys __initdata;
 static efi_system_table_t efi_systab __initdata;
 
-static inline bool efi_is_native(void)
-{
-	return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
-}
-
 unsigned long x86_efi_facility;
 
 /*
-- 
1.8.1.2


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

* [PATCH 139/145] x86,efi: Implement efi_no_storage_paranoia parameter
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (137 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 138/145] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native() Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 140/145] Modify UEFI anti-bricking code Kamal Mostafa
                   ` (5 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Richard Weinberger, Matt Fleming, Kamal Mostafa

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

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

From: Richard Weinberger <richard@nod.at>

commit 8c58bf3eec3b8fc8162fe557e9361891c20758f2 upstream.

Using this parameter one can disable the storage_size/2 check if
he is really sure that the UEFI does sane gc and fulfills the spec.

This parameter is useful if a devices uses more than 50% of the
storage by default.
The Intel DQSW67 desktop board is such a sucker for exmaple.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ kamal: backport to 3.8 as prereq for "Modify UEFI anti-bricking code"
  (replaced param functionality gets implemented by that commit) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 Documentation/kernel-parameters.txt | 6 ++++++
 arch/x86/platform/efi/efi.c         | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 986614d..0b92543 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -785,6 +785,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	edd=		[EDD]
 			Format: {"off" | "on" | "skip[mbr]"}
 
+	efi_no_storage_paranoia [EFI; X86]
+			Using this parameter you can use more than 50% of
+			your efi variable storage. Use this parameter only if
+			you are really sure that your UEFI does sane gc and
+			fulfills the spec otherwise your board may brick.
+
 	eisa_irq_edge=	[PARISC,HW]
 			See header of drivers/parisc/eisa.c.
 
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 27ff3b0..55452cd 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -98,6 +98,15 @@ static int __init setup_add_efi_memmap(char *arg)
 }
 early_param("add_efi_memmap", setup_add_efi_memmap);
 
+static bool efi_no_storage_paranoia;
+
+static int __init setup_storage_paranoia(char *arg)
+{
+	efi_no_storage_paranoia = true;
+	return 0;
+}
+early_param("efi_no_storage_paranoia", setup_storage_paranoia);
+
 
 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
-- 
1.8.1.2


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

* [PATCH 140/145] Modify UEFI anti-bricking code
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (138 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 139/145] x86,efi: Implement efi_no_storage_paranoia parameter Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 141/145] x86/efi: Fix dummy variable buffer allocation Kamal Mostafa
                   ` (4 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Matthew Garrett, Lee, Chun-Y, Matt Fleming, Greg Kroah-Hartman,
	Kamal Mostafa

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

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

From: Richard Weinberger <richard@nod.at>

commit f8b8404337de4e2466e2e1139ea68b1f8295974f upstream.

This patch reworks the UEFI anti-bricking code, including an effective
reversion of cc5a080c and 31ff2f20. It turns out that calling
QueryVariableInfo() from boot services results in some firmware
implementations jumping to physical addresses even after entering virtual
mode, so until we have 1:1 mappings for UEFI runtime space this isn't
going to work so well.

Reverting these gets us back to the situation where we'd refuse to create
variables on some systems because they classify deleted variables as "used"
until the firmware triggers a garbage collection run, which they won't do
until they reach a lower threshold. This results in it being impossible to
install a bootloader, which is unhelpful.

Feedback from Samsung indicates that the firmware doesn't need more than
5KB of storage space for its own purposes, so that seems like a reasonable
threshold. However, there's still no guarantee that a platform will attempt
garbage collection merely because it drops below this threshold. It seems
that this is often only triggered if an attempt to write generates a
genuine EFI_OUT_OF_RESOURCES error. We can force that by attempting to
create a variable larger than the remaining space. This should fail, but if
it somehow succeeds we can then immediately delete it.

I've tested this on the UEFI machines I have available, but I don't have
a Samsung and so can't verify that it avoids the bricking problem.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Lee, Chun-Y <jlee@suse.com> [ dummy variable cleanup ]
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ kamal: backport to 3.8 ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/platform/efi/efi.c | 71 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 68 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 55452cd..87e91ba 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -51,6 +51,13 @@
 
 #define EFI_DEBUG	1
 
+#define EFI_MIN_RESERVE 5120
+
+#define EFI_DUMMY_GUID \
+	EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9)
+
+static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
+
 struct efi __read_mostly efi = {
 	.mps        = EFI_INVALID_TABLE_ADDR,
 	.acpi       = EFI_INVALID_TABLE_ADDR,
@@ -972,6 +979,13 @@ void __init efi_enter_virtual_mode(void)
 		runtime_code_page_mkexec();
 
 	kfree(new_memmap);
+
+	/* clean DUMMY object */
+	efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
+			 EFI_VARIABLE_NON_VOLATILE |
+			 EFI_VARIABLE_BOOTSERVICE_ACCESS |
+			 EFI_VARIABLE_RUNTIME_ACCESS,
+			 0, NULL);
 }
 
 /*
@@ -1023,14 +1037,65 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
 	efi_status_t status;
 	u64 storage_size, remaining_size, max_size;
 
+	if (!(attributes & EFI_VARIABLE_NON_VOLATILE))
+		return 0;
+
 	status = efi.query_variable_info(attributes, &storage_size,
 					 &remaining_size, &max_size);
 	if (status != EFI_SUCCESS)
 		return status;
 
-	if (!storage_size || size > remaining_size || size > max_size ||
-	    (remaining_size - size) < (storage_size / 2))
-		return EFI_OUT_OF_RESOURCES;
+	/*
+	 * Some firmware implementations refuse to boot if there's insufficient
+	 * space in the variable store. We account for that by refusing the
+	 * write if permitting it would reduce the available space to under
+	 * 5KB. This figure was provided by Samsung, so should be safe.
+	 */
+	if ((remaining_size - size < EFI_MIN_RESERVE) &&
+		!efi_no_storage_paranoia) {
+
+		/*
+		 * Triggering garbage collection may require that the firmware
+		 * generate a real EFI_OUT_OF_RESOURCES error. We can force
+		 * that by attempting to use more space than is available.
+		 */
+		unsigned long dummy_size = remaining_size + 1024;
+		void *dummy = kmalloc(dummy_size, GFP_ATOMIC);
+
+		status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
+					  EFI_VARIABLE_NON_VOLATILE |
+					  EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					  EFI_VARIABLE_RUNTIME_ACCESS,
+					  dummy_size, dummy);
+
+		if (status == EFI_SUCCESS) {
+			/*
+			 * This should have failed, so if it didn't make sure
+			 * that we delete it...
+			 */
+			efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
+					 EFI_VARIABLE_NON_VOLATILE |
+					 EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					 EFI_VARIABLE_RUNTIME_ACCESS,
+					 0, dummy);
+		}
+
+		/*
+		 * The runtime code may now have triggered a garbage collection
+		 * run, so check the variable info again
+		 */
+		status = efi.query_variable_info(attributes, &storage_size,
+						 &remaining_size, &max_size);
+
+		if (status != EFI_SUCCESS)
+			return status;
+
+		/*
+		 * There still isn't enough room, so return an error
+		 */
+		if (remaining_size - size < EFI_MIN_RESERVE)
+			return EFI_OUT_OF_RESOURCES;
+	}
 
 	return EFI_SUCCESS;
 }
-- 
1.8.1.2


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

* [PATCH 141/145] x86/efi: Fix dummy variable buffer allocation
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (139 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 140/145] Modify UEFI anti-bricking code Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 142/145] lockd: protect nlm_blocked access in nlmsvc_retry_blocked Kamal Mostafa
                   ` (3 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Hutchings, Matt Fleming, Kamal Mostafa

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

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

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

commit b8cb62f82103083a6e8fa5470bfe634a2c06514d upstream.

1. Check for allocation failure
2. Clear the buffer contents, as they may actually be written to flash
3. Don't leak the buffer

Compile-tested only.

[ Tested successfully on my buggy ASUS machine - Matt ]

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/platform/efi/efi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 87e91ba..fe2ac4f 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1060,7 +1060,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
 		 * that by attempting to use more space than is available.
 		 */
 		unsigned long dummy_size = remaining_size + 1024;
-		void *dummy = kmalloc(dummy_size, GFP_ATOMIC);
+		void *dummy = kzalloc(dummy_size, GFP_ATOMIC);
+
+		if (!dummy)
+			return EFI_OUT_OF_RESOURCES;
 
 		status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
 					  EFI_VARIABLE_NON_VOLATILE |
@@ -1080,6 +1083,8 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
 					 0, dummy);
 		}
 
+		kfree(dummy);
+
 		/*
 		 * The runtime code may now have triggered a garbage collection
 		 * run, so check the variable info again
-- 
1.8.1.2


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

* [PATCH 142/145] lockd: protect nlm_blocked access in nlmsvc_retry_blocked
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (140 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 141/145] x86/efi: Fix dummy variable buffer allocation Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 143/145] ext4: don't show usrquota/grpquota twice in /proc/mounts Kamal Mostafa
                   ` (2 subsequent siblings)
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bryan Schumaker, David Jeffery, J. Bruce Fields, Kamal Mostafa

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

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

From: David Jeffery <djeffery@redhat.com>

commit 1c327d962fc420aea046c16215a552710bde8231 upstream.

In nlmsvc_retry_blocked, the check that the list is non-empty and acquiring
the pointer of the first entry is unprotected by any lock.  This allows a rare
race condition when there is only one entry on the list.  A function such as
nlmsvc_grant_callback() can be called, which will temporarily remove the entry
from the list.  Between the list_empty() and list_entry(),the list may become
empty, causing an invalid pointer to be used as an nlm_block, leading to a
possible crash.

This patch adds the nlm_block_lock around these calls to prevent concurrent
use of the nlm_blocked list.

This was a regression introduced by
f904be9cc77f361d37d71468b13ff3d1a1823dea  "lockd: Mostly remove BKL from
the server".

Cc: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/lockd/svclock.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 8d80c99..57a3922 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -939,6 +939,7 @@ nlmsvc_retry_blocked(void)
 	unsigned long	timeout = MAX_SCHEDULE_TIMEOUT;
 	struct nlm_block *block;
 
+	spin_lock(&nlm_blocked_lock);
 	while (!list_empty(&nlm_blocked) && !kthread_should_stop()) {
 		block = list_entry(nlm_blocked.next, struct nlm_block, b_list);
 
@@ -948,6 +949,7 @@ nlmsvc_retry_blocked(void)
 			timeout = block->b_when - jiffies;
 			break;
 		}
+		spin_unlock(&nlm_blocked_lock);
 
 		dprintk("nlmsvc_retry_blocked(%p, when=%ld)\n",
 			block, block->b_when);
@@ -957,7 +959,9 @@ nlmsvc_retry_blocked(void)
 			retry_deferred_block(block);
 		} else
 			nlmsvc_grant_blocked(block);
+		spin_lock(&nlm_blocked_lock);
 	}
+	spin_unlock(&nlm_blocked_lock);
 
 	return timeout;
 }
-- 
1.8.1.2


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

* [PATCH 143/145] ext4: don't show usrquota/grpquota twice in /proc/mounts
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (141 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 142/145] lockd: protect nlm_blocked access in nlmsvc_retry_blocked Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 144/145] ext4: don't allow ext4_free_blocks() to fail due to ENOMEM Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 145/145] svcrdma: underflow issue in decode_write_list() Kamal Mostafa
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Kamal Mostafa

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

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

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

commit ad065dd01662ae22138899e6b1c8eeb3a529964f upstream.

We now print mount options in a generic fashion in
ext4_show_options(), so we shouldn't be explicitly printing the
{usr,grp}quota options in ext4_show_quota_options().

Without this patch, /proc/mounts can look like this:

 /dev/vdb /vdb ext4 rw,relatime,quota,usrquota,data=ordered,usrquota 0 0
                                      ^^^^^^^^              ^^^^^^^^

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/super.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5575a45..f036930 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1738,12 +1738,6 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
 
 	if (sbi->s_qf_names[GRPQUOTA])
 		seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]);
-
-	if (test_opt(sb, USRQUOTA))
-		seq_puts(seq, ",usrquota");
-
-	if (test_opt(sb, GRPQUOTA))
-		seq_puts(seq, ",grpquota");
 #endif
 }
 
-- 
1.8.1.2


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

* [PATCH 144/145] ext4: don't allow ext4_free_blocks() to fail due to ENOMEM
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (142 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 143/145] ext4: don't show usrquota/grpquota twice in /proc/mounts Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  2013-07-17 22:47 ` [PATCH 145/145] svcrdma: underflow issue in decode_write_list() Kamal Mostafa
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Kamal Mostafa

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

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

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

commit e7676a704ee0a1ef71a6b23760b5a8f6896cb1a1 upstream.

The filesystem should not be marked inconsistent if ext4_free_blocks()
is not able to allocate memory.  Unfortunately some callers (most
notably ext4_truncate) don't have a way to reflect an error back up to
the VFS.  And even if we did, most userspace applications won't deal
with most system calls returning ENOMEM anyway.

Reported-by: Nagachandra P <nagachandra@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/mballoc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 1206682..c8003a1 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4652,11 +4652,16 @@ do_more:
 		 * blocks being freed are metadata. these blocks shouldn't
 		 * be used until this transaction is committed
 		 */
+	retry:
 		new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
 		if (!new_entry) {
-			ext4_mb_unload_buddy(&e4b);
-			err = -ENOMEM;
-			goto error_return;
+			/*
+			 * We use a retry loop because
+			 * ext4_free_blocks() is not allowed to fail.
+			 */
+			cond_resched();
+			congestion_wait(BLK_RW_ASYNC, HZ/50);
+			goto retry;
 		}
 		new_entry->efd_start_cluster = bit;
 		new_entry->efd_group = block_group;
-- 
1.8.1.2


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

* [PATCH 145/145] svcrdma: underflow issue in decode_write_list()
  2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
                   ` (143 preceding siblings ...)
  2013-07-17 22:47 ` [PATCH 144/145] ext4: don't allow ext4_free_blocks() to fail due to ENOMEM Kamal Mostafa
@ 2013-07-17 22:47 ` Kamal Mostafa
  144 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-17 22:47 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, J. Bruce Fields, Kamal Mostafa

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

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

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

commit b2781e1021525649c0b33fffd005ef219da33926 upstream.

My static checker marks everything from ntohl() as untrusted and it
complains we could have an underflow problem doing:

	return (u32 *)&ary->wc_array[nchunks];

Also on 32 bit systems the upper bound check could overflow.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sunrpc/xprtrdma/svc_rdma_marshal.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/net/sunrpc/xprtrdma/svc_rdma_marshal.c b/net/sunrpc/xprtrdma/svc_rdma_marshal.c
index 8d2eddd..65b1462 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_marshal.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_marshal.c
@@ -98,6 +98,7 @@ void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *ch,
  */
 static u32 *decode_write_list(u32 *va, u32 *vaend)
 {
+	unsigned long start, end;
 	int nchunks;
 
 	struct rpcrdma_write_array *ary =
@@ -113,9 +114,12 @@ static u32 *decode_write_list(u32 *va, u32 *vaend)
 		return NULL;
 	}
 	nchunks = ntohl(ary->wc_nchunks);
-	if (((unsigned long)&ary->wc_array[0] +
-	     (sizeof(struct rpcrdma_write_chunk) * nchunks)) >
-	    (unsigned long)vaend) {
+
+	start = (unsigned long)&ary->wc_array[0];
+	end = (unsigned long)vaend;
+	if (nchunks < 0 ||
+	    nchunks > (SIZE_MAX - start) / sizeof(struct rpcrdma_write_chunk) ||
+	    (start + (sizeof(struct rpcrdma_write_chunk) * nchunks)) > end) {
 		dprintk("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n",
 			ary, nchunks, vaend);
 		return NULL;
@@ -129,6 +133,7 @@ static u32 *decode_write_list(u32 *va, u32 *vaend)
 
 static u32 *decode_reply_array(u32 *va, u32 *vaend)
 {
+	unsigned long start, end;
 	int nchunks;
 	struct rpcrdma_write_array *ary =
 		(struct rpcrdma_write_array *)va;
@@ -143,9 +148,12 @@ static u32 *decode_reply_array(u32 *va, u32 *vaend)
 		return NULL;
 	}
 	nchunks = ntohl(ary->wc_nchunks);
-	if (((unsigned long)&ary->wc_array[0] +
-	     (sizeof(struct rpcrdma_write_chunk) * nchunks)) >
-	    (unsigned long)vaend) {
+
+	start = (unsigned long)&ary->wc_array[0];
+	end = (unsigned long)vaend;
+	if (nchunks < 0 ||
+	    nchunks > (SIZE_MAX - start) / sizeof(struct rpcrdma_write_chunk) ||
+	    (start + (sizeof(struct rpcrdma_write_chunk) * nchunks)) > end) {
 		dprintk("svcrdma: ary=%p, wc_nchunks=%d, vaend=%p\n",
 			ary, nchunks, vaend);
 		return NULL;
-- 
1.8.1.2


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

* Re: [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
  2013-07-17 22:47 ` [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets Kamal Mostafa
@ 2013-07-18  8:02   ` Thomas Backlund
  2013-07-18 10:37     ` Neil Horman
  0 siblings, 1 reply; 152+ messages in thread
From: Thomas Backlund @ 2013-07-18  8:02 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: linux-kernel, stable, kernel-team, Neil Horman, Prarit Bhargava,
	Don Zickus, Don Dutile, Bjorn Helgaas, Asit Mallick,
	David Woodhouse, linux-pci, Joerg Roedel, Konrad Rzeszutek Wilk,
	Arkadiusz Miśkiewicz, Luis Henriques

18.07.2013 01:47, Kamal Mostafa skrev:
> 3.8.13.5 -stable review patch.  If anyone has any objections, please let me know.
>
> ------------------
>
> From: Neil Horman <nhorman@tuxdriver.com>
>
> commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 upstream.
>
> A few years back intel published a spec update:
> http://www.intel.com/content/dam/doc/specification-update/5520-and-5500-chipset-ioh-specification-update.pdf
>
> For the 5520 and 5500 chipsets which contained an errata (specificially errata
> 53), which noted that these chipsets can't properly do interrupt remapping, and
> as a result the recommend that interrupt remapping be disabled in bios.  While
> many vendors have a bios update to do exactly that, not all do, and of course
> not all users update their bios to a level that corrects the problem.  As a
> result, occasionally interrupts can arrive at a cpu even after affinity for that
> interrupt has be moved, leading to lost or spurrious interrupts (usually
> characterized by the message:
> kernel: do_IRQ: 7.71 No irq handler for vector (irq -1)
>
> There have been several incidents recently of people seeing this error, and
> investigation has shown that they have system for which their BIOS level is such
> that this feature was not properly turned off.  As such, it would be good to
> give them a reminder that their systems are vulnurable to this problem.  For
> details of those that reported the problem, please see:
> https://bugzilla.redhat.com/show_bug.cgi?id=887006
>
> [ Joerg: Removed CONFIG_IRQ_REMAP ifdef from early-quirks.c ]
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> CC: Prarit Bhargava <prarit@redhat.com>
> CC: Don Zickus <dzickus@redhat.com>
> CC: Don Dutile <ddutile@redhat.com>
> CC: Bjorn Helgaas <bhelgaas@google.com>
> CC: Asit Mallick <asit.k.mallick@intel.com>
> CC: David Woodhouse <dwmw2@infradead.org>
> CC: linux-pci@vger.kernel.org
> CC: Joerg Roedel <joro@8bytes.org>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Arkadiusz Miśkiewicz <arekm@maven.pl>
> Signed-off-by: Joerg Roedel <joro@8bytes.org>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> ---
>   arch/x86/include/asm/irq_remapping.h |  2 ++
>   arch/x86/kernel/early-quirks.c       | 20 ++++++++++++++++++++
>   drivers/iommu/intel_irq_remapping.c  | 10 ++++++++++
>   drivers/iommu/irq_remapping.c        |  6 ++++++
>   drivers/iommu/irq_remapping.h        |  2 ++
>   5 files changed, 40 insertions(+)
>

This patch introduces this warning on 3.8 series kernels:

In file included from arch/x86/kernel/early-quirks.c:21:0:
/kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10: 
varning: ”struct irq_data” deklarerad inuti parameterlista [aktiverat 
som standard]
/kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10: 
varning: dess scope-område är endast denna definition eller deklaration, 
vilket troligen inte är vad du vill. [aktiverat som standard]
/kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:50:17: 
varning: ”struct msi_msg” deklarerad inuti parameterlista [aktiverat som 
standard]


You need to add this upstream fix too:

commit 35d3d814cbd46a85bed97cd74ba97fbbb51e0ccd
Author: Joerg Roedel <joro@8bytes.org>
Date:   Fri Apr 19 20:34:55 2013 +0200

     iommu: Fix compile warnings with forward declarations


--

Thomas


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

* Re: [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
  2013-07-18  8:02   ` Thomas Backlund
@ 2013-07-18 10:37     ` Neil Horman
  2013-07-18 13:45       ` Thomas Backlund
  0 siblings, 1 reply; 152+ messages in thread
From: Neil Horman @ 2013-07-18 10:37 UTC (permalink / raw)
  To: Thomas Backlund
  Cc: Kamal Mostafa, linux-kernel, stable, kernel-team,
	Prarit Bhargava, Don Zickus, Don Dutile, Bjorn Helgaas,
	Asit Mallick, David Woodhouse, linux-pci, Joerg Roedel,
	Konrad Rzeszutek Wilk, Arkadiusz Miśkiewicz, Luis Henriques

On Thu, Jul 18, 2013 at 11:02:00AM +0300, Thomas Backlund wrote:
> 18.07.2013 01:47, Kamal Mostafa skrev:
> >3.8.13.5 -stable review patch.  If anyone has any objections, please let me know.
> >
> >------------------
> >
> >From: Neil Horman <nhorman@tuxdriver.com>
> >
> >commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 upstream.
> >
> >A few years back intel published a spec update:
> >http://www.intel.com/content/dam/doc/specification-update/5520-and-5500-chipset-ioh-specification-update.pdf
> >
> >For the 5520 and 5500 chipsets which contained an errata (specificially errata
> >53), which noted that these chipsets can't properly do interrupt remapping, and
> >as a result the recommend that interrupt remapping be disabled in bios.  While
> >many vendors have a bios update to do exactly that, not all do, and of course
> >not all users update their bios to a level that corrects the problem.  As a
> >result, occasionally interrupts can arrive at a cpu even after affinity for that
> >interrupt has be moved, leading to lost or spurrious interrupts (usually
> >characterized by the message:
> >kernel: do_IRQ: 7.71 No irq handler for vector (irq -1)
> >
> >There have been several incidents recently of people seeing this error, and
> >investigation has shown that they have system for which their BIOS level is such
> >that this feature was not properly turned off.  As such, it would be good to
> >give them a reminder that their systems are vulnurable to this problem.  For
> >details of those that reported the problem, please see:
> >https://bugzilla.redhat.com/show_bug.cgi?id=887006
> >
> >[ Joerg: Removed CONFIG_IRQ_REMAP ifdef from early-quirks.c ]
> >
> >Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >CC: Prarit Bhargava <prarit@redhat.com>
> >CC: Don Zickus <dzickus@redhat.com>
> >CC: Don Dutile <ddutile@redhat.com>
> >CC: Bjorn Helgaas <bhelgaas@google.com>
> >CC: Asit Mallick <asit.k.mallick@intel.com>
> >CC: David Woodhouse <dwmw2@infradead.org>
> >CC: linux-pci@vger.kernel.org
> >CC: Joerg Roedel <joro@8bytes.org>
> >CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >CC: Arkadiusz Miśkiewicz <arekm@maven.pl>
> >Signed-off-by: Joerg Roedel <joro@8bytes.org>
> >Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> >---
> >  arch/x86/include/asm/irq_remapping.h |  2 ++
> >  arch/x86/kernel/early-quirks.c       | 20 ++++++++++++++++++++
> >  drivers/iommu/intel_irq_remapping.c  | 10 ++++++++++
> >  drivers/iommu/irq_remapping.c        |  6 ++++++
> >  drivers/iommu/irq_remapping.h        |  2 ++
> >  5 files changed, 40 insertions(+)
> >
> 
> This patch introduces this warning on 3.8 series kernels:
> 
> In file included from arch/x86/kernel/early-quirks.c:21:0:
> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10:
> varning: ”struct irq_data” deklarerad inuti parameterlista
> [aktiverat som standard]
> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10:
> varning: dess scope-område är endast denna definition eller
> deklaration, vilket troligen inte är vad du vill. [aktiverat som
> standard]
> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:50:17:
> varning: ”struct msi_msg” deklarerad inuti parameterlista [aktiverat
> som standard]
> 
> 
> You need to add this upstream fix too:
> 
> commit 35d3d814cbd46a85bed97cd74ba97fbbb51e0ccd
> Author: Joerg Roedel <joro@8bytes.org>
> Date:   Fri Apr 19 20:34:55 2013 +0200
> 
>     iommu: Fix compile warnings with forward declarations
> 
I submited a 3.9 backport that included that fix to -stable over a week ago, you
should just be able to use that if you want.
Neil

> 
> --
> 
> Thomas
> 
> 

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

* Re: [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
  2013-07-18 10:37     ` Neil Horman
@ 2013-07-18 13:45       ` Thomas Backlund
  2013-07-18 18:30         ` Kamal Mostafa
  0 siblings, 1 reply; 152+ messages in thread
From: Thomas Backlund @ 2013-07-18 13:45 UTC (permalink / raw)
  To: Neil Horman
  Cc: Kamal Mostafa, linux-kernel, stable, kernel-team,
	Prarit Bhargava, Don Zickus, Don Dutile, Bjorn Helgaas,
	Asit Mallick, David Woodhouse, linux-pci, Joerg Roedel,
	Konrad Rzeszutek Wilk, Arkadiusz Miśkiewicz, Luis Henriques

18.07.2013 13:37, Neil Horman skrev:
> On Thu, Jul 18, 2013 at 11:02:00AM +0300, Thomas Backlund wrote:
>> 18.07.2013 01:47, Kamal Mostafa skrev:
>>> 3.8.13.5 -stable review patch.  If anyone has any objections, please let me know.
>>>
>>> ------------------
>>>
>>> From: Neil Horman <nhorman@tuxdriver.com>
>>>
>>> commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 upstream.
>>>
>>> A few years back intel published a spec update:
>>> http://www.intel.com/content/dam/doc/specification-update/5520-and-5500-chipset-ioh-specification-update.pdf
>>>
>>> For the 5520 and 5500 chipsets which contained an errata (specificially errata
>>> 53), which noted that these chipsets can't properly do interrupt remapping, and
>>> as a result the recommend that interrupt remapping be disabled in bios.  While
>>> many vendors have a bios update to do exactly that, not all do, and of course
>>> not all users update their bios to a level that corrects the problem.  As a
>>> result, occasionally interrupts can arrive at a cpu even after affinity for that
>>> interrupt has be moved, leading to lost or spurrious interrupts (usually
>>> characterized by the message:
>>> kernel: do_IRQ: 7.71 No irq handler for vector (irq -1)
>>>
>>> There have been several incidents recently of people seeing this error, and
>>> investigation has shown that they have system for which their BIOS level is such
>>> that this feature was not properly turned off.  As such, it would be good to
>>> give them a reminder that their systems are vulnurable to this problem.  For
>>> details of those that reported the problem, please see:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=887006
>>>
>>> [ Joerg: Removed CONFIG_IRQ_REMAP ifdef from early-quirks.c ]
>>>
>>> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
>>> CC: Prarit Bhargava <prarit@redhat.com>
>>> CC: Don Zickus <dzickus@redhat.com>
>>> CC: Don Dutile <ddutile@redhat.com>
>>> CC: Bjorn Helgaas <bhelgaas@google.com>
>>> CC: Asit Mallick <asit.k.mallick@intel.com>
>>> CC: David Woodhouse <dwmw2@infradead.org>
>>> CC: linux-pci@vger.kernel.org
>>> CC: Joerg Roedel <joro@8bytes.org>
>>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> CC: Arkadiusz Miśkiewicz <arekm@maven.pl>
>>> Signed-off-by: Joerg Roedel <joro@8bytes.org>
>>> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
>>> ---
>>>   arch/x86/include/asm/irq_remapping.h |  2 ++
>>>   arch/x86/kernel/early-quirks.c       | 20 ++++++++++++++++++++
>>>   drivers/iommu/intel_irq_remapping.c  | 10 ++++++++++
>>>   drivers/iommu/irq_remapping.c        |  6 ++++++
>>>   drivers/iommu/irq_remapping.h        |  2 ++
>>>   5 files changed, 40 insertions(+)
>>>
>>
>> This patch introduces this warning on 3.8 series kernels:
>>
>> In file included from arch/x86/kernel/early-quirks.c:21:0:
>> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10:
>> varning: ”struct irq_data” deklarerad inuti parameterlista
>> [aktiverat som standard]
>> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10:
>> varning: dess scope-område är endast denna definition eller
>> deklaration, vilket troligen inte är vad du vill. [aktiverat som
>> standard]
>> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:50:17:
>> varning: ”struct msi_msg” deklarerad inuti parameterlista [aktiverat
>> som standard]
>>
>>
>> You need to add this upstream fix too:
>>
>> commit 35d3d814cbd46a85bed97cd74ba97fbbb51e0ccd
>> Author: Joerg Roedel <joro@8bytes.org>
>> Date:   Fri Apr 19 20:34:55 2013 +0200
>>
>>      iommu: Fix compile warnings with forward declarations
>>
> I submited a 3.9 backport that included that fix to -stable over a week ago, you
> should just be able to use that if you want.
> Neil

Almost, but not enough...

The patch you refer to was:
[3.9 stable PATCH] iommu/vt-d: add quirk for broken interrupt remapping 
on 55XX chipsets

and got merged in 3.9.9.

And that added a missing: "#include <linux/irq.h>" in
arch/x86/include/asm/irq_remapping.h

But using that patch it still spits out:

kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:50:17:
 >> varning: ”struct msi_msg” deklarerad inuti parameterlista [aktiverat
 >> som standard]


which is why the additional patch is still needed...

--

Thomas



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

* Re: [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
  2013-07-18 13:45       ` Thomas Backlund
@ 2013-07-18 18:30         ` Kamal Mostafa
  0 siblings, 0 replies; 152+ messages in thread
From: Kamal Mostafa @ 2013-07-18 18:30 UTC (permalink / raw)
  To: Thomas Backlund
  Cc: Neil Horman, linux-kernel, stable, kernel-team, Prarit Bhargava,
	Don Zickus, Don Dutile, Bjorn Helgaas, Asit Mallick,
	David Woodhouse, linux-pci, Joerg Roedel, Konrad Rzeszutek Wilk,
	Arkadiusz Miśkiewicz, Luis Henriques

[-- Attachment #1: Type: text/plain, Size: 5188 bytes --]

On Thu, 2013-07-18 at 16:45 +0300, Thomas Backlund wrote:
> 18.07.2013 13:37, Neil Horman skrev:
> > On Thu, Jul 18, 2013 at 11:02:00AM +0300, Thomas Backlund wrote:
> >> 18.07.2013 01:47, Kamal Mostafa skrev:
> >>> 3.8.13.5 -stable review patch.  If anyone has any objections, please let me know.
> >>>
> >>> ------------------
> >>>
> >>> From: Neil Horman <nhorman@tuxdriver.com>
> >>>
> >>> commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 upstream.
> >>>
> >>> A few years back intel published a spec update:
> >>> http://www.intel.com/content/dam/doc/specification-update/5520-and-5500-chipset-ioh-specification-update.pdf
> >>>
> >>> For the 5520 and 5500 chipsets which contained an errata (specificially errata
> >>> 53), which noted that these chipsets can't properly do interrupt remapping, and
> >>> as a result the recommend that interrupt remapping be disabled in bios.  While
> >>> many vendors have a bios update to do exactly that, not all do, and of course
> >>> not all users update their bios to a level that corrects the problem.  As a
> >>> result, occasionally interrupts can arrive at a cpu even after affinity for that
> >>> interrupt has be moved, leading to lost or spurrious interrupts (usually
> >>> characterized by the message:
> >>> kernel: do_IRQ: 7.71 No irq handler for vector (irq -1)
> >>>
> >>> There have been several incidents recently of people seeing this error, and
> >>> investigation has shown that they have system for which their BIOS level is such
> >>> that this feature was not properly turned off.  As such, it would be good to
> >>> give them a reminder that their systems are vulnurable to this problem.  For
> >>> details of those that reported the problem, please see:
> >>> https://bugzilla.redhat.com/show_bug.cgi?id=887006
> >>>
> >>> [ Joerg: Removed CONFIG_IRQ_REMAP ifdef from early-quirks.c ]
> >>>
> >>> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> >>> CC: Prarit Bhargava <prarit@redhat.com>
> >>> CC: Don Zickus <dzickus@redhat.com>
> >>> CC: Don Dutile <ddutile@redhat.com>
> >>> CC: Bjorn Helgaas <bhelgaas@google.com>
> >>> CC: Asit Mallick <asit.k.mallick@intel.com>
> >>> CC: David Woodhouse <dwmw2@infradead.org>
> >>> CC: linux-pci@vger.kernel.org
> >>> CC: Joerg Roedel <joro@8bytes.org>
> >>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >>> CC: Arkadiusz Miśkiewicz <arekm@maven.pl>
> >>> Signed-off-by: Joerg Roedel <joro@8bytes.org>
> >>> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> >>> ---
> >>>   arch/x86/include/asm/irq_remapping.h |  2 ++
> >>>   arch/x86/kernel/early-quirks.c       | 20 ++++++++++++++++++++
> >>>   drivers/iommu/intel_irq_remapping.c  | 10 ++++++++++
> >>>   drivers/iommu/irq_remapping.c        |  6 ++++++
> >>>   drivers/iommu/irq_remapping.h        |  2 ++
> >>>   5 files changed, 40 insertions(+)
> >>>
> >>
> >> This patch introduces this warning on 3.8 series kernels:
> >>
> >> In file included from arch/x86/kernel/early-quirks.c:21:0:
> >> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10:
> >> varning: ”struct irq_data” deklarerad inuti parameterlista
> >> [aktiverat som standard]
> >> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:46:10:
> >> varning: dess scope-område är endast denna definition eller
> >> deklaration, vilket troligen inte är vad du vill. [aktiverat som
> >> standard]
> >> /kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:50:17:
> >> varning: ”struct msi_msg” deklarerad inuti parameterlista [aktiverat
> >> som standard]
> >>
> >>
> >> You need to add this upstream fix too:
> >>
> >> commit 35d3d814cbd46a85bed97cd74ba97fbbb51e0ccd
> >> Author: Joerg Roedel <joro@8bytes.org>
> >> Date:   Fri Apr 19 20:34:55 2013 +0200
> >>
> >>      iommu: Fix compile warnings with forward declarations
> >>
> > I submited a 3.9 backport that included that fix to -stable over a week ago, you
> > should just be able to use that if you want.
> > Neil
> 
> Almost, but not enough...
> 
> The patch you refer to was:
> [3.9 stable PATCH] iommu/vt-d: add quirk for broken interrupt remapping 
> on 55XX chipsets
> 
> and got merged in 3.9.9.
> 
> And that added a missing: "#include <linux/irq.h>" in
> arch/x86/include/asm/irq_remapping.h
> 
> But using that patch it still spits out:
> 
> kernel/linux-3.8.13.5/arch/x86/include/asm/irq_remapping.h:50:17:
>  >> varning: ”struct msi_msg” deklarerad inuti parameterlista [aktiverat
>  >> som standard]
> 
> 
> which is why the additional patch is still needed...
> 
> --
> 
> Thomas


Ok, I have replaced the queued patch in linux-3.8.y-review[0] with
Neil's backport[1], and added Joerg's patch[2].  These are (still)
queued up for 3.8.13.5 -stable.

Thanks very much for the heads-up folks.

 -Kamal

[0] http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=linux-3.8.y-review;a=shortlog
[1] http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=commitdiff;h=af4e6e26bde03f5203c9e366673623f4a3797639
[2] http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=commitdiff;h=3668f1f9e97d4ab0007f357e06fc67ce152c3998


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-07-18 18:30 UTC | newest]

Thread overview: 152+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-17 22:45 [ 3.8.y.z extended stable ] Linux 3.8.13.5 stable review Kamal Mostafa
2013-07-17 22:45 ` [PATCH 001/145] UBIFS: correct mount message Kamal Mostafa
2013-07-17 22:45 ` [PATCH 002/145] [SCSI] zfcp: fix adapter (re)open recovery while link to SAN is down Kamal Mostafa
2013-07-17 22:45 ` [PATCH 003/145] [SCSI] zfcp: block queue limits with data router Kamal Mostafa
2013-07-17 22:45 ` [PATCH 004/145] [SCSI] zfcp: status read buffers on first adapter open with link down Kamal Mostafa
2013-07-17 22:45 ` [PATCH 005/145] ahci: Add AMD CZ SATA device ID Kamal Mostafa
2013-07-17 22:45 ` [PATCH 006/145] i2c-piix4: Add AMD CZ SMBus " Kamal Mostafa
2013-07-17 22:45 ` [PATCH 007/145] sata_highbank: increase retry count but shorten duration for Calxeda controller Kamal Mostafa
2013-07-17 22:45 ` [PATCH 008/145] clocksource: dw_apb: Fix error check Kamal Mostafa
2013-07-17 22:45 ` [PATCH 009/145] zram: avoid invalid memory access in zram_exit() Kamal Mostafa
2013-07-17 22:45 ` [PATCH 010/145] zram: use zram->lock to protect zram_free_page() in swap free notify path Kamal Mostafa
2013-07-17 22:45 ` [PATCH 011/145] zram: destroy all devices on error recovery path in zram_init() Kamal Mostafa
2013-07-17 22:45 ` [PATCH 012/145] zram: avoid access beyond the zram device Kamal Mostafa
2013-07-17 22:45 ` [PATCH 013/145] zram: protect sysfs handler from invalid memory access Kamal Mostafa
2013-07-17 22:45 ` [PATCH 014/145] pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status Kamal Mostafa
2013-07-17 22:45 ` [PATCH 015/145] PCI: Fix refcount issue in pci_create_root_bus() error recovery path Kamal Mostafa
2013-07-17 22:45 ` [PATCH 016/145] ahci: remove pmp link online check in FBS EH Kamal Mostafa
2013-07-17 22:45 ` [PATCH 017/145] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed Kamal Mostafa
2013-07-17 22:45 ` [PATCH 018/145] x86, efi: retry ExitBootServices() on failure Kamal Mostafa
2013-07-17 22:45 ` [PATCH 019/145] libata: skip SRST for all SIMG [34]7x port-multipliers Kamal Mostafa
2013-07-17 22:45 ` [PATCH 020/145] ASoC: wm8962: Remove remaining direct register cache accesses Kamal Mostafa
2013-07-17 22:45 ` [PATCH 021/145] xen/pcifront: Deal with toolstack missing 'XenbusStateClosing' state Kamal Mostafa
2013-07-17 22:45 ` [PATCH 022/145] ACPICA: Do not use extended sleep registers unless HW-reduced bit is set Kamal Mostafa
2013-07-17 22:45 ` [PATCH 023/145] ALSA: hda - Cache the MUX selection for generic HDMI Kamal Mostafa
2013-07-17 22:45 ` [PATCH 024/145] cgroup: fix umount vs cgroup_cfts_commit() race Kamal Mostafa
2013-07-17 22:45 ` [PATCH 025/145] cgroup: fix umount vs cgroup_event_remove() race Kamal Mostafa
2013-07-17 22:45 ` [PATCH 026/145] xhci: check for failed dma pool allocation Kamal Mostafa
2013-07-17 22:45 ` [PATCH 027/145] powerpc/eeh: Fix fetching bus for single-dev-PE Kamal Mostafa
2013-07-17 22:46 ` [PATCH 028/145] ata_piix: IDE-mode SATA patch for Intel Coleto Creek DeviceIDs Kamal Mostafa
2013-07-17 22:46 ` [PATCH 029/145] ahci: AHCI-mode " Kamal Mostafa
2013-07-17 22:46 ` [PATCH 030/145] ARM: 7765/1: perf: Record the user-mode PC in the call chain Kamal Mostafa
2013-07-17 22:46 ` [PATCH 031/145] [SCSI] mpt2sas: Fix for issue Missing delay not getting set during system bootup Kamal Mostafa
2013-07-17 22:46 ` [PATCH 032/145] [SCSI] mpt2sas: Fix for device scan following host reset could get stuck in a infinite loop Kamal Mostafa
2013-07-17 22:46 ` [PATCH 033/145] [SCSI] mpt2sas: fix firmware failure with wrong task attribute Kamal Mostafa
2013-07-17 22:46 ` [PATCH 034/145] usb: host: xhci-plat: release mem region while removing module Kamal Mostafa
2013-07-17 22:46 ` [PATCH 035/145] USB: option,qcserial: move Novatel Gobi1K IDs to qcserial Kamal Mostafa
2013-07-17 22:46 ` [PATCH 036/145] powerpc/hw_brk: Fix setting of length for exact mode breakpoints Kamal Mostafa
2013-07-17 22:46 ` [PATCH 037/145] crypto: algboss - Hold ref count on larval Kamal Mostafa
2013-07-17 22:46   ` Kamal Mostafa
2013-07-17 22:46 ` [PATCH 038/145] x86: Fix /proc/mtrr with base/size more than 44bits Kamal Mostafa
2013-07-17 22:46 ` [PATCH 039/145] futex: Take hugepages into account when generating futex_key Kamal Mostafa
2013-07-17 22:46 ` [PATCH 040/145] pch_uart: Add uart_clk selection for the MinnowBoard Kamal Mostafa
2013-07-17 22:46 ` [PATCH 041/145] perf: Disable monitoring on setuid processes for regular users Kamal Mostafa
2013-07-17 22:46 ` [PATCH 042/145] [SCSI] sd: Fix parsing of 'temporary ' cache mode prefix Kamal Mostafa
2013-07-17 22:46 ` [PATCH 043/145] Handle big endianness in NTLM (ntlmv2) authentication Kamal Mostafa
2013-07-17 22:46 ` [PATCH 044/145] [SCSI] sd: Update WRITE SAME heuristics Kamal Mostafa
2013-07-17 22:46 ` [PATCH 045/145] [SCSI] aacraid: Fix for arrays are going offline in the system. System hangs Kamal Mostafa
2013-07-17 22:46 ` [PATCH 046/145] genirq: Fix can_request_irq() for IRQs without an action Kamal Mostafa
2013-07-17 22:46 ` [PATCH 047/145] timer: Fix jiffies wrap behavior of round_jiffies_common() Kamal Mostafa
2013-07-17 22:46 ` [PATCH 048/145] xen/time: remove blocked time accounting from xen "clockchip" Kamal Mostafa
2013-07-17 22:46 ` [PATCH 049/145] UBIFS: prepare to fix a horrid bug Kamal Mostafa
2013-07-17 22:46 ` [PATCH 050/145] UBIFS: " Kamal Mostafa
2013-07-17 22:46 ` [PATCH 051/145] Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller" Kamal Mostafa
2013-07-17 22:46 ` [PATCH 052/145] powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries Kamal Mostafa
2013-07-17 22:46 ` [PATCH 053/145] ext4: fix corruption when online resizing a fs with 1K block size Kamal Mostafa
2013-07-17 22:46 ` [PATCH 054/145] jbd2: move superblock checksum calculation to jbd2_write_superblock() Kamal Mostafa
2013-07-17 22:46 ` [PATCH 055/145] ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree() Kamal Mostafa
2013-07-17 22:46 ` [PATCH 056/145] jbd2: fix theoretical race in jbd2__journal_restart Kamal Mostafa
2013-07-17 22:46 ` [PATCH 057/145] tick: Prevent uncontrolled switch to oneshot mode Kamal Mostafa
2013-07-17 22:46 ` [PATCH 058/145] md/raid10: fix two bugs affecting RAID10 reshape Kamal Mostafa
2013-07-17 22:46 ` [PATCH 059/145] HID: apple: Add support for the 2013 Macbook Air Kamal Mostafa
2013-07-17 22:46 ` [PATCH 060/145] Input: bcm5974 - add support for the 2013 MacBook Air Kamal Mostafa
2013-07-17 22:46 ` [PATCH 061/145] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() Kamal Mostafa
2013-07-17 22:46 ` [PATCH 062/145] ocfs2: xattr: fix inlined xattr reflink Kamal Mostafa
2013-07-17 22:46 ` [PATCH 063/145] block: do not pass disk names as format strings Kamal Mostafa
2013-07-17 22:46 ` [PATCH 064/145] crypto: sanitize argument for format string Kamal Mostafa
2013-07-17 22:46   ` Kamal Mostafa
2013-07-17 22:46 ` [PATCH 065/145] mm/memory-hotplug: fix lowmem count overflow when offline pages Kamal Mostafa
2013-07-17 22:46 ` [PATCH 066/145] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq Kamal Mostafa
2013-07-17 22:46 ` [PATCH 067/145] nbd: correct disconnect behavior Kamal Mostafa
2013-07-17 22:46 ` [PATCH 068/145] hpfs: better test for errors Kamal Mostafa
2013-07-17 22:46 ` [PATCH 069/145] Drivers: hv: Execute shutdown in a thread context Kamal Mostafa
2013-07-17 22:46 ` [PATCH 070/145] ext3: fix data=journal fast mount/umount hang Kamal Mostafa
2013-07-17 22:46 ` [PATCH 071/145] netfilter: xt_TCPOPTSTRIP: fix possible mangling beyond packet boundary Kamal Mostafa
2013-07-17 22:46 ` [PATCH 072/145] netfilter: ipt_ULOG: fix non-null terminated string in the nf_log path Kamal Mostafa
2013-07-17 22:46 ` [PATCH 073/145] netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6 Kamal Mostafa
2013-07-17 22:46 ` [PATCH 074/145] ipvs: Fix reuse connection if real server is dead Kamal Mostafa
2013-07-17 22:46 ` [PATCH 075/145] netfilter: xt_LOG: fix mark logging for IPv6 packets Kamal Mostafa
2013-07-17 22:46 ` [PATCH 076/145] ipvs: info leak in __ip_vs_get_dest_entries() Kamal Mostafa
2013-07-17 22:46 ` [PATCH 077/145] netfilter: nfnetlink_cttimeout: fix incomplete dumping of objects Kamal Mostafa
2013-07-17 22:46 ` [PATCH 078/145] netfilter: nfnetlink_acct: " Kamal Mostafa
2013-07-17 22:46 ` [PATCH 079/145] netfilter: xt_TCPMSS: Fix violation of RFC879 in absence of MSS option Kamal Mostafa
2013-07-17 22:46 ` [PATCH 080/145] netfilter: xt_TCPOPTSTRIP: don't use tcp_hdr() Kamal Mostafa
2013-07-17 22:46 ` [PATCH 081/145] netfilter: xt_TCPMSS: Fix missing fragmentation handling Kamal Mostafa
2013-07-17 22:46 ` [PATCH 082/145] netfilter: xt_TCPMSS: Fix IPv6 default MSS too Kamal Mostafa
2013-07-17 22:46 ` [PATCH 083/145] ipvs: SCTP ports should be writable in ICMP packets Kamal Mostafa
2013-07-17 22:46 ` [PATCH 084/145] tracing: Use current_uid() for critical time tracing Kamal Mostafa
2013-07-17 22:46 ` [PATCH 085/145] ext4: fix overflow when counting used blocks on 32-bit architectures Kamal Mostafa
2013-07-17 22:46 ` [PATCH 086/145] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs Kamal Mostafa
2013-07-17 22:46 ` [PATCH 087/145] ext4: fix overflows in SEEK_HOLE, SEEK_DATA implementations Kamal Mostafa
2013-07-17 22:47 ` [PATCH 088/145] ext4: fix data offset overflow on 32-bit archs in ext4_inline_data_fiemap() Kamal Mostafa
2013-07-17 22:47 ` [PATCH 089/145] iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets Kamal Mostafa
2013-07-18  8:02   ` Thomas Backlund
2013-07-18 10:37     ` Neil Horman
2013-07-18 13:45       ` Thomas Backlund
2013-07-18 18:30         ` Kamal Mostafa
2013-07-17 22:47 ` [PATCH 090/145] dma: tegra: avoid channel lock up after free Kamal Mostafa
2013-07-17 22:47 ` [PATCH 091/145] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware Kamal Mostafa
2013-07-17 22:47 ` [PATCH 092/145] printk: Fix rq->lock vs logbuf_lock unlock lock inversion Kamal Mostafa
2013-07-17 22:47 ` [PATCH 093/145] charger-manager: Ensure event is not used as format string Kamal Mostafa
2013-07-17 22:47 ` [PATCH 094/145] drm/radeon: add backlight quirk for hybrid mac Kamal Mostafa
2013-07-17 22:47 ` [PATCH 095/145] b43: ensue that BCMA is "y" when B43 is "y" Kamal Mostafa
2013-07-17 22:47 ` [PATCH 096/145] ath9k_hw: Assign default xlna config for AR9485 Kamal Mostafa
2013-07-17 22:47 ` [PATCH 097/145] ath9k: Do not assign noise for NULL caldata Kamal Mostafa
2013-07-17 22:47 ` [PATCH 098/145] iwlwifi: pcie: fix race in queue unmapping Kamal Mostafa
2013-07-17 22:47 ` [PATCH 099/145] iwlwifi: pcie: wake the queue if stopped when being unmapped Kamal Mostafa
2013-07-17 22:47 ` [PATCH 100/145] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND Kamal Mostafa
2013-07-17 22:47 ` [PATCH 101/145] [media] media: dmxdev: remove dvb_ringbuffer_flush() on writer side Kamal Mostafa
2013-07-17 22:47 ` [PATCH 102/145] MIPS: Octeon: Don't clobber bootloader data structures Kamal Mostafa
2013-07-17 22:47 ` [PATCH 103/145] iommu/amd: Only unmap large pages from the first pte Kamal Mostafa
2013-07-17 22:47 ` [PATCH 104/145] rt2x00: read 5GHz TX power values from the correct offset Kamal Mostafa
2013-07-17 22:47 ` [PATCH 105/145] rtlwifi: rtl8723ae: Fix typo in firmware names Kamal Mostafa
2013-07-17 22:47 ` [PATCH 106/145] writeback: Fix periodic writeback after fs mount Kamal Mostafa
2013-07-17 22:47 ` [PATCH 107/145] drm/i915: Fix context sizes on HSW Kamal Mostafa
2013-07-17 22:47 ` [PATCH 108/145] drm/i915: Only clear write-domains after a successful wait-seqno Kamal Mostafa
2013-07-17 22:47 ` [PATCH 109/145] nfsd4: fix decoding of compounds across page boundaries Kamal Mostafa
2013-07-17 22:47 ` [PATCH 110/145] svcrpc: fix handling of too-short rpc's Kamal Mostafa
2013-07-17 22:47 ` [PATCH 111/145] svcrpc: don't error out on small tcp fragment Kamal Mostafa
2013-07-17 22:47 ` [PATCH 112/145] ARM: shmobile: emev2 GIO3 resource fix Kamal Mostafa
2013-07-17 22:47 ` [PATCH 113/145] Btrfs: fix unlock after free on rewinded tree blocks Kamal Mostafa
2013-07-17 22:47 ` [PATCH 114/145] Btrfs: hold the tree mod lock in __tree_mod_log_rewind Kamal Mostafa
2013-07-17 22:47 ` [PATCH 115/145] Btrfs: only do the tree_mod_log_free_eb if this is our last ref Kamal Mostafa
2013-07-17 22:47 ` [PATCH 116/145] uprobes: Fix return value in error handling path Kamal Mostafa
2013-07-17 22:47 ` [PATCH 117/145] module: do percpu allocation after uniqueness check. No, really! Kamal Mostafa
2013-07-17 22:47 ` [PATCH 118/145] libceph: Fix NULL pointer dereference in auth client code Kamal Mostafa
2013-07-17 22:47 ` [PATCH 119/145] [CIFS] use sensible file nlink values if unprovided Kamal Mostafa
2013-07-17 22:47 ` [PATCH 120/145] drm/nouveau: use vmalloc for pgt allocation Kamal Mostafa
2013-07-17 22:47 ` [PATCH 121/145] drm/nva3/disp: Fix HDMI audio regression Kamal Mostafa
2013-07-17 22:47 ` [PATCH 122/145] ACPI / power: add missing newline to debug messages Kamal Mostafa
2013-07-17 22:47 ` [PATCH 123/145] [SCSI] megaraid_sas: fix memory leak if SGL has zero length entries Kamal Mostafa
2013-07-17 22:47 ` [PATCH 124/145] iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow Kamal Mostafa
2013-07-17 22:47 ` [PATCH 125/145] [SCSI] mpt3sas: fix for kernel panic when driver loads with HBA conected to non LUN 0 configured expander Kamal Mostafa
2013-07-17 22:47 ` [PATCH 126/145] [SCSI] mpt3sas: Infinite loops can occur if MPI2_IOCSTATUS_CONFIG_INVALID_PAGE is not returned Kamal Mostafa
2013-07-17 22:47 ` [PATCH 127/145] parisc: Fix gcc miscompilation in pa_memcpy() Kamal Mostafa
2013-07-17 22:47 ` [PATCH 128/145] ARM: 7778/1: smp_twd: twd_update_frequency need be run on all online CPUs Kamal Mostafa
2013-07-17 22:47 ` [PATCH 129/145] dm mpath: fix ioctl deadlock when no paths Kamal Mostafa
2013-07-17 22:47 ` [PATCH 130/145] dm ioctl: set noio flag to avoid __vmalloc deadlock Kamal Mostafa
2013-07-17 22:47 ` [PATCH 131/145] dm verity: fix inability to use a few specific devices sizes Kamal Mostafa
2013-07-17 22:47 ` [PATCH 132/145] CIFS: Fix a deadlock when a file is reopened Kamal Mostafa
2013-07-17 22:47 ` [PATCH 133/145] perf: Clone child context from parent context pmu Kamal Mostafa
2013-07-17 22:47 ` [PATCH 134/145] perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario Kamal Mostafa
2013-07-17 22:47 ` [PATCH 135/145] perf: Fix perf_lock_task_context() vs RCU Kamal Mostafa
2013-07-17 22:47 ` [PATCH 136/145] MFD: rtsx_pcr: Fix probe fail path Kamal Mostafa
2013-07-17 22:47 ` [PATCH 137/145] x86, efivars: firmware bug workarounds should be in platform code Kamal Mostafa
2013-07-17 22:47 ` [PATCH 138/145] x86, efi: remove duplicate code in setup_arch() by using, efi_is_native() Kamal Mostafa
2013-07-17 22:47 ` [PATCH 139/145] x86,efi: Implement efi_no_storage_paranoia parameter Kamal Mostafa
2013-07-17 22:47 ` [PATCH 140/145] Modify UEFI anti-bricking code Kamal Mostafa
2013-07-17 22:47 ` [PATCH 141/145] x86/efi: Fix dummy variable buffer allocation Kamal Mostafa
2013-07-17 22:47 ` [PATCH 142/145] lockd: protect nlm_blocked access in nlmsvc_retry_blocked Kamal Mostafa
2013-07-17 22:47 ` [PATCH 143/145] ext4: don't show usrquota/grpquota twice in /proc/mounts Kamal Mostafa
2013-07-17 22:47 ` [PATCH 144/145] ext4: don't allow ext4_free_blocks() to fail due to ENOMEM Kamal Mostafa
2013-07-17 22:47 ` [PATCH 145/145] svcrdma: underflow issue in decode_write_list() Kamal Mostafa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.