All of lore.kernel.org
 help / color / mirror / Atom feed
* [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review
@ 2013-08-16 22:32 Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 001/133] Input: elantech - fix for newer hardware versions (v7) Kamal Mostafa
                   ` (132 more replies)
  0 siblings, 133 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 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.7 stable kernel.

This version contains 133 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.7 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

--
 arch/Kconfig                                       |   6 +
 arch/arm/Kconfig                                   |   4 +-
 arch/arm/include/asm/a.out-core.h                  |  45 ------
 arch/arm/include/asm/mmu.h                         |   2 +
 arch/arm/include/asm/mmu_context.h                 |  20 ++-
 arch/arm/include/asm/processor.h                   |   4 -
 arch/arm/include/asm/thread_info.h                 |   1 -
 arch/arm/include/uapi/asm/Kbuild                   |   1 -
 arch/arm/include/uapi/asm/a.out.h                  |  34 ----
 arch/arm/kernel/entry-armv.S                       | 103 ++++++------
 arch/arm/kernel/fiq.c                              |  19 ++-
 arch/arm/kernel/perf_event.c                       |   7 +-
 arch/arm/kernel/traps.c                            |  37 +++--
 arch/arm/kernel/vmlinux.lds.S                      |  17 ++
 arch/arm/mach-footbridge/dc21285.c                 |   2 -
 arch/arm/mm/Kconfig                                |  34 ++++
 arch/arm/mm/mmu.c                                  |  10 +-
 arch/microblaze/Kconfig                            |   2 +-
 arch/powerpc/Kconfig                               |   2 +-
 arch/s390/include/asm/bitops.h                     |   2 +-
 arch/s390/kvm/kvm-s390.c                           |  21 ++-
 arch/x86/kernel/cpu/perf_event_intel_uncore.c      |   4 +-
 arch/x86/kernel/early-quirks.c                     |  14 +-
 arch/x86/kernel/i387.c                             |   2 +-
 arch/x86/kernel/sys_x86_64.c                       |   2 +-
 arch/x86/mm/mmap.c                                 |   2 +-
 drivers/acpi/battery.c                             |   2 +
 drivers/acpi/proc.c                                |  17 +-
 drivers/ata/ata_piix.c                             |   2 +-
 drivers/char/virtio_console.c                      |  70 ++++++---
 drivers/cpuidle/governors/menu.c                   |  98 +-----------
 drivers/dma/pl330.c                                |  93 ++++++++---
 drivers/firewire/core-cdev.c                       |   3 +
 drivers/firewire/ohci.c                            |  10 +-
 drivers/gpu/drm/ast/ast_ttm.c                      |   1 +
 drivers/gpu/drm/cirrus/cirrus_ttm.c                |   1 +
 drivers/gpu/drm/drm_irq.c                          |   5 +-
 drivers/gpu/drm/i915/i915_dma.c                    |   2 +
 drivers/gpu/drm/i915/i915_drv.h                    |   1 +
 drivers/gpu/drm/i915/i915_reg.h                    |  12 +-
 drivers/gpu/drm/i915/intel_display.c               |  23 ++-
 drivers/gpu/drm/i915/intel_panel.c                 |  11 ++
 drivers/gpu/drm/i915/intel_pm.c                    |   8 +-
 drivers/gpu/drm/mgag200/mgag200_ttm.c              |   1 +
 drivers/gpu/drm/nouveau/nv10_fence.c               |   2 +-
 drivers/gpu/drm/nouveau/nv50_fence.c               |  14 +-
 drivers/gpu/drm/radeon/atom.c                      |   5 +
 drivers/gpu/drm/radeon/atombios_dp.c               |  43 ++++-
 drivers/gpu/drm/radeon/radeon_combios.c            | 159 ++++++-------------
 drivers/hwmon/adt7470.c                            |   2 +-
 drivers/input/mouse/elantech.c                     |  17 +-
 drivers/macintosh/windfarm_rm31.c                  |  18 +--
 drivers/md/raid10.c                                |   8 +-
 drivers/md/raid5.c                                 |  15 +-
 drivers/md/raid5.h                                 |   1 +
 drivers/net/arcnet/arcnet.c                        |   2 +-
 drivers/net/ethernet/atheros/atl1c/atl1c.h         |   3 +
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c    |  40 ++++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c |   3 +-
 drivers/net/ethernet/mellanox/mlx4/main.c          |   2 +-
 drivers/net/ethernet/realtek/8139cp.c              |  48 +++++-
 drivers/net/usb/smsc75xx.c                         |  12 +-
 drivers/net/wireless/ath/ath9k/hif_usb.c           |   4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c      |   1 +
 drivers/net/wireless/iwlwifi/dvm/mac80211.c        |  19 ++-
 drivers/net/wireless/iwlwifi/pcie/drv.c            |   1 +
 drivers/net/wireless/mwifiex/sdio.c                |   4 +-
 drivers/net/wireless/rt2x00/rt2x00queue.c          |  18 ++-
 drivers/scsi/isci/task.c                           |   9 +-
 drivers/scsi/megaraid/megaraid_sas_base.c          |  20 ++-
 drivers/scsi/qla2xxx/qla_iocb.c                    |  11 +-
 drivers/scsi/scsi.c                                |   3 +
 drivers/scsi/sd.c                                  |  22 +--
 drivers/spi/spi-davinci.c                          |   2 +-
 drivers/staging/android/logger.c                   |   4 +-
 drivers/staging/comedi/comedi_fops.c               |  32 ++--
 drivers/tty/serial/arc_uart.c                      |   2 +-
 drivers/tty/serial/mxs-auart.c                     |  40 +++--
 drivers/usb/core/hub.c                             |   9 ++
 drivers/usb/dwc3/core.h                            |   4 +-
 drivers/usb/dwc3/gadget.c                          |   1 +
 drivers/usb/host/ehci-hub.c                        |   1 +
 drivers/usb/host/xhci-pci.c                        |   1 -
 drivers/usb/host/xhci-ring.c                       |   2 +-
 drivers/usb/host/xhci.c                            |  13 +-
 drivers/usb/misc/sisusbvga/sisusb.c                |   1 +
 drivers/usb/serial/cp210x.c                        |   4 +
 drivers/usb/serial/ftdi_sio.c                      |  31 +++-
 drivers/usb/serial/ftdi_sio_ids.h                  |  34 +++-
 drivers/usb/serial/mos7840.c                       | 175 ++++++++++++---------
 drivers/usb/serial/option.c                        |  23 +--
 drivers/usb/serial/ti_usb_3410_5052.c              |   2 +-
 drivers/usb/storage/unusual_devs.h                 |   7 +
 fs/btrfs/tree-log.c                                |   5 +-
 fs/cifs/cifsencrypt.c                              |   2 +-
 fs/cifs/cifsglob.h                                 |   1 +
 fs/cifs/connect.c                                  |   7 +-
 fs/cifs/readdir.c                                  |   8 +
 fs/cifs/sess.c                                     |   6 +-
 fs/ext4/extents.c                                  |   2 +-
 fs/ext4/ialloc.c                                   |  10 +-
 fs/ext4/super.c                                    |  20 ++-
 fs/nfsd/vfs.c                                      |   5 +-
 fs/proc/task_mmu.c                                 |   8 +-
 include/linux/firewire.h                           |   1 +
 include/linux/regmap.h                             |   1 +
 include/linux/sched.h                              |   1 +
 include/linux/syscalls.h                           |   5 +
 include/linux/tick.h                               |   6 -
 include/linux/user_namespace.h                     |   1 +
 include/net/ndisc.h                                |   2 +-
 include/uapi/linux/firewire-cdev.h                 |   4 +-
 kernel/fork.c                                      |   6 +
 kernel/sched/fair.c                                |   1 +
 kernel/time/tick-sched.c                           |   4 -
 kernel/user_namespace.c                            |  17 +-
 mm/mempolicy.c                                     |   6 +-
 net/ipv4/sysctl_net_ipv4.c                         |   6 +-
 net/ipv6/ip6mr.c                                   |   5 +
 net/key/af_key.c                                   |   4 +
 net/mac80211/cfg.c                                 |   2 +
 net/mac80211/rx.c                                  |  10 +-
 net/sched/sch_atm.c                                |   1 +
 net/sched/sch_cbq.c                                |   1 +
 net/wireless/nl80211.c                             |   7 +-
 sound/core/compress_offload.c                      |   2 +-
 sound/soc/codecs/max98088.c                        |   2 +-
 sound/usb/6fire/comm.c                             |  38 ++++-
 sound/usb/6fire/comm.h                             |   2 +-
 sound/usb/6fire/pcm.c                              |   2 +-
 sound/usb/endpoint.c                               |  13 +-
 tools/hv/hv_kvp_daemon.c                           |   5 +-
 132 files changed, 1143 insertions(+), 737 deletions(-)

Aaro Koskinen (1):
      powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31)

Alex Deucher (3):
      drm/radeon: fix endian issues with DP handling (v3)
      drm/radeon: improve dac adjust heuristics for legacy pdac
      drm/radeon/atom: initialize more atom interpretor elements to 0

Alexandr \\\"Sky\\\" Ivanov (1):
      USB: option: add D-Link DWM-152/C1 and DWM-156/C1

Amit Shah (5):
      virtio: console: fix race with port unplug and open/close
      virtio: console: fix race in port_fops_open() and port unplug
      virtio: console: clean up port data immediately at time of unplug
      virtio: console: fix raising SIGIO after port unplug
      virtio: console: return -ENODEV on all read operations after unplug

Andreas Fleig (1):
      ACPI / PM: Fix /proc/acpi/wakeup for devices w/o bus or parent

Anton Blanchard (1):
      powerpc: On POWERNV enable PPC_DENORMALISATION by default

Axel Lin (1):
      serial: arc_uart: Fix module alias

Barry Grussling (1):
      usb: cp210x support SEL C662 Vendor/Device

Ben Widawsky (1):
      drm/i915: fix missed hunk after GT access breakage

Bjørn Mork (1):
      usb: option: add TP-LINK MA260

Catalin Marinas (1):
      ARM: 7790/1: Fix deferred mm switch on VIVT processors

Chen Gang (1):
      cifs: extend the buffer length enought for sprintf() using

Chih-Chung Chang (1):
      ASoC: max98088 - fix element type of the register cache.

Christian Eggers (1):
      spi: spi-davinci: Fix direction in dma_map_single()

Clemens Ladisch (2):
      firewire: fix libdc1394/FlyCap2 iso event regression
      ALSA: usb-audio: do not trust too-big wMaxPacketSize values

Curt Brune (1):
      hwmon: (adt7470) Fix incorrect return code check

Dan Carpenter (3):
      arcnet: cleanup sizeof parameter
      af_key: more info leaks in pfkey messages
      net_sched: info leak in atm_tc_dump_class()

Dan Williams (1):
      usb: serial: option: add Olivetti Olicard 200

Daniil Bolsun (1):
      USB: option: append Petatel NP10T device to GSM modems list

Dave Airlie (1):
      drm/ast: invalidate page tables when pinning a BO

David S. Miller (1):
      net_sched: Fix stack info leak in cbq_dump_wrr().

Dominik Dingel (1):
      KVM: s390: move kvm_guest_enter,exit closer to sie

Egbert Eich (1):
      drm/mgag200: Invalidate page tables when pinning a BO

Eldad Zack (1):
      ALSA: usb-audio: 6fire: return correct XRUN indication

Emmanuel Grumbach (1):
      iwlwifi: add DELL SKU for 5150 HMC

Enrico Mioso (3):
      usb: serial: option: Add ONYX 3G device support
      usb: serial: option: blacklist ONDA MT689DC QMI interface
      usb: serial: option.c: remove ONDA MT825UP product ID fromdriver

Eric Dumazet (2):
      usbnet: do not pretend to support SG/TSO
      atl1c: use custom skb allocator

Eric Sandeen (1):
      ext4: destroy ext4_es_cachep on module unload

Ewan D. Milne (1):
      [SCSI] sd: fix crash when UA received on DIF enabled device

Felipe Balbi (1):
      usb: dwc3: gadget: don't prevent gadget from being probed if we fail

George Cherian (1):
      usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0

H.J. Lu (1):
      x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz

Hannes Frederic Sowa (1):
      ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup

Harshula Jayasuriya (1):
      nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file

Huang Rui (1):
      usb: dwc3: fix wrong bit mask in dwc3_event_type

Ian Abbott (2):
      staging: comedi: COMEDI_CANCEL ioctl should wake up read/write
      staging: comedi: fix a race between do_cmd_ioctl() and read/write

Jack Morgenstein (1):
      net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param

Jacob Keller (1):
      ixgbe: Fix Tx Hang issue with lldpad on 82598EB

Jani Nikula (2):
      drm/i915: initialize gt_lock early with other spin locks
      drm/i915: do not disable backlight on vgaswitcheroo switch off

Jeff Layton (1):
      cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately

Jeff Skirvin (1):
      [SCSI] isci: Fix a race condition in the SSP task management path

Joe Perches (1):
      ndisc: Add missing inline to ndisc_addr_option_pad

Johan Hovold (6):
      USB: ti_usb_3410_5052: fix dynamic-id matching
      USB: mos7840: fix memory leak in open
      USB: mos7840: fix race in register handling
      USB: mos7840: fix device-type detection
      USB: mos7840: fix race in led handling
      USB: mos7840: fix pointer casts

Johannes Berg (3):
      mac80211: fix ethtool stats for non-station interfaces
      mac80211: fix duplicate retransmission detection
      iwlwifi: mvm: refuse connection to APs with BI < 16

Josef Bacik (1):
      Btrfs: release both paths before logging dir/changed extents

Jussi Kivilinna (1):
      ALSA: 6fire: fix DMA issues with URB transfer_buffer usage

Jóhann B. Guðmundsson (1):
      USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga

K. Y. Srinivasan (1):
      Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration

Karlis Ogsts (1):
      staging: android: logger: Correct write offset reset on error

Lan Tianyu (1):
      ACPI / battery: Fix parsing _BIX return value

Lars-Peter Clausen (1):
      dma: pl330: Fix cyclic transfers

Luiz Angelo Daros de Luca (1):
      usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter

Maarten Lankhorst (1):
      drm/nouveau: fix semaphore dmabuf obj

Mark Kettenis (1):
      drm/radeon: fix combios tables on older cards

Martin K. Petersen (1):
      [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set

Martin Schwidefsky (1):
      s390/bitops: fix find_next_bit_left

Mateusz Krawczuk (1):
      regmap: Add missing header for !CONFIG_REGMAP stubs

Matteo Delfino (1):
      Input: elantech - fix for newer hardware versions (v7)

Michal Kazior (1):
      nl80211: fix mgmt tx status and testmode reporting for netns

Michal Simek (1):
      microblaze: fix clone syscall

Michal Srb (1):
      drm/cirrus: Invalidate page tables when pinning a BO

Michal Tesar (1):
      sysctl net: Keep tcp_syn_retries inside the boundary

Michel Dänzer (1):
      drm: Don't pass negative delta to ktime_sub_ns()

Mike Frysinger (1):
      ARM: footbridge: fix overlapping PCI mappings

Neil Horman (2):
      x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset
      8139cp: Add dma_mapping_error checking

NeilBrown (2):
      md/raid10: remove use-after-free bug.
      md/raid5: fix interaction of 'replace' and 'recovery'.

Oleg Nesterov (3):
      mm: mempolicy: fix mbind_range() && vma_adjust() interaction
      userns: unshare_userns(&cred) should not populate cred on failure
      userns: limit the maximum depth of user_namespace->parent chain

Oleksij Rempel (3):
      xhci: fix null pointer dereference on ring_doorbell_for_active_rings
      ath9k_htc: do some initial hardware configuration
      ath9k_htc: reboot firmware if it was loaded

Ondrej Zary (1):
      drm/radeon: Another card with wrong primary dac adj

Peter Zijlstra (1):
      sched: Ensure update_cfs_shares() is called for parents of continuously-running tasks

Piotr Sarna (1):
      ext4: fix mount/remount error messages for incompatible mount options

Radu Caragea (1):
      x86 get_unmapped_area(): use proper mmap base for bottom-up direction

Rafael J. Wysocki (3):
      Revert "cpuidle: Quickly notice prediction failure in general case"
      Revert "cpuidle: Quickly notice prediction failure for repeat mode"
      ACPI / PM: Walk physical_node_list under physical_node_lock

Ren Bigcren (1):
      USB: storage: Add MicroVault Flash Drive to unusual_devs

Rick Farina (Zero_Chaos) (1):
      USB: serial: ftdi_sio: add more RT Systems ftdi devices

Roger Quadros (1):
      USB: EHCI: Fix resume signalling on remote wakeup

Russell King (6):
      ARM: poison the vectors page
      ARM: poison memory between kuser helpers
      ARM: move vector stubs
      ARM: use linker magic for vectors and vector stubs
      ARM: update FIQ support for relocation of vectors
      ARM: allow kuser helpers to be removed from the vector page

Sami Rahman (1):
      USB: cp210x: add MMB and PI ZigBee USB Device Support

Sarah Sharp (1):
      xhci: Avoid NULL pointer deref when host dies.

Saurav Kashyap (1):
      [SCSI] qla2xxx: Properly set the tagging for commands.

Stanislaw Gruszka (1):
      rt2x00: fix stop queue

Stephen Boyd (1):
      perf/arm: Fix armpmu_map_hw_event()

Sumit.Saxena@lsi.com (1):
      [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel

Theodore Ts'o (3):
      ext4: make sure group number is bumped after a inode allocation race
      ext4: fix retry handling in ext4_ext_truncate()
      ext4: allow the mount options nodelalloc and data=journal

Tomasz Moń (1):
      mwifiex: Add missing endian conversion.

Uwe Kleine-König (2):
      serial/mxs-auart: fix race condition in interrupt handler
      serial/mxs-auart: increase time to wait for transmitter to become idle

Ville Syrjälä (1):
      drm/i915: Make data/link N value power of two

Vince Weaver (1):
      perf/x86: Fix intel QPI uncore event definitions

Vinod Koul (1):
      ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION

Will Deacon (1):
      ARM: 7791/1: a.out: remove partial a.out support

William Gulland (1):
      usb: Clear both buffers when clearing a control transfer TT buffer.

Wolfram Sang (1):
      serial: mxs: fix buffer overflow

Yoshihiro YUNOMAE (2):
      virtio/console: Quit from splice_write if pipe->nrbufs is 0
      virtio/console: Add pipe_lock/unlock for splice_write

Youquan Song (1):
      ata: Fix DVD not dectected at some platform with Wellsburg PCH

yonghua zheng (1):
      fs/proc/task_mmu.c: fix buffer overflow in add_page_map()

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

* [PATCH 001/133] Input: elantech - fix for newer hardware versions (v7)
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 002/133] usb: dwc3: gadget: don't prevent gadget from being probed if we fail Kamal Mostafa
                   ` (131 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Matteo Delfino, Dmitry Torokhov, Joseph Salisbury, Kamal Mostafa

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

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

From: Matteo Delfino <kendatsuba@gmail.com>

commit 9eebed7de660c0b5ab129a9de4f89d20b60de68c upstream.

* Fix version recognition in elantech_set_properties

  The new hardware reports itself as v7 but the packets'
  structure is unaltered.

* Fix packet type recognition in elantech_packet_check_v4

  The bitmask used for v6 is too wide, only the last three bits of
  the third byte in a packet (packet[3] & 0x03) are actually used to
  distinguish between packet types.
  Starting from v7, additional information (to be interpreted) is
  stored in the remaining bits (packets[3] & 0x1c).
  In addition, the value stored in (packet[0] & 0x0c) is no longer
  a constant but contains additional information yet to be deciphered.
  This change should be backwards compatible with v6 hardware.

Additional-author: Giovanni Frigione <gio.frigione@gmail.com>
Signed-off-by: Matteo Delfino <kendatsuba@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/elantech.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 1e8e42f..57b2637 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -694,18 +694,18 @@ static int elantech_packet_check_v3(struct psmouse *psmouse)
 static int elantech_packet_check_v4(struct psmouse *psmouse)
 {
 	unsigned char *packet = psmouse->packet;
+	unsigned char packet_type = packet[3] & 0x03;
 
-	if ((packet[0] & 0x0c) == 0x04 &&
-	    (packet[3] & 0x1f) == 0x11)
+	switch (packet_type) {
+	case 0:
+		return PACKET_V4_STATUS;
+
+	case 1:
 		return PACKET_V4_HEAD;
 
-	if ((packet[0] & 0x0c) == 0x04 &&
-	    (packet[3] & 0x1f) == 0x12)
+	case 2:
 		return PACKET_V4_MOTION;
-
-	if ((packet[0] & 0x0c) == 0x04 &&
-	    (packet[3] & 0x1f) == 0x10)
-		return PACKET_V4_STATUS;
+	}
 
 	return PACKET_UNKNOWN;
 }
@@ -1282,6 +1282,7 @@ static int elantech_set_properties(struct elantech_data *etd)
 			etd->hw_version = 3;
 			break;
 		case 6:
+		case 7:
 			etd->hw_version = 4;
 			break;
 		default:
-- 
1.8.1.2


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

* [PATCH 002/133] usb: dwc3: gadget: don't prevent gadget from being probed if we fail
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 001/133] Input: elantech - fix for newer hardware versions (v7) Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 003/133] usb: dwc3: fix wrong bit mask in dwc3_event_type Kamal Mostafa
                   ` (130 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Felipe Balbi, Kamal Mostafa

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

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

From: Felipe Balbi <balbi@ti.com>

commit cdcedd6981194e511cc206887db661d016069d68 upstream.

In case we fail our ->udc_start() callback, we
should be ready to accept another modprobe following
the failed one.

We had forgotten to clear dwc->gadget_driver back
to NULL and, because of that, we were preventing
gadget driver modprobe from being retried.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/dwc3/gadget.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index be13492..1656800 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1535,6 +1535,7 @@ err1:
 	__dwc3_gadget_ep_disable(dwc->eps[0]);
 
 err0:
+	dwc->gadget_driver = NULL;
 	spin_unlock_irqrestore(&dwc->lock, flags);
 
 	return ret;
-- 
1.8.1.2


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

* [PATCH 003/133] usb: dwc3: fix wrong bit mask in dwc3_event_type
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 001/133] Input: elantech - fix for newer hardware versions (v7) Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 002/133] usb: dwc3: gadget: don't prevent gadget from being probed if we fail Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 004/133] ASoC: max98088 - fix element type of the register cache Kamal Mostafa
                   ` (129 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Huang Rui, Felipe Balbi, Kamal Mostafa

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

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

From: Huang Rui <ray.huang@amd.com>

commit 1974d494dea05ea227cb42f5e918828801e237aa upstream.

Per dwc3 2.50a spec, the is_devspec bit is used to distinguish the
Device Endpoint-Specific Event or Device-Specific Event (DEVT). If the
bit is 1, the event is represented Device-Specific Event, then use
[7:1] bits as Device Specific Event to marked the type. It has 7 bits,
and we can see the reserved8_31 variable name which means from 8 to 31
bits marked reserved, actually there are 24 bits not 25 bits between
that. And 1 + 7 + 24 = 32, the event size is 4 byes.

So in dwc3_event_type, the bit mask should be:
is_devspec	[0]		1  bit
type		[7:1]		7  bits
reserved8_31	[31:8]		24 bits

This patch should be backported to kernels as old as 3.2, that contain
the commit 72246da40f3719af3bfd104a2365b32537c27d83 "usb: Introduce
DesignWare USB3 DRD Driver".

Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/dwc3/core.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 1dae91d..17dcd98 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -730,8 +730,8 @@ struct dwc3 {
 
 struct dwc3_event_type {
 	u32	is_devspec:1;
-	u32	type:6;
-	u32	reserved8_31:25;
+	u32	type:7;
+	u32	reserved8_31:24;
 } __packed;
 
 #define DWC3_DEPEVT_XFERCOMPLETE	0x01
-- 
1.8.1.2


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

* [PATCH 004/133] ASoC: max98088 - fix element type of the register cache.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (2 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 003/133] usb: dwc3: fix wrong bit mask in dwc3_event_type Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 005/133] ata: Fix DVD not dectected at some platform with Wellsburg PCH Kamal Mostafa
                   ` (128 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chih-Chung Chang, Dylan Reid, Mark Brown, Kamal Mostafa

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

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

From: Chih-Chung Chang <chihchung@chromium.org>

commit cb6f66a2d278e57a6c9d8fb59bd9ebd8ab3965c2 upstream.

The registers of max98088 are 8 bits, not 16 bits. This bug causes the
contents of registers to be overwritten with bad values when the codec
is suspended and then resumed.

Signed-off-by: Chih-Chung Chang <chihchung@chromium.org>
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/soc/codecs/max98088.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 5d36319..6c9e662 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1594,7 +1594,7 @@ static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int mute)
 
 static void max98088_sync_cache(struct snd_soc_codec *codec)
 {
-       u16 *reg_cache = codec->reg_cache;
+       u8 *reg_cache = codec->reg_cache;
        int i;
 
        if (!codec->cache_sync)
-- 
1.8.1.2


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

* [PATCH 005/133] ata: Fix DVD not dectected at some platform with Wellsburg PCH
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (3 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 004/133] ASoC: max98088 - fix element type of the register cache Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 006/133] Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration Kamal Mostafa
                   ` (127 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Youquan Song, Tejun Heo, Kamal Mostafa

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

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

From: Youquan Song <youquan.song@intel.com>

commit eac27f04a71e1f39f196f7e520d16dcefc955d77 upstream.

There is a patch b55f84e2d527182e7c611d466cd0bb6ddce201de "ata_piix: Fix DVD
 not dectected at some Haswell platforms" to fix an issue of DVD not
recognized on Haswell Desktop platform with Lynx Point.
Recently, it is also found the same issue at some platformas with Wellsburg PCH.

So deliver a similar patch to fix it by disables 32bit PIO in IDE mode.

Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/ata/ata_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index c70942f..2ae9efc 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -330,7 +330,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
 	/* SATA Controller IDE (Wellsburg) */
 	{ 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
 	/* SATA Controller IDE (Wellsburg) */
-	{ 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
+	{ 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb },
 	/* SATA Controller IDE (Wellsburg) */
 	{ 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
 	/* SATA Controller IDE (Wellsburg) */
-- 
1.8.1.2


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

* [PATCH 006/133] Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (4 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 005/133] ata: Fix DVD not dectected at some platform with Wellsburg PCH Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 007/133] ALSA: usb-audio: 6fire: return correct XRUN indication Kamal Mostafa
                   ` (126 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K. Y. Srinivasan, Greg Kroah-Hartman, Kamal Mostafa

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

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

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

commit ed4bb9744b41d39ba35080c2390e201575121dc7 upstream.

Each subnet string needs to be separated with a semicolon. Fix this bug.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/hv/hv_kvp_daemon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index d25a469..f0e1810 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -1012,9 +1012,10 @@ kvp_get_ip_info(int family, char *if_name, int op,
 
 				if (sn_offset == 0)
 					strcpy(sn_str, cidr_mask);
-				else
+				else {
+					strcat((char *)ip_buffer->sub_net, ";");
 					strcat(sn_str, cidr_mask);
-				strcat((char *)ip_buffer->sub_net, ";");
+				}
 				sn_offset += strlen(sn_str) + 1;
 			}
 
-- 
1.8.1.2


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

* [PATCH 007/133] ALSA: usb-audio: 6fire: return correct XRUN indication
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (5 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 006/133] Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 008/133] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter Kamal Mostafa
                   ` (125 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eldad Zack, Takashi Iwai, Kamal Mostafa

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

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

From: Eldad Zack <eldad@fogrefinery.com>

commit be2f93a4c4981b3646b6f98f477154411b8516cb upstream.

Return SNDRV_PCM_POS_XRUN (snd_pcm_uframes_t) instead of
SNDRV_PCM_STATE_XRUN (snd_pcm_state_t) from the pointer
function of 6fire, as expected by snd_pcm_update_hw_ptr0().

Caught by sparse.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/6fire/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 8221ff2..074aaf7 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -543,7 +543,7 @@ static snd_pcm_uframes_t usb6fire_pcm_pointer(
 	snd_pcm_uframes_t ret;
 
 	if (rt->panic || !sub)
-		return SNDRV_PCM_STATE_XRUN;
+		return SNDRV_PCM_POS_XRUN;
 
 	spin_lock_irqsave(&sub->lock, flags);
 	ret = sub->dma_off;
-- 
1.8.1.2


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

* [PATCH 008/133] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (6 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 007/133] ALSA: usb-audio: 6fire: return correct XRUN indication Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 009/133] USB: storage: Add MicroVault Flash Drive to unusual_devs Kamal Mostafa
                   ` (124 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Luiz Angelo Daros de Luca, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Luiz Angelo Daros de Luca <luizluca@gmail.com>

commit 90625070c4253377025878c4e82feed8b35c7116 upstream.

This adds NetGear Managed Switch M4100 series, M5300 series, M7100 series
USB ID (0846:0110) to the cp210x driver. Without this, the serial
adapter is not recognized in Linux. Description was obtained from
an Netgear Eng.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4747d1c..8585c6e 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -53,6 +53,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
 	{ USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
 	{ USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */
+	{ USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */
 	{ USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
 	{ USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
 	{ USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
-- 
1.8.1.2


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

* [PATCH 009/133] USB: storage: Add MicroVault Flash Drive to unusual_devs
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (7 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 008/133] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 010/133] USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga Kamal Mostafa
                   ` (123 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ren Bigcren, Matthew Dharm, Oskar Andero, Greg Kroah-Hartman,
	Kamal Mostafa

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

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

From: Ren Bigcren <bigcren.ren@sonymobile.com>

commit e7a6121f4929c17215f0cdca3726f4bf3e4e9529 upstream.

The device report an error capacity when read_capacity_16().
Using read_capacity_10() can get the correct capacity.

Signed-off-by: Ren Bigcren <bigcren.ren@sonymobile.com>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Oskar Andero <oskar.andero@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/storage/unusual_devs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index b75e90b..f828c76 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -657,6 +657,13 @@ UNUSUAL_DEV(  0x054c, 0x016a, 0x0000, 0x9999,
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_FIX_INQUIRY ),
 
+/* Submitted by Ren Bigcren <bigcren.ren@sonymobile.com> */
+UNUSUAL_DEV(  0x054c, 0x02a5, 0x0100, 0x0100,
+		"Sony Corp.",
+		"MicroVault Flash Drive",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_READ_CAPACITY_16 ),
+
 /* floppy reports multiple luns */
 UNUSUAL_DEV(  0x055d, 0x2020, 0x0000, 0x0210,
 		"SAMSUNG",
-- 
1.8.1.2


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

* [PATCH 010/133] USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (8 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 009/133] USB: storage: Add MicroVault Flash Drive to unusual_devs Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 011/133] USB: option: append Petatel NP10T device to GSM modems list Kamal Mostafa
                   ` (122 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jóhann B. Guðmundsson, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: =?UTF-8?q?J=C3=B3hann=20B=2E=20Gu=C3=B0mundsson?= <johannbg@gmail.com>

commit 58fc90db8261b571c026bb8bf23aad48a7233118 upstream.

Signed-off-by: Jóhann B. Guðmundsson <johannbg@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/misc/sisusbvga/sisusb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index dd573ab..7af163d 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3247,6 +3247,7 @@ static const struct usb_device_id sisusb_table[] = {
 	{ USB_DEVICE(0x0711, 0x0903) },
 	{ USB_DEVICE(0x0711, 0x0918) },
 	{ USB_DEVICE(0x0711, 0x0920) },
+	{ USB_DEVICE(0x0711, 0x0950) },
 	{ USB_DEVICE(0x182d, 0x021c) },
 	{ USB_DEVICE(0x182d, 0x0269) },
 	{ }
-- 
1.8.1.2


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

* [PATCH 011/133] USB: option: append Petatel NP10T device to GSM modems list
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (9 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 010/133] USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 012/133] usb: cp210x support SEL C662 Vendor/Device Kamal Mostafa
                   ` (121 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Daniil Bolsun, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Daniil Bolsun <dan.bolsun@gmail.com>

commit c38e83b6cc2adf80e3f091fd92cfbeacc9748347 upstream.

This patch was tested on 3.10.1 kernel.

Same models of Petatel NP10T modems have different device IDs.
Unfortunately they have no additional revision information on a board
which may treat them as different devices. Currently I've seen only
two NP10T devices with various IDs. Possibly Petatel NP10T list will
be appended upon devices with new IDs will appear.

Signed-off-by: Daniil Bolsun <dan.bolsun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index c94fe3e..604d8e7 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -444,7 +444,8 @@ static void option_instat_callback(struct urb *urb);
 
 /* Hyundai Petatel Inc. products */
 #define PETATEL_VENDOR_ID			0x1ff4
-#define PETATEL_PRODUCT_NP10T			0x600e
+#define PETATEL_PRODUCT_NP10T_600A		0x600a
+#define PETATEL_PRODUCT_NP10T_600E		0x600e
 
 /* TP-LINK Incorporated products */
 #define TPLINK_VENDOR_ID			0x2357
@@ -1329,7 +1330,8 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
-	{ USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) },
+	{ USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600A) },
+	{ USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) },
 	{ USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) },
-- 
1.8.1.2


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

* [PATCH 012/133] usb: cp210x support SEL C662 Vendor/Device
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (10 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 011/133] USB: option: append Petatel NP10T device to GSM modems list Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 013/133] USB: cp210x: add MMB and PI ZigBee USB Device Support Kamal Mostafa
                   ` (120 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Barry Grussling, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Barry Grussling <barry@grussling.com>

commit b579fa52f6be0b4157ca9cc5e94d44a2c89a7e95 upstream.

This patch adds support for the Schweitzer Engineering Laboratories
C662 USB cable based off the CP210x driver.

Signed-off-by: Barry Grussling <barry@grussling.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 8585c6e..d0e9f5d 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -149,6 +149,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
 	{ USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
 	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
+	{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
 	{ USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
 	{ USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
 	{ USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
-- 
1.8.1.2


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

* [PATCH 013/133] USB: cp210x: add MMB and PI ZigBee USB Device Support
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (11 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 012/133] usb: cp210x support SEL C662 Vendor/Device Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 014/133] USB: EHCI: Fix resume signalling on remote wakeup Kamal Mostafa
                   ` (119 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sami Rahman, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Sami Rahman <sami.rahman@mmbresearch.com>

commit 7681156982026ebf7eafd7301eb0374d7648d068 upstream.

Added support for MMB Networks and Planet Innovation Ingeni ZigBee USB
devices using customized Silicon Labs' CP210x.c USB to UART bridge
drivers with PIDs: 88A4, 88A5.

Signed-off-by: Sami Rahman <sami.rahman@mmbresearch.com>
Tested-by: Sami Rahman <sami.rahman@mmbresearch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/cp210x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index d0e9f5d..3850e92 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -119,6 +119,8 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
 	{ USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
 	{ USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
+	{ USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
+	{ USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
 	{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
 	{ USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
 	{ USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
-- 
1.8.1.2


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

* [PATCH 014/133] USB: EHCI: Fix resume signalling on remote wakeup
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (12 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 013/133] USB: cp210x: add MMB and PI ZigBee USB Device Support Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 015/133] drm/radeon: fix endian issues with DP handling (v3) Kamal Mostafa
                   ` (118 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roger Quadros, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Roger Quadros <rogerq@ti.com>

commit 47a64a13d54f6c669b00542848d5550be3d3310e upstream.

Set the ehci->resuming flag for the port we receive a remote
wakeup on so that resume signalling can be completed.

Without this, the root hub timer will not fire again to check
if the resume was completed and there will be a never-ending wait on
on the port.

This effect is only observed if the HUB IRQ IN does not come after we
have initiated the port resume.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/ehci-hub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 7d06e77..f578493 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -856,6 +856,7 @@ static int ehci_hub_control (
 				ehci->reset_done[wIndex] = jiffies
 						+ msecs_to_jiffies(20);
 				usb_hcd_start_port_resume(&hcd->self, wIndex);
+				set_bit(wIndex, &ehci->resuming_ports);
 				/* check the port again */
 				mod_timer(&ehci_to_hcd(ehci)->rh_timer,
 						ehci->reset_done[wIndex]);
-- 
1.8.1.2


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

* [PATCH 015/133] drm/radeon: fix endian issues with DP handling (v3)
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (13 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 014/133] USB: EHCI: Fix resume signalling on remote wakeup Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 016/133] drm/radeon: Another card with wrong primary dac adj Kamal Mostafa
                   ` (117 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Dong He, Kamal Mostafa

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

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

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

commit 34be8c9af7b8728465963740fc11136ae90dfc36 upstream.

The atom interpreter expects data in LE format, so
swap the message buffer as apprioriate.

v2: properly handle non-dw aligned byte counts.
v3: properly handle remainder

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Dong He <hedonghust@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/atombios_dp.c | 43 ++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 064023b..32501f6 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -44,6 +44,41 @@ static char *pre_emph_names[] = {
 };
 
 /***** radeon AUX functions *****/
+
+/* Atom needs data in little endian format
+ * so swap as appropriate when copying data to
+ * or from atom. Note that atom operates on
+ * dw units.
+ */
+static void radeon_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le)
+{
+#ifdef __BIG_ENDIAN
+	u8 src_tmp[20], dst_tmp[20]; /* used for byteswapping */
+	u32 *dst32, *src32;
+	int i;
+
+	memcpy(src_tmp, src, num_bytes);
+	src32 = (u32 *)src_tmp;
+	dst32 = (u32 *)dst_tmp;
+	if (to_le) {
+		for (i = 0; i < ((num_bytes + 3) / 4); i++)
+			dst32[i] = cpu_to_le32(src32[i]);
+		memcpy(dst, dst_tmp, num_bytes);
+	} else {
+		u8 dws = num_bytes & ~3;
+		for (i = 0; i < ((num_bytes + 3) / 4); i++)
+			dst32[i] = le32_to_cpu(src32[i]);
+		memcpy(dst, dst_tmp, dws);
+		if (num_bytes % 4) {
+			for (i = 0; i < (num_bytes % 4); i++)
+				dst[dws+i] = dst_tmp[dws+i];
+		}
+	}
+#else
+	memcpy(dst, src, num_bytes);
+#endif
+}
+
 union aux_channel_transaction {
 	PROCESS_AUX_CHANNEL_TRANSACTION_PS_ALLOCATION v1;
 	PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 v2;
@@ -65,10 +100,10 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
 
 	base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1);
 
-	memcpy(base, send, send_bytes);
+	radeon_copy_swap(base, send, send_bytes, true);
 
-	args.v1.lpAuxRequest = 0 + 4;
-	args.v1.lpDataOut = 16 + 4;
+	args.v1.lpAuxRequest = cpu_to_le16((u16)(0 + 4));
+	args.v1.lpDataOut = cpu_to_le16((u16)(16 + 4));
 	args.v1.ucDataOutLen = 0;
 	args.v1.ucChannelID = chan->rec.i2c_id;
 	args.v1.ucDelay = delay / 10;
@@ -102,7 +137,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan,
 		recv_bytes = recv_size;
 
 	if (recv && recv_size)
-		memcpy(recv, base + 16, recv_bytes);
+		radeon_copy_swap(recv, base + 16, recv_bytes, false);
 
 	return recv_bytes;
 }
-- 
1.8.1.2


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

* [PATCH 016/133] drm/radeon: Another card with wrong primary dac adj
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (14 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 015/133] drm/radeon: fix endian issues with DP handling (v3) Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 017/133] drm/radeon: improve dac adjust heuristics for legacy pdac Kamal Mostafa
                   ` (116 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ondrej Zary, Alex Deucher, Kamal Mostafa

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

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

From: Ondrej Zary <linux@rainbow-software.org>

commit f7929f34fa0e0bb6736a2484fdc07d77a1653081 upstream.

Hello,
got another card with "too bright" problem:
Sapphire Radeon VE 7000 DDR (VGA+S-Video)

lspci -vnn:
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI RV100 QY [Radeon 7000/VE] [1002:5159] (prog-if 00 [VGA controller])
        Subsystem: PC Partner Limited Sapphire Radeon VE 7000 DDR [174b:7c28]

The patch below fixes the problem for this card.
But I don't like the blacklist, couldn't some heuristic be used instead?
The interesting thing is that the manufacturer is the same as the other card
needing the same quirk. I wonder how many different types are broken this way.

The "wrong" ps2_pdac_adj value that comes from BIOS on this card is 0x300.

====================
drm/radeon: Add primary dac adj quirk for Sapphire Radeon VE 7000 DDR

Values from BIOS are wrong, causing too bright colors.
Use default values instead.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_combios.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 78edadc..8528b81 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -971,10 +971,14 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
 	}
 
 	/* quirks */
+	/* Radeon 7000 (RV100) */
+	if (((dev->pdev->device == 0x5159) &&
+	    (dev->pdev->subsystem_vendor == 0x174B) &&
+	    (dev->pdev->subsystem_device == 0x7c28)) ||
 	/* Radeon 9100 (R200) */
-	if ((dev->pdev->device == 0x514D) &&
+	   ((dev->pdev->device == 0x514D) &&
 	    (dev->pdev->subsystem_vendor == 0x174B) &&
-	    (dev->pdev->subsystem_device == 0x7149)) {
+	    (dev->pdev->subsystem_device == 0x7149))) {
 		/* vbios value is bad, use the default */
 		found = 0;
 	}
-- 
1.8.1.2


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

* [PATCH 017/133] drm/radeon: improve dac adjust heuristics for legacy pdac
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (15 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 016/133] drm/radeon: Another card with wrong primary dac adj Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 018/133] drm/radeon: fix combios tables on older cards Kamal Mostafa
                   ` (115 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

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

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

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

commit 03ed8cf9b28d886c64c7e705c7bb1a365fd8fb95 upstream.

Hopefully avoid more quirks in the future due to bogus
vbios dac data.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_combios.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 8528b81..485f82c 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -965,8 +965,10 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
 			dac = RBIOS8(dac_info + 0x3) & 0xf;
 			p_dac->ps2_pdac_adj = (bg << 8) | (dac);
 		}
-		/* if the values are all zeros, use the table */
-		if (p_dac->ps2_pdac_adj)
+		/* if the values are zeros, use the table */
+		if ((dac == 0) || (bg == 0))
+			found = 0;
+		else
 			found = 1;
 	}
 
-- 
1.8.1.2


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

* [PATCH 018/133] drm/radeon: fix combios tables on older cards
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (16 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 017/133] drm/radeon: improve dac adjust heuristics for legacy pdac Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 019/133] ARM: footbridge: fix overlapping PCI mappings Kamal Mostafa
                   ` (114 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Kettenis, Alex Deucher, Kamal Mostafa

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

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

From: Mark Kettenis <kettenis@openbsd.org>

commit cef1d00cd56f600121ad121875655ad410a001b8 upstream.

Noticed that my old Radeon 7500 hung after printing

   drm: GPU not posted. posting now...

when it wasn't selected as the primary card the BIOS.  Some digging
revealed that it was hanging in combios_parse_mmio_table() while
parsing the ASIC INIT 3 table.  Looking at the BIOS ROM for the card,
it becomes obvious that there is no ASIC INIT 3 table in the BIOS.
The code is just processing random garbage.  No surprise it hangs!

Why do I say that there is no ASIC INIT 3 table is the BIOS?  This
table is found through the MISC INFO table.  The MISC INFO table can
be found at offset 0x5e in the COMBIOS header.  But the header is
smaller than that.  The COMBIOS header starts at offset 0x126.  The
standard PCI Data Structure (the bit that starts with 'PCIR') lives at
offset 0x180.  That means that the COMBIOS header can not be larger
than 0x5a bytes and therefore cannot contain a MISC INFO table.

I looked at a dozen or so BIOS images, some my own, some downloaded from:

    <http://www.techpowerup.com/vgabios/index.php?manufacturer=ATI&page=1>

It is fairly obvious that the size of the COMBIOS header can be found
at offset 0x6 of the header.  Not sure if it is a 16-bit number or
just an 8-bit number, but that doesn't really matter since the tables
seems to be always smaller than 256 bytes.

So I think combios_get_table_offset() should check if the requested
table is present.  This can be done by checking the offset against the
size of the header.  See the diff below.  The diff is against the WIP
OpenBSD codebase that roughly corresponds to Linux 3.8.13 at this
point.  But I don't think this bit of the code changed much since
then.

For what it is worth:

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_combios.c | 145 +++++++++-----------------------
 1 file changed, 41 insertions(+), 104 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 485f82c..68ce360 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -147,7 +147,7 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
 					 enum radeon_combios_table_offset table)
 {
 	struct radeon_device *rdev = dev->dev_private;
-	int rev;
+	int rev, size;
 	uint16_t offset = 0, check_offset;
 
 	if (!rdev->bios)
@@ -156,174 +156,106 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
 	switch (table) {
 		/* absolute offset tables */
 	case COMBIOS_ASIC_INIT_1_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0xc);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0xc;
 		break;
 	case COMBIOS_BIOS_SUPPORT_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x14);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x14;
 		break;
 	case COMBIOS_DAC_PROGRAMMING_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x2a);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x2a;
 		break;
 	case COMBIOS_MAX_COLOR_DEPTH_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x2c);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x2c;
 		break;
 	case COMBIOS_CRTC_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x2e);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x2e;
 		break;
 	case COMBIOS_PLL_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x30);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x30;
 		break;
 	case COMBIOS_TV_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x32);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x32;
 		break;
 	case COMBIOS_DFP_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x34);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x34;
 		break;
 	case COMBIOS_HW_CONFIG_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x36);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x36;
 		break;
 	case COMBIOS_MULTIMEDIA_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x38);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x38;
 		break;
 	case COMBIOS_TV_STD_PATCH_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x3e);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x3e;
 		break;
 	case COMBIOS_LCD_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x40);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x40;
 		break;
 	case COMBIOS_MOBILE_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x42);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x42;
 		break;
 	case COMBIOS_PLL_INIT_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x46);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x46;
 		break;
 	case COMBIOS_MEM_CONFIG_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x48);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x48;
 		break;
 	case COMBIOS_SAVE_MASK_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x4a);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x4a;
 		break;
 	case COMBIOS_HARDCODED_EDID_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x4c);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x4c;
 		break;
 	case COMBIOS_ASIC_INIT_2_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x4e);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x4e;
 		break;
 	case COMBIOS_CONNECTOR_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x50);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x50;
 		break;
 	case COMBIOS_DYN_CLK_1_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x52);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x52;
 		break;
 	case COMBIOS_RESERVED_MEM_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x54);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x54;
 		break;
 	case COMBIOS_EXT_TMDS_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x58);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x58;
 		break;
 	case COMBIOS_MEM_CLK_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x5a);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x5a;
 		break;
 	case COMBIOS_EXT_DAC_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x5c);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x5c;
 		break;
 	case COMBIOS_MISC_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x5e);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x5e;
 		break;
 	case COMBIOS_CRT_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x60);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x60;
 		break;
 	case COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x62);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x62;
 		break;
 	case COMBIOS_COMPONENT_VIDEO_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x64);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x64;
 		break;
 	case COMBIOS_FAN_SPEED_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x66);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x66;
 		break;
 	case COMBIOS_OVERDRIVE_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x68);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x68;
 		break;
 	case COMBIOS_OEM_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x6a);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x6a;
 		break;
 	case COMBIOS_DYN_CLK_2_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x6c);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x6c;
 		break;
 	case COMBIOS_POWER_CONNECTOR_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x6e);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x6e;
 		break;
 	case COMBIOS_I2C_INFO_TABLE:
-		check_offset = RBIOS16(rdev->bios_header_start + 0x70);
-		if (check_offset)
-			offset = check_offset;
+		check_offset = 0x70;
 		break;
 		/* relative offset tables */
 	case COMBIOS_ASIC_INIT_3_TABLE:	/* offset from misc info */
@@ -439,11 +371,16 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
 		}
 		break;
 	default:
+		check_offset = 0;
 		break;
 	}
 
-	return offset;
+	size = RBIOS8(rdev->bios_header_start + 0x6);
+	/* check absolute offset tables */
+	if (table < COMBIOS_ASIC_INIT_3_TABLE && check_offset && check_offset < size)
+		offset = RBIOS16(rdev->bios_header_start + check_offset);
 
+	return offset;
 }
 
 bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
-- 
1.8.1.2


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

* [PATCH 019/133] ARM: footbridge: fix overlapping PCI mappings
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (17 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 018/133] drm/radeon: fix combios tables on older cards Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 020/133] [SCSI] isci: Fix a race condition in the SSP task management path Kamal Mostafa
                   ` (113 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mike Frysinger, Olof Johansson, Kamal Mostafa

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

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

From: Mike Frysinger <vapier@gentoo.org>

commit 6287e7319870ec949fb809e4eb4154c2b05b221f upstream.

Commit 8ef6e6201b26cb9fde79c1baa08145af6aca2815 (ARM: footbridge: use
fixed PCI i/o mapping) broke booting on my netwinder.  Before that,
everything boots fine.  Since then, it crashes on boot.

With earlyprintk, I see it BUG-ing like so:
kernel BUG at lib/ioremap.c:27!
Internal error: Oops - BUG: 0 [#1] ARM
...
[<c0139b54>] (ioremap_page_range+0x128/0x154) from [<c02e6a6c>] (dc21285_setup+0xd0/0x114)
[<c02e6a6c>] (dc21285_setup+0xd0/0x114) from [<c02e4874>] (pci_common_init+0xa0/0x298)
[<c02e4874>] (pci_common_init+0xa0/0x298) from [<c02e793c>] (netwinder_pci_init+0xc/0x18)
[<c02e793c>] (netwinder_pci_init+0xc/0x18) from [<c02e27d0>] (do_one_initcall+0xb4/0x180)
...

Russell points out it's because of overlapping PCI mappings that was
added with the aforementioned commit.  Rob thought the code would re-use
the static mapping, but that turns out to not be the case and instead
hits the BUG further down.

After deleting this hunk as suggested by Russel, the system boots up fine
again and all my PCI devices work (IDE, ethernet, the DC21285).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-footbridge/dc21285.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index a7cd2cf..3490a24 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -276,8 +276,6 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
 
 	sys->mem_offset  = DC21285_PCI_MEM;
 
-	pci_ioremap_io(0, DC21285_PCI_IO);
-
 	pci_add_resource_offset(&sys->resources, &res[0], sys->mem_offset);
 	pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);
 
-- 
1.8.1.2


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

* [PATCH 020/133] [SCSI] isci: Fix a race condition in the SSP task management path
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (18 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 019/133] ARM: footbridge: fix overlapping PCI mappings Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 021/133] [SCSI] qla2xxx: Properly set the tagging for commands Kamal Mostafa
                   ` (112 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jeff Skirvin, James Bottomley, Kamal Mostafa

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

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

From: Jeff Skirvin <jeffrey.d.skirvin@intel.com>

commit 96f15f29038e58e1b0a96483e2b369ff446becf1 upstream.

This commit fixes a race condition in the isci driver abort task and SSP
device task management path.  The race is caused when an I/O termination
in the SCU hardware is necessary because of an SSP target timeout condition,
and the check of the I/O end state races against the HW-termination-driven
end state.  The failure of the race meant that no TMF was sent to the device
to clean-up the pending I/O.

Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/isci/task.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index b6f19a1..572ab51 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -491,6 +491,7 @@ int isci_task_abort_task(struct sas_task *task)
 	struct isci_tmf           tmf;
 	int                       ret = TMF_RESP_FUNC_FAILED;
 	unsigned long             flags;
+	int                       target_done_already = 0;
 
 	/* Get the isci_request reference from the task.  Note that
 	 * this check does not depend on the pending request list
@@ -505,9 +506,11 @@ int isci_task_abort_task(struct sas_task *task)
 	/* If task is already done, the request isn't valid */
 	if (!(task->task_state_flags & SAS_TASK_STATE_DONE) &&
 	    (task->task_state_flags & SAS_TASK_AT_INITIATOR) &&
-	    old_request)
+	    old_request) {
 		idev = isci_get_device(task->dev->lldd_dev);
-
+		target_done_already = test_bit(IREQ_COMPLETE_IN_TARGET,
+					       &old_request->flags);
+	}
 	spin_unlock(&task->task_state_lock);
 	spin_unlock_irqrestore(&ihost->scic_lock, flags);
 
@@ -561,7 +564,7 @@ int isci_task_abort_task(struct sas_task *task)
 
 	if (task->task_proto == SAS_PROTOCOL_SMP ||
 	    sas_protocol_ata(task->task_proto) ||
-	    test_bit(IREQ_COMPLETE_IN_TARGET, &old_request->flags) ||
+	    target_done_already ||
 	    test_bit(IDEV_GONE, &idev->flags)) {
 
 		spin_unlock_irqrestore(&ihost->scic_lock, flags);
-- 
1.8.1.2


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

* [PATCH 021/133] [SCSI] qla2xxx: Properly set the tagging for commands.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (19 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 020/133] [SCSI] isci: Fix a race condition in the SSP task management path Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 022/133] [SCSI] sd: fix crash when UA received on DIF enabled device Kamal Mostafa
                   ` (111 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Saurav Kashyap, Giridhar Malavali, James Bottomley, Kamal Mostafa

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

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

From: Saurav Kashyap <saurav.kashyap@qlogic.com>

commit c3ccb1d7cf4c4549151876dd37c0944a682fd9e1 upstream.

This fixes a regression where Xyratex controllers and disks were lost by the
driver:

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

Reported-by: Jack Hill <jackhill@jackhill.us>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/qla2xxx/qla_iocb.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index a481684..01bb80f 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -418,6 +418,8 @@ qla2x00_start_scsi(srb_t *sp)
 			    __constant_cpu_to_le16(CF_SIMPLE_TAG);
 			break;
 		}
+	} else {
+		cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
 	}
 
 	/* Load SCSI command packet. */
@@ -1316,11 +1318,11 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
 		    fcp_cmnd->task_attribute = TSK_ORDERED;
 		    break;
 		default:
-		    fcp_cmnd->task_attribute = 0;
+		    fcp_cmnd->task_attribute = TSK_SIMPLE;
 		    break;
 		}
 	} else {
-		fcp_cmnd->task_attribute = 0;
+		fcp_cmnd->task_attribute = TSK_SIMPLE;
 	}
 
 	cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */
@@ -1536,7 +1538,12 @@ qla24xx_start_scsi(srb_t *sp)
 		case ORDERED_QUEUE_TAG:
 			cmd_pkt->task = TSK_ORDERED;
 			break;
+		default:
+		    cmd_pkt->task = TSK_SIMPLE;
+		    break;
 		}
+	} else {
+		cmd_pkt->task = TSK_SIMPLE;
 	}
 
 	/* Load SCSI command packet. */
-- 
1.8.1.2


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

* [PATCH 022/133] [SCSI] sd: fix crash when UA received on DIF enabled device
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (20 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 021/133] [SCSI] qla2xxx: Properly set the tagging for commands Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 023/133] nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file Kamal Mostafa
                   ` (110 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ewan D. Milne, James Bottomley, Kamal Mostafa

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

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

From: "Ewan D. Milne" <emilne@redhat.com>

commit 085b513f97d8d799d28491239be4b451bcd8c2c5 upstream.

sd_prep_fn will allocate a larger CDB for the command via mempool_alloc
for devices using DIF type 2 protection.  This CDB was being freed
in sd_done, which results in a kernel crash if the command is retried
due to a UNIT ATTENTION.  This change moves the code to free the larger
CDB into sd_unprep_fn instead, which is invoked after the request is
complete.

It is no longer necessary to call scsi_print_command separately for
this case as the ->cmnd will no longer be NULL in the normal code path.

Also removed conditional test for DIF type 2 when freeing the larger
CDB because the protection_type could have been changed via sysfs while
the command was executing.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/sd.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index f5fcf65..a1dcdc3 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -828,10 +828,17 @@ static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
 
 static void sd_unprep_fn(struct request_queue *q, struct request *rq)
 {
+	struct scsi_cmnd *SCpnt = rq->special;
+
 	if (rq->cmd_flags & REQ_DISCARD) {
 		free_page((unsigned long)rq->buffer);
 		rq->buffer = NULL;
 	}
+	if (SCpnt->cmnd != rq->cmd) {
+		mempool_free(SCpnt->cmnd, sd_cdb_pool);
+		SCpnt->cmnd = NULL;
+		SCpnt->cmd_len = 0;
+	}
 }
 
 /**
@@ -1722,21 +1729,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 	if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt))
 		sd_dif_complete(SCpnt, good_bytes);
 
-	if (scsi_host_dif_capable(sdkp->device->host, sdkp->protection_type)
-	    == SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd) {
-
-		/* We have to print a failed command here as the
-		 * extended CDB gets freed before scsi_io_completion()
-		 * is called.
-		 */
-		if (result)
-			scsi_print_command(SCpnt);
-
-		mempool_free(SCpnt->cmnd, sd_cdb_pool);
-		SCpnt->cmnd = NULL;
-		SCpnt->cmd_len = 0;
-	}
-
 	return good_bytes;
 }
 
-- 
1.8.1.2


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

* [PATCH 023/133] nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (21 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 022/133] [SCSI] sd: fix crash when UA received on DIF enabled device Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 024/133] USB: option: add D-Link DWM-152/C1 and DWM-156/C1 Kamal Mostafa
                   ` (109 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Harshula Jayasuriya, J. Bruce Fields, Kamal Mostafa

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

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

From: Harshula Jayasuriya <harshula@redhat.com>

commit e4daf1ffbe6cc3b12aab4d604e627829e93e9914 upstream.

The following call chain:
------------------------------------------------------------
nfs4_get_vfs_file
- nfsd_open
  - dentry_open
    - do_dentry_open
      - __get_file_write_access
        - get_write_access
          - return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY;
------------------------------------------------------------

can result in the following state:
------------------------------------------------------------
struct nfs4_file {
...
  fi_fds = {0xffff880c1fa65c80, 0xffffffffffffffe6, 0x0},
  fi_access = {{
      counter = 0x1
    }, {
      counter = 0x0
    }},
...
------------------------------------------------------------

1) First time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is
NULL, hence nfsd_open() is called where we get status set to an error
and fp->fi_fds[O_WRONLY] to -ETXTBSY. Thus we do not reach
nfs4_file_get_access() and fi_access[O_WRONLY] is not incremented.

2) Second time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is
NOT NULL (-ETXTBSY), so nfsd_open() is NOT called, but
nfs4_file_get_access() IS called and fi_access[O_WRONLY] is incremented.
Thus we leave a landmine in the form of the nfs4_file data structure in
an incorrect state.

3) Eventually, when __nfs4_file_put_access() is called it finds
fi_access[O_WRONLY] being non-zero, it decrements it and calls
nfs4_file_put_fd() which tries to fput -ETXTBSY.
------------------------------------------------------------
...
     [exception RIP: fput+0x9]
     RIP: ffffffff81177fa9  RSP: ffff88062e365c90  RFLAGS: 00010282
     RAX: ffff880c2b3d99cc  RBX: ffff880c2b3d9978  RCX: 0000000000000002
     RDX: dead000000100101  RSI: 0000000000000001  RDI: ffffffffffffffe6
     RBP: ffff88062e365c90   R8: ffff88041fe797d8   R9: ffff88062e365d58
     R10: 0000000000000008  R11: 0000000000000000  R12: 0000000000000001
     R13: 0000000000000007  R14: 0000000000000000  R15: 0000000000000000
     ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
  #9 [ffff88062e365c98] __nfs4_file_put_access at ffffffffa0562334 [nfsd]
 #10 [ffff88062e365cc8] nfs4_file_put_access at ffffffffa05623ab [nfsd]
 #11 [ffff88062e365ce8] free_generic_stateid at ffffffffa056634d [nfsd]
 #12 [ffff88062e365d18] release_open_stateid at ffffffffa0566e4b [nfsd]
 #13 [ffff88062e365d38] nfsd4_close at ffffffffa0567401 [nfsd]
 #14 [ffff88062e365d88] nfsd4_proc_compound at ffffffffa0557f28 [nfsd]
 #15 [ffff88062e365dd8] nfsd_dispatch at ffffffffa054543e [nfsd]
 #16 [ffff88062e365e18] svc_process_common at ffffffffa04ba5a4 [sunrpc]
 #17 [ffff88062e365e98] svc_process at ffffffffa04babe0 [sunrpc]
 #18 [ffff88062e365eb8] nfsd at ffffffffa0545b62 [nfsd]
 #19 [ffff88062e365ee8] kthread at ffffffff81090886
 #20 [ffff88062e365f48] kernel_thread at ffffffff8100c14a
------------------------------------------------------------

Signed-off-by: Harshula Jayasuriya <harshula@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/nfsd/vfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 69c6413..10f950f 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -802,9 +802,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
 			flags = O_WRONLY|O_LARGEFILE;
 	}
 	*filp = dentry_open(&path, flags, current_cred());
-	if (IS_ERR(*filp))
+	if (IS_ERR(*filp)) {
 		host_err = PTR_ERR(*filp);
-	else {
+		*filp = NULL;
+	} else {
 		host_err = ima_file_check(*filp, may_flags);
 
 		if (may_flags & NFSD_MAY_64BIT_COOKIE)
-- 
1.8.1.2


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

* [PATCH 024/133] USB: option: add D-Link DWM-152/C1 and DWM-156/C1
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (22 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 023/133] nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 025/133] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write Kamal Mostafa
                   ` (108 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexandr Ivanov, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: "Alexandr \\\\\\\"Sky\\\\\\\" Ivanov" <alexandr.sky@gmail.com>

commit ca24763588844b14f019ffc45c7df6d9e8f932c5 upstream.

Adding support for D-Link DWM-152/C1 and DWM-156/C1 devices.

DWM-152/C1:
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=07d1 ProdID=3e01 Rev= 0.00
S:  Product=USB Configuration
S:  SerialNumber=1234567890ABCDEF
C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

DWM-156/C1:
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  8 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=07d1 ProdID=3e02 Rev= 0.00
S:  Product=DataCard Device
S:  SerialNumber=1234567890ABCDEF
C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Signed-off-by: Alexandr Ivanov <alexandr.sky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 604d8e7..50ed76e 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1341,6 +1341,8 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
 	{ } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
-- 
1.8.1.2


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

* [PATCH 025/133] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (23 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 024/133] USB: option: add D-Link DWM-152/C1 and DWM-156/C1 Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 026/133] staging: comedi: fix a race between do_cmd_ioctl() and read/write Kamal Mostafa
                   ` (107 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ian Abbott, Greg Kroah-Hartman, Kamal Mostafa

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

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

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

commit 69acbaac303e8cb948801a9ddd0ac24e86cc4a1b upstream.

Comedi devices can do blocking read() or write() (or poll()) if an
asynchronous command has been set up, blocking for data (for read()) or
buffer space (for write()).  Various events associated with the
asynchronous command will wake up the blocked reader or writer (or
poller).  It is also possible to force the asynchronous command to
terminate by issuing a `COMEDI_CANCEL` ioctl.  That shuts down the
asynchronous command, but does not currently wake up the blocked reader
or writer (or poller).  If the blocked task could be woken up, it would
see that the command is no longer active and return.  The caller of the
`COMEDI_CANCEL` ioctl could attempt to wake up the blocked task by
sending a signal, but that's a nasty workaround.

Change `do_cancel_ioctl()` to wake up the wait queue after it returns
from `do_cancel()`.  `do_cancel()` can propagate an error return value
from the low-level comedi driver's cancel routine, but it always shuts
the command down regardless, so `do_cancel_ioctl()` can wake up he wait
queue regardless of the return value from `do_cancel()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/comedi/comedi_fops.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 6894b3e..929452e 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1472,6 +1472,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
 			   void *file)
 {
 	struct comedi_subdevice *s;
+	int ret;
 
 	if (arg >= dev->n_subdevices)
 		return -EINVAL;
@@ -1488,7 +1489,11 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
 	if (s->busy != file)
 		return -EBUSY;
 
-	return do_cancel(dev, s);
+	ret = do_cancel(dev, s);
+	if (comedi_get_subdevice_runflags(s) & SRF_USER)
+		wake_up_interruptible(&s->async->wait_head);
+
+	return ret;
 }
 
 /*
-- 
1.8.1.2


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

* [PATCH 026/133] staging: comedi: fix a race between do_cmd_ioctl() and read/write
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (24 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 025/133] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 027/133] staging: android: logger: Correct write offset reset on error Kamal Mostafa
                   ` (106 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ian Abbott, Greg Kroah-Hartman, Kamal Mostafa

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

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

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

commit 4b18f08be01a7b3c7b6df497137b6e3cb28adaa3 upstream.

`do_cmd_ioctl()` is called with the comedi device's mutex locked to
process the `COMEDI_CMD` ioctl to set up comedi's asynchronous command
handling on a comedi subdevice.  `comedi_read()` and `comedi_write()`
are the `read` and `write` handlers for the comedi device, but do not
lock the mutex (for performance reasons, as some things can hold the
mutex for quite a long time).

There is a race condition if `comedi_read()` or `comedi_write()` is
running at the same time and for the same file object and comedi
subdevice as `do_cmd_ioctl()`.  `do_cmd_ioctl()` sets the subdevice's
`busy` pointer to the file object way before it sets the `SRF_RUNNING` flag
in the subdevice's `runflags` member.  `comedi_read() and
`comedi_write()` check the subdevice's `busy` pointer is pointing to the
current file object, then if the `SRF_RUNNING` flag is not set, will call
`do_become_nonbusy()` to shut down the asyncronous command.  Bad things
can happen if the asynchronous command is being shutdown and set up at
the same time.

To prevent the race, don't set the `busy` pointer until
after the `SRF_RUNNING` flag has been set.  Also, make sure the mutex is
held in `comedi_read()` and `comedi_write()` while calling
`do_become_nonbusy()` in order to avoid moving the race condition to a
point within that function.

Change some error handling `goto cleanup` statements in `do_cmd_ioctl()`
to simple `return -ERRFOO` statements as a result of changing when the
`busy` pointer is set.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/comedi/comedi_fops.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 929452e..fbd9231 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1180,22 +1180,19 @@ static int do_cmd_ioctl(struct comedi_device *dev,
 		DPRINTK("subdevice busy\n");
 		return -EBUSY;
 	}
-	s->busy = file;
 
 	/* make sure channel/gain list isn't too long */
 	if (cmd.chanlist_len > s->len_chanlist) {
 		DPRINTK("channel/gain list too long %u > %d\n",
 			cmd.chanlist_len, s->len_chanlist);
-		ret = -EINVAL;
-		goto cleanup;
+		return -EINVAL;
 	}
 
 	/* make sure channel/gain list isn't too short */
 	if (cmd.chanlist_len < 1) {
 		DPRINTK("channel/gain list too short %u < 1\n",
 			cmd.chanlist_len);
-		ret = -EINVAL;
-		goto cleanup;
+		return -EINVAL;
 	}
 
 	async->cmd = cmd;
@@ -1205,8 +1202,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
 	    kmalloc(async->cmd.chanlist_len * sizeof(int), GFP_KERNEL);
 	if (!async->cmd.chanlist) {
 		DPRINTK("allocation failed\n");
-		ret = -ENOMEM;
-		goto cleanup;
+		return -ENOMEM;
 	}
 
 	if (copy_from_user(async->cmd.chanlist, user_chanlist,
@@ -1258,6 +1254,9 @@ static int do_cmd_ioctl(struct comedi_device *dev,
 
 	comedi_set_subdevice_runflags(s, ~0, SRF_USER | SRF_RUNNING);
 
+	/* set s->busy _after_ setting SRF_RUNNING flag to avoid race with
+	 * comedi_read() or comedi_write() */
+	s->busy = file;
 	ret = s->do_cmd(dev, s);
 	if (ret == 0)
 		return 0;
@@ -1860,6 +1859,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
 
 		if (!(comedi_get_subdevice_runflags(s) & SRF_RUNNING)) {
 			if (count == 0) {
+				mutex_lock(&dev->mutex);
 				if (comedi_get_subdevice_runflags(s) &
 					SRF_ERROR) {
 					retval = -EPIPE;
@@ -1867,6 +1867,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
 					retval = 0;
 				}
 				do_become_nonbusy(dev, s);
+				mutex_unlock(&dev->mutex);
 			}
 			break;
 		}
@@ -1981,6 +1982,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
 
 		if (n == 0) {
 			if (!(comedi_get_subdevice_runflags(s) & SRF_RUNNING)) {
+				mutex_lock(&dev->mutex);
 				do_become_nonbusy(dev, s);
 				if (comedi_get_subdevice_runflags(s) &
 				    SRF_ERROR) {
@@ -1988,6 +1990,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
 				} else {
 					retval = 0;
 				}
+				mutex_unlock(&dev->mutex);
 				break;
 			}
 			if (file->f_flags & O_NONBLOCK) {
@@ -2025,9 +2028,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
 		buf += n;
 		break;		/* makes device work like a pipe */
 	}
-	if (!(comedi_get_subdevice_runflags(s) & (SRF_ERROR | SRF_RUNNING)) &&
-	    async->buf_read_count - async->buf_write_count == 0) {
-		do_become_nonbusy(dev, s);
+	if (!(comedi_get_subdevice_runflags(s) & (SRF_ERROR | SRF_RUNNING))) {
+		mutex_lock(&dev->mutex);
+		if (async->buf_read_count - async->buf_write_count == 0)
+			do_become_nonbusy(dev, s);
+		mutex_unlock(&dev->mutex);
 	}
 	set_current_state(TASK_RUNNING);
 	remove_wait_queue(&async->wait_head, &wait);
-- 
1.8.1.2


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

* [PATCH 027/133] staging: android: logger: Correct write offset reset on error
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (25 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 026/133] staging: comedi: fix a race between do_cmd_ioctl() and read/write Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 028/133] usb: option: add TP-LINK MA260 Kamal Mostafa
                   ` (105 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Android Kernel Team, Bjorn Andersson, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Karlis Ogsts <karlis.ogsts@sonymobile.com>

commit 72bb99cfe9c57d2044445fb34bbc95b4c0bae6f2 upstream.

In the situation that a writer fails to copy data from userspace it will reset
the write offset to the value it had before it went to sleep. This discarding
any messages written while aquiring the mutex.

Therefore the reset offset needs to be retrieved after acquiring the mutex.

Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/android/logger.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index dbc63cb..316cb2c 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -371,7 +371,7 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov,
 			 unsigned long nr_segs, loff_t ppos)
 {
 	struct logger_log *log = file_get_log(iocb->ki_filp);
-	size_t orig = log->w_off;
+	size_t orig;
 	struct logger_entry header;
 	struct timespec now;
 	ssize_t ret = 0;
@@ -390,6 +390,8 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov,
 
 	mutex_lock(&log->mutex);
 
+	orig = log->w_off;
+
 	/*
 	 * Fix up any readers, pulling them forward to the first readable
 	 * entry after (what will be) the new write offset. We do this now
-- 
1.8.1.2


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

* [PATCH 028/133] usb: option: add TP-LINK MA260
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (26 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 027/133] staging: android: logger: Correct write offset reset on error Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 029/133] USB: ti_usb_3410_5052: fix dynamic-id matching Kamal Mostafa
                   ` (104 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Greg Kroah-Hartman, Kamal Mostafa

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

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

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

commit 94190301ffa059c2d127b3a67ec5d161d5c62681 upstream.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 50ed76e..b8e09fc 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1334,6 +1334,8 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) },
 	{ USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE(TPLINK_VENDOR_ID, 0x9000),					/* TP-Link MA260 */
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x02, 0x01) },	/* D-Link DWM-156 (variant) */
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x00, 0x00) },	/* D-Link DWM-156 (variant) */
-- 
1.8.1.2


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

* [PATCH 029/133] USB: ti_usb_3410_5052: fix dynamic-id matching
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (27 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 028/133] usb: option: add TP-LINK MA260 Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 030/133] usb: serial: option: Add ONYX 3G device support Kamal Mostafa
                   ` (103 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Johan Hovold <jhovold@gmail.com>

commit 1fad56424f5ad3ce4973505a357212b2e2282b3f upstream.

The driver failed to take the dynamic ids into account when determining
the device type and therefore all devices were detected as 2-port
devices when using the dynamic-id interface.

Match on the usb-serial-driver field instead of doing redundant id-table
searches.

Reported-by: Anders Hammarquist <iko@iko.pp.se>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/ti_usb_3410_5052.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index a166761..f4a748b 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -373,7 +373,7 @@ static int ti_startup(struct usb_serial *serial)
 	usb_set_serial_data(serial, tdev);
 
 	/* determine device type */
-	if (usb_match_id(serial->interface, ti_id_table_3410))
+	if (serial->type == &ti_1port_device)
 		tdev->td_is_3410 = 1;
 	dev_dbg(&dev->dev, "%s - device type is %s\n", __func__,
 		tdev->td_is_3410 ? "3410" : "5052");
-- 
1.8.1.2


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

* [PATCH 030/133] usb: serial: option: Add ONYX 3G device support
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (28 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 029/133] USB: ti_usb_3410_5052: fix dynamic-id matching Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 031/133] md/raid10: remove use-after-free bug Kamal Mostafa
                   ` (102 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Enrico Mioso, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Enrico Mioso <mrkiko.rs@gmail.com>

commit 63b5df963f52ccbab6fabedf05b7ac6b465789a4 upstream.

This patch adds support for the ONYX 3G device (version 1) from ALFA
NETWORK.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index b8e09fc..9736e9b 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -783,6 +783,7 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) },
 	{ USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
 	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
+	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
 	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
 	{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */
 	{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) },
-- 
1.8.1.2


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

* [PATCH 031/133] md/raid10: remove use-after-free bug.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (29 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 030/133] usb: serial: option: Add ONYX 3G device support Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 032/133] md/raid5: fix interaction of 'replace' and 'recovery' Kamal Mostafa
                   ` (101 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: NeilBrown, Luis Henriques, Kamal Mostafa

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

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

From: NeilBrown <neilb@suse.de>

commit 0eb25bb027a100f5a9df8991f2f628e7d851bc1e upstream.

We always need to be careful when calling generic_make_request, as it
can start a chain of events which might free something that we are
using.

Here is one place I wasn't careful enough.  If the wbio2 is not in
use, then it might get freed at the first generic_make_request call.
So perform all necessary tests first.

This bug was introduced in 3.3-rc3 (24afd80d99) and can cause an
oops, so fix is suitable for any -stable since then.

Signed-off-by: NeilBrown <neilb@suse.de>
[ luis: backported to 3.5: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid10.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7187dbd..92858ab 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2221,12 +2221,18 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio)
 	d = r10_bio->devs[1].devnum;
 	wbio = r10_bio->devs[1].bio;
 	wbio2 = r10_bio->devs[1].repl_bio;
+	/* Need to test wbio2->bi_end_io before we call
+	 * generic_make_request as if the former is NULL,
+	 * the latter is free to free wbio2.
+	 */
+	if (wbio2 && !wbio2->bi_end_io)
+		wbio2 = NULL;
 	if (wbio->bi_end_io) {
 		atomic_inc(&conf->mirrors[d].rdev->nr_pending);
 		md_sync_acct(conf->mirrors[d].rdev->bdev, wbio->bi_size >> 9);
 		generic_make_request(wbio);
 	}
-	if (wbio2 && wbio2->bi_end_io) {
+	if (wbio2) {
 		atomic_inc(&conf->mirrors[d].replacement->nr_pending);
 		md_sync_acct(conf->mirrors[d].replacement->bdev,
 			     wbio2->bi_size >> 9);
-- 
1.8.1.2


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

* [PATCH 032/133] md/raid5: fix interaction of 'replace' and 'recovery'.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (30 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 031/133] md/raid10: remove use-after-free bug Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 033/133] drm/i915: initialize gt_lock early with other spin locks Kamal Mostafa
                   ` (100 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Kamal Mostafa

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

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

From: NeilBrown <neilb@suse.de>

commit f94c0b6658c7edea8bc19d13be321e3860a3fa54 upstream.

If a device in a RAID4/5/6 is being replaced while another is being
recovered, then the writes to the replacement device currently don't
happen, resulting in corruption when the replacement completes and the
new drive takes over.

This is because the replacement writes are only triggered when
's.replacing' is set and not when the similar 's.sync' is set (which
is the case during resync and recovery - it means all devices need to
be read).

So schedule those writes when s.replacing is set as well.

In this case we cannot use "STRIPE_INSYNC" to record that the
replacement has happened as that is needed for recording that any
parity calculation is complete.  So introduce STRIPE_REPLACED to
record if the replacement has happened.

For safety we should also check that STRIPE_COMPUTE_RUN is not set.
This has a similar effect to the "s.locked == 0" test.  The latter
ensure that now IO has been flagged but not started.  The former
checks if any parity calculation has been flagged by not started.
We must wait for both of these to complete before triggering the
'replace'.

Add a similar test to the subsequent check for "are we finished yet".
This possibly isn't needed (is subsumed in the STRIPE_INSYNC test),
but it makes it more obvious that the REPLACE will happen before we
think we are finished.

Finally if a NeedReplace device is not UPTODATE then that is an
error.  We really must trigger a warning.

This bug was introduced in commit 9a3e1101b827a59ac9036a672f5fa8d5279d0fe2
(md/raid5:  detect and handle replacements during recovery.)
which introduced replacement for raid5.
That was in 3.3-rc3, so any stable kernel since then would benefit
from this fix.

Reported-by: qindehua <13691222965@163.com>
Tested-by: qindehua <qindehua@163.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid5.c | 15 ++++++++++-----
 drivers/md/raid5.h |  1 +
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 9a6ff72..5b022b1 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3491,6 +3491,7 @@ static void handle_stripe(struct stripe_head *sh)
 		    test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) {
 			set_bit(STRIPE_SYNCING, &sh->state);
 			clear_bit(STRIPE_INSYNC, &sh->state);
+			clear_bit(STRIPE_REPLACED, &sh->state);
 		}
 		spin_unlock(&sh->stripe_lock);
 	}
@@ -3636,19 +3637,23 @@ static void handle_stripe(struct stripe_head *sh)
 			handle_parity_checks5(conf, sh, &s, disks);
 	}
 
-	if (s.replacing && s.locked == 0
-	    && !test_bit(STRIPE_INSYNC, &sh->state)) {
+	if ((s.replacing || s.syncing) && s.locked == 0
+	    && !test_bit(STRIPE_COMPUTE_RUN, &sh->state)
+	    && !test_bit(STRIPE_REPLACED, &sh->state)) {
 		/* Write out to replacement devices where possible */
 		for (i = 0; i < conf->raid_disks; i++)
-			if (test_bit(R5_UPTODATE, &sh->dev[i].flags) &&
-			    test_bit(R5_NeedReplace, &sh->dev[i].flags)) {
+			if (test_bit(R5_NeedReplace, &sh->dev[i].flags)) {
+				WARN_ON(!test_bit(R5_UPTODATE, &sh->dev[i].flags));
 				set_bit(R5_WantReplace, &sh->dev[i].flags);
 				set_bit(R5_LOCKED, &sh->dev[i].flags);
 				s.locked++;
 			}
-		set_bit(STRIPE_INSYNC, &sh->state);
+		if (s.replacing)
+			set_bit(STRIPE_INSYNC, &sh->state);
+		set_bit(STRIPE_REPLACED, &sh->state);
 	}
 	if ((s.syncing || s.replacing) && s.locked == 0 &&
+	    !test_bit(STRIPE_COMPUTE_RUN, &sh->state) &&
 	    test_bit(STRIPE_INSYNC, &sh->state)) {
 		md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
 		clear_bit(STRIPE_SYNCING, &sh->state);
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 050a334..7b20e03 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -310,6 +310,7 @@ enum {
 	STRIPE_SYNC_REQUESTED,
 	STRIPE_SYNCING,
 	STRIPE_INSYNC,
+	STRIPE_REPLACED,
 	STRIPE_PREREAD_ACTIVE,
 	STRIPE_DELAYED,
 	STRIPE_DEGRADED,
-- 
1.8.1.2


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

* [PATCH 033/133] drm/i915: initialize gt_lock early with other spin locks
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (31 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 032/133] md/raid5: fix interaction of 'replace' and 'recovery' Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 034/133] xhci: Avoid NULL pointer deref when host dies Kamal Mostafa
                   ` (99 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jani Nikula, Daniel Vetter, Kamal Mostafa

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

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

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

commit 14c5cec5d0cd73e7e9d4fbea2bbfeea8f3ade871 upstream.

commit 181d1b9e31c668259d3798c521672afb8edd355c
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sun Jul 21 13:16:24 2013 +0200

    drm/i915: fix up gt init sequence fallout

moved dev_priv->gt_lock initialization after use. Do the initialization
much earlier with other spin lock initializations.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/i915_dma.c | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 38254c0..565a889 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1469,6 +1469,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	spin_lock_init(&dev_priv->error_lock);
 	spin_lock_init(&dev_priv->rps.lock);
 	spin_lock_init(&dev_priv->dpio_lock);
+	spin_lock_init(&dev_priv->gt_lock);
 	mutex_init(&dev_priv->rps.hw_lock);
 
 	i915_dump_device_info(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 7af828c..6538d3f 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4408,8 +4408,6 @@ void intel_gt_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	spin_lock_init(&dev_priv->gt_lock);
-
 	if (IS_VALLEYVIEW(dev)) {
 		dev_priv->gt.force_wake_get = vlv_force_wake_get;
 		dev_priv->gt.force_wake_put = vlv_force_wake_put;
-- 
1.8.1.2


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

* [PATCH 034/133] xhci: Avoid NULL pointer deref when host dies.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (32 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 033/133] drm/i915: initialize gt_lock early with other spin locks Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 035/133] usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 Kamal Mostafa
                   ` (98 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Kamal Mostafa

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

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

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 203a86613fb3bf2767335659513fa98563a3eb71 upstream.

When the host controller fails to respond to an Enable Slot command, and
the host fails to respond to the register write to abort the command
ring, the xHCI driver will assume the host is dead, and call
usb_hc_died().

The USB device's slot_id is still set to zero, and the pointer stored at
xhci->devs[0] will always be NULL.  The call to xhci_check_args in
xhci_free_dev should have caught the NULL virt_dev pointer.

However, xhci_free_dev is designed to free the xhci_virt_device
structures, even if the host is dead, so that we don't leak kernel
memory.  xhci_free_dev checks the return value from the generic
xhci_check_args function.  If the return value is -ENODEV, it carries on
trying to free the virtual device.

The issue is that xhci_check_args looks at the host controller state
before it looks at the xhci_virt_device pointer.  It will return -ENIVAL
because the host is dead, and xhci_free_dev will ignore the return
value, and happily dereference the NULL xhci_virt_device pointer.

The fix is to make sure that xhci_check_args checks the xhci_virt_device
pointer before it checks the host state.

See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1203453 for
further details.  This patch doesn't solve the underlying issue, but
will ensure we don't see any more NULL pointer dereferences because of
the issue.

This patch should be backported to kernels as old as 3.1, that
contain the commit 7bd89b4017f46a9b92853940fd9771319acb578a "xhci: Don't
submit commands or URBs to halted hosts."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Vincent Thiele <vincentthiele@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/xhci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 7f6de85..6cffc0e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1167,9 +1167,6 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev,
 	}
 
 	xhci = hcd_to_xhci(hcd);
-	if (xhci->xhc_state & XHCI_STATE_HALTED)
-		return -ENODEV;
-
 	if (check_virt_dev) {
 		if (!udev->slot_id || !xhci->devs[udev->slot_id]) {
 			printk(KERN_DEBUG "xHCI %s called with unaddressed "
@@ -1185,6 +1182,9 @@ static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev,
 		}
 	}
 
+	if (xhci->xhc_state & XHCI_STATE_HALTED)
+		return -ENODEV;
+
 	return 1;
 }
 
-- 
1.8.1.2


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

* [PATCH 035/133] usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (33 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 034/133] xhci: Avoid NULL pointer deref when host dies Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 036/133] xhci: fix null pointer dereference on ring_doorbell_for_active_rings Kamal Mostafa
                   ` (97 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: George Cherian, Sarah Sharp, Kamal Mostafa

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

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

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

commit 07f3cb7c28bf3f4dd80bfb136cf45810c46ac474 upstream.

Xhci controllers with hci_version > 0.96 gives spurious success
events on short packet completion. During webcam capture the
"ERROR Transfer event TRB DMA ptr not part of current TD" was observed.
The same application works fine with synopsis controllers hci_version 0.96.
The same issue is seen with Intel Pantherpoint xhci controller. So enabling
this quirk in xhci_gen_setup if controller verion is greater than 0.96.
For xhci-pci move the quirk to much generic place xhci_gen_setup.

Note from Sarah:

The xHCI 1.0 spec changed how hardware handles short packets.  The HW
will notify SW of the TRB where the short packet occurred, and it will
also give a successful status for the last TRB in a TD (the one with the
IOC flag set).  On the second successful status, that warning will be
triggered in the driver.

Software is now supposed to not assume the TD is not completed until it
gets that last successful status.  That means we have a slight race
condition, although it should have little practical impact.  This patch
papers over that issue.

It's on my long-term to-do list to fix this race condition, but it is a
much more involved patch that will probably be too big for stable.  This
patch is needed for stable to avoid serious log spam.

This patch should be backported to kernels as old as 3.0, that
contain the commit ad808333d8201d53075a11bc8dd83b81f3d68f0b "Intel xhci:
Ignore spurious successful event."

The patch will have to be modified for kernels older than 3.2, since
that kernel added the xhci_gen_setup function for xhci platform devices.
The correct conflict resolution for kernels older than 3.2 is to set
XHCI_SPURIOUS_SUCCESS in xhci_pci_quirks for all xHCI 1.0 hosts.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/xhci-pci.c | 1 -
 drivers/usb/host/xhci.c     | 7 +++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 1aeb4da..76fb7d9 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -93,7 +93,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 			pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
-		xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
 		xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
 		xhci->limit_active_eps = 64;
 		xhci->quirks |= XHCI_SW_BW_CHECKING;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6cffc0e..661c553 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4671,6 +4671,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
 
 	get_quirks(dev, xhci);
 
+	/* In xhci controllers which follow xhci 1.0 spec gives a spurious
+	 * success event after a short transfer. This quirk will ignore such
+	 * spurious event.
+	 */
+	if (xhci->hci_version > 0x96)
+		xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
+
 	/* Make sure the HC is halted. */
 	retval = xhci_halt(xhci);
 	if (retval)
-- 
1.8.1.2


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

* [PATCH 036/133] xhci: fix null pointer dereference on ring_doorbell_for_active_rings
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (34 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 035/133] usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:32 ` [PATCH 037/133] usb: serial: option: blacklist ONDA MT689DC QMI interface Kamal Mostafa
                   ` (96 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleksij Rempel, Sarah Sharp, Kamal Mostafa

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

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

From: Oleksij Rempel <linux@rempel-privat.de>

commit d66eaf9f89502971fddcb0de550b01fa6f409d83 upstream.

in some cases where device is attched to xhci port and do not responding,
for example ath9k_htc with stalled firmware, kernel will
crash on ring_doorbell_for_active_rings.
This patch check if pointer exist before it is used.

This patch should be backported to kernels as old as 2.6.35, that
contain the commit e9df17eb1408cfafa3d1844bfc7f22c7237b31b8 "USB: xhci:
Correct assumptions about number of rings per endpoint"

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/host/xhci-ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 2573cf4..3020c71 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -434,7 +434,7 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci,
 
 	/* A ring has pending URBs if its TD list is not empty */
 	if (!(ep->ep_state & EP_HAS_STREAMS)) {
-		if (!(list_empty(&ep->ring->td_list)))
+		if (ep->ring && !(list_empty(&ep->ring->td_list)))
 			xhci_ring_ep_doorbell(xhci, slot_id, ep_index, 0);
 		return;
 	}
-- 
1.8.1.2


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

* [PATCH 037/133] usb: serial: option: blacklist ONDA MT689DC QMI interface
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (35 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 036/133] xhci: fix null pointer dereference on ring_doorbell_for_active_rings Kamal Mostafa
@ 2013-08-16 22:32 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 038/133] usb: serial: option: add Olivetti Olicard 200 Kamal Mostafa
                   ` (95 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:32 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: enrico Mioso, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Enrico Mioso <mrkiko.rs@gmail.com>

commit 3d1a69e726406ab662ab88fa30a3a05ed404334d upstream.

Prevent the option driver from binding itself to the QMI/WWAN interface, making
it unusable by the proper driver.

Signed-off-by: enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9736e9b..1c8733a 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -819,7 +819,8 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff),
 		.driver_info = (kernel_ulong_t)&net_intf3_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0018, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff),
+		.driver_info = (kernel_ulong_t)&net_intf3_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0020, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0021, 0xff, 0xff, 0xff),
 		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-- 
1.8.1.2


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

* [PATCH 038/133] usb: serial: option: add Olivetti Olicard 200
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (36 preceding siblings ...)
  2013-08-16 22:32 ` [PATCH 037/133] usb: serial: option: blacklist ONDA MT689DC QMI interface Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 039/133] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver Kamal Mostafa
                   ` (94 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Williams, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Dan Williams <dcbw@redhat.com>

commit 4cf76df06ecc852633ed927d91e01c83c33bc331 upstream.

Speaks AT on interfaces 5 (command & PPP) and 3 (secondary), other
interface protocols are unknown.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 1c8733a..d4099bb 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -341,6 +341,7 @@ static void option_instat_callback(struct urb *urb);
 #define OLIVETTI_VENDOR_ID			0x0b3c
 #define OLIVETTI_PRODUCT_OLICARD100		0xc000
 #define OLIVETTI_PRODUCT_OLICARD145		0xc003
+#define OLIVETTI_PRODUCT_OLICARD200		0xc005
 
 /* Celot products */
 #define CELOT_VENDOR_ID				0x211f
@@ -1259,6 +1260,7 @@ static const struct usb_device_id option_ids[] = {
 
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200) },
 	{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
 	{ USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
 	{ USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
-- 
1.8.1.2


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

* [PATCH 039/133] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (37 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 038/133] usb: serial: option: add Olivetti Olicard 200 Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 040/133] USB: mos7840: fix memory leak in open Kamal Mostafa
                   ` (93 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Enrico Mioso, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Enrico Mioso <mrkiko.rs@gmail.com>

commit 878c69aae986ae97084458c0183a8c0a059865b1 upstream.

Some (very few) early devices like mine, where not exposting a proper CDC
descriptor. This was fixed with an immediate firmware update from the vendor,
and pre-installed on newer devices.
So actual devices can be driven by cdc_acm.c + cdc_ether.c.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/option.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index d4099bb..09e0581 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -347,12 +347,6 @@ static void option_instat_callback(struct urb *urb);
 #define CELOT_VENDOR_ID				0x211f
 #define CELOT_PRODUCT_CT680M			0x6801
 
-/* ONDA Communication vendor id */
-#define ONDA_VENDOR_ID       0x1ee8
-
-/* ONDA MT825UP HSDPA 14.2 modem */
-#define ONDA_MT825UP         0x000b
-
 /* Samsung products */
 #define SAMSUNG_VENDOR_ID                       0x04e8
 #define SAMSUNG_PRODUCT_GT_B3730                0x6889
@@ -1262,7 +1256,6 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200) },
 	{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
-	{ USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
 	{ USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM610) },
-- 
1.8.1.2


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

* [PATCH 040/133] USB: mos7840: fix memory leak in open
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (38 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 039/133] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 041/133] usb: Clear both buffers when clearing a control transfer TT buffer Kamal Mostafa
                   ` (92 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Johan Hovold <jhovold@gmail.com>

commit 5f8a2e68b679b41cc8e9b642f2f5aa45dd678641 upstream.

Allocated urbs and buffers were never freed on errors in open.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/mos7840.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 54f23f0..06ca54a 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -942,20 +942,20 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
 	status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "Reading Spreg failed\n");
-		return -1;
+		goto err;
 	}
 	Data |= 0x80;
 	status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "writing Spreg failed\n");
-		return -1;
+		goto err;
 	}
 
 	Data &= ~0x80;
 	status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "writing Spreg failed\n");
-		return -1;
+		goto err;
 	}
 	/* End of block to be checked */
 
@@ -964,7 +964,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
 									&Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "Reading Controlreg failed\n");
-		return -1;
+		goto err;
 	}
 	Data |= 0x08;		/* Driver done bit */
 	Data |= 0x20;		/* rx_disable */
@@ -972,7 +972,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
 				mos7840_port->ControlRegOffset, Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "writing Controlreg failed\n");
-		return -1;
+		goto err;
 	}
 	/* do register settings here */
 	/* Set all regs to the device default values. */
@@ -983,21 +983,21 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
 	status = mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "disabling interrupts failed\n");
-		return -1;
+		goto err;
 	}
 	/* Set FIFO_CONTROL_REGISTER to the default value */
 	Data = 0x00;
 	status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER  failed\n");
-		return -1;
+		goto err;
 	}
 
 	Data = 0xcf;
 	status = mos7840_set_uart_reg(port, FIFO_CONTROL_REGISTER, Data);
 	if (status < 0) {
 		dev_dbg(&port->dev, "Writing FIFO_CONTROL_REGISTER  failed\n");
-		return -1;
+		goto err;
 	}
 
 	Data = 0x03;
@@ -1147,6 +1147,15 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
 	mos7840_port->icount.rx = 0;
 
 	return 0;
+err:
+	for (j = 0; j < NUM_URBS; ++j) {
+		urb = mos7840_port->write_urb_pool[j];
+		if (!urb)
+			continue;
+		kfree(urb->transfer_buffer);
+		usb_free_urb(urb);
+	}
+	return status;
 }
 
 /*****************************************************************************
-- 
1.8.1.2


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

* [PATCH 041/133] usb: Clear both buffers when clearing a control transfer TT buffer.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (39 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 040/133] USB: mos7840: fix memory leak in open Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 042/133] nl80211: fix mgmt tx status and testmode reporting for netns Kamal Mostafa
                   ` (91 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: William Gulland, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: William Gulland <wgulland@google.com>

commit 2c7b871b9102c497ba8f972aa5d38532f05b654d upstream.

Control transfers have both IN and OUT (or SETUP) packets, so when
clearing TT buffers for a control transfer it's necessary to send
two HUB_CLEAR_TT_BUFFER requests to the hub.

Signed-off-by: William Gulland <wgulland@google.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/core/hub.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 2a89588..d96ca07 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -725,6 +725,15 @@ resubmit:
 static inline int
 hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
 {
+	/* Need to clear both directions for control ep */
+	if (((devinfo >> 11) & USB_ENDPOINT_XFERTYPE_MASK) ==
+			USB_ENDPOINT_XFER_CONTROL) {
+		int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
+				HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
+				devinfo ^ 0x8000, tt, NULL, 0, 1000);
+		if (status)
+			return status;
+	}
 	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
 			       HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
 			       tt, NULL, 0, 1000);
-- 
1.8.1.2


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

* [PATCH 042/133] nl80211: fix mgmt tx status and testmode reporting for netns
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (40 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 041/133] usb: Clear both buffers when clearing a control transfer TT buffer Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 043/133] mac80211: fix ethtool stats for non-station interfaces Kamal Mostafa
                   ` (90 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kazior, Johannes Berg, Kamal Mostafa

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

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

From: Michal Kazior <michal.kazior@tieto.com>

commit a0ec570f4f69c4cb700d743a915096c2c8f56a99 upstream.

These two events were sent to the default network
namespace.

This caused AP mode in a non-default netns to not
work correctly. Mgmt tx status was multicasted to
a different (default) netns instead of the one the
AP was in.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/wireless/nl80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f45706a..c6268cb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5800,12 +5800,14 @@ EXPORT_SYMBOL(cfg80211_testmode_alloc_event_skb);
 
 void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
 {
+	struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0];
 	void *hdr = ((void **)skb->cb)[1];
 	struct nlattr *data = ((void **)skb->cb)[2];
 
 	nla_nest_end(skb, data);
 	genlmsg_end(skb, hdr);
-	genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp);
+	genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), skb, 0,
+				nl80211_testmode_mcgrp.id, gfp);
 }
 EXPORT_SYMBOL(cfg80211_testmode_event);
 #endif
@@ -8754,7 +8756,8 @@ void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev,
 
 	genlmsg_end(msg, hdr);
 
-	genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp);
+	genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
+				nl80211_mlme_mcgrp.id, gfp);
 	return;
 
  nla_put_failure:
-- 
1.8.1.2


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

* [PATCH 043/133] mac80211: fix ethtool stats for non-station interfaces
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (41 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 042/133] nl80211: fix mgmt tx status and testmode reporting for netns Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 044/133] mac80211: fix duplicate retransmission detection Kamal Mostafa
                   ` (89 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Kamal Mostafa

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

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

From: Johannes Berg <johannes@sipsolutions.net>

commit e13bae4f807401729b3f27c7e882a96b8b292809 upstream.

As reported in https://bugzilla.kernel.org/show_bug.cgi?id=60514,
the station loop never initialises 'sinfo' and therefore adds up
a stack values, leaking stack information (the number of times it
adds values is easily obtained another way.)

Fix this by initialising the sinfo for each station to add.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/cfg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 49c48c6..40732e3 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -638,6 +638,8 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
 			if (sta->sdata->dev != dev)
 				continue;
 
+			sinfo.filled = 0;
+			sta_set_sinfo(sta, &sinfo);
 			i = 0;
 			ADD_STA_STATS(sta);
 		}
-- 
1.8.1.2


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

* [PATCH 044/133] mac80211: fix duplicate retransmission detection
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (42 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 043/133] mac80211: fix ethtool stats for non-station interfaces Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 045/133] iwlwifi: mvm: refuse connection to APs with BI < 16 Kamal Mostafa
                   ` (88 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Johannes Berg, Kamal Mostafa

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

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

From: Johannes Berg <johannes.berg@intel.com>

commit 6b0f32745dcfba01d7be33acd1b40306c7a914c6 upstream.

The duplicate retransmission detection code in mac80211
erroneously attempts to do the check for every frame,
even frames that don't have a sequence control field or
that don't use it (QoS-Null frames.)

This is problematic because it causes the code to access
data beyond the end of the SKB and depending on the data
there will drop packets erroneously.

Correct the code to not do duplicate detection for such
frames.

I found this error while testing AP powersave, it lead
to retransmitted PS-Poll frames being dropped entirely
as the data beyond the end of the SKB was always zero.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/rx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bed1b09..87f76fa 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -935,8 +935,14 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
 
-	/* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */
-	if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) {
+	/*
+	 * Drop duplicate 802.11 retransmissions
+	 * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery")
+	 */
+	if (rx->skb->len >= 24 && rx->sta &&
+	    !ieee80211_is_ctl(hdr->frame_control) &&
+	    !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
+	    !is_multicast_ether_addr(hdr->addr1)) {
 		if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
 			     rx->sta->last_seq_ctrl[rx->seqno_idx] ==
 			     hdr->seq_ctrl)) {
-- 
1.8.1.2


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

* [PATCH 045/133] iwlwifi: mvm: refuse connection to APs with BI < 16
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (43 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 044/133] mac80211: fix duplicate retransmission detection Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 046/133] iwlwifi: add DELL SKU for 5150 HMC Kamal Mostafa
                   ` (87 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johannes Berg, Luis Henriques, Kamal Mostafa

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

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

From: Johannes Berg <johannes.berg@intel.com>

commit 48bc13072109ea58465542aa1ee31b4e1065468a upstream.

Due to a firmware bug, it crashes when the beacon interval
is smaller than 16. Avoid this by refusing the station state
change creating the AP station, causing mac80211 to abandon
the attempt to connect to the AP, and eventually wpa_s to
blacklist it.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ luis: backported to 3.5:
  - file renamed: drivers/net/wireless/iwlwifi/mvm/mac80211.c ->
    drivers/net/wireless/iwlwifi/iwl-mac80211.c
  - adjusted context
  - changed IWL_ERR 1st argument to 'priv'
  - removed redundant condition in 'if' statement ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/iwlwifi/dvm/mac80211.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index 3163e0f..c784f69 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -786,9 +786,23 @@ static int iwlagn_mac_sta_state(struct ieee80211_hw *hw,
 	mutex_lock(&priv->mutex);
 	if (vif->type == NL80211_IFTYPE_STATION) {
 		if (old_state == IEEE80211_STA_NOTEXIST &&
-		    new_state == IEEE80211_STA_NONE)
+		    new_state == IEEE80211_STA_NONE) {
+			/*
+			 * Firmware bug - it'll crash if the beacon interval is less
+			 * than 16. We can't avoid connecting at all, so refuse the
+			 * station state change, this will cause mac80211 to abandon
+			 * attempts to connect to this AP, and eventually wpa_s will
+			 * blacklist the AP...
+			 */
+			if (vif->bss_conf.beacon_int < 16) {
+				IWL_ERR(priv,
+					"AP %pM beacon interval is %d, refusing due to firmware bug!\n",
+					sta->addr, vif->bss_conf.beacon_int);
+				ret = -EINVAL;
+				goto out_unlock;
+			}
 			op = ADD;
-		else if (old_state == IEEE80211_STA_NONE &&
+		} else if (old_state == IEEE80211_STA_NONE &&
 			 new_state == IEEE80211_STA_NOTEXIST)
 			op = REMOVE;
 		else if (old_state == IEEE80211_STA_AUTH &&
@@ -856,6 +870,7 @@ static int iwlagn_mac_sta_state(struct ieee80211_hw *hw,
 	if (iwl_is_rfkill(priv))
 		ret = 0;
 
+out_unlock:
 	mutex_unlock(&priv->mutex);
 	IWL_DEBUG_MAC80211(priv, "leave\n");
 
-- 
1.8.1.2


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

* [PATCH 046/133] iwlwifi: add DELL SKU for 5150 HMC
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (44 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 045/133] iwlwifi: mvm: refuse connection to APs with BI < 16 Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 047/133] ath9k_htc: do some initial hardware configuration Kamal Mostafa
                   ` (86 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Emmanuel Grumbach, Johannes Berg, Kamal Mostafa

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

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

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

commit a1923f1d4723e5757cefdd60f7c7ab30e472007a upstream.

This SKU was missing in the list of supported devices

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

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/drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 2c18171..8fee66f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -131,6 +131,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
 	{IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */
 	{IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */
 	{IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */
+	{IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */
 
 	{IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */
 	{IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */
-- 
1.8.1.2


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

* [PATCH 047/133] ath9k_htc: do some initial hardware configuration
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (45 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 046/133] iwlwifi: add DELL SKU for 5150 HMC Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 048/133] ath9k_htc: reboot firmware if it was loaded Kamal Mostafa
                   ` (85 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleksij Rempel, John W. Linville, Kamal Mostafa

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

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

From: Oleksij Rempel <linux@rempel-privat.de>

commit dc2a87f519a4d8cb376ab54f22b6b98a943b51ce upstream.

Currently we configure harwdare and clock, only after
interface start. In this case, if we reload module or
reboot PC without configuring adapter, firmware will freeze.
There is no software way to reset adpter.

This patch add initial configuration and set it in
disabled state, to avoid this freeze. Behaviour of this patch
should be similar to: ifconfig wlan0 up; ifconfig wlan0 down.

Bug: https://github.com/qca/open-ath9k-htc-firmware/issues/1
Tested-by: Bo Shi <cnshibo@gmail.com>
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 0663653..351123a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -846,6 +846,7 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,
 	if (error != 0)
 		goto err_rx;
 
+	ath9k_hw_disable(priv->ah);
 #ifdef CONFIG_MAC80211_LEDS
 	/* must be initialized before ieee80211_register_hw */
 	priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw,
-- 
1.8.1.2


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

* [PATCH 048/133] ath9k_htc: reboot firmware if it was loaded
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (46 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 047/133] ath9k_htc: do some initial hardware configuration Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 049/133] ARM: 7790/1: Fix deferred mm switch on VIVT processors Kamal Mostafa
                   ` (84 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleksij Rempel, John W. Linville, Kamal Mostafa

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

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

From: Oleksij Rempel <linux@rempel-privat.de>

commit 4928bd2ef8ece262f4f314630219999a91eaa440 upstream.

Currently ath9k_htc will reboot firmware only if interface was
ever started. Which lead to the problem in case where interface
was never started but module need to be reloaded.

This patch will partially fix bug "ath9k_htc: Target is unresponsive"
https://github.com/qca/open-ath9k-htc-firmware/issues/1

Reproduction case:
- plug adapter
- make sure nothing will touch it. Stop Networkmanager or blacklist mac address of this adapter.
- rmmod ath9k_htc; sleep 1; modprobe ath9k_htc

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index f5dda84..75a6376 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1289,7 +1289,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
 
 	usb_set_intfdata(interface, NULL);
 
-	if (!unplugged && (hif_dev->flags & HIF_USB_START))
+	/* If firmware was loaded we should drop it
+	 * go back to first stage bootloader. */
+	if (!unplugged && (hif_dev->flags & HIF_USB_READY))
 		ath9k_hif_usb_reboot(udev);
 
 	kfree(hif_dev);
-- 
1.8.1.2


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

* [PATCH 049/133] ARM: 7790/1: Fix deferred mm switch on VIVT processors
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (47 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 048/133] ath9k_htc: reboot firmware if it was loaded Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 050/133] ARM: 7791/1: a.out: remove partial a.out support Kamal Mostafa
                   ` (83 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Catalin Marinas, Russell King, Kamal Mostafa

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

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

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

commit bdae73cd374e28db544fdd9b77de689a36e3c129 upstream.

As of commit b9d4d42ad9 (ARM: Remove __ARCH_WANT_INTERRUPTS_ON_CTXSW on
pre-ARMv6 CPUs), the mm switching on VIVT processors is done in the
finish_arch_post_lock_switch() function to avoid whole cache flushing
with interrupts disabled. The need for deferred mm switch is stored as a
thread flag (TIF_SWITCH_MM). However, with preemption enabled, we can
have another thread switch before finish_arch_post_lock_switch(). If the
new thread has the same mm as the previous 'next' thread, the scheduler
will not call switch_mm() and the TIF_SWITCH_MM flag won't be set for
the new thread.

This patch moves the switch pending flag to the mm_context_t structure
since this is specific to the mm rather than thread.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/include/asm/mmu.h         |  2 ++
 arch/arm/include/asm/mmu_context.h | 20 ++++++++++++++++----
 arch/arm/include/asm/thread_info.h |  1 -
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index e3d5554..d1b4998 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -6,6 +6,8 @@
 typedef struct {
 #ifdef CONFIG_CPU_HAS_ASID
 	atomic64_t	id;
+#else
+	int		switch_pending;
 #endif
 	unsigned int	vmalloc_seq;
 } mm_context_t;
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 863a661..3da6557 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -45,7 +45,7 @@ static inline void check_and_switch_context(struct mm_struct *mm,
 		 * on non-ASID CPUs, the old mm will remain valid until the
 		 * finish_arch_post_lock_switch() call.
 		 */
-		set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
+		mm->context.switch_pending = 1;
 	else
 		cpu_switch_mm(mm->pgd, mm);
 }
@@ -54,9 +54,21 @@ static inline void check_and_switch_context(struct mm_struct *mm,
 	finish_arch_post_lock_switch
 static inline void finish_arch_post_lock_switch(void)
 {
-	if (test_and_clear_thread_flag(TIF_SWITCH_MM)) {
-		struct mm_struct *mm = current->mm;
-		cpu_switch_mm(mm->pgd, mm);
+	struct mm_struct *mm = current->mm;
+
+	if (mm && mm->context.switch_pending) {
+		/*
+		 * Preemption must be disabled during cpu_switch_mm() as we
+		 * have some stateful cache flush implementations. Check
+		 * switch_pending again in case we were preempted and the
+		 * switch to this mm was already done.
+		 */
+		preempt_disable();
+		if (mm->context.switch_pending) {
+			mm->context.switch_pending = 0;
+			cpu_switch_mm(mm->pgd, mm);
+		}
+		preempt_enable_no_resched();
 	}
 }
 
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index cddda1f..20038ae 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -155,7 +155,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
 #define TIF_USING_IWMMXT	17
 #define TIF_MEMDIE		18	/* is terminating due to OOM killer */
 #define TIF_RESTORE_SIGMASK	20
-#define TIF_SWITCH_MM		22	/* deferred switch_mm */
 
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
-- 
1.8.1.2


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

* [PATCH 050/133] ARM: 7791/1: a.out: remove partial a.out support
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (48 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 049/133] ARM: 7790/1: Fix deferred mm switch on VIVT processors Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 051/133] mwifiex: Add missing endian conversion Kamal Mostafa
                   ` (82 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ashish Sangwan, Will Deacon, Russell King, Kamal Mostafa

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

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

From: Will Deacon <will.deacon@arm.com>

commit acfdd4b1f7590d02e9bae3b73bdbbc4a31b05d38 upstream.

a.out support on ARM requires that argc, argv and envp are passed in
r0-r2 respectively, which requires hacking load_aout_binary to
prevent argc being clobbered by the return code. Whilst mainline kernels
do set the registers up in start_thread, the aout loader has never
carried the hack in mainline.

Initialising the registers in this way actually goes against the libc
expectations for ELF binaries, where argc, argv and envp are passed on
the stack, with r0 being used to hold a pointer to an exit function for
cleaning up after the dynamic linker if required. If the pointer is
NULL, then it is ignored. When execing an ELF binary, Linux currently
zeroes r0, then sets it to argc and then finally clobbers it with the
return value of the execve syscall, so we actually end up with:

	r0 = 0
	stack[0] = argc
	r1 = stack[1] = argv
	r2 = stack[2] = envp

libc treats r1 and r2 as undefined. The clobbering of r0 by sys_execve
works for user-spawned threads, but when executing an ELF binary from a
kernel thread (via call_usermodehelper), the execve is performed on the
ret_from_fork path, which restores r0 from the saved pt_regs, resulting
in argc being presented to the C library. This has horrible consequences
when the application exits, since we have an exit function registered
using argc, resulting in a jump to hyperspace.

This patch solves the problem by removing the partial a.out support from
arch/arm/ altogether.

Cc: Ashish Sangwan <ashishsangwan2@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/Kconfig                  |  1 -
 arch/arm/include/asm/a.out-core.h | 45 ---------------------------------------
 arch/arm/include/asm/processor.h  |  4 ----
 arch/arm/include/uapi/asm/Kbuild  |  1 -
 arch/arm/include/uapi/asm/a.out.h | 34 -----------------------------
 5 files changed, 85 deletions(-)
 delete mode 100644 arch/arm/include/asm/a.out-core.h
 delete mode 100644 arch/arm/include/uapi/asm/a.out.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 613f3a6..6dd9069 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -17,7 +17,6 @@ config ARM
 	select GENERIC_STRNCPY_FROM_USER
 	select GENERIC_STRNLEN_USER
 	select HARDIRQS_SW_RESEND
-	select HAVE_AOUT
 	select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_SECCOMP_FILTER
diff --git a/arch/arm/include/asm/a.out-core.h b/arch/arm/include/asm/a.out-core.h
deleted file mode 100644
index 92f10cb..0000000
--- a/arch/arm/include/asm/a.out-core.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* a.out coredump register dumper
- *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowells@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licence
- * as published by the Free Software Foundation; either version
- * 2 of the Licence, or (at your option) any later version.
- */
-
-#ifndef _ASM_A_OUT_CORE_H
-#define _ASM_A_OUT_CORE_H
-
-#ifdef __KERNEL__
-
-#include <linux/user.h>
-#include <linux/elfcore.h>
-
-/*
- * fill in the user structure for an a.out core dump
- */
-static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
-{
-	struct task_struct *tsk = current;
-
-	dump->magic = CMAGIC;
-	dump->start_code = tsk->mm->start_code;
-	dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
-
-	dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
-	dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	dump->u_ssize = 0;
-
-	memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg));
-
-	if (dump->start_stack < 0x04000000)
-		dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT;
-
-	dump->regs = *regs;
-	dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
-}
-
-#endif /* __KERNEL__ */
-#endif /* _ASM_A_OUT_CORE_H */
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 06e7d50..413f387 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -54,7 +54,6 @@ struct thread_struct {
 
 #define start_thread(regs,pc,sp)					\
 ({									\
-	unsigned long *stack = (unsigned long *)sp;			\
 	memset(regs->uregs, 0, sizeof(regs->uregs));			\
 	if (current->personality & ADDR_LIMIT_32BIT)			\
 		regs->ARM_cpsr = USR_MODE;				\
@@ -65,9 +64,6 @@ struct thread_struct {
 	regs->ARM_cpsr |= PSR_ENDSTATE;					\
 	regs->ARM_pc = pc & ~1;		/* pc */			\
 	regs->ARM_sp = sp;		/* sp */			\
-	regs->ARM_r2 = stack[2];	/* r2 (envp) */			\
-	regs->ARM_r1 = stack[1];	/* r1 (argv) */			\
-	regs->ARM_r0 = stack[0];	/* r0 (argc) */			\
 	nommu_start_thread(regs);					\
 })
 
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index 47bcb2d..18d76fd 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -1,7 +1,6 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += a.out.h
 header-y += byteorder.h
 header-y += fcntl.h
 header-y += hwcap.h
diff --git a/arch/arm/include/uapi/asm/a.out.h b/arch/arm/include/uapi/asm/a.out.h
deleted file mode 100644
index 083894b..0000000
--- a/arch/arm/include/uapi/asm/a.out.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __ARM_A_OUT_H__
-#define __ARM_A_OUT_H__
-
-#include <linux/personality.h>
-#include <linux/types.h>
-
-struct exec
-{
-  __u32 a_info;		/* Use macros N_MAGIC, etc for access */
-  __u32 a_text;		/* length of text, in bytes */
-  __u32 a_data;		/* length of data, in bytes */
-  __u32 a_bss;		/* length of uninitialized data area for file, in bytes */
-  __u32 a_syms;		/* length of symbol table data in file, in bytes */
-  __u32 a_entry;	/* start address */
-  __u32 a_trsize;	/* length of relocation info for text, in bytes */
-  __u32 a_drsize;	/* length of relocation info for data, in bytes */
-};
-
-/*
- * This is always the same
- */
-#define N_TXTADDR(a)	(0x00008000)
-
-#define N_TRSIZE(a)	((a).a_trsize)
-#define N_DRSIZE(a)	((a).a_drsize)
-#define N_SYMSIZE(a)	((a).a_syms)
-
-#define M_ARM 103
-
-#ifndef LIBRARY_START_TEXT
-#define LIBRARY_START_TEXT	(0x00c00000)
-#endif
-
-#endif /* __A_OUT_GNU_H__ */
-- 
1.8.1.2


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

* [PATCH 051/133] mwifiex: Add missing endian conversion.
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (49 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 050/133] ARM: 7791/1: a.out: remove partial a.out support Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 052/133] USB: mos7840: fix race in register handling Kamal Mostafa
                   ` (81 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomasz Moń, John W. Linville, Kamal Mostafa

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

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

From: =?UTF-8?q?Tomasz=20Mo=C5=84?= <desowin@gmail.com>

commit 83e612f632c3897be29ef02e0472f6d63e258378 upstream.

Both type and pkt_len variables are in host endian and these should be in
Little Endian in the payload.

Signed-off-by: Tomasz Moń <desowin@gmail.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/mwifiex/sdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 5a1c1d0..86c025d 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -1455,8 +1455,8 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter,
 	/* Allocate buffer and copy payload */
 	blk_size = MWIFIEX_SDIO_BLOCK_SIZE;
 	buf_block_len = (pkt_len + blk_size - 1) / blk_size;
-	*(u16 *) &payload[0] = (u16) pkt_len;
-	*(u16 *) &payload[2] = type;
+	*(__le16 *)&payload[0] = cpu_to_le16((u16)pkt_len);
+	*(__le16 *)&payload[2] = cpu_to_le16(type);
 
 	/*
 	 * This is SDIO specific header
-- 
1.8.1.2


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

* [PATCH 052/133] USB: mos7840: fix race in register handling
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (50 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 051/133] mwifiex: Add missing endian conversion Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 053/133] USB: mos7840: fix device-type detection Kamal Mostafa
                   ` (80 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Johan Hovold <jhovold@gmail.com>

commit d8a083cc746664916d9d36ed9e4d08a29525f245 upstream.

Fix race in mos7840_get_reg which unconditionally manipulated the
control urb (which may already be in use) by adding a control-urb busy
flag.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/mos7840.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 06ca54a..eab52f6 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -183,6 +183,10 @@
 #define LED_ON_MS	500
 #define LED_OFF_MS	500
 
+enum mos7840_flag {
+	MOS7840_FLAG_CTRL_BUSY,
+};
+
 static int device_type;
 
 static const struct usb_device_id id_table[] = {
@@ -243,6 +247,8 @@ struct moschip_port {
 	bool led_flag;
 	struct timer_list led_timer1;	/* Timer for LED on */
 	struct timer_list led_timer2;	/* Timer for LED off */
+
+	unsigned long flags;
 };
 
 /*
@@ -487,10 +493,10 @@ static void mos7840_control_callback(struct urb *urb)
 	case -ESHUTDOWN:
 		/* this urb is terminated, clean up */
 		dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
-		return;
+		goto out;
 	default:
 		dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
-		return;
+		goto out;
 	}
 
 	dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length);
@@ -503,6 +509,8 @@ static void mos7840_control_callback(struct urb *urb)
 		mos7840_handle_new_msr(mos7840_port, regval);
 	else if (mos7840_port->MsrLsr == 1)
 		mos7840_handle_new_lsr(mos7840_port, regval);
+out:
+	clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mos7840_port->flags);
 }
 
 static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
@@ -513,6 +521,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
 	unsigned char *buffer = mcs->ctrl_buf;
 	int ret;
 
+	if (test_and_set_bit_lock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags))
+		return -EBUSY;
+
 	dr->bRequestType = MCS_RD_RTYPE;
 	dr->bRequest = MCS_RDREQ;
 	dr->wValue = cpu_to_le16(Wval);	/* 0 */
@@ -524,6 +535,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
 			     mos7840_control_callback, mcs);
 	mcs->control_urb->transfer_buffer_length = 2;
 	ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC);
+	if (ret)
+		clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags);
+
 	return ret;
 }
 
-- 
1.8.1.2


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

* [PATCH 053/133] USB: mos7840: fix device-type detection
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (51 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 052/133] USB: mos7840: fix race in register handling Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 054/133] USB: mos7840: fix race in led handling Kamal Mostafa
                   ` (79 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Johan Hovold <jhovold@gmail.com>

commit 40c24f2893ba0ba7df485871f6aac0c197ceef5b upstream.

Fix race in device-type detection introduced by commit 0eafe4de ("USB:
serial: mos7840: add support for MCS7810 devices") which used a static
variable to hold the device type.

Move type detection to probe and use serial data to store the device
type.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/mos7840.c | 75 +++++++++++++++++++++-----------------------
 1 file changed, 35 insertions(+), 40 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index eab52f6..343a179 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -187,8 +187,6 @@ enum mos7840_flag {
 	MOS7840_FLAG_CTRL_BUSY,
 };
 
-static int device_type;
-
 static const struct usb_device_id id_table[] = {
 	{USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
 	{USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
@@ -867,18 +865,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
 /************************************************************************/
 /*       D R I V E R  T T Y  I N T E R F A C E  F U N C T I O N S       */
 /************************************************************************/
-#ifdef MCSSerialProbe
-static int mos7840_serial_probe(struct usb_serial *serial,
-				const struct usb_device_id *id)
-{
-
-	/*need to implement the mode_reg reading and updating\
-	   structures usb_serial_ device_type\
-	   (i.e num_ports, num_bulkin,bulkout etc) */
-	/* Also we can update the changes  attach */
-	return 1;
-}
-#endif
 
 /*****************************************************************************
  * mos7840_open
@@ -2333,38 +2319,48 @@ static int mos7810_check(struct usb_serial *serial)
 	return 0;
 }
 
-static int mos7840_calc_num_ports(struct usb_serial *serial)
+static int mos7840_probe(struct usb_serial *serial,
+				const struct usb_device_id *id)
 {
-	__u16 data = 0x00;
+	u16 product = serial->dev->descriptor.idProduct;
 	u8 *buf;
-	int mos7840_num_ports;
+	int device_type;
+
+	if (product == MOSCHIP_DEVICE_ID_7810 ||
+		product == MOSCHIP_DEVICE_ID_7820) {
+		device_type = product;
+		goto out;
+	}
 
 	buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
-	if (buf) {
-		usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+	if (!buf)
+		return -ENOMEM;
+
+	usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 			MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
 			VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
-		data = *buf;
-		kfree(buf);
-	}
 
-	if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 ||
-		serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) {
-		device_type = serial->dev->descriptor.idProduct;
-	} else {
-		/* For a MCS7840 device GPIO0 must be set to 1 */
-		if ((data & 0x01) == 1)
-			device_type = MOSCHIP_DEVICE_ID_7840;
-		else if (mos7810_check(serial))
-			device_type = MOSCHIP_DEVICE_ID_7810;
-		else
-			device_type = MOSCHIP_DEVICE_ID_7820;
-	}
+	/* For a MCS7840 device GPIO0 must be set to 1 */
+	if (buf[0] & 0x01)
+		device_type = MOSCHIP_DEVICE_ID_7840;
+	else if (mos7810_check(serial))
+		device_type = MOSCHIP_DEVICE_ID_7810;
+	else
+		device_type = MOSCHIP_DEVICE_ID_7820;
+
+	kfree(buf);
+out:
+	usb_set_serial_data(serial, (void *)device_type);
+
+	return 0;
+}
+
+static int mos7840_calc_num_ports(struct usb_serial *serial)
+{
+	int device_type = (int)usb_get_serial_data(serial);
+	int mos7840_num_ports;
 
 	mos7840_num_ports = (device_type >> 4) & 0x000F;
-	serial->num_bulk_in = mos7840_num_ports;
-	serial->num_bulk_out = mos7840_num_ports;
-	serial->num_ports = mos7840_num_ports;
 
 	return mos7840_num_ports;
 }
@@ -2372,6 +2368,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial)
 static int mos7840_port_probe(struct usb_serial_port *port)
 {
 	struct usb_serial *serial = port->serial;
+	int device_type = (int)usb_get_serial_data(serial);
 	struct moschip_port *mos7840_port;
 	int status;
 	int pnum;
@@ -2630,9 +2627,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
 	.throttle = mos7840_throttle,
 	.unthrottle = mos7840_unthrottle,
 	.calc_num_ports = mos7840_calc_num_ports,
-#ifdef MCSSerialProbe
-	.probe = mos7840_serial_probe,
-#endif
+	.probe = mos7840_probe,
 	.ioctl = mos7840_ioctl,
 	.set_termios = mos7840_set_termios,
 	.break_ctl = mos7840_break,
-- 
1.8.1.2


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

* [PATCH 054/133] USB: mos7840: fix race in led handling
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (52 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 053/133] USB: mos7840: fix device-type detection Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 055/133] serial/mxs-auart: fix race condition in interrupt handler Kamal Mostafa
                   ` (78 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Johan Hovold <jhovold@gmail.com>

commit 05cf0dec5ccc696a7636c84b265b477173498156 upstream.

Fix race in LED handling introduced by commit 0eafe4de ("USB: serial:
mos7840: add support for MCS7810 devices") which reused the port control
urb for manipulating the LED without making sure that the urb is not
already in use. This could lead to the control urb being manipulated
while in flight.

Fix by adding a dedicated LED urb and ctrlrequest along with a LED-busy
flag to handle concurrency.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/mos7840.c | 59 +++++++++++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 343a179..0116855 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -185,6 +185,7 @@
 
 enum mos7840_flag {
 	MOS7840_FLAG_CTRL_BUSY,
+	MOS7840_FLAG_LED_BUSY,
 };
 
 static const struct usb_device_id id_table[] = {
@@ -242,9 +243,10 @@ struct moschip_port {
 
 	/* For device(s) with LED indicator */
 	bool has_led;
-	bool led_flag;
 	struct timer_list led_timer1;	/* Timer for LED on */
 	struct timer_list led_timer2;	/* Timer for LED off */
+	struct urb *led_urb;
+	struct usb_ctrlrequest *led_dr;
 
 	unsigned long flags;
 };
@@ -562,7 +564,7 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval,
 				__u16 reg)
 {
 	struct usb_device *dev = mcs->port->serial->dev;
-	struct usb_ctrlrequest *dr = mcs->dr;
+	struct usb_ctrlrequest *dr = mcs->led_dr;
 
 	dr->bRequestType = MCS_WR_RTYPE;
 	dr->bRequest = MCS_WRREQ;
@@ -570,10 +572,10 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval,
 	dr->wIndex = cpu_to_le16(reg);
 	dr->wLength = cpu_to_le16(0);
 
-	usb_fill_control_urb(mcs->control_urb, dev, usb_sndctrlpipe(dev, 0),
+	usb_fill_control_urb(mcs->led_urb, dev, usb_sndctrlpipe(dev, 0),
 		(unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL);
 
-	usb_submit_urb(mcs->control_urb, GFP_ATOMIC);
+	usb_submit_urb(mcs->led_urb, GFP_ATOMIC);
 }
 
 static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg,
@@ -599,7 +601,19 @@ static void mos7840_led_flag_off(unsigned long arg)
 {
 	struct moschip_port *mcs = (struct moschip_port *) arg;
 
-	mcs->led_flag = false;
+	clear_bit_unlock(MOS7840_FLAG_LED_BUSY, &mcs->flags);
+}
+
+static void mos7840_led_activity(struct usb_serial_port *port)
+{
+	struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
+
+	if (test_and_set_bit_lock(MOS7840_FLAG_LED_BUSY, &mos7840_port->flags))
+		return;
+
+	mos7840_set_led_async(mos7840_port, 0x0301, MODEM_CONTROL_REGISTER);
+	mod_timer(&mos7840_port->led_timer1,
+				jiffies + msecs_to_jiffies(LED_ON_MS));
 }
 
 /*****************************************************************************
@@ -804,14 +818,8 @@ static void mos7840_bulk_in_callback(struct urb *urb)
 		return;
 	}
 
-	/* Turn on LED */
-	if (mos7840_port->has_led && !mos7840_port->led_flag) {
-		mos7840_port->led_flag = true;
-		mos7840_set_led_async(mos7840_port, 0x0301,
-					MODEM_CONTROL_REGISTER);
-		mod_timer(&mos7840_port->led_timer1,
-				jiffies + msecs_to_jiffies(LED_ON_MS));
-	}
+	if (mos7840_port->has_led)
+		mos7840_led_activity(port);
 
 	mos7840_port->read_urb_busy = true;
 	retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC);
@@ -1517,13 +1525,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
 	data1 = urb->transfer_buffer;
 	dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress);
 
-	/* Turn on LED */
-	if (mos7840_port->has_led && !mos7840_port->led_flag) {
-		mos7840_port->led_flag = true;
-		mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0301);
-		mod_timer(&mos7840_port->led_timer1,
-				jiffies + msecs_to_jiffies(LED_ON_MS));
-	}
+	if (mos7840_port->has_led)
+		mos7840_led_activity(port);
 
 	/* send it down the pipe */
 	status = usb_submit_urb(urb, GFP_ATOMIC);
@@ -2546,6 +2549,14 @@ static int mos7840_port_probe(struct usb_serial_port *port)
 	if (device_type == MOSCHIP_DEVICE_ID_7810) {
 		mos7840_port->has_led = true;
 
+		mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL);
+		mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr),
+								GFP_KERNEL);
+		if (!mos7840_port->led_urb || !mos7840_port->led_dr) {
+			status = -ENOMEM;
+			goto error;
+		}
+
 		init_timer(&mos7840_port->led_timer1);
 		mos7840_port->led_timer1.function = mos7840_led_off;
 		mos7840_port->led_timer1.expires =
@@ -2558,8 +2569,6 @@ static int mos7840_port_probe(struct usb_serial_port *port)
 			jiffies + msecs_to_jiffies(LED_OFF_MS);
 		mos7840_port->led_timer2.data = (unsigned long)mos7840_port;
 
-		mos7840_port->led_flag = false;
-
 		/* Turn off LED */
 		mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300);
 	}
@@ -2581,6 +2590,8 @@ out:
 	}
 	return 0;
 error:
+	kfree(mos7840_port->led_dr);
+	usb_free_urb(mos7840_port->led_urb);
 	kfree(mos7840_port->dr);
 	kfree(mos7840_port->ctrl_buf);
 	usb_free_urb(mos7840_port->control_urb);
@@ -2601,6 +2612,10 @@ static int mos7840_port_remove(struct usb_serial_port *port)
 
 		del_timer_sync(&mos7840_port->led_timer1);
 		del_timer_sync(&mos7840_port->led_timer2);
+
+		usb_kill_urb(mos7840_port->led_urb);
+		usb_free_urb(mos7840_port->led_urb);
+		kfree(mos7840_port->led_dr);
 	}
 	usb_kill_urb(mos7840_port->control_urb);
 	usb_free_urb(mos7840_port->control_urb);
-- 
1.8.1.2


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

* [PATCH 055/133] serial/mxs-auart: fix race condition in interrupt handler
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (53 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 054/133] USB: mos7840: fix race in led handling Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 056/133] serial: mxs: fix buffer overflow Kamal Mostafa
                   ` (77 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit d970d7fe65adff5efe75b4a73c4ffc9be57089f7 upstream.

The handler needs to ack the pending events before actually handling them.
Otherwise a new event might come in after it it considered non-pending or
handled and is acked then without being handled. So this event is only
noticed when the next interrupt happens.

Without this patch an i.MX28 based machine running an rt-patched kernel
regularly hangs during boot.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/mxs-auart.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index e55615e..f0d17ee 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -710,11 +710,18 @@ static void mxs_auart_settermios(struct uart_port *u,
 
 static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
 {
-	u32 istatus, istat;
+	u32 istat;
 	struct mxs_auart_port *s = context;
 	u32 stat = readl(s->port.membase + AUART_STAT);
 
-	istatus = istat = readl(s->port.membase + AUART_INTR);
+	istat = readl(s->port.membase + AUART_INTR);
+
+	/* ack irq */
+	writel(istat & (AUART_INTR_RTIS
+		| AUART_INTR_TXIS
+		| AUART_INTR_RXIS
+		| AUART_INTR_CTSMIS),
+			s->port.membase + AUART_INTR_CLR);
 
 	if (istat & AUART_INTR_CTSMIS) {
 		uart_handle_cts_change(&s->port, stat & AUART_STAT_CTS);
@@ -734,12 +741,6 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
 		istat &= ~AUART_INTR_TXIS;
 	}
 
-	writel(istatus & (AUART_INTR_RTIS
-		| AUART_INTR_TXIS
-		| AUART_INTR_RXIS
-		| AUART_INTR_CTSMIS),
-			s->port.membase + AUART_INTR_CLR);
-
 	return IRQ_HANDLED;
 }
 
-- 
1.8.1.2


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

* [PATCH 056/133] serial: mxs: fix buffer overflow
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (54 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 055/133] serial/mxs-auart: fix race condition in interrupt handler Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 057/133] serial/mxs-auart: increase time to wait for transmitter to become idle Kamal Mostafa
                   ` (76 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wolfram Sang, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Wolfram Sang <wsa@the-dreams.de>

commit 4829e7650f8a40645e4e32b26a37fb833a5e75f0 upstream.

SMATCH correctly found an off-by-one error:

drivers/tty/serial/mxs-auart.c:889 auart_console_write() error: buffer overflow 'auart_port' 5 <= 5

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/mxs-auart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index f0d17ee..6b00fa5 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -885,7 +885,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count)
 	unsigned int old_ctrl0, old_ctrl2;
 	unsigned int to = 1000;
 
-	if (co->index >	MXS_AUART_PORTS || co->index < 0)
+	if (co->index >= MXS_AUART_PORTS || co->index < 0)
 		return;
 
 	s = auart_port[co->index];
-- 
1.8.1.2


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

* [PATCH 057/133] serial/mxs-auart: increase time to wait for transmitter to become idle
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (55 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 056/133] serial: mxs: fix buffer overflow Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 058/133] serial: arc_uart: Fix module alias Kamal Mostafa
                   ` (75 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Uwe Kleine-König, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>

commit 079a036f4283e2b0e5c26080b8c5112bc0cc1831 upstream.

Without this patch the driver waits ~1 ms for the UART to become idle. At
115200n8 this time is (theoretically) enough to transfer 11.5 characters
(= 115200 bits/s / (10 Bits/char) * 1ms). As the mxs-auart has a fifo size
of 16 characters the clock is gated too early. The problem is worse for
lower baud rates.

This only happens to really shut down the transmitter in the middle of a
transfer if /dev/ttyAPPx isn't opened in userspace (e.g. by a getty) but
was at least once (because the bootloader doesn't disable the transmitter).

So increase the timeout to 20 ms which should be enough for 9600n8, too.
Moreover skip gating the clock if the timeout is elapsed.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/mxs-auart.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 6b00fa5..8bb306b 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -883,7 +883,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count)
 	struct mxs_auart_port *s;
 	struct uart_port *port;
 	unsigned int old_ctrl0, old_ctrl2;
-	unsigned int to = 1000;
+	unsigned int to = 20000;
 
 	if (co->index >= MXS_AUART_PORTS || co->index < 0)
 		return;
@@ -904,18 +904,23 @@ auart_console_write(struct console *co, const char *str, unsigned int count)
 
 	uart_console_write(port, str, count, mxs_auart_console_putchar);
 
-	/*
-	 * Finally, wait for transmitter to become empty
-	 * and restore the TCR
-	 */
+	/* Finally, wait for transmitter to become empty ... */
 	while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) {
+		udelay(1);
 		if (!to--)
 			break;
-		udelay(1);
 	}
 
-	writel(old_ctrl0, port->membase + AUART_CTRL0);
-	writel(old_ctrl2, port->membase + AUART_CTRL2);
+	/*
+	 * ... and restore the TCR if we waited long enough for the transmitter
+	 * to be idle. This might keep the transmitter enabled although it is
+	 * unused, but that is better than to disable it while it is still
+	 * transmitting.
+	 */
+	if (!(readl(port->membase + AUART_STAT) & AUART_STAT_BUSY)) {
+		writel(old_ctrl0, port->membase + AUART_CTRL0);
+		writel(old_ctrl2, port->membase + AUART_CTRL2);
+	}
 
 	clk_disable(s->clk);
 }
-- 
1.8.1.2


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

* [PATCH 058/133] serial: arc_uart: Fix module alias
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (56 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 057/133] serial/mxs-auart: increase time to wait for transmitter to become idle Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 059/133] firewire: fix libdc1394/FlyCap2 iso event regression Kamal Mostafa
                   ` (74 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Greg Kroah-Hartman, Kamal Mostafa

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

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

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

commit d5a12ea7a9e58d9e5c19d25cb668aadb396423ec upstream.

Platform drivers use "platform:" prefix in module alias.
Also use DRIVER_NAME in MODULE_ALIAS to make module autoloading work.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/arc_uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 3e0b3fa..c4e06db 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -741,6 +741,6 @@ module_init(arc_serial_init);
 module_exit(arc_serial_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("plat-arcfpga/uart");
+MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_AUTHOR("Vineet Gupta");
 MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver");
-- 
1.8.1.2


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

* [PATCH 059/133] firewire: fix libdc1394/FlyCap2 iso event regression
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (57 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 058/133] serial: arc_uart: Fix module alias Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 060/133] dma: pl330: Fix cyclic transfers Kamal Mostafa
                   ` (73 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Clemens Ladisch, Stefan Richter, Kamal Mostafa

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

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

From: Clemens Ladisch <clemens@ladisch.de>

commit 0699a73af3811b66b1ab5650575acee5eea841ab upstream.

Commit 18d627113b83 (firewire: prevent dropping of completed iso packet
header data) was intended to be an obvious bug fix, but libdc1394 and
FlyCap2 depend on the old behaviour by ignoring all returned information
and thus not noticing that not all packets have been received yet.  The
result was that the video frame buffers would be saved before they
contained the correct data.

Reintroduce the old behaviour for old clients.

Tested-by: Stepan Salenikovich <stepan.salenikovich@gmail.com>
Tested-by: Josep Bosch <jep250@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/firewire/core-cdev.c       |  3 +++
 drivers/firewire/ohci.c            | 10 ++++++++--
 include/linux/firewire.h           |  1 +
 include/uapi/linux/firewire-cdev.h |  4 ++--
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index f8d2287..87ae86f 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -54,6 +54,7 @@
 #define FW_CDEV_KERNEL_VERSION			5
 #define FW_CDEV_VERSION_EVENT_REQUEST2		4
 #define FW_CDEV_VERSION_ALLOCATE_REGION_END	4
+#define FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW	5
 
 struct client {
 	u32 version;
@@ -1009,6 +1010,8 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg)
 			a->channel, a->speed, a->header_size, cb, client);
 	if (IS_ERR(context))
 		return PTR_ERR(context);
+	if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW)
+		context->drop_overflow_headers = true;
 
 	/* We only support one context at this time. */
 	spin_lock_irq(&client->lock);
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 6ce6e07..41474aa 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -2729,8 +2729,11 @@ static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr)
 {
 	u32 *ctx_hdr;
 
-	if (ctx->header_length + ctx->base.header_size > PAGE_SIZE)
+	if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) {
+		if (ctx->base.drop_overflow_headers)
+			return;
 		flush_iso_completions(ctx);
+	}
 
 	ctx_hdr = ctx->header + ctx->header_length;
 	ctx->last_timestamp = (u16)le32_to_cpu((__force __le32)dma_hdr[0]);
@@ -2890,8 +2893,11 @@ static int handle_it_packet(struct context *context,
 
 	sync_it_packet_for_cpu(context, d);
 
-	if (ctx->header_length + 4 > PAGE_SIZE)
+	if (ctx->header_length + 4 > PAGE_SIZE) {
+		if (ctx->base.drop_overflow_headers)
+			return 1;
 		flush_iso_completions(ctx);
+	}
 
 	ctx_hdr = ctx->header + ctx->header_length;
 	ctx->last_timestamp = le16_to_cpu(last->res_count);
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 191501a..217e4b4 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -434,6 +434,7 @@ struct fw_iso_context {
 	int type;
 	int channel;
 	int speed;
+	bool drop_overflow_headers;
 	size_t header_size;
 	union {
 		fw_iso_callback_t sc;
diff --git a/include/uapi/linux/firewire-cdev.h b/include/uapi/linux/firewire-cdev.h
index d500369..1db453e 100644
--- a/include/uapi/linux/firewire-cdev.h
+++ b/include/uapi/linux/firewire-cdev.h
@@ -215,8 +215,8 @@ struct fw_cdev_event_request2 {
  * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with
  * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets
  * without the interrupt bit set that the kernel's internal buffer for @header
- * is about to overflow.  (In the last case, kernels with ABI version < 5 drop
- * header data up to the next interrupt packet.)
+ * is about to overflow.  (In the last case, ABI versions < 5 drop header data
+ * up to the next interrupt packet.)
  *
  * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
  *
-- 
1.8.1.2


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

* [PATCH 060/133] dma: pl330: Fix cyclic transfers
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (58 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 059/133] firewire: fix libdc1394/FlyCap2 iso event regression Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 061/133] USB: mos7840: fix pointer casts Kamal Mostafa
                   ` (72 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Vinod Koul, Kamal Mostafa

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

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

From: Lars-Peter Clausen <lars@metafoo.de>

commit fc51446021f42aca8906e701fc2292965aafcb15 upstream.

Allocate a descriptor for each period of a cyclic transfer, not just the first.
Also since the callback needs to be called for each finished period make sure to
initialize the callback and callback_param fields of each descriptor in a cyclic
transfer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/dma/pl330.c | 93 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 67 insertions(+), 26 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 4bed3f1..9cfe424 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2501,6 +2501,10 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx)
 	/* Assign cookies to all nodes */
 	while (!list_empty(&last->node)) {
 		desc = list_entry(last->node.next, struct dma_pl330_desc, node);
+		if (pch->cyclic) {
+			desc->txd.callback = last->txd.callback;
+			desc->txd.callback_param = last->txd.callback_param;
+		}
 
 		dma_cookie_assign(&desc->txd);
 
@@ -2684,45 +2688,82 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
 		size_t period_len, enum dma_transfer_direction direction,
 		unsigned long flags, void *context)
 {
-	struct dma_pl330_desc *desc;
+	struct dma_pl330_desc *desc = NULL, *first = NULL;
 	struct dma_pl330_chan *pch = to_pchan(chan);
+	struct dma_pl330_dmac *pdmac = pch->dmac;
+	unsigned int i;
 	dma_addr_t dst;
 	dma_addr_t src;
 
-	desc = pl330_get_desc(pch);
-	if (!desc) {
-		dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n",
-			__func__, __LINE__);
+	if (len % period_len != 0)
 		return NULL;
-	}
 
-	switch (direction) {
-	case DMA_MEM_TO_DEV:
-		desc->rqcfg.src_inc = 1;
-		desc->rqcfg.dst_inc = 0;
-		desc->req.rqtype = MEMTODEV;
-		src = dma_addr;
-		dst = pch->fifo_addr;
-		break;
-	case DMA_DEV_TO_MEM:
-		desc->rqcfg.src_inc = 0;
-		desc->rqcfg.dst_inc = 1;
-		desc->req.rqtype = DEVTOMEM;
-		src = pch->fifo_addr;
-		dst = dma_addr;
-		break;
-	default:
+	if (!is_slave_direction(direction)) {
 		dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n",
 		__func__, __LINE__);
 		return NULL;
 	}
 
-	desc->rqcfg.brst_size = pch->burst_sz;
-	desc->rqcfg.brst_len = 1;
+	for (i = 0; i < len / period_len; i++) {
+		desc = pl330_get_desc(pch);
+		if (!desc) {
+			dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n",
+				__func__, __LINE__);
 
-	pch->cyclic = true;
+			if (!first)
+				return NULL;
+
+			spin_lock_irqsave(&pdmac->pool_lock, flags);
+
+			while (!list_empty(&first->node)) {
+				desc = list_entry(first->node.next,
+						struct dma_pl330_desc, node);
+				list_move_tail(&desc->node, &pdmac->desc_pool);
+			}
+
+			list_move_tail(&first->node, &pdmac->desc_pool);
 
-	fill_px(&desc->px, dst, src, period_len);
+			spin_unlock_irqrestore(&pdmac->pool_lock, flags);
+
+			return NULL;
+		}
+
+		switch (direction) {
+		case DMA_MEM_TO_DEV:
+			desc->rqcfg.src_inc = 1;
+			desc->rqcfg.dst_inc = 0;
+			desc->req.rqtype = MEMTODEV;
+			src = dma_addr;
+			dst = pch->fifo_addr;
+			break;
+		case DMA_DEV_TO_MEM:
+			desc->rqcfg.src_inc = 0;
+			desc->rqcfg.dst_inc = 1;
+			desc->req.rqtype = DEVTOMEM;
+			src = pch->fifo_addr;
+			dst = dma_addr;
+			break;
+		default:
+			break;
+		}
+
+		desc->rqcfg.brst_size = pch->burst_sz;
+		desc->rqcfg.brst_len = 1;
+		fill_px(&desc->px, dst, src, period_len);
+
+		if (!first)
+			first = desc;
+		else
+			list_add_tail(&desc->node, &first->node);
+
+		dma_addr += period_len;
+	}
+
+	if (!desc)
+		return NULL;
+
+	pch->cyclic = true;
+	desc->txd.flags = flags;
 
 	return &desc->txd;
 }
-- 
1.8.1.2


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

* [PATCH 061/133] USB: mos7840: fix pointer casts
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (59 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 060/133] dma: pl330: Fix cyclic transfers Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 062/133] ixgbe: Fix Tx Hang issue with lldpad on 82598EB Kamal Mostafa
                   ` (71 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hovold, Greg Kroah-Hartman, Kamal Mostafa

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

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

From: Johan Hovold <jhovold@gmail.com>

commit 683a0e4d7971c3186dc4d429027debfe309129aa upstream.

Silence compiler warnings on 64-bit systems introduced by commit
05cf0dec ("USB: mos7840: fix race in led handling") which uses the
usb-serial data pointer to temporarily store the device type during
probe but failed to add the required casts.

[gregkh - change uintptr_t to unsigned long]

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/mos7840.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 0116855..ab2f48f 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2353,14 +2353,14 @@ static int mos7840_probe(struct usb_serial *serial,
 
 	kfree(buf);
 out:
-	usb_set_serial_data(serial, (void *)device_type);
+	usb_set_serial_data(serial, (void *)(unsigned long)device_type);
 
 	return 0;
 }
 
 static int mos7840_calc_num_ports(struct usb_serial *serial)
 {
-	int device_type = (int)usb_get_serial_data(serial);
+	int device_type = (unsigned long)usb_get_serial_data(serial);
 	int mos7840_num_ports;
 
 	mos7840_num_ports = (device_type >> 4) & 0x000F;
@@ -2371,7 +2371,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial)
 static int mos7840_port_probe(struct usb_serial_port *port)
 {
 	struct usb_serial *serial = port->serial;
-	int device_type = (int)usb_get_serial_data(serial);
+	int device_type = (unsigned long)usb_get_serial_data(serial);
 	struct moschip_port *mos7840_port;
 	int status;
 	int pnum;
-- 
1.8.1.2


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

* [PATCH 062/133] ixgbe: Fix Tx Hang issue with lldpad on 82598EB
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (60 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 061/133] USB: mos7840: fix pointer casts Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 063/133] Revert "cpuidle: Quickly notice prediction failure in general case" Kamal Mostafa
                   ` (70 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jacob Keller, Jeff Kirsher, David S. Miller, Kamal Mostafa

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

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

From: Jacob Keller <jacob.e.keller@intel.com>

commit 1eb9ac14c34a948bf1538bfb9034e8ab29099a64 upstream.

This patch fixes an issue with the 82598EB device, where lldpad is causing Tx
Hangs on the card as soon as it attempts to configure DCB for the device. The
adapter will continually Tx hang and reset in a loop.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Tested-by: Jack Morgan <jack.morgan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
index 87592b4..b3c05de 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c
@@ -108,9 +108,8 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw,
 
 	/* Enable arbiter */
 	reg &= ~IXGBE_DPMCS_ARBDIS;
-	/* Enable DFP and Recycle mode */
-	reg |= (IXGBE_DPMCS_TDPAC | IXGBE_DPMCS_TRM);
 	reg |= IXGBE_DPMCS_TSOEF;
+
 	/* Configure Max TSO packet size 34KB including payload and headers */
 	reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT);
 
-- 
1.8.1.2


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

* [PATCH 063/133] Revert "cpuidle: Quickly notice prediction failure in general case"
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (61 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 062/133] ixgbe: Fix Tx Hang issue with lldpad on 82598EB Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 064/133] Revert "cpuidle: Quickly notice prediction failure for repeat mode" Kamal Mostafa
                   ` (69 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rafael J. Wysocki, Kamal Mostafa

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

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

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

commit 228b30234f258a193317874854eee1ca7807186e upstream.

Revert commit e11538d1 (cpuidle: Quickly notice prediction failure in
general case), since it depends on commit 69a37be (cpuidle: Quickly
notice prediction failure for repeat mode) that has been identified
as the source of a significant performance regression in v3.8 and
later.

Requested-by: Jeremy Eder <jeder@redhat.com>
Tested-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/cpuidle/governors/menu.c | 35 +----------------------------------
 1 file changed, 1 insertion(+), 34 deletions(-)

diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index fe343a0..b69a87e 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -34,7 +34,7 @@
 static DEFINE_PER_CPU(struct hrtimer, menu_hrtimer);
 static DEFINE_PER_CPU(int, hrtimer_status);
 /* menu hrtimer mode */
-enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL};
+enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT};
 
 /*
  * Concepts and ideas behind the menu governor
@@ -116,13 +116,6 @@ enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL};
  *
  */
 
-/*
- * The C-state residency is so long that is is worthwhile to exit
- * from the shallow C-state and re-enter into a deeper C-state.
- */
-static unsigned int perfect_cstate_ms __read_mostly = 30;
-module_param(perfect_cstate_ms, uint, 0000);
-
 struct menu_device {
 	int		last_state_idx;
 	int             needs_update;
@@ -223,16 +216,6 @@ EXPORT_SYMBOL_GPL(menu_hrtimer_cancel);
 static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer)
 {
 	int cpu = smp_processor_id();
-	struct menu_device *data = &per_cpu(menu_devices, cpu);
-
-	/* In general case, the expected residency is much larger than
-	 *  deepest C-state target residency, but prediction logic still
-	 *  predicts a small predicted residency, so the prediction
-	 *  history is totally broken if the timer is triggered.
-	 *  So reset the correction factor.
-	 */
-	if (per_cpu(hrtimer_status, cpu) == MENU_HRTIMER_GENERAL)
-		data->correction_factor[data->bucket] = RESOLUTION * DECAY;
 
 	per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP;
 
@@ -389,7 +372,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	/* not deepest C-state chosen for low predicted residency */
 	if (low_predicted) {
 		unsigned int timer_us = 0;
-		unsigned int perfect_us = 0;
 
 		/*
 		 * Set a timer to detect whether this sleep is much
@@ -400,28 +382,13 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 		 */
 		timer_us = 2 * (data->predicted_us + MAX_DEVIATION);
 
-		perfect_us = perfect_cstate_ms * 1000;
-
 		if (repeat && (4 * timer_us < data->expected_us)) {
 			RCU_NONIDLE(hrtimer_start(hrtmr,
 				ns_to_ktime(1000 * timer_us),
 				HRTIMER_MODE_REL_PINNED));
 			/* In repeat case, menu hrtimer is started */
 			per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_REPEAT;
-		} else if (perfect_us < data->expected_us) {
-			/*
-			 * The next timer is long. This could be because
-			 * we did not make a useful prediction.
-			 * In that case, it makes sense to re-enter
-			 * into a deeper C-state after some time.
-			 */
-			RCU_NONIDLE(hrtimer_start(hrtmr,
-				ns_to_ktime(1000 * timer_us),
-				HRTIMER_MODE_REL_PINNED));
-			/* In general case, menu hrtimer is started */
-			per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_GENERAL;
 		}
-
 	}
 
 	return data->last_state_idx;
-- 
1.8.1.2


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

* [PATCH 064/133] Revert "cpuidle: Quickly notice prediction failure for repeat mode"
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (62 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 063/133] Revert "cpuidle: Quickly notice prediction failure in general case" Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 065/133] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION Kamal Mostafa
                   ` (68 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rafael J. Wysocki, Kamal Mostafa

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

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

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

commit 148519120c6d1f19ad53349683aeae9f228b0b8d upstream.

Revert commit 69a37bea (cpuidle: Quickly notice prediction failure for
repeat mode), because it has been identified as the source of a
significant performance regression in v3.8 and later as explained by
Jeremy Eder:

  We believe we've identified a particular commit to the cpuidle code
  that seems to be impacting performance of variety of workloads.
  The simplest way to reproduce is using netperf TCP_RR test, so
  we're using that, on a pair of Sandy Bridge based servers.  We also
  have data from a large database setup where performance is also
  measurably/positively impacted, though that test data isn't easily
  share-able.

  Included below are test results from 3 test kernels:

  kernel       reverts
  -----------------------------------------------------------
  1) vanilla   upstream (no reverts)

  2) perfteam2 reverts e11538d1f03914eb92af5a1a378375c05ae8520c

  3) test      reverts 69a37beabf1f0a6705c08e879bdd5d82ff6486c4
                       e11538d1f03914eb92af5a1a378375c05ae8520c

  In summary, netperf TCP_RR numbers improve by approximately 4%
  after reverting 69a37beabf1f0a6705c08e879bdd5d82ff6486c4.  When
  69a37beabf1f0a6705c08e879bdd5d82ff6486c4 is included, C0 residency
  never seems to get above 40%.  Taking that patch out gets C0 near
  100% quite often, and performance increases.

  The below data are histograms representing the %c0 residency @
  1-second sample rates (using turbostat), while under netperf test.

  - If you look at the first 4 histograms, you can see %c0 residency
    almost entirely in the 30,40% bin.
  - The last pair, which reverts 69a37beabf1f0a6705c08e879bdd5d82ff6486c4,
    shows %c0 in the 80,90,100% bins.

  Below each kernel name are netperf TCP_RR trans/s numbers for the
  particular kernel that can be disclosed publicly, comparing the 3
  test kernels.  We ran a 4th test with the vanilla kernel where
  we've also set /dev/cpu_dma_latency=0 to show overall impact
  boosting single-threaded TCP_RR performance over 11% above
  baseline.

  3.10-rc2 vanilla RX + c0 lock (/dev/cpu_dma_latency=0):
  TCP_RR trans/s 54323.78

  -----------------------------------------------------------
  3.10-rc2 vanilla RX (no reverts)
  TCP_RR trans/s 48192.47

  Receiver %c0
      0.0000 -    10.0000 [     1]: *
     10.0000 -    20.0000 [     0]:
     20.0000 -    30.0000 [     0]:
     30.0000 -    40.0000 [    59]:
  ***********************************************************
     40.0000 -    50.0000 [     1]: *
     50.0000 -    60.0000 [     0]:
     60.0000 -    70.0000 [     0]:
     70.0000 -    80.0000 [     0]:
     80.0000 -    90.0000 [     0]:
     90.0000 -   100.0000 [     0]:

  Sender %c0
      0.0000 -    10.0000 [     1]: *
     10.0000 -    20.0000 [     0]:
     20.0000 -    30.0000 [     0]:
     30.0000 -    40.0000 [    11]: ***********
     40.0000 -    50.0000 [    49]:
  *************************************************
     50.0000 -    60.0000 [     0]:
     60.0000 -    70.0000 [     0]:
     70.0000 -    80.0000 [     0]:
     80.0000 -    90.0000 [     0]:
     90.0000 -   100.0000 [     0]:

  -----------------------------------------------------------
  3.10-rc2 perfteam2 RX (reverts commit
  e11538d1f03914eb92af5a1a378375c05ae8520c)
  TCP_RR trans/s 49698.69

  Receiver %c0
      0.0000 -    10.0000 [     1]: *
     10.0000 -    20.0000 [     1]: *
     20.0000 -    30.0000 [     0]:
     30.0000 -    40.0000 [    59]:
  ***********************************************************
     40.0000 -    50.0000 [     0]:
     50.0000 -    60.0000 [     0]:
     60.0000 -    70.0000 [     0]:
     70.0000 -    80.0000 [     0]:
     80.0000 -    90.0000 [     0]:
     90.0000 -   100.0000 [     0]:

  Sender %c0
      0.0000 -    10.0000 [     1]: *
     10.0000 -    20.0000 [     0]:
     20.0000 -    30.0000 [     0]:
     30.0000 -    40.0000 [     2]: **
     40.0000 -    50.0000 [    58]:
  **********************************************************
     50.0000 -    60.0000 [     0]:
     60.0000 -    70.0000 [     0]:
     70.0000 -    80.0000 [     0]:
     80.0000 -    90.0000 [     0]:
     90.0000 -   100.0000 [     0]:

  -----------------------------------------------------------
  3.10-rc2 test RX (reverts 69a37beabf1f0a6705c08e879bdd5d82ff6486c4
  and e11538d1f03914eb92af5a1a378375c05ae8520c)
  TCP_RR trans/s 47766.95

  Receiver %c0
      0.0000 -    10.0000 [     1]: *
     10.0000 -    20.0000 [     1]: *
     20.0000 -    30.0000 [     0]:
     30.0000 -    40.0000 [    27]: ***************************
     40.0000 -    50.0000 [     2]: **
     50.0000 -    60.0000 [     0]:
     60.0000 -    70.0000 [     2]: **
     70.0000 -    80.0000 [     0]:
     80.0000 -    90.0000 [     0]:
     90.0000 -   100.0000 [    28]: ****************************

  Sender:
      0.0000 -    10.0000 [     1]: *
     10.0000 -    20.0000 [     0]:
     20.0000 -    30.0000 [     0]:
     30.0000 -    40.0000 [    11]: ***********
     40.0000 -    50.0000 [     0]:
     50.0000 -    60.0000 [     1]: *
     60.0000 -    70.0000 [     0]:
     70.0000 -    80.0000 [     3]: ***
     80.0000 -    90.0000 [     7]: *******
     90.0000 -   100.0000 [    38]: **************************************

  These results demonstrate gaining back the tendency of the CPU to
  stay in more responsive, performant C-states (and thus yield
  measurably better performance), by reverting commit
  69a37beabf1f0a6705c08e879bdd5d82ff6486c4.

Requested-by: Jeremy Eder <jeder@redhat.com>
Tested-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ kamal: revert 69a37bea from 3.8 instead of upstream revert ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/cpuidle/governors/menu.c | 65 ++--------------------------------------
 include/linux/tick.h             |  6 ----
 kernel/time/tick-sched.c         |  4 ---
 3 files changed, 2 insertions(+), 73 deletions(-)

diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index b69a87e..322967f 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -28,13 +28,6 @@
 #define MAX_INTERESTING 50000
 #define STDDEV_THRESH 400
 
-/* 60 * 60 > STDDEV_THRESH * INTERVALS = 400 * 8 */
-#define MAX_DEVIATION 60
-
-static DEFINE_PER_CPU(struct hrtimer, menu_hrtimer);
-static DEFINE_PER_CPU(int, hrtimer_status);
-/* menu hrtimer mode */
-enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT};
 
 /*
  * Concepts and ideas behind the menu governor
@@ -198,30 +191,6 @@ static u64 div_round64(u64 dividend, u32 divisor)
 	return div_u64(dividend + (divisor / 2), divisor);
 }
 
-/* Cancel the hrtimer if it is not triggered yet */
-void menu_hrtimer_cancel(void)
-{
-	int cpu = smp_processor_id();
-	struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu);
-
-	/* The timer is still not time out*/
-	if (per_cpu(hrtimer_status, cpu)) {
-		hrtimer_cancel(hrtmr);
-		per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP;
-	}
-}
-EXPORT_SYMBOL_GPL(menu_hrtimer_cancel);
-
-/* Call back for hrtimer is triggered */
-static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer)
-{
-	int cpu = smp_processor_id();
-
-	per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP;
-
-	return HRTIMER_NORESTART;
-}
-
 /*
  * Try detecting repeating patterns by keeping track of the last 8
  * intervals, and checking if the standard deviation of that set
@@ -298,9 +267,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	int i;
 	int multiplier;
 	struct timespec t;
-	int repeat = 0, low_predicted = 0;
-	int cpu = smp_processor_id();
-	struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu);
 
 	if (data->needs_update) {
 		menu_update(drv, dev);
@@ -335,7 +301,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket],
 					 RESOLUTION * DECAY);
 
-	repeat = get_typical_interval(data);
+	get_typical_interval(data);
 
 	/*
 	 * We want to default to C1 (hlt), not to busy polling
@@ -356,10 +322,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 
 		if (s->disabled || su->disable)
 			continue;
-		if (s->target_residency > data->predicted_us) {
-			low_predicted = 1;
+		if (s->target_residency > data->predicted_us)
 			continue;
-		}
 		if (s->exit_latency > latency_req)
 			continue;
 		if (s->exit_latency * multiplier > data->predicted_us)
@@ -369,28 +333,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 		data->exit_us = s->exit_latency;
 	}
 
-	/* not deepest C-state chosen for low predicted residency */
-	if (low_predicted) {
-		unsigned int timer_us = 0;
-
-		/*
-		 * Set a timer to detect whether this sleep is much
-		 * longer than repeat mode predicted.  If the timer
-		 * triggers, the code will evaluate whether to put
-		 * the CPU into a deeper C-state.
-		 * The timer is cancelled on CPU wakeup.
-		 */
-		timer_us = 2 * (data->predicted_us + MAX_DEVIATION);
-
-		if (repeat && (4 * timer_us < data->expected_us)) {
-			RCU_NONIDLE(hrtimer_start(hrtmr,
-				ns_to_ktime(1000 * timer_us),
-				HRTIMER_MODE_REL_PINNED));
-			/* In repeat case, menu hrtimer is started */
-			per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_REPEAT;
-		}
-	}
-
 	return data->last_state_idx;
 }
 
@@ -481,9 +423,6 @@ static int menu_enable_device(struct cpuidle_driver *drv,
 				struct cpuidle_device *dev)
 {
 	struct menu_device *data = &per_cpu(menu_devices, dev->cpu);
-	struct hrtimer *t = &per_cpu(menu_hrtimer, dev->cpu);
-	hrtimer_init(t, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	t->function = menu_hrtimer_notify;
 
 	memset(data, 0, sizeof(struct menu_device));
 
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 1a6567b..f37fceb 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -142,10 +142,4 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
 static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
 # endif /* !NO_HZ */
 
-# ifdef CONFIG_CPU_IDLE_GOV_MENU
-extern void menu_hrtimer_cancel(void);
-# else
-static inline void menu_hrtimer_cancel(void) {}
-# endif /* CONFIG_CPU_IDLE_GOV_MENU */
-
 #endif
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 8853dab..b28e112 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -572,8 +572,6 @@ void tick_nohz_irq_exit(void)
 
 	local_irq_save(flags);
 
-	/* Cancel the timer because CPU already waken up from the C-states */
-	menu_hrtimer_cancel();
 	__tick_nohz_idle_enter(ts);
 
 	local_irq_restore(flags);
@@ -671,8 +669,6 @@ void tick_nohz_idle_exit(void)
 
 	ts->inidle = 0;
 
-	/* Cancel the timer because CPU already waken up from the C-states*/
-	menu_hrtimer_cancel();
 	if (ts->idle_active || ts->tick_stopped)
 		now = ktime_get();
 
-- 
1.8.1.2


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

* [PATCH 065/133] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (63 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 064/133] Revert "cpuidle: Quickly notice prediction failure for repeat mode" Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 066/133] rt2x00: fix stop queue Kamal Mostafa
                   ` (67 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vinod Koul, Takashi Iwai, Kamal Mostafa

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

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

From: Vinod Koul <vinod.koul@intel.com>

commit a8d30608eaed6cc759b8e2e8a8bbbb42591f797f upstream.

the return value of SNDRV_COMPRESS_VERSION always return default -ENOTTY as the
return value was never updated for this call
assign return value from put_user()

Reported-by: Haynes <hgeorge@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/core/compress_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index ad11dc9..2401d06 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -608,7 +608,7 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 	mutex_lock(&stream->device->lock);
 	switch (_IOC_NR(cmd)) {
 	case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION):
-		put_user(SNDRV_COMPRESS_VERSION,
+		retval = put_user(SNDRV_COMPRESS_VERSION,
 				(int __user *)arg) ? -EFAULT : 0;
 		break;
 	case _IOC_NR(SNDRV_COMPRESS_GET_CAPS):
-- 
1.8.1.2


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

* [PATCH 066/133] rt2x00: fix stop queue
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (64 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 065/133] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 067/133] USB: serial: ftdi_sio: add more RT Systems ftdi devices Kamal Mostafa
                   ` (66 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stanislaw Gruszka, John W. Linville, Kamal Mostafa

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

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

From: Stanislaw Gruszka <stf_xl@wp.pl>

commit e2288b66fe7ff0288382b2af671b4da558b44472 upstream.

Since we clear QUEUE_STARTED in rt2x00queue_stop_queue(), following
call to rt2x00queue_pause_queue() reduce to noop, i.e we do not
stop queue in mac80211.

To fix that introduce rt2x00queue_pause_queue_nocheck() function,
which will stop queue in mac80211 directly.

Note that rt2x00_start_queue() explicitly set QUEUE_PAUSED bit.

Note also that reordering operations i.e. first call to
rt2x00queue_pause_queue() and then clear QUEUE_STARTED bit, will race
with rt2x00queue_unpause_queue(), so calling ieee80211_stop_queue()
directly is the only available solution to fix the problem without
major rework.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/rt2x00/rt2x00queue.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index e488b94..a57032e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -877,13 +877,8 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index)
 	spin_unlock_irqrestore(&queue->index_lock, irqflags);
 }
 
-void rt2x00queue_pause_queue(struct data_queue *queue)
+void rt2x00queue_pause_queue_nocheck(struct data_queue *queue)
 {
-	if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) ||
-	    !test_bit(QUEUE_STARTED, &queue->flags) ||
-	    test_and_set_bit(QUEUE_PAUSED, &queue->flags))
-		return;
-
 	switch (queue->qid) {
 	case QID_AC_VO:
 	case QID_AC_VI:
@@ -899,6 +894,15 @@ void rt2x00queue_pause_queue(struct data_queue *queue)
 		break;
 	}
 }
+void rt2x00queue_pause_queue(struct data_queue *queue)
+{
+	if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) ||
+	    !test_bit(QUEUE_STARTED, &queue->flags) ||
+	    test_and_set_bit(QUEUE_PAUSED, &queue->flags))
+		return;
+
+	rt2x00queue_pause_queue_nocheck(queue);
+}
 EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue);
 
 void rt2x00queue_unpause_queue(struct data_queue *queue)
@@ -960,7 +964,7 @@ void rt2x00queue_stop_queue(struct data_queue *queue)
 		return;
 	}
 
-	rt2x00queue_pause_queue(queue);
+	rt2x00queue_pause_queue_nocheck(queue);
 
 	queue->rt2x00dev->ops->lib->stop_queue(queue);
 
-- 
1.8.1.2


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

* [PATCH 067/133] USB: serial: ftdi_sio: add more RT Systems ftdi devices
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (65 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 066/133] rt2x00: fix stop queue Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 068/133] drm/nouveau: fix semaphore dmabuf obj Kamal Mostafa
                   ` (65 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Rick Farina (Zero_Chaos), Greg Kroah-Hartman, Kamal Mostafa

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

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

From: "Rick Farina (Zero_Chaos)" <zerochaos@gentoo.org>

commit fed1f1ed90bce42ea010e2904cbc04e7b8304940 upstream.

RT Systems makes many usb serial cables based on the ftdi_sio driver for
programming various amateur radios.  This patch is a full listing of
their current product offerings and should allow these cables to all
be recognized.

Signed-off-by: Rick Farina (Zero_Chaos) <zerochaos@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     | 31 ++++++++++++++++++++++++++++---
 drivers/usb/serial/ftdi_sio_ids.h | 34 +++++++++++++++++++++++++++++-----
 2 files changed, 57 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 86a1892..2bc1966 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -737,9 +737,34 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
 	{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
-	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
-	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) },
-	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
 	{ USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 6dd7925..1b8af46 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -815,11 +815,35 @@
 /*
  * RT Systems programming cables for various ham radios
  */
-#define RTSYSTEMS_VID			0x2100	/* Vendor ID */
-#define RTSYSTEMS_SERIAL_VX7_PID	0x9e52	/* Serial converter for VX-7 Radios using FT232RL */
-#define RTSYSTEMS_CT29B_PID		0x9e54	/* CT29B Radio Cable */
-#define RTSYSTEMS_RTS01_PID		0x9e57	/* USB-RTS01 Radio Cable */
-
+#define RTSYSTEMS_VID		0x2100	/* Vendor ID */
+#define RTSYSTEMS_USB_S03_PID	0x9001	/* RTS-03 USB to Serial Adapter */
+#define RTSYSTEMS_USB_59_PID	0x9e50	/* USB-59 USB to 8 pin plug */
+#define RTSYSTEMS_USB_57A_PID	0x9e51	/* USB-57A USB to 4pin 3.5mm plug */
+#define RTSYSTEMS_USB_57B_PID	0x9e52	/* USB-57B USB to extended 4pin 3.5mm plug */
+#define RTSYSTEMS_USB_29A_PID	0x9e53	/* USB-29A USB to 3.5mm stereo plug */
+#define RTSYSTEMS_USB_29B_PID	0x9e54	/* USB-29B USB to 6 pin mini din */
+#define RTSYSTEMS_USB_29F_PID	0x9e55	/* USB-29F USB to 6 pin modular plug */
+#define RTSYSTEMS_USB_62B_PID	0x9e56	/* USB-62B USB to 8 pin mini din plug*/
+#define RTSYSTEMS_USB_S01_PID	0x9e57	/* USB-RTS01 USB to 3.5 mm stereo plug*/
+#define RTSYSTEMS_USB_63_PID	0x9e58	/* USB-63 USB to 9 pin female*/
+#define RTSYSTEMS_USB_29C_PID	0x9e59	/* USB-29C USB to 4 pin modular plug*/
+#define RTSYSTEMS_USB_81B_PID	0x9e5A	/* USB-81 USB to 8 pin mini din plug*/
+#define RTSYSTEMS_USB_82B_PID	0x9e5B	/* USB-82 USB to 2.5 mm stereo plug*/
+#define RTSYSTEMS_USB_K5D_PID	0x9e5C	/* USB-K5D USB to 8 pin modular plug*/
+#define RTSYSTEMS_USB_K4Y_PID	0x9e5D	/* USB-K4Y USB to 2.5/3.5 mm plugs*/
+#define RTSYSTEMS_USB_K5G_PID	0x9e5E	/* USB-K5G USB to 8 pin modular plug*/
+#define RTSYSTEMS_USB_S05_PID	0x9e5F	/* USB-RTS05 USB to 2.5 mm stereo plug*/
+#define RTSYSTEMS_USB_60_PID	0x9e60	/* USB-60 USB to 6 pin din*/
+#define RTSYSTEMS_USB_61_PID	0x9e61	/* USB-61 USB to 6 pin mini din*/
+#define RTSYSTEMS_USB_62_PID	0x9e62	/* USB-62 USB to 8 pin mini din*/
+#define RTSYSTEMS_USB_63B_PID	0x9e63	/* USB-63 USB to 9 pin female*/
+#define RTSYSTEMS_USB_64_PID	0x9e64	/* USB-64 USB to 9 pin male*/
+#define RTSYSTEMS_USB_65_PID	0x9e65	/* USB-65 USB to 9 pin female null modem*/
+#define RTSYSTEMS_USB_92_PID	0x9e66	/* USB-92 USB to 12 pin plug*/
+#define RTSYSTEMS_USB_92D_PID	0x9e67	/* USB-92D USB to 12 pin plug data*/
+#define RTSYSTEMS_USB_W5R_PID	0x9e68	/* USB-W5R USB to 8 pin modular plug*/
+#define RTSYSTEMS_USB_A5R_PID	0x9e69	/* USB-A5R USB to 8 pin modular plug*/
+#define RTSYSTEMS_USB_PW1_PID	0x9e6A	/* USB-PW1 USB to 8 pin modular plug*/
 
 /*
  * Physik Instrumente
-- 
1.8.1.2


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

* [PATCH 068/133] drm/nouveau: fix semaphore dmabuf obj
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (66 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 067/133] USB: serial: ftdi_sio: add more RT Systems ftdi devices Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 069/133] ACPI / battery: Fix parsing _BIX return value Kamal Mostafa
                   ` (64 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maarten Lankhorst, Ben Skeggs, Kamal Mostafa

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

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

From: Maarten Lankhorst <maarten.lankhorst@canonical.com>

commit 7a7da592cbb22a1d360638dbecc393470c5effe3 upstream.

Fixes some dmabuf object errors on nv50 chipset and below.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
[ kamal: backport to 3.8 ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/nouveau/nv10_fence.c |  2 +-
 drivers/gpu/drm/nouveau/nv50_fence.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c
index 03017f2..4f1d5d3 100644
--- a/drivers/gpu/drm/nouveau/nv10_fence.c
+++ b/drivers/gpu/drm/nouveau/nv10_fence.c
@@ -132,7 +132,7 @@ nv10_fence_context_new(struct nouveau_channel *chan)
 		struct ttm_mem_reg *mem = &priv->bo->bo.mem;
 		struct nouveau_object *object;
 		u32 start = mem->start * PAGE_SIZE;
-		u32 limit = mem->start + mem->size - 1;
+		u32 limit = start + mem->size - 1;
 
 		ret = nouveau_object_new(nv_object(chan->cli), chan->handle,
 					 NvSema, 0x0002,
diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c
index d889f3a..923c7ef 100644
--- a/drivers/gpu/drm/nouveau/nv50_fence.c
+++ b/drivers/gpu/drm/nouveau/nv50_fence.c
@@ -50,6 +50,8 @@ nv50_fence_context_new(struct nouveau_channel *chan)
 	struct nv50_fence_chan *fctx;
 	struct ttm_mem_reg *mem = &priv->bo->bo.mem;
 	struct nouveau_object *object;
+	u32 start = mem->start * PAGE_SIZE;
+	u32 limit = start + mem->size - 1;
 	int ret, i;
 
 	fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL);
@@ -59,26 +61,28 @@ nv50_fence_context_new(struct nouveau_channel *chan)
 	nouveau_fence_context_new(&fctx->base);
 
 	ret = nouveau_object_new(nv_object(chan->cli), chan->handle,
-				 NvSema, 0x0002,
+				 NvSema, 0x003d,
 				 &(struct nv_dma_class) {
 					.flags = NV_DMA_TARGET_VRAM |
 						 NV_DMA_ACCESS_RDWR,
-					.start = mem->start * PAGE_SIZE,
-					.limit = mem->size - 1,
+					.start = start,
+					.limit = limit,
 				 }, sizeof(struct nv_dma_class),
 				 &object);
 
 	/* dma objects for display sync channel semaphore blocks */
 	for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) {
 		struct nouveau_bo *bo = nv50_display_crtc_sema(dev, i);
+		u32 start = bo->bo.mem.start * PAGE_SIZE;
+		u32 limit = start + bo->bo.mem.size - 1;
 
 		ret = nouveau_object_new(nv_object(chan->cli), chan->handle,
 					 NvEvoSema0 + i, 0x003d,
 					 &(struct nv_dma_class) {
 						.flags = NV_DMA_TARGET_VRAM |
 							 NV_DMA_ACCESS_RDWR,
-						.start = bo->bo.offset,
-						.limit = bo->bo.offset + 0xfff,
+						.start = start,
+						.limit = limit,
 					 }, sizeof(struct nv_dma_class),
 					 &object);
 	}
-- 
1.8.1.2


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

* [PATCH 069/133] ACPI / battery: Fix parsing _BIX return value
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (67 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 068/133] drm/nouveau: fix semaphore dmabuf obj Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 070/133] drm/radeon/atom: initialize more atom interpretor elements to 0 Kamal Mostafa
                   ` (63 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lan Tianyu, Rafael J. Wysocki, Kamal Mostafa

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

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

From: Lan Tianyu <tianyu.lan@intel.com>

commit 016d5baad04269e8559332df05f89bd95b52d6ad upstream.

The _BIX method returns extended battery info as a package.
According the ACPI spec (ACPI 5, Section 10.2.2.2), the first member
of that package should be "Revision".  However, the current ACPI
battery driver treats the first member as "Power Unit" which should
be the second member.  This causes the result of _BIX return data
parsing to be incorrect.

Fix this by adding a new member called 'revision' to struct
acpi_battery and adding the offsetof() information on it to
extended_info_offsets[] as the first row.

[rjw: Changelog]
Reported-and-tested-by: Jan Hoffmann <jan.christian.hoffmann@gmail.com>
References: http://bugzilla.kernel.org/show_bug.cgi?id=60519
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/battery.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7efaeaa..7663df7 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -117,6 +117,7 @@ struct acpi_battery {
 	struct acpi_device *device;
 	struct notifier_block pm_nb;
 	unsigned long update_time;
+	int revision;
 	int rate_now;
 	int capacity_now;
 	int voltage_now;
@@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = {
 };
 
 static struct acpi_offsets extended_info_offsets[] = {
+	{offsetof(struct acpi_battery, revision), 0},
 	{offsetof(struct acpi_battery, power_unit), 0},
 	{offsetof(struct acpi_battery, design_capacity), 0},
 	{offsetof(struct acpi_battery, full_charge_capacity), 0},
-- 
1.8.1.2


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

* [PATCH 070/133] drm/radeon/atom: initialize more atom interpretor elements to 0
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (68 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 069/133] ACPI / battery: Fix parsing _BIX return value Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 071/133] drm/i915: fix missed hunk after GT access breakage Kamal Mostafa
                   ` (62 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

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

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

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

commit 42a21826dc54583cdb79cc8477732e911ac9c376 upstream.

The ProcessAuxChannel table on some rv635 boards assumes
the divmul members are initialized to 0 otherwise we get
an invalid fb offset since it has a bad mask set when
setting the fb base.  While here initialize all the
atom interpretor elements to 0.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=60639

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/atom.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 43672b6..daa1e34 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
 	int r;
 
 	mutex_lock(&ctx->mutex);
+	/* reset data block */
+	ctx->data_block = 0;
 	/* reset reg block */
 	ctx->reg_block = 0;
 	/* reset fb window */
 	ctx->fb_base = 0;
 	/* reset io mode */
 	ctx->io_mode = ATOM_IO_MM;
+	/* reset divmul */
+	ctx->divmul[0] = 0;
+	ctx->divmul[1] = 0;
 	r = atom_execute_table_locked(ctx, index, params);
 	mutex_unlock(&ctx->mutex);
 	return r;
-- 
1.8.1.2


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

* [PATCH 071/133] drm/i915: fix missed hunk after GT access breakage
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (69 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 070/133] drm/radeon/atom: initialize more atom interpretor elements to 0 Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 072/133] ARM: poison the vectors page Kamal Mostafa
                   ` (61 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ben Widawsky, Dave Airlie, Kamal Mostafa

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

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

From: Ben Widawsky <ben@bwidawsk.net>

commit e1b4d3036c07ff137955fb1c0197ab62534f46ec upstream.

Upon some code refactoring, a hunk was missed. This was fixed for
next, but missed the current trees, and hasn't yet been merged by Dave
Airlie. It is fixed in:
commit 907b28c56ea40629aa6595ddfa414ec2fc7da41c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 19 20:36:52 2013 +0100

    drm/i915: Colocate all GT access routines in the same file

It is introduced by:
commit 181d1b9e31c668259d3798c521672afb8edd355c
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sun Jul 21 13:16:24 2013 +0200

    drm/i915: fix up gt init sequence fallout

Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/i915_dma.c | 1 +
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
 3 files changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 565a889..7e5f232 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1561,6 +1561,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	intel_detect_pch(dev);
 
 	intel_irq_init(dev);
+	intel_pm_init(dev);
 	intel_gt_sanitize(dev);
 	intel_gt_init(dev);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8c661512..d47283d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1328,6 +1328,7 @@ void i915_hangcheck_elapsed(unsigned long data);
 void i915_handle_error(struct drm_device *dev, bool wedged);
 
 extern void intel_irq_init(struct drm_device *dev);
+extern void intel_pm_init(struct drm_device *dev);
 extern void intel_gt_init(struct drm_device *dev);
 extern void intel_gt_sanitize(struct drm_device *dev);
 
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6538d3f..b035d41 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4447,6 +4447,12 @@ void intel_gt_init(struct drm_device *dev)
 		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
 		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
 	}
+}
+
+void intel_pm_init(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work,
 			  intel_gen6_powersave_work);
 }
-- 
1.8.1.2


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

* [PATCH 072/133] ARM: poison the vectors page
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (70 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 071/133] drm/i915: fix missed hunk after GT access breakage Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 073/133] ARM: poison memory between kuser helpers Kamal Mostafa
                   ` (60 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Kamal Mostafa

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit f928d4f2a86f46b030fa0850385b4391fc2b5918 upstream.

Fill the empty regions of the vectors page with an exception generating
instruction.  This ensures that any inappropriate branch to the vector
page is appropriately trapped, rather than just encountering some code
to execute.  (The vectors page was filled with zero before, which
corresponds with the "andeq r0, r0, r0" instruction - a no-op.)

Acked-by Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/traps.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index b0179b8..a4f84b0 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -824,10 +824,20 @@ void __init early_trap_init(void *vectors_base)
 	extern char __vectors_start[], __vectors_end[];
 	extern char __kuser_helper_start[], __kuser_helper_end[];
 	int kuser_sz = __kuser_helper_end - __kuser_helper_start;
+	unsigned i;
 
 	vectors_page = vectors_base;
 
 	/*
+	 * Poison the vectors page with an undefined instruction.  This
+	 * instruction is chosen to be undefined for both ARM and Thumb
+	 * ISAs.  The Thumb version is an undefined instruction with a
+	 * branch back to the undefined instruction.
+	 */
+	for (i = 0; i < PAGE_SIZE / sizeof(u32); i++)
+		((u32 *)vectors_base)[i] = 0xe7fddef1;
+
+	/*
 	 * Copy the vectors, stubs and kuser helpers (in entry-armv.S)
 	 * into the vector page, mapped at 0xffff0000, and ensure these
 	 * are visible to the instruction stream.
-- 
1.8.1.2


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

* [PATCH 073/133] ARM: poison memory between kuser helpers
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (71 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 072/133] ARM: poison the vectors page Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 074/133] ARM: move vector stubs Kamal Mostafa
                   ` (59 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Kamal Mostafa

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit 5b43e7a383d69381ffe53423e46dd0fafae07da3 upstream.

Poison the memory between each kuser helper.  This ensures that any
branch between the kuser helpers will be appropriately trapped.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/entry-armv.S | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..9c80c1d 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -784,6 +784,17 @@ ENDPROC(__switch_to)
 #endif
 	.endm
 
+	.macro	kuser_pad, sym, size
+	.if	(. - \sym) & 3
+	.rept	4 - (. - \sym) & 3
+	.byte	0
+	.endr
+	.endif
+	.rept	(\size - (. - \sym)) / 4
+	.word	0xe7fddef1
+	.endr
+	.endm
+
 	.align	5
 	.globl	__kuser_helper_start
 __kuser_helper_start:
@@ -874,18 +885,13 @@ kuser_cmpxchg64_fixup:
 #error "incoherent kernel configuration"
 #endif
 
-	/* pad to next slot */
-	.rept	(16 - (. - __kuser_cmpxchg64)/4)
-	.word	0
-	.endr
-
-	.align	5
+	kuser_pad __kuser_cmpxchg64, 64
 
 __kuser_memory_barrier:				@ 0xffff0fa0
 	smp_dmb	arm
 	usr_ret	lr
 
-	.align	5
+	kuser_pad __kuser_memory_barrier, 32
 
 __kuser_cmpxchg:				@ 0xffff0fc0
 
@@ -958,13 +964,14 @@ kuser_cmpxchg32_fixup:
 
 #endif
 
-	.align	5
+	kuser_pad __kuser_cmpxchg, 32
 
 __kuser_get_tls:				@ 0xffff0fe0
 	ldr	r0, [pc, #(16 - 8)]	@ read TLS, set in kuser_get_tls_init
 	usr_ret	lr
 	mrc	p15, 0, r0, c13, c0, 3	@ 0xffff0fe8 hardware TLS code
-	.rep	4
+	kuser_pad __kuser_get_tls, 16
+	.rep	3
 	.word	0			@ 0xffff0ff0 software TLS value, then
 	.endr				@ pad up to __kuser_helper_version
 
-- 
1.8.1.2


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

* [PATCH 074/133] ARM: move vector stubs
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (72 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 073/133] ARM: poison memory between kuser helpers Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 075/133] ARM: use linker magic for vectors and " Kamal Mostafa
                   ` (58 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Kamal Mostafa

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit 19accfd373847ac3d10623c5d20f948846299741 upstream.

Move the machine vector stubs into the page above the vector page,
which we can prevent from being visible to userspace.  Also move
the reset stub, and place the swi vector at a location that the
'ldr' can get to it.

This hides pointers into the kernel which could give valuable
information to attackers, and reduces the number of exploitable
instructions at a fixed address.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/Kconfig             |  3 ++-
 arch/arm/kernel/entry-armv.S | 50 +++++++++++++++++++++-----------------------
 arch/arm/kernel/traps.c      |  4 ++--
 arch/arm/mm/mmu.c            | 10 ++++++++-
 4 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6dd9069..5c037b9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -189,7 +189,8 @@ config VECTORS_BASE
 	default DRAM_BASE if REMAP_VECTORS_TO_RAM
 	default 0x00000000
 	help
-	  The base address of exception vectors.
+	  The base address of exception vectors.  This must be two pages
+	  in size.
 
 config ARM_PATCH_PHYS_VIRT
 	bool "Patch physical to virtual translations at runtime" if EMBEDDED
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 9c80c1d..a4af8e8 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -986,9 +986,9 @@ __kuser_helper_end:
 /*
  * Vector stubs.
  *
- * This code is copied to 0xffff0200 so we can use branches in the
- * vectors, rather than ldr's.  Note that this code must not
- * exceed 0x300 bytes.
+ * This code is copied to 0xffff1000 so we can use branches in the
+ * vectors, rather than ldr's.  Note that this code must not exceed
+ * a page size.
  *
  * Common stub entry macro:
  *   Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
@@ -1037,6 +1037,15 @@ ENDPROC(vector_\name)
 
 	.globl	__stubs_start
 __stubs_start:
+	@ This must be the first word
+	.word	vector_swi
+
+vector_rst:
+ ARM(	swi	SYS_ERROR0	)
+ THUMB(	svc	#0		)
+ THUMB(	nop			)
+	b	vector_und
+
 /*
  * Interrupt dispatcher
  */
@@ -1131,6 +1140,16 @@ __stubs_start:
 	.align	5
 
 /*=============================================================================
+ * Address exception handler
+ *-----------------------------------------------------------------------------
+ * These aren't too critical.
+ * (they're not supposed to happen, and won't happen in 32-bit data mode).
+ */
+
+vector_addrexcptn:
+	b	vector_addrexcptn
+
+/*=============================================================================
  * Undefined FIQs
  *-----------------------------------------------------------------------------
  * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC
@@ -1143,35 +1162,14 @@ __stubs_start:
 vector_fiq:
 	subs	pc, lr, #4
 
-/*=============================================================================
- * Address exception handler
- *-----------------------------------------------------------------------------
- * These aren't too critical.
- * (they're not supposed to happen, and won't happen in 32-bit data mode).
- */
-
-vector_addrexcptn:
-	b	vector_addrexcptn
-
-/*
- * We group all the following data together to optimise
- * for CPUs with separate I & D caches.
- */
-	.align	5
-
-.LCvswi:
-	.word	vector_swi
-
 	.globl	__stubs_end
 __stubs_end:
 
-	.equ	stubs_offset, __vectors_start + 0x200 - __stubs_start
+	.equ	stubs_offset, __vectors_start + 0x1000 - __stubs_start
 
 	.globl	__vectors_start
 __vectors_start:
- ARM(	swi	SYS_ERROR0	)
- THUMB(	svc	#0		)
- THUMB(	nop			)
+	W(b)	vector_rst + stubs_offset
 	W(b)	vector_und + stubs_offset
 	W(ldr)	pc, .LCvswi + stubs_offset
 	W(b)	vector_pabt + stubs_offset
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index a4f84b0..366aa93 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -843,7 +843,7 @@ void __init early_trap_init(void *vectors_base)
 	 * are visible to the instruction stream.
 	 */
 	memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start);
-	memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - __stubs_start);
+	memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - __stubs_start);
 	memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
 
 	/*
@@ -858,6 +858,6 @@ void __init early_trap_init(void *vectors_base)
 	memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE),
 	       sigreturn_codes, sizeof(sigreturn_codes));
 
-	flush_icache_range(vectors, vectors + PAGE_SIZE);
+	flush_icache_range(vectors, vectors + PAGE_SIZE * 2);
 	modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
 }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index ce328c7..458b6f4 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1114,7 +1114,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 	/*
 	 * Allocate the vector page early.
 	 */
-	vectors = early_alloc(PAGE_SIZE);
+	vectors = early_alloc(PAGE_SIZE * 2);
 
 	early_trap_init(vectors);
 
@@ -1164,10 +1164,18 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 
 	if (!vectors_high()) {
 		map.virtual = 0;
+		map.length = PAGE_SIZE * 2;
 		map.type = MT_LOW_VECTORS;
 		create_mapping(&map);
 	}
 
+	/* Now create a kernel read-only mapping */
+	map.pfn += 1;
+	map.virtual = 0xffff0000 + PAGE_SIZE;
+	map.length = PAGE_SIZE;
+	map.type = MT_LOW_VECTORS;
+	create_mapping(&map);
+
 	/*
 	 * Ask the machine support to map in the statically mapped devices.
 	 */
-- 
1.8.1.2


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

* [PATCH 075/133] ARM: use linker magic for vectors and vector stubs
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (73 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 074/133] ARM: move vector stubs Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 076/133] ARM: update FIQ support for relocation of vectors Kamal Mostafa
                   ` (57 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Kamal Mostafa

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit b9b32bf70f2fb710b07c94e13afbc729afe221da upstream.

Use linker magic to create the vectors and vector stubs: we can tell the
linker to place them at an appropriate VMA, but keep the LMA within the
kernel.  This gets rid of some unnecessary symbol manipulation, and
have the linker calculate the relocations appropriately.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/entry-armv.S  | 28 ++++++++++------------------
 arch/arm/kernel/vmlinux.lds.S | 17 +++++++++++++++++
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index a4af8e8..c19779f 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -1035,7 +1035,7 @@ ENDPROC(vector_\name)
 1:
 	.endm
 
-	.globl	__stubs_start
+	.section .stubs, "ax", %progbits
 __stubs_start:
 	@ This must be the first word
 	.word	vector_swi
@@ -1162,24 +1162,16 @@ vector_addrexcptn:
 vector_fiq:
 	subs	pc, lr, #4
 
-	.globl	__stubs_end
-__stubs_end:
-
-	.equ	stubs_offset, __vectors_start + 0x1000 - __stubs_start
-
-	.globl	__vectors_start
+	.section .vectors, "ax", %progbits
 __vectors_start:
-	W(b)	vector_rst + stubs_offset
-	W(b)	vector_und + stubs_offset
-	W(ldr)	pc, .LCvswi + stubs_offset
-	W(b)	vector_pabt + stubs_offset
-	W(b)	vector_dabt + stubs_offset
-	W(b)	vector_addrexcptn + stubs_offset
-	W(b)	vector_irq + stubs_offset
-	W(b)	vector_fiq + stubs_offset
-
-	.globl	__vectors_end
-__vectors_end:
+	W(b)	vector_rst
+	W(b)	vector_und
+	W(ldr)	pc, __vectors_start + 0x1000
+	W(b)	vector_pabt
+	W(b)	vector_dabt
+	W(b)	vector_addrexcptn
+	W(b)	vector_irq
+	W(b)	vector_fiq
 
 	.data
 
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 11c1785..f9036ac 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -148,6 +148,23 @@ SECTIONS
 	. = ALIGN(PAGE_SIZE);
 	__init_begin = .;
 #endif
+	/*
+	 * The vectors and stubs are relocatable code, and the
+	 * only thing that matters is their relative offsets
+	 */
+	__vectors_start = .;
+	.vectors 0 : AT(__vectors_start) {
+		*(.vectors)
+	}
+	. = __vectors_start + SIZEOF(.vectors);
+	__vectors_end = .;
+
+	__stubs_start = .;
+	.stubs 0x1000 : AT(__stubs_start) {
+		*(.stubs)
+	}
+	. = __stubs_start + SIZEOF(.stubs);
+	__stubs_end = .;
 
 	INIT_TEXT_SECTION(8)
 	.exit.text : {
-- 
1.8.1.2


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

* [PATCH 076/133] ARM: update FIQ support for relocation of vectors
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (74 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 075/133] ARM: use linker magic for vectors and " Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-18 21:09   ` Aaro Koskinen
  2013-08-16 22:33 ` [PATCH 077/133] ARM: allow kuser helpers to be removed from the vector page Kamal Mostafa
                   ` (56 subsequent siblings)
  132 siblings, 1 reply; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Kamal Mostafa

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 upstream.

FIQ should no longer copy the FIQ code into the user visible vector
page.  Instead, it should use the hidden page.  This change makes
that happen.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/entry-armv.S |  3 +++
 arch/arm/kernel/fiq.c        | 19 ++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index c19779f..4c28aff 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -1162,6 +1162,9 @@ vector_addrexcptn:
 vector_fiq:
 	subs	pc, lr, #4
 
+	.globl	vector_fiq_offset
+	.equ	vector_fiq_offset, vector_fiq
+
 	.section .vectors, "ax", %progbits
 __vectors_start:
 	W(b)	vector_rst
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 2adda11..25442f4 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -47,6 +47,11 @@
 #include <asm/irq.h>
 #include <asm/traps.h>
 
+#define FIQ_OFFSET ({					\
+		extern void *vector_fiq_offset;		\
+		(unsigned)&vector_fiq_offset;		\
+	})
+
 static unsigned long no_fiq_insn;
 
 /* Default reacquire function
@@ -80,13 +85,16 @@ int show_fiq_list(struct seq_file *p, int prec)
 void set_fiq_handler(void *start, unsigned int length)
 {
 #if defined(CONFIG_CPU_USE_DOMAINS)
-	memcpy((void *)0xffff001c, start, length);
+	void *base = (void *)0xffff0000;
 #else
-	memcpy(vectors_page + 0x1c, start, length);
+	void *base = vectors_page;
 #endif
-	flush_icache_range(0xffff001c, 0xffff001c + length);
+	unsigned offset = FIQ_OFFSET;
+
+	memcpy(base + offset, start, length);
+	flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length);
 	if (!vectors_high())
-		flush_icache_range(0x1c, 0x1c + length);
+		flush_icache_range(offset, offset + length);
 }
 
 int claim_fiq(struct fiq_handler *f)
@@ -144,6 +152,7 @@ EXPORT_SYMBOL(disable_fiq);
 
 void __init init_FIQ(int start)
 {
-	no_fiq_insn = *(unsigned long *)0xffff001c;
+	unsigned offset = FIQ_OFFSET;
+	no_fiq_insn = *(unsigned long *)(0xffff0000 + offset);
 	fiq_start = start;
 }
-- 
1.8.1.2


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

* [PATCH 077/133] ARM: allow kuser helpers to be removed from the vector page
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (75 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 076/133] ARM: update FIQ support for relocation of vectors Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 078/133] mm: mempolicy: fix mbind_range() && vma_adjust() interaction Kamal Mostafa
                   ` (55 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Russell King, Kamal Mostafa

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

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

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit f6f91b0d9fd971c630cef908dde8fe8795aefbf8 upstream.

Provide a kernel configuration option to allow the kernel user helpers
to be removed from the vector page, thereby preventing their use with
ROP (return orientated programming) attacks.  This option is only
visible for CPU architectures which natively support all the operations
which kernel user helpers would normally provide, and must be enabled
with caution.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/entry-armv.S |  3 +++
 arch/arm/kernel/traps.c      | 23 ++++++++++++++---------
 arch/arm/mm/Kconfig          | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 4c28aff..5492d72 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -795,6 +795,7 @@ ENDPROC(__switch_to)
 	.endr
 	.endm
 
+#ifdef CONFIG_KUSER_HELPERS
 	.align	5
 	.globl	__kuser_helper_start
 __kuser_helper_start:
@@ -981,6 +982,8 @@ __kuser_helper_version:				@ 0xffff0ffc
 	.globl	__kuser_helper_end
 __kuser_helper_end:
 
+#endif
+
  THUMB(	.thumb	)
 
 /*
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 366aa93..1392beb 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -807,23 +807,32 @@ void __init trap_init(void)
 	return;
 }
 
-static void __init kuser_get_tls_init(unsigned long vectors)
+#ifdef CONFIG_KUSER_HELPERS
+static void __init kuser_init(void *vectors)
 {
+	extern char __kuser_helper_start[], __kuser_helper_end[];
+	int kuser_sz = __kuser_helper_end - __kuser_helper_start;
+
+	memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
+
 	/*
 	 * vectors + 0xfe0 = __kuser_get_tls
 	 * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8
 	 */
 	if (tls_emu || has_tls_reg)
-		memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4);
+		memcpy(vectors + 0xfe0, vectors + 0xfe8, 4);
+}
+#else
+static void __init kuser_init(void *vectors)
+{
 }
+#endif
 
 void __init early_trap_init(void *vectors_base)
 {
 	unsigned long vectors = (unsigned long)vectors_base;
 	extern char __stubs_start[], __stubs_end[];
 	extern char __vectors_start[], __vectors_end[];
-	extern char __kuser_helper_start[], __kuser_helper_end[];
-	int kuser_sz = __kuser_helper_end - __kuser_helper_start;
 	unsigned i;
 
 	vectors_page = vectors_base;
@@ -844,12 +853,8 @@ void __init early_trap_init(void *vectors_base)
 	 */
 	memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start);
 	memcpy((void *)vectors + 0x1000, __stubs_start, __stubs_end - __stubs_start);
-	memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
 
-	/*
-	 * Do processor specific fixups for the kuser helpers
-	 */
-	kuser_get_tls_init(vectors);
+	kuser_init(vectors_base);
 
 	/*
 	 * Copy signal return handlers into the vector page, and
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 3fd629d..1d5ee0a 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -404,24 +404,28 @@ config CPU_32v3
 	select CPU_USE_DOMAINS if MMU
 	select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
 	select TLS_REG_EMUL if SMP || !MMU
+	select NEED_KUSER_HELPERS
 
 config CPU_32v4
 	bool
 	select CPU_USE_DOMAINS if MMU
 	select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
 	select TLS_REG_EMUL if SMP || !MMU
+	select NEED_KUSER_HELPERS
 
 config CPU_32v4T
 	bool
 	select CPU_USE_DOMAINS if MMU
 	select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
 	select TLS_REG_EMUL if SMP || !MMU
+	select NEED_KUSER_HELPERS
 
 config CPU_32v5
 	bool
 	select CPU_USE_DOMAINS if MMU
 	select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
 	select TLS_REG_EMUL if SMP || !MMU
+	select NEED_KUSER_HELPERS
 
 config CPU_32v6
 	bool
@@ -756,6 +760,7 @@ config CPU_BPREDICT_DISABLE
 
 config TLS_REG_EMUL
 	bool
+	select NEED_KUSER_HELPERS
 	help
 	  An SMP system using a pre-ARMv6 processor (there are apparently
 	  a few prototypes like that in existence) and therefore access to
@@ -763,11 +768,40 @@ config TLS_REG_EMUL
 
 config NEEDS_SYSCALL_FOR_CMPXCHG
 	bool
+	select NEED_KUSER_HELPERS
 	help
 	  SMP on a pre-ARMv6 processor?  Well OK then.
 	  Forget about fast user space cmpxchg support.
 	  It is just not possible.
 
+config NEED_KUSER_HELPERS
+	bool
+
+config KUSER_HELPERS
+	bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS
+	default y
+	help
+	  Warning: disabling this option may break user programs.
+
+	  Provide kuser helpers in the vector page.  The kernel provides
+	  helper code to userspace in read only form at a fixed location
+	  in the high vector page to allow userspace to be independent of
+	  the CPU type fitted to the system.  This permits binaries to be
+	  run on ARMv4 through to ARMv7 without modification.
+
+	  However, the fixed address nature of these helpers can be used
+	  by ROP (return orientated programming) authors when creating
+	  exploits.
+
+	  If all of the binaries and libraries which run on your platform
+	  are built specifically for your platform, and make no use of
+	  these helpers, then you can turn this option off.  However,
+	  when such an binary or library is run, it will receive a SIGILL
+	  signal, which will terminate the program.
+
+	  Say N here only if you are absolutely certain that you do not
+	  need these helpers; otherwise, the safe option is to say Y.
+
 config DMA_CACHE_RWFO
 	bool "Enable read/write for ownership DMA cache maintenance"
 	depends on CPU_V6K && SMP
-- 
1.8.1.2


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

* [PATCH 078/133] mm: mempolicy: fix mbind_range() && vma_adjust() interaction
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (76 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 077/133] ARM: allow kuser helpers to be removed from the vector page Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 079/133] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31) Kamal Mostafa
                   ` (54 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Steven T Hampson, Mel Gorman, KOSAKI Motohiro,
	Rik van Riel, Andi Kleen, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit 3964acd0dbec123aa0a621973a2a0580034b4788 upstream.

vma_adjust() does vma_set_policy(vma, vma_policy(next)) and this
is doubly wrong:

1. This leaks vma->vm_policy if it is not NULL and not equal to
   next->vm_policy.

   This can happen if vma_merge() expands "area", not prev (case 8).

2. This sets the wrong policy if vma_merge() joins prev and area,
   area is the vma the caller needs to update and it still has the
   old policy.

Revert commit 1444f92c8498 ("mm: merging memory blocks resets
mempolicy") which introduced these problems.

Change mbind_range() to recheck mpol_equal() after vma_merge() to fix
the problem that commit tried to address.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Steven T Hampson <steven.t.hampson@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/mempolicy.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 3df6d12..efabe65 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -745,7 +745,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
 		if (prev) {
 			vma = prev;
 			next = vma->vm_next;
-			continue;
+			if (mpol_equal(vma_policy(vma), new_pol))
+				continue;
+			/* vma_merge() joined vma && vma->next, case 8 */
+			goto replace;
 		}
 		if (vma->vm_start != vmstart) {
 			err = split_vma(vma->vm_mm, vma, vmstart, 1);
@@ -757,6 +760,7 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
 			if (err)
 				goto out;
 		}
+ replace:
 		err = vma_replace_policy(vma, new_pol);
 		if (err)
 			goto out;
-- 
1.8.1.2


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

* [PATCH 079/133] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31)
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (77 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 078/133] mm: mempolicy: fix mbind_range() && vma_adjust() interaction Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 080/133] drm/i915: Make data/link N value power of two Kamal Mostafa
                   ` (53 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Aaro Koskinen, Benjamin Herrenschmidt, Kamal Mostafa

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

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

From: Aaro Koskinen <aaro.koskinen@iki.fi>

commit fe956a1d4081ce1a959f87df397a15e252201f10 upstream.

slots-fan on G5 Xserve is always running at full speed with windfarm_rm31
driver, resulting in a very high acoustic noise level. It seems the fan
parameters are incorrect, and have been copied from the Drive Bay fan
(RPM, not present on rm31) of the legacy therm_pm72 driver. This patch
changes the parameters to match the Slots fan (PWM) of therm_pm72. With
the patch, slots-fan speed drops from 99% to 19% during normal use,
and slots-temp settle to ~42'C.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/macintosh/windfarm_rm31.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/macintosh/windfarm_rm31.c b/drivers/macintosh/windfarm_rm31.c
index 844003f..30b091e 100644
--- a/drivers/macintosh/windfarm_rm31.c
+++ b/drivers/macintosh/windfarm_rm31.c
@@ -439,15 +439,15 @@ static void backside_setup_pid(void)
 
 /* Slots fan */
 static const struct wf_pid_param slots_param = {
-	.interval	= 5,
-	.history_len	= 2,
-	.gd		= 30 << 20,
-	.gp		= 5 << 20,
-	.gr		= 0,
-	.itarget	= 40 << 16,
-	.additive	= 1,
-	.min		= 300,
-	.max		= 4000,
+	.interval	= 1,
+	.history_len	= 20,
+	.gd		= 0,
+	.gp		= 0,
+	.gr		= 0x00100000,
+	.itarget	= 3200000,
+	.additive	= 0,
+	.min		= 20,
+	.max		= 100,
 };
 
 static void slots_fan_tick(void)
-- 
1.8.1.2


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

* [PATCH 080/133] drm/i915: Make data/link N value power of two
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (78 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 079/133] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31) Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 081/133] virtio/console: Quit from splice_write if pipe->nrbufs is 0 Kamal Mostafa
                   ` (52 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ville Syrjälä, Daniel Vetter, Haitao Zhang, Kamal Mostafa

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

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

From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>

commit a65851af59387146a28a928c3e7bb17dabc5db72 upstream.

The BIOS uses power of two values for the data/link N value.

Follow suit to make the Zotac DP to dual-HDMI dongle work.

v2: Clean up the magic numbers and defines
    Change the N clamping to be a bit easier on the eye
    Rename intel_reduce_ratio to intel_reduce_m_n_ratio

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49402
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59810
Tested-by:  Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[Haitao Zhang: backport to 3.8]
Signed-off-by: Haitao Zhang <haitao.zhang@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/i915_reg.h      | 12 ++++--------
 drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++--------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index b7315e3..24f0368 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2602,14 +2602,14 @@
 #define _PIPEB_GMCH_DATA_M			0x71050
 
 /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
-#define   PIPE_GMCH_DATA_M_TU_SIZE_MASK		(0x3f << 25)
-#define   PIPE_GMCH_DATA_M_TU_SIZE_SHIFT	25
+#define  TU_SIZE(x)             (((x)-1) << 25) /* default size 64 */
+#define  TU_SIZE_MASK           (0x3f << 25)
 
-#define   PIPE_GMCH_DATA_M_MASK			(0xffffff)
+#define  DATA_LINK_M_N_MASK	(0xffffff)
+#define  DATA_LINK_N_MAX	(0x800000)
 
 #define _PIPEA_GMCH_DATA_N			0x70054
 #define _PIPEB_GMCH_DATA_N			0x71054
-#define   PIPE_GMCH_DATA_N_MASK			(0xffffff)
 
 /*
  * Computing Link M and N values for the Display Port link
@@ -2624,11 +2624,9 @@
 
 #define _PIPEA_DP_LINK_M				0x70060
 #define _PIPEB_DP_LINK_M				0x71060
-#define   PIPEA_DP_LINK_M_MASK			(0xffffff)
 
 #define _PIPEA_DP_LINK_N				0x70064
 #define _PIPEB_DP_LINK_N				0x71064
-#define   PIPEA_DP_LINK_N_MASK			(0xffffff)
 
 #define PIPE_GMCH_DATA_M(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_M, _PIPEB_GMCH_DATA_M)
 #define PIPE_GMCH_DATA_N(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_N, _PIPEB_GMCH_DATA_N)
@@ -3294,8 +3292,6 @@
 
 
 #define _PIPEA_DATA_M1           0x60030
-#define  TU_SIZE(x)             (((x)-1) << 25) /* default size 64 */
-#define  TU_SIZE_MASK           0x7e000000
 #define  PIPE_DATA_M1_OFFSET    0
 #define _PIPEA_DATA_N1           0x60034
 #define  PIPE_DATA_N1_OFFSET    0
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e094040..1f20ac5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4042,26 +4042,33 @@ struct fdi_m_n {
 static void
 fdi_reduce_ratio(u32 *num, u32 *den)
 {
-	while (*num > 0xffffff || *den > 0xffffff) {
+	while (*num > DATA_LINK_M_N_MASK ||
+	       *den > DATA_LINK_M_N_MASK) {
 		*num >>= 1;
 		*den >>= 1;
 	}
 }
 
+static void compute_m_n(unsigned int m, unsigned int n,
+			uint32_t *ret_m, uint32_t *ret_n)
+{
+	*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
+	*ret_m = div_u64((uint64_t) m * *ret_n, n);
+	fdi_reduce_ratio(ret_m, ret_n);
+}
+
 static void
 ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock,
 		     int link_clock, struct fdi_m_n *m_n)
 {
 	m_n->tu = 64; /* default size */
 
-	/* BUG_ON(pixel_clock > INT_MAX / 36); */
-	m_n->gmch_m = bits_per_pixel * pixel_clock;
-	m_n->gmch_n = link_clock * nlanes * 8;
-	fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n);
+	compute_m_n(bits_per_pixel * pixel_clock,
+		    link_clock * nlanes * 8,
+		    &m_n->gmch_m, &m_n->gmch_n);
 
-	m_n->link_m = pixel_clock;
-	m_n->link_n = link_clock;
-	fdi_reduce_ratio(&m_n->link_m, &m_n->link_n);
+	compute_m_n(pixel_clock, link_clock,
+		    &m_n->link_m, &m_n->link_n);
 }
 
 static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
-- 
1.8.1.2


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

* [PATCH 081/133] virtio/console: Quit from splice_write if pipe->nrbufs is 0
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (79 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 080/133] drm/i915: Make data/link N value power of two Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 082/133] virtio/console: Add pipe_lock/unlock for splice_write Kamal Mostafa
                   ` (51 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yoshihiro YUNOMAE, Amit Shah, Arnd Bergmann, Greg Kroah-Hartman,
	Rusty Russell, Kamal Mostafa

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

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

From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>

commit 68c034fefe20eaf7d5569aae84584b07987ce50a upstream.

Quit from splice_write if pipe->nrbufs is 0 for avoiding oops in virtio-serial.

When an application was doing splice from a kernel buffer to virtio-serial on
a guest, the application received signal(SIGINT). This situation will normally
happen, but the kernel executed a kernel panic by oops as follows:

 BUG: unable to handle kernel paging request at ffff882071c8ef28
 IP: [<ffffffff812de48f>] sg_init_table+0x2f/0x50
 PGD 1fac067 PUD 0
 Oops: 0000 [#1] SMP
 Modules linked in: lockd sunrpc bnep bluetooth rfkill ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc snd_timer snd microcode virtio_balloon virtio_net pcspkr soundcore i2c_piix4 i2c_core uinput floppy
 CPU: 1 PID: 908 Comm: trace-cmd Not tainted 3.10.0+ #49
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
 task: ffff880071c64650 ti: ffff88007bf24000 task.ti: ffff88007bf24000
 RIP: 0010:[<ffffffff812de48f>]  [<ffffffff812de48f>] sg_init_table+0x2f/0x50
 RSP: 0018:ffff88007bf25dd8  EFLAGS: 00010286
 RAX: 0000001fffffffe0 RBX: ffff882071c8ef28 RCX: 0000000000000000
 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880071c8ef48
 RBP: ffff88007bf25de8 R08: ffff88007fd15d40 R09: ffff880071c8ef48
 R10: ffffea0001c71040 R11: ffffffff8139c555 R12: 0000000000000000
 R13: ffff88007506a3c0 R14: ffff88007c862500 R15: ffff880071c8ef00
 FS:  00007f0a3646c740(0000) GS:ffff88007fd00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: ffff882071c8ef28 CR3: 000000007acbb000 CR4: 00000000000006e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Stack:
  ffff880071c8ef48 ffff88007bf25e20 ffff88007bf25e88 ffffffff8139d6fa
  ffff88007bf25e28 ffffffff8127a3f4 0000000000000000 0000000000000000
  ffff880071c8ef48 0000100000000000 0000000000000003 ffff88007bf25e08
 Call Trace:
  [<ffffffff8139d6fa>] port_fops_splice_write+0xaa/0x130
  [<ffffffff8127a3f4>] ? selinux_file_permission+0xc4/0x120
  [<ffffffff8139d650>] ? wait_port_writable+0x1b0/0x1b0
  [<ffffffff811a6fe0>] do_splice_from+0xa0/0x110
  [<ffffffff811a951f>] SyS_splice+0x5ff/0x6b0
  [<ffffffff8161f8c2>] system_call_fastpath+0x16/0x1b
 Code: c1 e2 05 48 89 e5 48 83 ec 10 4c 89 65 f8 41 89 f4 31 f6 48 89 5d f0 48 89 fb e8 8d ce ff ff 41 8d 44 24 ff 48 c1 e0 05 48 01 c3 <48> 8b 03 48 83 e0 fe 48 83 c8 02 48 89 03 48 8b 5d f0 4c 8b 65
 RIP  [<ffffffff812de48f>] sg_init_table+0x2f/0x50
  RSP <ffff88007bf25dd8>
 CR2: ffff882071c8ef28
 ---[ end trace 86323505eb42ea8f ]---

It seems to induce pagefault in sg_init_tabel() when pipe->nrbufs is equal to
zero. This may happen in a following situation:

(1) The application normally does splice(read) from a kernel buffer, then does
    splice(write) to virtio-serial.
(2) The application receives SIGINT when is doing splice(read), so splice(read)
    is failed by EINTR. However, the application does not finish the operation.
(3) The application tries to do splice(write) without pipe->nrbufs.
(4) The virtio-console driver tries to touch scatterlist structure sgl in
    sg_init_table(), but the region is out of bound.

To avoid the case, a kernel should check whether pipe->nrbufs is empty or not
when splice_write is executed in the virtio-console driver.

V3: Add Reviewed-by lines and stable@ line in sign-off area.

Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Amit Shah <amit.shah@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index a4b7aa0..0dfd175 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -938,6 +938,13 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
 	if (is_rproc_serial(port->out_vq->vdev))
 		return -EINVAL;
 
+	/*
+	 * pipe->nrbufs == 0 means there are no data to transfer,
+	 * so this returns just 0 for no data.
+	 */
+	if (!pipe->nrbufs)
+		return 0;
+
 	ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);
 	if (ret < 0)
 		return ret;
-- 
1.8.1.2


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

* [PATCH 082/133] virtio/console: Add pipe_lock/unlock for splice_write
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (80 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 081/133] virtio/console: Quit from splice_write if pipe->nrbufs is 0 Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 083/133] x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset Kamal Mostafa
                   ` (50 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yoshihiro YUNOMAE, Amit Shah, Arnd Bergmann, Greg Kroah-Hartman,
	Rusty Russell, Kamal Mostafa

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

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

From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>

commit 2b4fbf029dff5a28d9bf646346dea891ec43398a upstream.

Add pipe_lock/unlock for splice_write to avoid oops by following competition:

(1) An application gets fds of a trace buffer, virtio-serial, pipe.
(2) The application does fork()
(3) The processes execute splice_read(trace buffer) and
    splice_write(virtio-serial) via same pipe.

        <parent>                   <child>
  get fds of a trace buffer,
         virtio-serial, pipe
          |
        fork()----------create--------+
          |                           |
      splice(read)                    |           ---+
      splice(write)                   |              +-- no competition
          |                       splice(read)       |
          |                       splice(write)   ---+
          |                           |
      splice(read)                    |
      splice(write)               splice(read)    ------ competition
          |                       splice(write)

Two processes share a pipe_inode_info structure. If the child execute
splice(read) when the parent tries to execute splice(write), the
structure can be broken. Existing virtio-serial driver does not get
lock for the structure in splice_write, so this competition will induce
oops.

<oops messages>
 BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
 IP: [<ffffffff811a6b5f>] splice_from_pipe_feed+0x6f/0x130
 PGD 7223e067 PUD 72391067 PMD 0
 Oops: 0000 [#1] SMP
 Modules linked in: lockd bnep bluetooth rfkill sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc snd_timer snd soundcore pcspkr virtio_net virtio_balloon i2c_piix4 i2c_core microcode uinput floppy
 CPU: 0 PID: 1072 Comm: compete-test Not tainted 3.10.0ws+ #55
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
 task: ffff880071b98000 ti: ffff88007b55e000 task.ti: ffff88007b55e000
 RIP: 0010:[<ffffffff811a6b5f>]  [<ffffffff811a6b5f>] splice_from_pipe_feed+0x6f/0x130
 RSP: 0018:ffff88007b55fd78  EFLAGS: 00010287
 RAX: 0000000000000000 RBX: ffff88007b55fe20 RCX: 0000000000000000
 RDX: 0000000000001000 RSI: ffff88007a95ba30 RDI: ffff880036f9e6c0
 RBP: ffff88007b55fda8 R08: 00000000000006ec R09: ffff880077626708
 R10: 0000000000000003 R11: ffffffff8139ca59 R12: ffff88007a95ba30
 R13: 0000000000000000 R14: ffffffff8139dd00 R15: ffff880036f9e6c0
 FS:  00007f2e2e3a0740(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 0000000000000018 CR3: 0000000071bd1000 CR4: 00000000000006f0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Stack:
  ffffffff8139ca59 ffff88007b55fe20 ffff880036f9e6c0 ffffffff8139dd00
  ffff8800776266c0 ffff880077626708 ffff88007b55fde8 ffffffff811a6e8e
  ffff88007b55fde8 ffffffff8139ca59 ffff880036f9e6c0 ffff88007b55fe20
 Call Trace:
  [<ffffffff8139ca59>] ? alloc_buf.isra.13+0x39/0xb0
  [<ffffffff8139dd00>] ? virtcons_restore+0x100/0x100
  [<ffffffff811a6e8e>] __splice_from_pipe+0x7e/0x90
  [<ffffffff8139ca59>] ? alloc_buf.isra.13+0x39/0xb0
  [<ffffffff8139d739>] port_fops_splice_write+0xe9/0x140
  [<ffffffff8127a3f4>] ? selinux_file_permission+0xc4/0x120
  [<ffffffff8139d650>] ? wait_port_writable+0x1b0/0x1b0
  [<ffffffff811a6fe0>] do_splice_from+0xa0/0x110
  [<ffffffff811a951f>] SyS_splice+0x5ff/0x6b0
  [<ffffffff8161facf>] tracesys+0xdd/0xe2
 Code: 49 8b 87 80 00 00 00 4c 8d 24 d0 8b 53 04 41 8b 44 24 0c 4d 8b 6c 24 10 39 d0 89 03 76 02 89 13 49 8b 44 24 10 4c 89 e6 4c 89 ff <ff> 50 18 85 c0 0f 85 aa 00 00 00 48 89 da 4c 89 e6 4c 89 ff 41
 RIP  [<ffffffff811a6b5f>] splice_from_pipe_feed+0x6f/0x130
  RSP <ffff88007b55fd78>
 CR2: 0000000000000018
 ---[ end trace 24572beb7764de59 ]---

V2: Fix a locking problem for error
V3: Add Reviewed-by lines and stable@ line in sign-off area

Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Amit Shah <amit.shah@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 0dfd175..3e338a7 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -942,16 +942,21 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
 	 * pipe->nrbufs == 0 means there are no data to transfer,
 	 * so this returns just 0 for no data.
 	 */
-	if (!pipe->nrbufs)
-		return 0;
+	pipe_lock(pipe);
+	if (!pipe->nrbufs) {
+		ret = 0;
+		goto error_out;
+	}
 
 	ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);
 	if (ret < 0)
-		return ret;
+		goto error_out;
 
 	buf = alloc_buf(port->out_vq, 0, pipe->nrbufs);
-	if (!buf)
-		return -ENOMEM;
+	if (!buf) {
+		ret = -ENOMEM;
+		goto error_out;
+	}
 
 	sgl.n = 0;
 	sgl.len = 0;
@@ -959,12 +964,17 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
 	sgl.sg = buf->sg;
 	sg_init_table(sgl.sg, sgl.size);
 	ret = __splice_from_pipe(pipe, &sd, pipe_to_sg);
+	pipe_unlock(pipe);
 	if (likely(ret > 0))
 		ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true);
 
 	if (unlikely(ret <= 0))
 		free_buf(buf, true);
 	return ret;
+
+error_out:
+	pipe_unlock(pipe);
+	return ret;
 }
 
 static unsigned int port_fops_poll(struct file *filp, poll_table *wait)
-- 
1.8.1.2


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

* [PATCH 083/133] x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (81 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 082/133] virtio/console: Add pipe_lock/unlock for splice_write Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 084/133] s390/bitops: fix find_next_bit_left Kamal Mostafa
                   ` (49 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Neil Horman, Joerg Roedel, Andrew Cooper, Malcolm Crossley,
	Prarit Bhargava, Don Zickus, Ingo Molnar, Kamal Mostafa

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

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

From: Neil Horman <nhorman@tuxdriver.com>

commit 803075dba31c17af110e1d9a915fe7262165b213 upstream.

Recently we added an early quirk to detect 5500/5520 chipsets
with early revisions that had problems with irq draining with
interrupt remapping enabled:

  commit 03bbcb2e7e292838bb0244f5a7816d194c911d62
  Author: Neil Horman <nhorman@tuxdriver.com>
  Date:   Tue Apr 16 16:38:32 2013 -0400

      iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets

It turns out this same problem is present in the intel X58
chipset as well. See errata 69 here:

  http://www.intel.com/content/www/us/en/chipsets/x58-express-specification-update.html

This patch extends the pci early quirk so that the chip
devices/revisions specified in the above update are also covered
in the same way:

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Donald Dutile <ddutile@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Malcolm Crossley <malcolm.crossley@citrix.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Don Zickus <dzickus@redhat.com>
Link: http://lkml.kernel.org/r/1374059639-8631-1-git-send-email-nhorman@tuxdriver.com
[ Small edits. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/early-quirks.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 94ab6b9..63bdb29 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -196,15 +196,23 @@ static void __init ati_bugs_contd(int num, int slot, int func)
 static void __init intel_remapping_check(int num, int slot, int func)
 {
 	u8 revision;
+	u16 device;
 
+	device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID);
 	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
+ 	 * Revision 13 of all triggering devices id in this quirk have
+	 * a problem draining interrupts when irq remapping is enabled,
+	 * and should be flagged as broken.  Additionally revisions 0x12
+	 * and 0x22 of device id 0x3405 has this problem.
 	 */
 	if (revision == 0x13)
 		set_irq_remapping_broken();
+	else if ((device == 0x3405) &&
+	    ((revision == 0x12) ||
+	     (revision == 0x22)))
+		set_irq_remapping_broken();
 
 }
 
@@ -239,6 +247,8 @@ static struct chipset early_qrk[] __initdata = {
 	  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, 0x3405, 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 },
 	{}
-- 
1.8.1.2


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

* [PATCH 084/133] s390/bitops: fix find_next_bit_left
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (82 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 083/133] x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 085/133] x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz Kamal Mostafa
                   ` (48 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Martin Schwidefsky, Kamal Mostafa

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

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

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

commit 3b0040a47ad63f7147e9e7d2febb61a3b564bb90 upstream.

The find_next_bit_left function is broken if used with an offset which
is not a multiple of 64. The shift to mask the bits of a 64-bit word
not to search is in the wrong direction, the result can be either a
bit found smaller than the offset or failure to find a set bit.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/s390/include/asm/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 1542293..787eb3b 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -698,7 +698,7 @@ static inline int find_next_bit_left(const unsigned long *addr,
 	size -= offset;
 	p = addr + offset / __BITOPS_WORDSIZE;
 	if (bit) {
-		set = __flo_word(0, *p & (~0UL << bit));
+		set = __flo_word(0, *p & (~0UL >> bit));
 		if (set >= size)
 			return size + offset;
 		if (set < __BITOPS_WORDSIZE)
-- 
1.8.1.2


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

* [PATCH 085/133] x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (83 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 084/133] s390/bitops: fix find_next_bit_left Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 086/133] ext4: make sure group number is bumped after a inode allocation race Kamal Mostafa
                   ` (47 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: H. Peter Anvin, Kamal Mostafa

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

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

From: "H.J. Lu" <hjl.tools@gmail.com>

commit eaa5a990191d204ba0f9d35dbe5505ec2cdd1460 upstream.

GCC will optimize mxcsr_feature_mask_init in arch/x86/kernel/i387.c:

		memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
		asm volatile("fxsave %0" : : "m" (fx_scratch));
		mask = fx_scratch.mxcsr_mask;
		if (mask == 0)
			mask = 0x0000ffbf;

to

		memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
		asm volatile("fxsave %0" : : "m" (fx_scratch));
		mask = 0x0000ffbf;

since asm statement doesn’t say it will update fx_scratch.  As the
result, the DAZ bit will be cleared.  This patch fixes it. This bug
dates back to at least kernel 2.6.12.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/i387.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index cb33909..f7ea30d 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -116,7 +116,7 @@ static void __cpuinit mxcsr_feature_mask_init(void)
 
 	if (cpu_has_fxsr) {
 		memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
-		asm volatile("fxsave %0" : : "m" (fx_scratch));
+		asm volatile("fxsave %0" : "+m" (fx_scratch));
 		mask = fx_scratch.mxcsr_mask;
 		if (mask == 0)
 			mask = 0x0000ffbf;
-- 
1.8.1.2


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

* [PATCH 086/133] ext4: make sure group number is bumped after a inode allocation race
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (84 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 085/133] x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 087/133] ext4: destroy ext4_es_cachep on module unload Kamal Mostafa
                   ` (46 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Kamal Mostafa

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

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

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

commit a34eb503742fd25155fd6cff6163daacead9fbc3 upstream.

When we try to allocate an inode, and there is a race between two
CPU's trying to grab the same inode, _and_ this inode is the last free
inode in the block group, make sure the group number is bumped before
we continue searching the rest of the block groups.  Otherwise, we end
up searching the current block group twice, and we end up skipping
searching the last block group.  So in the unlikely situation where
almost all of the inodes are allocated, it's possible that we will
return ENOSPC even though there might be free inodes in that last
block group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/ialloc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index ec2909e..f4da2a3 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -715,11 +715,8 @@ repeat_in_this_group:
 		ino = ext4_find_next_zero_bit((unsigned long *)
 					      inode_bitmap_bh->b_data,
 					      EXT4_INODES_PER_GROUP(sb), ino);
-		if (ino >= EXT4_INODES_PER_GROUP(sb)) {
-			if (++group == ngroups)
-				group = 0;
-			continue;
-		}
+		if (ino >= EXT4_INODES_PER_GROUP(sb))
+			goto next_group;
 		if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
 			ext4_error(sb, "reserved inode found cleared - "
 				   "inode=%lu", ino + 1);
@@ -737,6 +734,9 @@ repeat_in_this_group:
 			goto got; /* we grabbed the inode! */
 		if (ino < EXT4_INODES_PER_GROUP(sb))
 			goto repeat_in_this_group;
+next_group:
+		if (++group == ngroups)
+			group = 0;
 	}
 	err = -ENOSPC;
 	goto out;
-- 
1.8.1.2


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

* [PATCH 087/133] ext4: destroy ext4_es_cachep on module unload
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (85 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 086/133] ext4: make sure group number is bumped after a inode allocation race Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 088/133] virtio: console: fix race with port unplug and open/close Kamal Mostafa
                   ` (45 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Sandeen, Theodore Ts'o, Kamal Mostafa

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

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

From: Eric Sandeen <sandeen@redhat.com>

commit dd12ed144e9797094c04736f97aa27d5fe401476 upstream.

Without this, module can't be reloaded.

[  500.521980] kmem_cache_sanity_check (ext4_extent_status): Cache name already exists.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f036930..d757050 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5370,6 +5370,7 @@ static void __exit ext4_exit_fs(void)
 	kset_unregister(ext4_kset);
 	ext4_exit_system_zone();
 	ext4_exit_pageio();
+	ext4_exit_es();
 }
 
 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
-- 
1.8.1.2


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

* [PATCH 088/133] virtio: console: fix race with port unplug and open/close
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (86 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 087/133] ext4: destroy ext4_es_cachep on module unload Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 089/133] virtio: console: fix race in port_fops_open() and port unplug Kamal Mostafa
                   ` (44 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Amit Shah, Rusty Russell, Kamal Mostafa

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

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

From: Amit Shah <amit.shah@redhat.com>

commit 057b82be3ca3d066478e43b162fc082930a746c9 upstream.

There's a window between find_port_by_devt() returning a port and us
taking a kref on the port, where the port could get unplugged.  Fix it
by taking the reference in find_port_by_devt() itself.

Problem reported and analyzed by Mateusz Guzik.

Reported-by: Mateusz Guzik <mguzik@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 3e338a7..ff015e7 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -278,9 +278,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev,
 	unsigned long flags;
 
 	spin_lock_irqsave(&portdev->ports_lock, flags);
-	list_for_each_entry(port, &portdev->ports, list)
-		if (port->cdev->dev == dev)
+	list_for_each_entry(port, &portdev->ports, list) {
+		if (port->cdev->dev == dev) {
+			kref_get(&port->kref);
 			goto out;
+		}
+	}
 	port = NULL;
 out:
 	spin_unlock_irqrestore(&portdev->ports_lock, flags);
@@ -1042,14 +1045,10 @@ static int port_fops_open(struct inode *inode, struct file *filp)
 	struct port *port;
 	int ret;
 
+	/* We get the port with a kref here */
 	port = find_port_by_devt(cdev->dev);
 	filp->private_data = port;
 
-	/* Prevent against a port getting hot-unplugged at the same time */
-	spin_lock_irq(&port->portdev->ports_lock);
-	kref_get(&port->kref);
-	spin_unlock_irq(&port->portdev->ports_lock);
-
 	/*
 	 * Don't allow opening of console port devices -- that's done
 	 * via /dev/hvc
-- 
1.8.1.2


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

* [PATCH 089/133] virtio: console: fix race in port_fops_open() and port unplug
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (87 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 088/133] virtio: console: fix race with port unplug and open/close Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 090/133] virtio: console: clean up port data immediately at time of unplug Kamal Mostafa
                   ` (43 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Amit Shah, Rusty Russell, Kamal Mostafa

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

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

From: Amit Shah <amit.shah@redhat.com>

commit 671bdea2b9f210566610603ecbb6584c8a201c8c upstream.

Between open() being called and processed, the port can be unplugged.
Check if this happened, and bail out.

A simple test script to reproduce this is:

while true; do for i in $(seq 1 100); do echo $i > /dev/vport0p3; done; done;

This opens and closes the port a lot of times; unplugging the port while
this is happening triggers the bug.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index ff015e7..4e848c8 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1047,6 +1047,10 @@ static int port_fops_open(struct inode *inode, struct file *filp)
 
 	/* We get the port with a kref here */
 	port = find_port_by_devt(cdev->dev);
+	if (!port) {
+		/* Port was unplugged before we could proceed */
+		return -ENXIO;
+	}
 	filp->private_data = port;
 
 	/*
-- 
1.8.1.2


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

* [PATCH 090/133] virtio: console: clean up port data immediately at time of unplug
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (88 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 089/133] virtio: console: fix race in port_fops_open() and port unplug Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 091/133] virtio: console: fix raising SIGIO after port unplug Kamal Mostafa
                   ` (42 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Amit Shah, Rusty Russell, Kamal Mostafa

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

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

From: Amit Shah <amit.shah@redhat.com>

commit ea3768b4386a8d1790f4cc9a35de4f55b92d6442 upstream.

We used to keep the port's char device structs and the /sys entries
around till the last reference to the port was dropped.  This is
actually unnecessary, and resulted in buggy behaviour:

1. Open port in guest
2. Hot-unplug port
3. Hot-plug a port with the same 'name' property as the unplugged one

This resulted in hot-plug being unsuccessful, as a port with the same
name already exists (even though it was unplugged).

This behaviour resulted in a warning message like this one:

-------------------8<---------------------------------------
WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
Hardware name: KVM
sysfs: cannot create duplicate filename
'/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'

Call Trace:
 [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0
 [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50
 [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130
 [<ffffffff811f23e8>] ? create_dir+0x68/0xb0
 [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50
 [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260
 [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60
 [<ffffffff812734b4>] ? kobject_add+0x44/0x70
 [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0
 [<ffffffff8134b389>] ? device_add+0xc9/0x650

-------------------8<---------------------------------------

Instead of relying on guest applications to release all references to
the ports, we should go ahead and unregister the port from all the core
layers.  Any open/read calls on the port will then just return errors,
and an unplug/plug operation on the host will succeed as expected.

This also caused buggy behaviour in case of the device removal (not just
a port): when the device was removed (which means all ports on that
device are removed automatically as well), the ports with active
users would clean up only when the last references were dropped -- and
it would be too late then to be referencing char device pointers,
resulting in oopses:

-------------------8<---------------------------------------
PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
 #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
 #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
 #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
 #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
 #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
 #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
    [exception RIP: strlen+2]
    RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
    RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
    RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
    RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
    R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
    R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
 #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
 #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
 #9 [ffff88011b9d5de0] device_del at ffffffff813440c7

-------------------8<---------------------------------------

So clean up when we have all the context, and all that's left to do when
the references to the port have dropped is to free up the port struct
itself.

Reported-by: chayang <chayang@redhat.com>
Reported-by: YOGANANTH SUBRAMANIAN <anantyog@in.ibm.com>
Reported-by: FuXiangChun <xfu@redhat.com>
Reported-by: Qunfang Zhang <qzhang@redhat.com>
Reported-by: Sibiao Luo <sluo@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 4e848c8..615804c 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1524,14 +1524,6 @@ static void remove_port(struct kref *kref)
 
 	port = container_of(kref, struct port, kref);
 
-	sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
-	device_destroy(pdrvdata.class, port->dev->devt);
-	cdev_del(port->cdev);
-
-	kfree(port->name);
-
-	debugfs_remove(port->debugfs_file);
-
 	kfree(port);
 }
 
@@ -1589,6 +1581,14 @@ static void unplug_port(struct port *port)
 	 */
 	port->portdev = NULL;
 
+	sysfs_remove_group(&port->dev->kobj, &port_attribute_group);
+	device_destroy(pdrvdata.class, port->dev->devt);
+	cdev_del(port->cdev);
+
+	kfree(port->name);
+
+	debugfs_remove(port->debugfs_file);
+
 	/*
 	 * Locks around here are not necessary - a port can't be
 	 * opened after we removed the port struct from ports_list
-- 
1.8.1.2


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

* [PATCH 091/133] virtio: console: fix raising SIGIO after port unplug
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (89 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 090/133] virtio: console: clean up port data immediately at time of unplug Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 092/133] virtio: console: return -ENODEV on all read operations after unplug Kamal Mostafa
                   ` (41 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Amit Shah, Rusty Russell, Kamal Mostafa

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

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

From: Amit Shah <amit.shah@redhat.com>

commit 92d3453815fbe74d539c86b60dab39ecdf01bb99 upstream.

SIGIO should be sent when a port gets unplugged.  It should only be sent
to prcesses that have the port opened, and have asked for SIGIO to be
delivered.  We were clearing out guest_connected before calling
send_sigio_to_port(), resulting in a sigio not getting sent to
processes.

Fix by setting guest_connected to false after invoking the sigio
function.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 615804c..62834bc 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1557,12 +1557,14 @@ static void unplug_port(struct port *port)
 	spin_unlock_irq(&port->portdev->ports_lock);
 
 	if (port->guest_connected) {
+		/* Let the app know the port is going down. */
+		send_sigio_to_port(port);
+
+		/* Do this after sigio is actually sent */
 		port->guest_connected = false;
 		port->host_connected = false;
-		wake_up_interruptible(&port->waitqueue);
 
-		/* Let the app know the port is going down. */
-		send_sigio_to_port(port);
+		wake_up_interruptible(&port->waitqueue);
 	}
 
 	if (is_console_port(port)) {
-- 
1.8.1.2


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

* [PATCH 092/133] virtio: console: return -ENODEV on all read operations after unplug
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (90 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 091/133] virtio: console: fix raising SIGIO after port unplug Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 093/133] KVM: s390: move kvm_guest_enter,exit closer to sie Kamal Mostafa
                   ` (40 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Amit Shah, Rusty Russell, Kamal Mostafa

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

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

From: Amit Shah <amit.shah@redhat.com>

commit 96f97a83910cdb9d89d127c5ee523f8fc040a804 upstream.

If a port gets unplugged while a user is blocked on read(), -ENODEV is
returned.  However, subsequent read()s returned 0, indicating there's no
host-side connection (but not indicating the device went away).

This also happened when a port was unplugged and the user didn't have
any blocking operation pending.  If the user didn't monitor the SIGIO
signal, they won't have a chance to find out if the port went away.

Fix by returning -ENODEV on all read()s after the port gets unplugged.
write() already behaves this way.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/virtio_console.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 62834bc..12829ae 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -755,6 +755,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
 
 	port = filp->private_data;
 
+	/* Port is hot-unplugged. */
+	if (!port->guest_connected)
+		return -ENODEV;
+
 	if (!port_has_data(port)) {
 		/*
 		 * If nothing's connected on the host just return 0 in
@@ -771,7 +775,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
 		if (ret < 0)
 			return ret;
 	}
-	/* Port got hot-unplugged. */
+	/* Port got hot-unplugged while we were waiting above. */
 	if (!port->guest_connected)
 		return -ENODEV;
 	/*
-- 
1.8.1.2


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

* [PATCH 093/133] KVM: s390: move kvm_guest_enter,exit closer to sie
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (91 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 092/133] virtio: console: return -ENODEV on all read operations after unplug Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 094/133] ext4: fix retry handling in ext4_ext_truncate() Kamal Mostafa
                   ` (39 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dominik Dingel, Christian Borntraeger, Paolo Bonzini, Kamal Mostafa

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

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

From: Dominik Dingel <dingel@linux.vnet.ibm.com>

commit 2b29a9fdcb92bfc6b6f4c412d71505869de61a56 upstream.

Any uaccess between guest_enter and guest_exit could trigger a page fault,
the page fault handler would handle it as a guest fault and translate a
user address as guest address.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/s390/kvm/kvm-s390.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 8bafa4f..74e64f8 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -613,14 +613,25 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
 		kvm_s390_deliver_pending_interrupts(vcpu);
 
 	vcpu->arch.sie_block->icptcode = 0;
-	preempt_disable();
-	kvm_guest_enter();
-	preempt_enable();
 	VCPU_EVENT(vcpu, 6, "entering sie flags %x",
 		   atomic_read(&vcpu->arch.sie_block->cpuflags));
 	trace_kvm_s390_sie_enter(vcpu,
 				 atomic_read(&vcpu->arch.sie_block->cpuflags));
+
+	/*
+	 * As PF_VCPU will be used in fault handler, between guest_enter
+	 * and guest_exit should be no uaccess.
+	 */
+	preempt_disable();
+	kvm_guest_enter();
+	preempt_enable();
 	rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs);
+	kvm_guest_exit();
+
+	VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
+		   vcpu->arch.sie_block->icptcode);
+	trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
+
 	if (rc) {
 		if (kvm_is_ucontrol(vcpu->kvm)) {
 			rc = SIE_INTERCEPT_UCONTROL;
@@ -631,10 +642,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
 			rc = 0;
 		}
 	}
-	VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
-		   vcpu->arch.sie_block->icptcode);
-	trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
-	kvm_guest_exit();
 
 	memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
 	return rc;
-- 
1.8.1.2


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

* [PATCH 094/133] ext4: fix retry handling in ext4_ext_truncate()
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (92 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 093/133] KVM: s390: move kvm_guest_enter,exit closer to sie Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 095/133] spi: spi-davinci: Fix direction in dma_map_single() Kamal Mostafa
                   ` (38 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Kamal Mostafa

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

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

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

commit 94eec0fc3520c759831763d866421b4d60b599b4 upstream.

We tested for ENOMEM instead of -ENOMEM.   Oops.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/extents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 728c8f6..c3db941 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4329,7 +4329,7 @@ void ext4_ext_truncate(struct inode *inode)
 retry:
 	err = ext4_es_remove_extent(inode, last_block,
 				    EXT_MAX_BLOCKS - last_block);
-	if (err == ENOMEM) {
+	if (err == -ENOMEM) {
 		cond_resched();
 		congestion_wait(BLK_RW_ASYNC, HZ/50);
 		goto retry;
-- 
1.8.1.2


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

* [PATCH 095/133] spi: spi-davinci: Fix direction in dma_map_single()
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (93 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 094/133] ext4: fix retry handling in ext4_ext_truncate() Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 096/133] [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel Kamal Mostafa
                   ` (37 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Christian Eggers, Mark Brown, Kamal Mostafa

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

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

From: Christian Eggers <ceggers@gmx.de>

commit 89c66ee890af18500fa4598db300cc07c267f900 upstream.

Commit 048177ce3b3962852fd34a7e04938959271c7e70 (spi: spi-davinci:
convert to DMA engine API) introduced a regression: dma_map_single()
is called with direction DMA_FROM_DEVICE for rx and for tx.

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Acked-by: Matt Porter <mporter@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/spi/spi-davinci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 13661e1..9f3d1bb 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -608,7 +608,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
 		else
 			buf = (void *)t->tx_buf;
 		t->tx_dma = dma_map_single(&spi->dev, buf,
-				t->len, DMA_FROM_DEVICE);
+				t->len, DMA_TO_DEVICE);
 		if (!t->tx_dma) {
 			ret = -EFAULT;
 			goto err_tx_map;
-- 
1.8.1.2


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

* [PATCH 096/133] [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (94 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 095/133] spi: spi-davinci: Fix direction in dma_map_single() Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:33 ` [PATCH 097/133] [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set Kamal Mostafa
                   ` (36 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sumit Saxena, Kashyap Desai, James Bottomley, Kamal Mostafa

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

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

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

commit 6431f5d7c6025f8b007af06ea090de308f7e6881 upstream.

Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails
in kdump kernel with LSI MegaRAID controller(device id-0x73).

Actually this issue needs fix in firmware, but for firmware running in field,
this driver fix is proposed to resolve the issue.  At firmware initialization
time, if firmware does not come to ready state, driver will reset the adapter
and retry for firmware transition to ready state unconditionally(not only
executed for kdump kernel).

Signed-off-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 996a314..3433e07 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3508,11 +3508,21 @@ static int megasas_init_fw(struct megasas_instance *instance)
 		break;
 	}
 
-	/*
-	 * We expect the FW state to be READY
-	 */
-	if (megasas_transition_to_ready(instance, 0))
-		goto fail_ready_state;
+	if (megasas_transition_to_ready(instance, 0)) {
+		atomic_set(&instance->fw_reset_no_pci_access, 1);
+		instance->instancet->adp_reset
+			(instance, instance->reg_set);
+		atomic_set(&instance->fw_reset_no_pci_access, 0);
+		dev_info(&instance->pdev->dev,
+			"megasas: FW restarted successfully from %s!\n",
+			__func__);
+
+		/*waitting for about 30 second before retry*/
+		ssleep(30);
+
+		if (megasas_transition_to_ready(instance, 0))
+			goto fail_ready_state;
+	}
 
 	/* Check if MSI-X is supported while in ready state */
 	msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
-- 
1.8.1.2


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

* [PATCH 097/133] [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (95 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 096/133] [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel Kamal Mostafa
@ 2013-08-16 22:33 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 098/133] ACPI / PM: Fix /proc/acpi/wakeup for devices w/o bus or parent Kamal Mostafa
                   ` (35 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:33 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Martin K. Petersen, James Bottomley, Kamal Mostafa

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

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

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

commit 7562523e84ddc742fe1f9db8bd76b01acca89f6b upstream.

If a device has the skip_vpd_pages flag set we should simply fail the
scsi_get_vpd_page() call.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Stuart Foster <smf.linux@ntlworld.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/scsi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 3b1ea34..eaa808e 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1031,6 +1031,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
 {
 	int i, result;
 
+	if (sdev->skip_vpd_pages)
+		goto fail;
+
 	/* Ask for all the pages supported by this device */
 	result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
 	if (result)
-- 
1.8.1.2


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

* [PATCH 098/133] ACPI / PM: Fix /proc/acpi/wakeup for devices w/o bus or parent
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (96 preceding siblings ...)
  2013-08-16 22:33 ` [PATCH 097/133] [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 099/133] ACPI / PM: Walk physical_node_list under physical_node_lock Kamal Mostafa
                   ` (34 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andreas Fleig, Rafael J. Wysocki, Kamal Mostafa

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

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

From: Andreas Fleig <andreasfleig@gmail.com>

commit 65ab96f60621c4da8f1b4087a57b788bc4d8f27b upstream.

Fix /proc/acpi/wakeup for devices without bus or parent

This patch fixes printing the wakeup status for devices without a bus
or parent, such as laptop lid switches and sleep buttons. These devices
have an empty physical_node_list, because acpi_bind_one is never run
for them.

[rjw: White space and coding style.]
Signed-off-by: Andreas Fleig <andreasfleig@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ kamal: 3.8.y-stable prereq for 623cf33c ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/proc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index ef98796..52ce767 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -311,11 +311,12 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 			   dev->pnp.bus_id,
 			   (u32) dev->wakeup.sleep_state);
 
-		if (!dev->physical_node_count)
+		if (!dev->physical_node_count) {
 			seq_printf(seq, "%c%-8s\n",
-				dev->wakeup.flags.run_wake ?
-				'*' : ' ', "disabled");
-		else {
+				dev->wakeup.flags.run_wake ? '*' : ' ',
+				device_may_wakeup(&dev->dev) ?
+					"enabled" : "disabled");
+		} else {
 			struct device *ldev;
 			list_for_each_entry(entry, &dev->physical_node_list,
 					node) {
-- 
1.8.1.2


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

* [PATCH 099/133] ACPI / PM: Walk physical_node_list under physical_node_lock
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (97 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 098/133] ACPI / PM: Fix /proc/acpi/wakeup for devices w/o bus or parent Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 100/133] regmap: Add missing header for !CONFIG_REGMAP stubs Kamal Mostafa
                   ` (33 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rafael J. Wysocki, Kamal Mostafa

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

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

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

commit 623cf33cb055b1e81fa47e4fc16789b2c129e31e upstream.

The list of physical devices corresponding to an ACPI device
object is walked by acpi_system_wakeup_device_seq_show() and
physical_device_enable_wakeup() without taking that object's
physical_node_lock mutex.  Since each of those functions may be
run at any time as a result of a user space action, the lack of
appropriate locking in them may lead to a kernel crash if that
happens during device hot-add or hot-remove involving the device
object in question.

Fix the issue by modifying acpi_system_wakeup_device_seq_show() and
physical_device_enable_wakeup() to use physical_node_lock as
appropriate.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/acpi/proc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 52ce767..8fa2d08 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 			   dev->pnp.bus_id,
 			   (u32) dev->wakeup.sleep_state);
 
+		mutex_lock(&dev->physical_node_lock);
+
 		if (!dev->physical_node_count) {
 			seq_printf(seq, "%c%-8s\n",
 				dev->wakeup.flags.run_wake ? '*' : ' ',
@@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 				put_device(ldev);
 			}
 		}
+
+		mutex_unlock(&dev->physical_node_lock);
 	}
 	mutex_unlock(&acpi_device_lock);
 	return 0;
@@ -347,12 +351,16 @@ static void physical_device_enable_wakeup(struct acpi_device *adev)
 {
 	struct acpi_device_physical_node *entry;
 
+	mutex_lock(&adev->physical_node_lock);
+
 	list_for_each_entry(entry,
 		&adev->physical_node_list, node)
 		if (entry->dev && device_can_wakeup(entry->dev)) {
 			bool enable = !device_may_wakeup(entry->dev);
 			device_set_wakeup_enable(entry->dev, enable);
 		}
+
+	mutex_unlock(&adev->physical_node_lock);
 }
 
 static ssize_t
-- 
1.8.1.2


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

* [PATCH 100/133] regmap: Add missing header for !CONFIG_REGMAP stubs
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (98 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 099/133] ACPI / PM: Walk physical_node_list under physical_node_lock Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 101/133] userns: unshare_userns(&cred) should not populate cred on failure Kamal Mostafa
                   ` (32 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mateusz Krawczuk, Kyungmin Park, Mark Brown, Kamal Mostafa

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

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

From: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>

commit 49ccc142f9cbc33fdda18e8fa90c1c5b4a79c0ad upstream.

regmap.h requires linux/err.h if CONFIG_REGMAP is not defined. Without it I get
error.
CC      drivers/media/platform/exynos4-is/fimc-reg.o
In file included from drivers/media/platform/exynos4-is/fimc-reg.c:14:0:
include/linux/regmap.h: In function ‘regmap_write’:
include/linux/regmap.h:525:10: error: ‘EINVAL’ undeclared (first use in this function)
include/linux/regmap.h:525:10: note: each undeclared identifier is reported only once for each function it appears in

Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/regmap.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index b7e95bf..6a0b639 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,6 +15,7 @@
 
 #include <linux/list.h>
 #include <linux/rbtree.h>
+#include <linux/err.h>
 
 struct module;
 struct device;
-- 
1.8.1.2


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

* [PATCH 101/133] userns: unshare_userns(&cred) should not populate cred on failure
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (99 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 100/133] regmap: Add missing header for !CONFIG_REGMAP stubs Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 102/133] userns: limit the maximum depth of user_namespace->parent chain Kamal Mostafa
                   ` (31 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Linus Torvalds, Kamal Mostafa

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit 6160968cee8b90a5dd95318d716e31d7775c4ef3 upstream.

unshare_userns(new_cred) does *new_cred = prepare_creds() before
create_user_ns() which can fail. However, the caller expects that
it doesn't need to take care of new_cred if unshare_userns() fails.

We could change the single caller, sys_unshare(), but I think it
would be more clean to avoid the side effects on failure, so with
this patch unshare_userns() does put_cred() itself and initializes
*new_cred only if create_user_ns() succeeeds.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/user_namespace.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index f359dc7..38ae0f5 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -105,16 +105,21 @@ int create_user_ns(struct cred *new)
 int unshare_userns(unsigned long unshare_flags, struct cred **new_cred)
 {
 	struct cred *cred;
+	int err = -ENOMEM;
 
 	if (!(unshare_flags & CLONE_NEWUSER))
 		return 0;
 
 	cred = prepare_creds();
-	if (!cred)
-		return -ENOMEM;
+	if (cred) {
+		err = create_user_ns(cred);
+		if (err)
+			put_cred(cred);
+		else
+			*new_cred = cred;
+	}
 
-	*new_cred = cred;
-	return create_user_ns(cred);
+	return err;
 }
 
 void free_user_ns(struct kref *kref)
-- 
1.8.1.2


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

* [PATCH 102/133] userns: limit the maximum depth of user_namespace->parent chain
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (100 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 101/133] userns: unshare_userns(&cred) should not populate cred on failure Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 103/133] drm/cirrus: Invalidate page tables when pinning a BO Kamal Mostafa
                   ` (30 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oleg Nesterov, Linus Torvalds, Kamal Mostafa

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

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

From: Oleg Nesterov <oleg@redhat.com>

commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8 upstream.

Ensure that user_namespace->parent chain can't grow too much.
Currently we use the hardroded 32 as limit.

Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/user_namespace.h | 1 +
 kernel/user_namespace.c        | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 5209cfe..e4539aa 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -23,6 +23,7 @@ struct user_namespace {
 	struct uid_gid_map	projid_map;
 	struct kref		kref;
 	struct user_namespace	*parent;
+	int			level;
 	kuid_t			owner;
 	kgid_t			group;
 	unsigned int		proc_inum;
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 38ae0f5..b9b0b51 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -62,6 +62,9 @@ int create_user_ns(struct cred *new)
 	kgid_t group = new->egid;
 	int ret;
 
+	if (parent_ns->level > 32)
+		return -EUSERS;
+
 	/*
 	 * Verify that we can not violate the policy of which files
 	 * may be accessed that is specified by the root directory,
@@ -92,6 +95,7 @@ int create_user_ns(struct cred *new)
 	kref_init(&ns->kref);
 	/* Leave the new->user_ns reference with the new user namespace. */
 	ns->parent = parent_ns;
+	ns->level = parent_ns->level + 1;
 	ns->owner = owner;
 	ns->group = group;
 
-- 
1.8.1.2


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

* [PATCH 103/133] drm/cirrus: Invalidate page tables when pinning a BO
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (101 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 102/133] userns: limit the maximum depth of user_namespace->parent chain Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 104/133] drm/mgag200: " Kamal Mostafa
                   ` (29 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Michal Srb, Dave Airlie, Kamal Mostafa

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

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

From: Michal Srb <msrb@suse.com>

commit 109a51598869a39fdcec2d49672a9a39b6d89481 upstream.

This is a cirrus version of Egbert Eich's patch for mgag200.

Without bo.bdev->dev_mapping set, the ttm_bo_unmap_virtual_locked
called from ttm_bo_handle_move_mem returns with no effect. If any
application accessed the memory before it was moved, it will
access wrong memory next time. This causes crashes when changing
resolution down.

Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/cirrus/cirrus_ttm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 2ed8cfc..c18faff 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -353,6 +353,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align,
 
 	cirrusbo->gem.driver_private = NULL;
 	cirrusbo->bo.bdev = &cirrus->ttm.bdev;
+	cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping;
 
 	cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
 
-- 
1.8.1.2


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

* [PATCH 104/133] drm/mgag200: Invalidate page tables when pinning a BO
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (102 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 103/133] drm/cirrus: Invalidate page tables when pinning a BO Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 105/133] drm/ast: invalidate " Kamal Mostafa
                   ` (28 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Egbert Eich, Dave Airlie, Kamal Mostafa

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

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

From: Egbert Eich <eich@suse.com>

commit ecaac1c866bcda4780a963b3d18cd310d971aea3 upstream.

When a BO gets pinned the placement may get changed. If the memory is
mapped into user space and user space has already accessed the mapped
range the page tables are set up but now point to the wrong memory.
Set bo.mdev->dev_mapping in mgag200_bo_create() to make sure that
ttm_bo_unmap_virtual() called from ttm_bo_handle_move_mem() will take
care of this.

v2: Don't call ttm_bo_unmap_virtual() in mgag200_bo_pin(), fix comment.

Signed-off-by: Egbert Eich <eich@suse.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/mgag200/mgag200_ttm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 401c989..d2cb32f 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -347,6 +347,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align,
 
 	mgabo->gem.driver_private = NULL;
 	mgabo->bo.bdev = &mdev->ttm.bdev;
+	mgabo->bo.bdev->dev_mapping = dev->dev_mapping;
 
 	mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
 
-- 
1.8.1.2


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

* [PATCH 105/133] drm/ast: invalidate page tables when pinning a BO
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (103 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 104/133] drm/mgag200: " Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 106/133] drm/i915: do not disable backlight on vgaswitcheroo switch off Kamal Mostafa
                   ` (27 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Dave Airlie, Kamal Mostafa

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

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

From: Dave Airlie <airlied@redhat.com>

commit 3ac65259328324de323dc006b52ff7c1a5b18d19 upstream.

same fix as cirrus and mgag200.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/ast/ast_ttm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index 09da339..d5902e2 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -348,6 +348,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align,
 
 	astbo->gem.driver_private = NULL;
 	astbo->bo.bdev = &ast->ttm.bdev;
+	astbo->bo.bdev->dev_mapping = dev->dev_mapping;
 
 	ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
 
-- 
1.8.1.2


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

* [PATCH 106/133] drm/i915: do not disable backlight on vgaswitcheroo switch off
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (104 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 105/133] drm/ast: invalidate " Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 107/133] ALSA: 6fire: fix DMA issues with URB transfer_buffer usage Kamal Mostafa
                   ` (26 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jani Nikula, Daniel Vetter, Kamal Mostafa

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

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

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

commit 3f577573cd5482a32f85bd131e52f7cb4b9ac518 upstream.

On muxed systems, the other vgaswitcheroo client may depend on i915 to
handle the backlight. We began switching off the backlight since

commit a261b246ebd552fd5d5a8ed84cc931bb821c427f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Jul 26 19:21:47 2012 +0200

    drm/i915: disable all crtcs at suspend time

breaking backlight on discreet graphics in (some) muxed systems.

Keep the backlight on when the state is changed through vgaswitcheroo.

Note: The alternative would be to add a quirk table to achieve the same
based on system identifiers, but AFAICS it would asymptotically approach
effectively the same as this patch as more IDs are added, but with the
maintenance burden of the quirk table.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=55311
Tested-by: Fede <fedevx@yahoo.com>
Tested-by: Aximab <laurent.debian@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59785
Tested-by: sfievet <sebastien.fievet@free.fr>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index cc6346d..8df501a 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -295,6 +295,17 @@ void intel_panel_disable_backlight(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
+	/*
+	 * Do not disable backlight on the vgaswitcheroo path. When switching
+	 * away from i915, the other client may depend on i915 to handle the
+	 * backlight. This will leave the backlight on unnecessarily when
+	 * another client is not activated.
+	 */
+	if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) {
+		DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
+		return;
+	}
+
 	dev_priv->backlight_enabled = false;
 	intel_panel_actually_set_backlight(dev, 0);
 
-- 
1.8.1.2


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

* [PATCH 107/133] ALSA: 6fire: fix DMA issues with URB transfer_buffer usage
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (105 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 106/133] drm/i915: do not disable backlight on vgaswitcheroo switch off Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 108/133] drm: Don't pass negative delta to ktime_sub_ns() Kamal Mostafa
                   ` (25 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jussi Kivilinna, Takashi Iwai, Kamal Mostafa

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

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

From: Jussi Kivilinna <jussi.kivilinna@iki.fi>

commit ddb6b5a964371e8e52e696b2b258bda144c8bd3f upstream.

Patch fixes 6fire not to use stack as URB transfer_buffer. URB buffers need to
be DMA-able, which stack is not. Furthermore, transfer_buffer should not be
allocated as part of larger device structure because DMA coherency issues and
patch fixes this issue too.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Tested-by: Torsten Schenk <torsten.schenk@zoho.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/6fire/comm.c | 38 +++++++++++++++++++++++++++++++++-----
 sound/usb/6fire/comm.h |  2 +-
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c
index 9e6e3ff..23452ee 100644
--- a/sound/usb/6fire/comm.c
+++ b/sound/usb/6fire/comm.c
@@ -110,19 +110,37 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev)
 static int usb6fire_comm_write8(struct comm_runtime *rt, u8 request,
 		u8 reg, u8 value)
 {
-	u8 buffer[13]; /* 13: maximum length of message */
+	u8 *buffer;
+	int ret;
+
+	/* 13: maximum length of message */
+	buffer = kmalloc(13, GFP_KERNEL);
+	if (!buffer)
+		return -ENOMEM;
 
 	usb6fire_comm_init_buffer(buffer, 0x00, request, reg, value, 0x00);
-	return usb6fire_comm_send_buffer(buffer, rt->chip->dev);
+	ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev);
+
+	kfree(buffer);
+	return ret;
 }
 
 static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request,
 		u8 reg, u8 vl, u8 vh)
 {
-	u8 buffer[13]; /* 13: maximum length of message */
+	u8 *buffer;
+	int ret;
+
+	/* 13: maximum length of message */
+	buffer = kmalloc(13, GFP_KERNEL);
+	if (!buffer)
+		return -ENOMEM;
 
 	usb6fire_comm_init_buffer(buffer, 0x00, request, reg, vl, vh);
-	return usb6fire_comm_send_buffer(buffer, rt->chip->dev);
+	ret = usb6fire_comm_send_buffer(buffer, rt->chip->dev);
+
+	kfree(buffer);
+	return ret;
 }
 
 int usb6fire_comm_init(struct sfire_chip *chip)
@@ -135,6 +153,12 @@ int usb6fire_comm_init(struct sfire_chip *chip)
 	if (!rt)
 		return -ENOMEM;
 
+	rt->receiver_buffer = kzalloc(COMM_RECEIVER_BUFSIZE, GFP_KERNEL);
+	if (!rt->receiver_buffer) {
+		kfree(rt);
+		return -ENOMEM;
+	}
+
 	urb = &rt->receiver;
 	rt->serial = 1;
 	rt->chip = chip;
@@ -153,6 +177,7 @@ int usb6fire_comm_init(struct sfire_chip *chip)
 	urb->interval = 1;
 	ret = usb_submit_urb(urb, GFP_KERNEL);
 	if (ret < 0) {
+		kfree(rt->receiver_buffer);
 		kfree(rt);
 		snd_printk(KERN_ERR PREFIX "cannot create comm data receiver.");
 		return ret;
@@ -171,6 +196,9 @@ void usb6fire_comm_abort(struct sfire_chip *chip)
 
 void usb6fire_comm_destroy(struct sfire_chip *chip)
 {
-	kfree(chip->comm);
+	struct comm_runtime *rt = chip->comm;
+
+	kfree(rt->receiver_buffer);
+	kfree(rt);
 	chip->comm = NULL;
 }
diff --git a/sound/usb/6fire/comm.h b/sound/usb/6fire/comm.h
index 6a0840b..780d5ed 100644
--- a/sound/usb/6fire/comm.h
+++ b/sound/usb/6fire/comm.h
@@ -24,7 +24,7 @@ struct comm_runtime {
 	struct sfire_chip *chip;
 
 	struct urb receiver;
-	u8 receiver_buffer[COMM_RECEIVER_BUFSIZE];
+	u8 *receiver_buffer;
 
 	u8 serial; /* urb serial */
 
-- 
1.8.1.2


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

* [PATCH 108/133] drm: Don't pass negative delta to ktime_sub_ns()
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (106 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 107/133] ALSA: 6fire: fix DMA issues with URB transfer_buffer usage Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 109/133] ALSA: usb-audio: do not trust too-big wMaxPacketSize values Kamal Mostafa
                   ` (24 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michel Dänzer, Dave Airlie, Kamal Mostafa

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

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

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

commit e91abf80a0998f326107874c88d549f94839f13c upstream.

It takes an unsigned value. This happens not to blow up on 64-bit
architectures, but it does on 32-bit, causing
drm_calc_vbltimestamp_from_scanoutpos() to calculate totally bogus
timestamps for vblank events. Which in turn causes e.g. gnome-shell to
hang after a DPMS off cycle with current xf86-video-ati Git.

[airlied: regression introduced in drm: use monotonic time in drm_calc_vbltimestamp_from_scanoutpos]

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59339
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59836
Tested-by: shui yangwei <yangweix.shui@intel.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/drm_irq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 570dac6..0f3cdda 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -704,7 +704,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,
 	/* Subtract time delta from raw timestamp to get final
 	 * vblank_time timestamp for end of vblank.
 	 */
-	etime = ktime_sub_ns(etime, delta_ns);
+	if (delta_ns < 0)
+		etime = ktime_add_ns(etime, -delta_ns);
+	else
+		etime = ktime_sub_ns(etime, delta_ns);
 	*vblank_time = ktime_to_timeval(etime);
 
 	DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
-- 
1.8.1.2


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

* [PATCH 109/133] ALSA: usb-audio: do not trust too-big wMaxPacketSize values
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (107 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 108/133] drm: Don't pass negative delta to ktime_sub_ns() Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 110/133] hwmon: (adt7470) Fix incorrect return code check Kamal Mostafa
                   ` (23 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Clemens Ladisch, Takashi Iwai, Kamal Mostafa

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

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

From: Clemens Ladisch <clemens@ladisch.de>

commit 57e6dae1087bbaa6b33d3dd8a8e90b63888939a3 upstream.

The driver used to assume that the streaming endpoint's wMaxPacketSize
value would be an indication of how much data the endpoint expects or
sends, and compute the number of packets per URB using this value.

However, the Focusrite Scarlett 2i4 declares a value of 1024 bytes,
while only about 88 or 44 bytes are be actually used.  This discrepancy
would result in URBs with far too few packets, which would not work
correctly on the EHCI driver.

To get correct URBs, use wMaxPacketSize only as an upper limit on the
packet size.

Reported-by: James Stone <jamesmstone@gmail.com>
Tested-by: James Stone <jamesmstone@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/endpoint.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 63cca3a..d5ec603 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -584,17 +584,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
 	ep->stride = frame_bits >> 3;
 	ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0;
 
-	/* calculate max. frequency */
-	if (ep->maxpacksize) {
+	/* assume max. frequency is 25% higher than nominal */
+	ep->freqmax = ep->freqn + (ep->freqn >> 2);
+	maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))
+				>> (16 - ep->datainterval);
+	/* but wMaxPacketSize might reduce this */
+	if (ep->maxpacksize && ep->maxpacksize < maxsize) {
 		/* whatever fits into a max. size packet */
 		maxsize = ep->maxpacksize;
 		ep->freqmax = (maxsize / (frame_bits >> 3))
 				<< (16 - ep->datainterval);
-	} else {
-		/* no max. packet size: just take 25% higher than nominal */
-		ep->freqmax = ep->freqn + (ep->freqn >> 2);
-		maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))
-				>> (16 - ep->datainterval);
 	}
 
 	if (ep->fill_max)
-- 
1.8.1.2


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

* [PATCH 110/133] hwmon: (adt7470) Fix incorrect return code check
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (108 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 109/133] ALSA: usb-audio: do not trust too-big wMaxPacketSize values Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 111/133] powerpc: On POWERNV enable PPC_DENORMALISATION by default Kamal Mostafa
                   ` (22 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Curt Brune, Guenter Roeck, Kamal Mostafa

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

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

From: Curt Brune <curt@cumulusnetworks.com>

commit 93d783bcca69bfacc8dc739d8a050498402587b5 upstream.

In adt7470_write_word_data(), which writes two bytes using
i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
together when they should be OR-ed together.

The return code of i2c_smbus_write_byte_data() is zero for success.

The upshot is only the first byte was ever written to the hardware.
The 2nd byte was never written out.

I noticed that trying to set the fan speed limits was not working
correctly on my system.  Setting the fan speed limits is the only
code that uses adt7470_write_word_data().  After making the change
the limit settings work and the alarms work also.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hwmon/adt7470.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 39ecb1a..aa63420 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg,
 					  u16 value)
 {
 	return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
-	       && i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
+	       || i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
 }
 
 static void adt7470_init_client(struct i2c_client *client)
-- 
1.8.1.2


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

* [PATCH 111/133] powerpc: On POWERNV enable PPC_DENORMALISATION by default
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (109 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 110/133] hwmon: (adt7470) Fix incorrect return code check Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 112/133] Btrfs: release both paths before logging dir/changed extents Kamal Mostafa
                   ` (21 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Anton Blanchard, Benjamin Herrenschmidt, Kamal Mostafa

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

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

From: Anton Blanchard <anton@samba.org>

commit 4e90a2a7375e86827541bda9393414c03e7721c6 upstream.

We want PPC_DENORMALISATION enabled when POWERNV is enabled,
so update the Kconfig.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/powerpc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index dabe429..74002f0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -574,7 +574,7 @@ config SCHED_SMT
 config PPC_DENORMALISATION
 	bool "PowerPC denormalisation exception handling"
 	depends on PPC_BOOK3S_64
-	default "n"
+	default "y" if PPC_POWERNV
 	---help---
 	  Add support for handling denormalisation of single precision
 	  values.  Useful for bare metal only.  If unsure say Y here.
-- 
1.8.1.2


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

* [PATCH 112/133] Btrfs: release both paths before logging dir/changed extents
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (110 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 111/133] powerpc: On POWERNV enable PPC_DENORMALISATION by default Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 113/133] sched: Ensure update_cfs_shares() is called for parents of continuously-running tasks Kamal Mostafa
                   ` (20 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Josef Bacik, Chris Mason, Kamal Mostafa

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

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

From: Josef Bacik <jbacik@fusionio.com>

commit f3b15ccdbb9a79781578249a63318805e55a6c34 upstream.

The ceph guys tripped over this bug where we were still holding onto the
original path that we used to copy the inode with when logging.  This is based
on Chris's fix which was reported to fix the problem.  We need to drop the paths
in two cases anyway so just move the drop up so that we don't have duplicate
code.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/btrfs/tree-log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 8a00e2f..372a7d4 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3684,8 +3684,9 @@ next_slot:
 	}
 
 log_extents:
+	btrfs_release_path(path);
+	btrfs_release_path(dst_path);
 	if (fast_search) {
-		btrfs_release_path(dst_path);
 		ret = btrfs_log_changed_extents(trans, root, inode, dst_path);
 		if (ret) {
 			err = ret;
@@ -3702,8 +3703,6 @@ log_extents:
 	}
 
 	if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {
-		btrfs_release_path(path);
-		btrfs_release_path(dst_path);
 		ret = log_directory_changes(trans, root, inode, path, dst_path);
 		if (ret) {
 			err = ret;
-- 
1.8.1.2


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

* [PATCH 113/133] sched: Ensure update_cfs_shares() is called for parents of continuously-running tasks
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (111 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 112/133] Btrfs: release both paths before logging dir/changed extents Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 114/133] cifs: extend the buffer length enought for sprintf() using Kamal Mostafa
                   ` (19 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Zijlstra, Ingo Molnar, Kamal Mostafa

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

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

From: Peter Zijlstra <peterz@infradead.org>

commit bf0bd948d1682e3996adc093b43021ed391983e6 upstream.

We typically update a task_group's shares within the dequeue/enqueue
path.  However, continuously running tasks sharing a CPU are not
subject to these updates as they are only put/picked.  Unfortunately,
when we reverted f269ae046 (in 17bc14b7), we lost the augmenting
periodic update that was supposed to account for this; resulting in a
potential loss of fairness.

To fix this, re-introduce the explicit update in
update_cfs_rq_blocked_load() [called via entity_tick()].

Reported-by: Max Hailperin <max@gustavus.edu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Paul Turner <pjt@google.com>
Link: http://lkml.kernel.org/n/tip-9545m3apw5d93ubyrotrj31y@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/sched/fair.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 81fa536..7d0374f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1964,6 +1964,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued)
 	 */
 	update_entity_load_avg(curr, 1);
 	update_cfs_rq_blocked_load(cfs_rq, 1);
+	update_cfs_shares(cfs_rq);
 
 #ifdef CONFIG_SCHED_HRTICK
 	/*
-- 
1.8.1.2


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

* [PATCH 114/133] cifs: extend the buffer length enought for sprintf() using
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (112 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 113/133] sched: Ensure update_cfs_shares() is called for parents of continuously-running tasks Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 115/133] perf/x86: Fix intel QPI uncore event definitions Kamal Mostafa
                   ` (18 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Chen Gang, Steve French, Kamal Mostafa

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

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

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

commit 057d6332b24a4497c55a761c83c823eed9e3f23b upstream.

For cifs_set_cifscreds() in "fs/cifs/connect.c", 'desc' buffer length
is 'CIFSCREDS_DESC_SIZE' (56 is less than 256), and 'ses->domainName'
length may be "255 + '\0'".

The related sprintf() may cause memory overflow, so need extend related
buffer enough to hold all things.

It is also necessary to be sure of 'ses->domainName' must be less than
256, and define the related macro instead of hard code number '256'.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: Scott Lovenberg <scott.lovenberg@gmail.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cifs/cifsencrypt.c | 2 +-
 fs/cifs/cifsglob.h    | 1 +
 fs/cifs/connect.c     | 7 ++++---
 fs/cifs/sess.c        | 6 +++---
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 6d718c3..5488fe3 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -390,7 +390,7 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp)
 		if (blobptr + attrsize > blobend)
 			break;
 		if (type == NTLMSSP_AV_NB_DOMAIN_NAME) {
-			if (!attrsize)
+			if (!attrsize || attrsize >= CIFS_MAX_DOMAINNAME_LEN)
 				break;
 			if (!ses->domainName) {
 				ses->domainName =
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index e6899ce..420141c 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -44,6 +44,7 @@
 #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
 #define MAX_SERVER_SIZE 15
 #define MAX_SHARE_SIZE 80
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define MAX_USERNAME_SIZE 256	/* reasonable maximum for current servers */
 #define MAX_PASSWORD_SIZE 512	/* max for windows seems to be 256 wide chars */
 
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index c70d31a..6771d01 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1660,7 +1660,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
 			if (string == NULL)
 				goto out_nomem;
 
-			if (strnlen(string, 256) == 256) {
+			if (strnlen(string, CIFS_MAX_DOMAINNAME_LEN)
+					== CIFS_MAX_DOMAINNAME_LEN) {
 				printk(KERN_WARNING "CIFS: domain name too"
 						    " long\n");
 				goto cifs_parse_mount_err;
@@ -2321,8 +2322,8 @@ cifs_put_smb_ses(struct cifs_ses *ses)
 
 #ifdef CONFIG_KEYS
 
-/* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */
-#define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1)
+/* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */
+#define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1)
 
 /* Populate username and pw fields from keyring if possible */
 static int
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 76809f4..0ba9bf7 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -198,7 +198,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses,
 		bytes_ret = 0;
 	} else
 		bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->domainName,
-					    256, nls_cp);
+					    CIFS_MAX_DOMAINNAME_LEN, nls_cp);
 	bcc_ptr += 2 * bytes_ret;
 	bcc_ptr += 2;  /* account for null terminator */
 
@@ -256,8 +256,8 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
 
 	/* copy domain */
 	if (ses->domainName != NULL) {
-		strncpy(bcc_ptr, ses->domainName, 256);
-		bcc_ptr += strnlen(ses->domainName, 256);
+		strncpy(bcc_ptr, ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
+		bcc_ptr += strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN);
 	} /* else we will send a null domain name
 	     so the server will default to its own domain */
 	*bcc_ptr = 0;
-- 
1.8.1.2


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

* [PATCH 115/133] perf/x86: Fix intel QPI uncore event definitions
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (113 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 114/133] cifs: extend the buffer length enought for sprintf() using Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 116/133] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately Kamal Mostafa
                   ` (17 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vince Weaver, zheng.z.yan, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Paul Mackerras, Ingo Molnar,
	Kamal Mostafa

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

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

From: Vince Weaver <vincent.weaver@maine.edu>

commit c9601247f8f3fdc18aed7ed7e490e8dfcd07f122 upstream.

John McCalpin reports that the "drs_data" and "ncb_data" QPI
uncore events are missing the "extra bit" and always return zero
values unless the bit is properly set.

More details from him:

 According to the Xeon E5-2600 Product Family Uncore Performance
 Monitoring Guide, Table 2-94, about 1/2 of the QPI Link Layer events
 (including the ones that "perf" calls "drs_data" and "ncb_data") require
 that the "extra bit" be set.

 This was confusing for a while -- a note at the bottom of page 94 says
 that the "extra bit" is bit 16 of the control register.
 Unfortunately, Table 2-86 clearly says that bit 16 is reserved and must
 be zero.  Looking around a bit, I found that bit 21 appears to be the
 correct "extra bit", and further investigation shows that "perf" actually
 agrees with me:
	[root@c560-003.stampede]# cat /sys/bus/event_source/devices/uncore_qpi_0/format/event
	config:0-7,21

 So the command
	# perf -e "uncore_qpi_0/event=drs_data/"
 Is the same as
	# perf -e "uncore_qpi_0/event=0x02,umask=0x08/"
 While it should be
	# perf -e "uncore_qpi_0/event=0x102,umask=0x08/"

 I confirmed that this last version gives results that agree with the
 amount of data that I expected the STREAM benchmark to move across the QPI
 link in the second (cross-chip) test of the original script.

Reported-by: John McCalpin <mccalpin@tacc.utexas.edu>
Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: zheng.z.yan@intel.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Paul Mackerras <paulus@samba.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1308021037280.26119@vincent-weaver-1.um.maine.edu
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 3e091f0..99e70d45 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -315,8 +315,8 @@ static struct uncore_event_desc snbep_uncore_imc_events[] = {
 static struct uncore_event_desc snbep_uncore_qpi_events[] = {
 	INTEL_UNCORE_EVENT_DESC(clockticks,       "event=0x14"),
 	INTEL_UNCORE_EVENT_DESC(txl_flits_active, "event=0x00,umask=0x06"),
-	INTEL_UNCORE_EVENT_DESC(drs_data,         "event=0x02,umask=0x08"),
-	INTEL_UNCORE_EVENT_DESC(ncb_data,         "event=0x03,umask=0x04"),
+	INTEL_UNCORE_EVENT_DESC(drs_data,         "event=0x102,umask=0x08"),
+	INTEL_UNCORE_EVENT_DESC(ncb_data,         "event=0x103,umask=0x04"),
 	{ /* end: all zeroes */ },
 };
 
-- 
1.8.1.2


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

* [PATCH 116/133] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (114 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 115/133] perf/x86: Fix intel QPI uncore event definitions Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 117/133] ext4: allow the mount options nodelalloc and data=journal Kamal Mostafa
                   ` (16 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan (metze) Metzmacher, Sachin Prabhu, Jeff Layton,
	Steve French, Kamal Mostafa

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

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

From: Jeff Layton <jlayton@redhat.com>

commit 757c4f6260febff982276818bb946df89c1105aa upstream.

David reported that commit c2b93e06 (cifs: only set ops for inodes in
I_NEW state) caused a regression with mfsymlinks. Prior to that patch,
if a mfsymlink dentry was instantiated at readdir time, the inode would
get a new set of ops when it was revalidated. After that patch, this
did not occur.

This patch addresses this by simply skipping instantiating dentries in
the readdir codepath when we know that they will need to be immediately
revalidated. The next attempt to use that dentry will cause a new lookup
to occur (which is basically what we want to happen anyway).

Cc: "Stefan (metze) Metzmacher" <metze@samba.org>
Cc: Sachin Prabhu <sprabhu@redhat.com>
Reported-and-Tested-by: David McBride <dwm37@cam.ac.uk>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/cifs/readdir.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index cdd6ff4..5e636a8 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -113,6 +113,14 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
 			return;
 	}
 
+	/*
+	 * If we know that the inode will need to be revalidated immediately,
+	 * then don't create a new dentry for it. We'll end up doing an on
+	 * the wire call either way and this spares us an invalidation.
+	 */
+	if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL)
+		return;
+
 	dentry = d_alloc(parent, name);
 	if (!dentry)
 		return;
-- 
1.8.1.2


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

* [PATCH 117/133] ext4: allow the mount options nodelalloc and data=journal
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (115 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 116/133] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 118/133] ext4: fix mount/remount error messages for incompatible mount options Kamal Mostafa
                   ` (15 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Theodore Ts'o, Kamal Mostafa

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

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

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

commit 59d9fa5c2e9086db11aa287bb4030151d0095a17 upstream.

Commit 26092bf ("ext4: use a table-driven handler for mount options")
wrongly disallows the specifying the mount options nodelalloc and
data=journal simultaneously.  This is incorrect; it should have only
disallowed the combination of delalloc and data=journal
simultaneously.

Reported-by: Piotr Sarna <p.sarna@partner.samsung.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d757050..1e4b5926 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1426,7 +1426,7 @@ static const struct mount_opts {
 	{Opt_discard, EXT4_MOUNT_DISCARD, MOPT_SET},
 	{Opt_nodiscard, EXT4_MOUNT_DISCARD, MOPT_CLEAR},
 	{Opt_delalloc, EXT4_MOUNT_DELALLOC, MOPT_SET | MOPT_EXPLICIT},
-	{Opt_nodelalloc, EXT4_MOUNT_DELALLOC, MOPT_CLEAR | MOPT_EXPLICIT},
+	{Opt_nodelalloc, EXT4_MOUNT_DELALLOC, MOPT_CLEAR},
 	{Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM, MOPT_SET},
 	{Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT |
 				    EXT4_MOUNT_JOURNAL_CHECKSUM), MOPT_SET},
-- 
1.8.1.2


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

* [PATCH 118/133] ext4: fix mount/remount error messages for incompatible mount options
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (116 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 117/133] ext4: allow the mount options nodelalloc and data=journal Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 119/133] perf/arm: Fix armpmu_map_hw_event() Kamal Mostafa
                   ` (14 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Piotr Sarna, Kyungmin Park, Theodore Ts'o, Kamal Mostafa

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

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

From: Piotr Sarna <p.sarna@partner.samsung.com>

commit 6ae6514b33f941d3386da0dfbe2942766eab1577 upstream.

Commit 5688978 ("ext4: improve handling of conflicting mount options")
introduced incorrect messages shown while choosing wrong mount options.

First of all, both cases of incorrect mount options,
"data=journal,delalloc" and "data=journal,dioread_nolock" result in
the same error message.

Secondly, the problem above isn't solved for remount option: the
mismatched parameter is simply ignored.  Moreover, ext4_msg states
that remount with options "data=journal,delalloc" succeeded, which is
not true.

To fix it up, I added a simple check after parse_options() call to
ensure that data=journal and delalloc/dioread_nolock parameters are
not present at the same time.

Signed-off-by: Piotr Sarna <p.sarna@partner.samsung.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ext4/super.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 1e4b5926..b83f75d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3440,7 +3440,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		}
 		if (test_opt(sb, DIOREAD_NOLOCK)) {
 			ext4_msg(sb, KERN_ERR, "can't mount with "
-				 "both data=journal and delalloc");
+				 "both data=journal and dioread_nolock");
 			goto failed_mount;
 		}
 		if (test_opt(sb, DELALLOC))
@@ -4618,6 +4618,21 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 		goto restore_opts;
 	}
 
+	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
+		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
+			ext4_msg(sb, KERN_ERR, "can't mount with "
+				 "both data=journal and delalloc");
+			err = -EINVAL;
+			goto restore_opts;
+		}
+		if (test_opt(sb, DIOREAD_NOLOCK)) {
+			ext4_msg(sb, KERN_ERR, "can't mount with "
+				 "both data=journal and dioread_nolock");
+			err = -EINVAL;
+			goto restore_opts;
+		}
+	}
+
 	if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
 		ext4_abort(sb, "Abort forced by user");
 
-- 
1.8.1.2


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

* [PATCH 119/133] perf/arm: Fix armpmu_map_hw_event()
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (117 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 118/133] ext4: fix mount/remount error messages for incompatible mount options Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 120/133] microblaze: fix clone syscall Kamal Mostafa
                   ` (13 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ingo Molnar, Linus Torvalds, Kamal Mostafa

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

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

From: Stephen Boyd <sboyd@codeaurora.org>

commit b88a2595b6d8aedbd275c07dfa784657b4f757eb upstream.

Fix constraint check in armpmu_map_hw_event().

Reported-and-tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/kernel/perf_event.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 5da31bb..0a29456 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -53,7 +53,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)
 static int
 armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
 {
-	int mapping = (*event_map)[config];
+	int mapping;
+
+	if (config >= PERF_COUNT_HW_MAX)
+		return -ENOENT;
+
+	mapping = (*event_map)[config];
 	return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
 }
 
-- 
1.8.1.2


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

* [PATCH 120/133] microblaze: fix clone syscall
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (118 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 119/133] perf/arm: Fix armpmu_map_hw_event() Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 121/133] x86 get_unmapped_area(): use proper mmap base for bottom-up direction Kamal Mostafa
                   ` (12 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Simek, Andrew Morton, Linus Torvalds, Kamal Mostafa

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

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

From: Michal Simek <michal.simek@xilinx.com>

commit dfa9771a7c4784bafd0673bc7abcee3813088b77 upstream.

Fix inadvertent breakage in the clone syscall ABI for Microblaze that
was introduced in commit f3268edbe6fe ("microblaze: switch to generic
fork/vfork/clone").

The Microblaze syscall ABI for clone takes the parent tid address in the
4th argument; the third argument slot is used for the stack size.  The
incorrectly-used CLONE_BACKWARDS type assigned parent tid to the 3rd
slot.

This commit restores the original ABI so that existing userspace libc
code will work correctly.

All kernel versions from v3.8-rc1 were affected.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/Kconfig             | 6 ++++++
 arch/microblaze/Kconfig  | 2 +-
 include/linux/syscalls.h | 5 +++++
 kernel/fork.c            | 6 ++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 7f8f281..acb6d03 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -373,4 +373,10 @@ config CLONE_BACKWARDS2
 	help
 	  Architecture has the first two arguments of clone(2) swapped.
 
+config CLONE_BACKWARDS3
+	bool
+	help
+	  Architecture has tls passed as the 3rd argument of clone(2),
+	  not the 5th one.
+
 source "kernel/gcov/Kconfig"
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index ba3b7c8..458991c 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -26,7 +26,7 @@ config MICROBLAZE
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select MODULES_USE_ELF_RELA
-	select CLONE_BACKWARDS
+	select CLONE_BACKWARDS3
 
 config SWAP
 	def_bool n
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 45e2db2..2ce3071 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -839,9 +839,14 @@ asmlinkage long sys_vfork(void);
 asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
 	       int __user *);
 #else
+#ifdef CONFIG_CLONE_BACKWARDS3
+asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,
+			  int __user *, int);
+#else
 asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
 	       int __user *, int);
 #endif
+#endif
 
 asmlinkage long sys_execve(const char __user *filename,
 		const char __user *const __user *argv,
diff --git a/kernel/fork.c b/kernel/fork.c
index 5630e52..1c53e38 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1664,6 +1664,12 @@ SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags,
 		 int __user *, parent_tidptr,
 		 int __user *, child_tidptr,
 		 int, tls_val)
+#elif defined(CONFIG_CLONE_BACKWARDS3)
+SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp,
+		int, stack_size,
+		int __user *, parent_tidptr,
+		int __user *, child_tidptr,
+		int, tls_val)
 #else
 SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
 		 int __user *, parent_tidptr,
-- 
1.8.1.2


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

* [PATCH 121/133] x86 get_unmapped_area(): use proper mmap base for bottom-up direction
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (119 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 120/133] microblaze: fix clone syscall Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 122/133] fs/proc/task_mmu.c: fix buffer overflow in add_page_map() Kamal Mostafa
                   ` (11 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michel Lespinasse, Oleg Nesterov, Adrian Sendroiu, Andrew Morton,
	Linus Torvalds, Kamal Mostafa

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

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

From: Radu Caragea <sinaelgl@gmail.com>

commit df54d6fa54275ce59660453e29d1228c2b45a826 upstream.

When the stack is set to unlimited, the bottomup direction is used for
mmap-ings but the mmap_base is not used and thus effectively renders
ASLR for mmapings along with PIE useless.

Cc: Michel Lespinasse <walken@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Sendroiu <molecula2788@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/sys_x86_64.c | 2 +-
 arch/x86/mm/mmap.c           | 2 +-
 include/linux/sched.h        | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 97ef74b..af46e18 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -101,7 +101,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
 				*begin = new_begin;
 		}
 	} else {
-		*begin = TASK_UNMAPPED_BASE;
+		*begin = mmap_legacy_base();
 		*end = TASK_SIZE;
 	}
 }
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 845df68..c1af323 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -98,7 +98,7 @@ static unsigned long mmap_base(void)
  * Bottom-up (legacy) layout on X86_32 did not support randomization, X86_64
  * does, but not when emulating X86_32
  */
-static unsigned long mmap_legacy_base(void)
+unsigned long mmap_legacy_base(void)
 {
 	if (mmap_is_ia32())
 		return TASK_UNMAPPED_BASE;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index caa76ae..9d96429 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -360,6 +360,7 @@ extern int sysctl_max_map_count;
 #include <linux/aio.h>
 
 #ifdef CONFIG_MMU
+extern unsigned long mmap_legacy_base(void);
 extern void arch_pick_mmap_layout(struct mm_struct *mm);
 extern unsigned long
 arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
-- 
1.8.1.2


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

* [PATCH 122/133] fs/proc/task_mmu.c: fix buffer overflow in add_page_map()
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (120 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 121/133] x86 get_unmapped_area(): use proper mmap base for bottom-up direction Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 123/133] arcnet: cleanup sizeof parameter Kamal Mostafa
                   ` (10 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yonghua Zheng, Andrew Morton, Linus Torvalds, Kamal Mostafa

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

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

From: yonghua zheng <younghua.zheng@gmail.com>

commit 8c8296223f3abb142be8fc31711b18a704c0e7d8 upstream.

Recently we met quite a lot of random kernel panic issues after enabling
CONFIG_PROC_PAGE_MONITOR.  After debuggind we found this has something
to do with following bug in pagemap:

In struct pagemapread:

  struct pagemapread {
      int pos, len;
      pagemap_entry_t *buffer;
      bool v2;
  };

pos is number of PM_ENTRY_BYTES in buffer, but len is the size of
buffer, it is a mistake to compare pos and len in add_page_map() for
checking buffer is full or not, and this can lead to buffer overflow and
random kernel panic issue.

Correct len to be total number of PM_ENTRY_BYTES in buffer.

[akpm@linux-foundation.org: document pagemapread.pos and .len units, fix PM_ENTRY_BYTES definition]
Signed-off-by: Yonghua Zheng <younghua.zheng@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/proc/task_mmu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ca5ce7f..f31d90f 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -792,14 +792,14 @@ typedef struct {
 } pagemap_entry_t;
 
 struct pagemapread {
-	int pos, len;
+	int pos, len;		/* units: PM_ENTRY_BYTES, not bytes */
 	pagemap_entry_t *buffer;
 };
 
 #define PAGEMAP_WALK_SIZE	(PMD_SIZE)
 #define PAGEMAP_WALK_MASK	(PMD_MASK)
 
-#define PM_ENTRY_BYTES      sizeof(u64)
+#define PM_ENTRY_BYTES      sizeof(pagemap_entry_t)
 #define PM_STATUS_BITS      3
 #define PM_STATUS_OFFSET    (64 - PM_STATUS_BITS)
 #define PM_STATUS_MASK      (((1LL << PM_STATUS_BITS) - 1) << PM_STATUS_OFFSET)
@@ -1038,8 +1038,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
 	if (!count)
 		goto out_task;
 
-	pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
-	pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);
+	pm.len = (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
+	pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_TEMPORARY);
 	ret = -ENOMEM;
 	if (!pm.buffer)
 		goto out_task;
-- 
1.8.1.2


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

* [PATCH 123/133] arcnet: cleanup sizeof parameter
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (121 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 122/133] fs/proc/task_mmu.c: fix buffer overflow in add_page_map() Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 124/133] sysctl net: Keep tcp_syn_retries inside the boundary Kamal Mostafa
                   ` (9 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S. Miller, Kamal Mostafa

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

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

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

[ Upstream commit 087d273caf4f7d3f2159256f255f1f432bc84a5b ]

This patch doesn't change the compiled code because ARC_HDR_SIZE is 4
and sizeof(int) is 4, but the intent was to use the header size and not
the sizeof the header size.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/arcnet/arcnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index a746ba2..a956053 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -1007,7 +1007,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
 
 	soft = &pkt.soft.rfc1201;
 
-	lp->hw.copy_from_card(dev, bufnum, 0, &pkt, sizeof(ARC_HDR_SIZE));
+	lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE);
 	if (pkt.hard.offset[0]) {
 		ofs = pkt.hard.offset[0];
 		length = 256 - ofs;
-- 
1.8.1.2


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

* [PATCH 124/133] sysctl net: Keep tcp_syn_retries inside the boundary
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (122 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 123/133] arcnet: cleanup sizeof parameter Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 125/133] ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup Kamal Mostafa
                   ` (8 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Tesar, David S. Miller, Kamal Mostafa

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

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

From: Michal Tesar <mtesar@redhat.com>

[ Upstream commit 651e92716aaae60fc41b9652f54cb6803896e0da ]

Limit the min/max value passed to the
/proc/sys/net/ipv4/tcp_syn_retries.

Signed-off-by: Michal Tesar <mtesar@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/sysctl_net_ipv4.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index d84400b..63632ea 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -35,6 +35,8 @@ static int tcp_adv_win_scale_min = -31;
 static int tcp_adv_win_scale_max = 31;
 static int ip_ttl_min = 1;
 static int ip_ttl_max = 255;
+static int tcp_syn_retries_min = 1;
+static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
 static int ip_ping_group_range_min[] = { 0, 0 };
 static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
 
@@ -330,7 +332,9 @@ static struct ctl_table ipv4_table[] = {
 		.data		= &sysctl_tcp_syn_retries,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &tcp_syn_retries_min,
+		.extra2		= &tcp_syn_retries_max
 	},
 	{
 		.procname	= "tcp_synack_retries",
-- 
1.8.1.2


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

* [PATCH 125/133] ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (123 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 124/133] sysctl net: Keep tcp_syn_retries inside the boundary Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 126/133] usbnet: do not pretend to support SG/TSO Kamal Mostafa
                   ` (7 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hannes Frederic Sowa, David S. Miller, Kamal Mostafa

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

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

From: Hannes Frederic Sowa <hannes@stressinduktion.org>

[ Upstream commit 905a6f96a1b18e490a75f810d733ced93c39b0e5 ]

Otherwise we end up dereferencing the already freed net->ipv6.mrt pointer
which leads to a panic (from Srivatsa S. Bhat):

BUG: unable to handle kernel paging request at ffff882018552020
IP: [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6]
PGD 290a067 PUD 207ffe0067 PMD 207ff1d067 PTE 8000002018552060
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
Modules linked in: ebtable_nat ebtables nfs fscache nf_conntrack_ipv4 nf_defrag_ipv4 ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables nfsd lockd nfs_acl exportfs auth_rpcgss autofs4 sunrpc 8021q garp bridge stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter
+ip6_tables ipv6 vfat fat vhost_net macvtap macvlan vhost tun kvm_intel kvm uinput iTCO_wdt iTCO_vendor_support cdc_ether usbnet mii microcode i2c_i801 i2c_core lpc_ich mfd_core shpchp ioatdma dca mlx4_core be2net wmi acpi_cpufreq mperf ext4 jbd2 mbcache dm_mirror dm_region_hash dm_log dm_mod
CPU: 0 PID: 7 Comm: kworker/u33:0 Not tainted 3.11.0-rc1-ea45e-a #4
Hardware name: IBM  -[8737R2A]-/00Y2738, BIOS -[B2E120RUS-1.20]- 11/30/2012
Workqueue: netns cleanup_net
task: ffff8810393641c0 ti: ffff881039366000 task.ti: ffff881039366000
RIP: 0010:[<ffffffffa0366b02>]  [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6]
RSP: 0018:ffff881039367bd8  EFLAGS: 00010286
RAX: ffff881039367fd8 RBX: ffff882018552000 RCX: dead000000200200
RDX: 0000000000000000 RSI: ffff881039367b68 RDI: ffff881039367b68
RBP: ffff881039367bf8 R08: ffff881039367b68 R09: 2222222222222222
R10: 2222222222222222 R11: 2222222222222222 R12: ffff882015a7a040
R13: ffff882014eb89c0 R14: ffff8820289e2800 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88103fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff882018552020 CR3: 0000000001c0b000 CR4: 00000000000407f0
Stack:
 ffff881039367c18 ffff882014eb89c0 ffff882015e28c00 0000000000000000
 ffff881039367c18 ffffffffa034d9d1 ffff8820289e2800 ffff882014eb89c0
 ffff881039367c58 ffffffff815bdecb ffffffff815bddf2 ffff882014eb89c0
Call Trace:
 [<ffffffffa034d9d1>] rawv6_close+0x21/0x40 [ipv6]
 [<ffffffff815bdecb>] inet_release+0xfb/0x220
 [<ffffffff815bddf2>] ? inet_release+0x22/0x220
 [<ffffffffa032686f>] inet6_release+0x3f/0x50 [ipv6]
 [<ffffffff8151c1d9>] sock_release+0x29/0xa0
 [<ffffffff81525520>] sk_release_kernel+0x30/0x70
 [<ffffffffa034f14b>] icmpv6_sk_exit+0x3b/0x80 [ipv6]
 [<ffffffff8152fff9>] ops_exit_list+0x39/0x60
 [<ffffffff815306fb>] cleanup_net+0xfb/0x1a0
 [<ffffffff81075e3a>] process_one_work+0x1da/0x610
 [<ffffffff81075dc9>] ? process_one_work+0x169/0x610
 [<ffffffff81076390>] worker_thread+0x120/0x3a0
 [<ffffffff81076270>] ? process_one_work+0x610/0x610
 [<ffffffff8107da2e>] kthread+0xee/0x100
 [<ffffffff8107d940>] ? __init_kthread_worker+0x70/0x70
 [<ffffffff8162a99c>] ret_from_fork+0x7c/0xb0
 [<ffffffff8107d940>] ? __init_kthread_worker+0x70/0x70
Code: 20 48 89 5d e8 4c 89 65 f0 4c 89 6d f8 66 66 66 66 90 4c 8b 67 30 49 89 fd e8 db 3c 1e e1 49 8b 9c 24 90 08 00 00 48 85 db 74 06 <4c> 39 6b 20 74 20 bb f3 ff ff ff e8 8e 3c 1e e1 89 d8 4c 8b 65
RIP  [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6]
 RSP <ffff881039367bd8>
CR2: ffff882018552020

Reported-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Tested-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv6/ip6mr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 8fd154e..1535096 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -259,10 +259,12 @@ static void __net_exit ip6mr_rules_exit(struct net *net)
 {
 	struct mr6_table *mrt, *next;
 
+	rtnl_lock();
 	list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) {
 		list_del(&mrt->list);
 		ip6mr_free_table(mrt);
 	}
+	rtnl_unlock();
 	fib_rules_unregister(net->ipv6.mr6_rules_ops);
 }
 #else
@@ -289,7 +291,10 @@ static int __net_init ip6mr_rules_init(struct net *net)
 
 static void __net_exit ip6mr_rules_exit(struct net *net)
 {
+	rtnl_lock();
 	ip6mr_free_table(net->ipv6.mrt6);
+	net->ipv6.mrt6 = NULL;
+	rtnl_unlock();
 }
 #endif
 
-- 
1.8.1.2


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

* [PATCH 126/133] usbnet: do not pretend to support SG/TSO
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (124 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 125/133] ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 127/133] net_sched: Fix stack info leak in cbq_dump_wrr() Kamal Mostafa
                   ` (6 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S. Miller, Kamal Mostafa

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

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 20f0170377264e8449b6987041f0bcc4d746d3ed ]

usbnet doesn't support yet SG, so drivers should not advertise SG or TSO
capabilities, as they allow TCP stack to build large TSO packets that
need to be linearized and might use order-5 pages.

This adds an extra copy overhead and possible allocation failures.

Current code ignore skb_linearize() return code so crashes are even
possible.

Best is to not pretend SG/TSO is supported, and add this again when/if
usbnet really supports SG for devices who could get a performance gain.

Based on a prior patch from Freddy Xin <freddy@asix.com.tw>

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/usb/smsc75xx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 937c09d..506a024 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -45,7 +45,6 @@
 #define EEPROM_MAC_OFFSET		(0x01)
 #define DEFAULT_TX_CSUM_ENABLE		(true)
 #define DEFAULT_RX_CSUM_ENABLE		(true)
-#define DEFAULT_TSO_ENABLE		(true)
 #define SMSC75XX_INTERNAL_PHY_ID	(1)
 #define SMSC75XX_TX_OVERHEAD		(8)
 #define MAX_RX_FIFO_SIZE		(20 * 1024)
@@ -1412,17 +1411,14 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write);
 
-	if (DEFAULT_TX_CSUM_ENABLE) {
+	if (DEFAULT_TX_CSUM_ENABLE)
 		dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-		if (DEFAULT_TSO_ENABLE)
-			dev->net->features |= NETIF_F_SG |
-				NETIF_F_TSO | NETIF_F_TSO6;
-	}
+
 	if (DEFAULT_RX_CSUM_ENABLE)
 		dev->net->features |= NETIF_F_RXCSUM;
 
 	dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-		NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM;
+				NETIF_F_RXCSUM;
 
 	ret = smsc75xx_wait_ready(dev, 0);
 	if (ret < 0) {
@@ -2198,8 +2194,6 @@ static struct sk_buff *smsc75xx_tx_fixup(struct usbnet *dev,
 {
 	u32 tx_cmd_a, tx_cmd_b;
 
-	skb_linearize(skb);
-
 	if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) {
 		struct sk_buff *skb2 =
 			skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags);
-- 
1.8.1.2


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

* [PATCH 127/133] net_sched: Fix stack info leak in cbq_dump_wrr().
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (125 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 126/133] usbnet: do not pretend to support SG/TSO Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 128/133] af_key: more info leaks in pfkey messages Kamal Mostafa
                   ` (5 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S. Miller, Kamal Mostafa

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

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

From: "David S. Miller" <davem@davemloft.net>

[ Upstream commit a0db856a95a29efb1c23db55c02d9f0ff4f0db48 ]

Make sure the reserved fields, and padding (if any), are
fully initialized.

Based upon a patch by Dan Carpenter and feedback from
Joe Perches.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sched/sch_cbq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index ced81a1..27cedc1 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1468,6 +1468,7 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl)
 	unsigned char *b = skb_tail_pointer(skb);
 	struct tc_cbq_wrropt opt;
 
+	memset(&opt, 0, sizeof(opt));
 	opt.flags = 0;
 	opt.allot = cl->allot;
 	opt.priority = cl->priority + 1;
-- 
1.8.1.2


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

* [PATCH 128/133] af_key: more info leaks in pfkey messages
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (126 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 127/133] net_sched: Fix stack info leak in cbq_dump_wrr() Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 129/133] atl1c: use custom skb allocator Kamal Mostafa
                   ` (4 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S. Miller, Kamal Mostafa

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

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

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

[ Upstream commit ff862a4668dd6dba962b1d2d8bd344afa6375683 ]

This is inspired by a5cc68f3d6 "af_key: fix info leaks in notify
messages".  There are some struct members which don't get initialized
and could disclose small amounts of private information.

Acked-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/key/af_key.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 891db6c..e1cc508 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2076,6 +2076,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy *
 			pol->sadb_x_policy_type = IPSEC_POLICY_NONE;
 	}
 	pol->sadb_x_policy_dir = dir+1;
+	pol->sadb_x_policy_reserved = 0;
 	pol->sadb_x_policy_id = xp->index;
 	pol->sadb_x_policy_priority = xp->priority;
 
@@ -3111,7 +3112,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct
 	pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
 	pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC;
 	pol->sadb_x_policy_dir = XFRM_POLICY_OUT + 1;
+	pol->sadb_x_policy_reserved = 0;
 	pol->sadb_x_policy_id = xp->index;
+	pol->sadb_x_policy_priority = xp->priority;
 
 	/* Set sadb_comb's. */
 	if (x->id.proto == IPPROTO_AH)
@@ -3499,6 +3502,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
 	pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
 	pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC;
 	pol->sadb_x_policy_dir = dir + 1;
+	pol->sadb_x_policy_reserved = 0;
 	pol->sadb_x_policy_id = 0;
 	pol->sadb_x_policy_priority = 0;
 
-- 
1.8.1.2


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

* [PATCH 129/133] atl1c: use custom skb allocator
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (127 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 128/133] af_key: more info leaks in pfkey messages Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 130/133] net_sched: info leak in atm_tc_dump_class() Kamal Mostafa
                   ` (3 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, Luis Henriques, Neil Horman, David S. Miller,
	Kamal Mostafa

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

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 7b70176421993866e616f1cbc4d0dd4054f1bf78 ]

We had reports ( https://bugzilla.kernel.org/show_bug.cgi?id=54021 )
that using high order pages for skb allocations is problematic for atl1c

We do not know exactly what the problem is, but we suspect that crossing
4K pages is not well supported by this hardware.

Use a custom allocator, using page allocator and 2K fragments for
optimal stack behavior. We might make this allocator generic
in future kernels.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Luis Henriques <luis.henriques@canonical.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c.h      |  3 ++
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 40 ++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h
index b2bf324..0f05565 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h
@@ -520,6 +520,9 @@ struct atl1c_adapter {
 	struct net_device   *netdev;
 	struct pci_dev      *pdev;
 	struct napi_struct  napi;
+	struct page         *rx_page;
+	unsigned int	    rx_page_offset;
+	unsigned int	    rx_frag_size;
 	struct atl1c_hw        hw;
 	struct atl1c_hw_stats  hw_stats;
 	struct mii_if_info  mii;    /* MII interface info */
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index bfcb8bc..26a8c62 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -482,10 +482,15 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p)
 static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter,
 				struct net_device *dev)
 {
+	unsigned int head_size;
 	int mtu = dev->mtu;
 
 	adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ?
 		roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
+
+	head_size = SKB_DATA_ALIGN(adapter->rx_buffer_len + NET_SKB_PAD) +
+		    SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
+	adapter->rx_frag_size = roundup_pow_of_two(head_size);
 }
 
 static netdev_features_t atl1c_fix_features(struct net_device *netdev,
@@ -953,6 +958,10 @@ static void atl1c_free_ring_resources(struct atl1c_adapter *adapter)
 		kfree(adapter->tpd_ring[0].buffer_info);
 		adapter->tpd_ring[0].buffer_info = NULL;
 	}
+	if (adapter->rx_page) {
+		put_page(adapter->rx_page);
+		adapter->rx_page = NULL;
+	}
 }
 
 /**
@@ -1642,6 +1651,35 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter,
 	skb_checksum_none_assert(skb);
 }
 
+static struct sk_buff *atl1c_alloc_skb(struct atl1c_adapter *adapter)
+{
+	struct sk_buff *skb;
+	struct page *page;
+
+	if (adapter->rx_frag_size > PAGE_SIZE)
+		return netdev_alloc_skb(adapter->netdev,
+					adapter->rx_buffer_len);
+
+	page = adapter->rx_page;
+	if (!page) {
+		adapter->rx_page = page = alloc_page(GFP_ATOMIC);
+		if (unlikely(!page))
+			return NULL;
+		adapter->rx_page_offset = 0;
+	}
+
+	skb = build_skb(page_address(page) + adapter->rx_page_offset,
+			adapter->rx_frag_size);
+	if (likely(skb)) {
+		adapter->rx_page_offset += adapter->rx_frag_size;
+		if (adapter->rx_page_offset >= PAGE_SIZE)
+			adapter->rx_page = NULL;
+		else
+			get_page(page);
+	}
+	return skb;
+}
+
 static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter)
 {
 	struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
@@ -1663,7 +1701,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter)
 	while (next_info->flags & ATL1C_BUFFER_FREE) {
 		rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use);
 
-		skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len);
+		skb = atl1c_alloc_skb(adapter);
 		if (unlikely(!skb)) {
 			if (netif_msg_rx_err(adapter))
 				dev_warn(&pdev->dev, "alloc rx buffer failed\n");
-- 
1.8.1.2


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

* [PATCH 130/133] net_sched: info leak in atm_tc_dump_class()
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (128 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 129/133] atl1c: use custom skb allocator Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 131/133] ndisc: Add missing inline to ndisc_addr_option_pad Kamal Mostafa
                   ` (2 subsequent siblings)
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S. Miller, Kamal Mostafa

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

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

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

[ Upstream commit 8cb3b9c3642c0263d48f31d525bcee7170eedc20 ]

The "pvc" struct has a hole after pvc.sap_family which is not cleared.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sched/sch_atm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index ca8e0a5..1f9c314 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -605,6 +605,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
 		struct sockaddr_atmpvc pvc;
 		int state;
 
+		memset(&pvc, 0, sizeof(pvc));
 		pvc.sap_family = AF_ATMPVC;
 		pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1;
 		pvc.sap_addr.vpi = flow->vcc->vpi;
-- 
1.8.1.2


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

* [PATCH 131/133] ndisc: Add missing inline to ndisc_addr_option_pad
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (129 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 130/133] net_sched: info leak in atm_tc_dump_class() Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 132/133] 8139cp: Add dma_mapping_error checking Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 133/133] net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param Kamal Mostafa
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joe Perches, David S. Miller, Kamal Mostafa

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

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

From: Joe Perches <joe@perches.com>

[ Upstream commit d9d10a30964504af834d8d250a0c76d4ae91eb1e ]

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/net/ndisc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 23b3a7c..c9db93d 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -119,7 +119,7 @@ extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
  * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may
  * also need a pad of 2.
  */
-static int ndisc_addr_option_pad(unsigned short type)
+static inline int ndisc_addr_option_pad(unsigned short type)
 {
 	switch (type) {
 	case ARPHRD_INFINIBAND: return 2;
-- 
1.8.1.2


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

* [PATCH 132/133] 8139cp: Add dma_mapping_error checking
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (130 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 131/133] ndisc: Add missing inline to ndisc_addr_option_pad Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  2013-08-16 22:34 ` [PATCH 133/133] net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param Kamal Mostafa
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Neil Horman, David S. Miller, Francois Romieu, Kamal Mostafa

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

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

From: Neil Horman <nhorman@tuxdriver.com>

[ Upstream commit cf3c4c03060b688cbc389ebc5065ebcce5653e96 ]

Self explanitory dma_mapping_error addition to the 8139 driver, based on this:
https://bugzilla.redhat.com/show_bug.cgi?id=947250

It showed several backtraces arising for dma_map_* usage without checking the
return code on the mapping.  Add the check and abort the rx/tx operation if its
failed.  Untested as I have no hardware and the reporter has wandered off, but
seems pretty straightforward.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/realtek/8139cp.c | 48 ++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index f945393..9af14e0 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -478,7 +478,7 @@ rx_status_loop:
 
 	while (1) {
 		u32 status, len;
-		dma_addr_t mapping;
+		dma_addr_t mapping, new_mapping;
 		struct sk_buff *skb, *new_skb;
 		struct cp_desc *desc;
 		const unsigned buflen = cp->rx_buf_sz;
@@ -520,6 +520,13 @@ rx_status_loop:
 			goto rx_next;
 		}
 
+		new_mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen,
+					 PCI_DMA_FROMDEVICE);
+		if (dma_mapping_error(&cp->pdev->dev, new_mapping)) {
+			dev->stats.rx_dropped++;
+			goto rx_next;
+		}
+
 		dma_unmap_single(&cp->pdev->dev, mapping,
 				 buflen, PCI_DMA_FROMDEVICE);
 
@@ -531,12 +538,11 @@ rx_status_loop:
 
 		skb_put(skb, len);
 
-		mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen,
-					 PCI_DMA_FROMDEVICE);
 		cp->rx_skb[rx_tail] = new_skb;
 
 		cp_rx_skb(cp, skb, desc);
 		rx++;
+		mapping = new_mapping;
 
 rx_next:
 		cp->rx_ring[rx_tail].opts2 = 0;
@@ -716,6 +722,22 @@ static inline u32 cp_tx_vlan_tag(struct sk_buff *skb)
 		TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00;
 }
 
+static void unwind_tx_frag_mapping(struct cp_private *cp, struct sk_buff *skb,
+				   int first, int entry_last)
+{
+	int frag, index;
+	struct cp_desc *txd;
+	skb_frag_t *this_frag;
+	for (frag = 0; frag+first < entry_last; frag++) {
+		index = first+frag;
+		cp->tx_skb[index] = NULL;
+		txd = &cp->tx_ring[index];
+		this_frag = &skb_shinfo(skb)->frags[frag];
+		dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr),
+				 skb_frag_size(this_frag), PCI_DMA_TODEVICE);
+	}
+}
+
 static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
 					struct net_device *dev)
 {
@@ -749,6 +771,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
 
 		len = skb->len;
 		mapping = dma_map_single(&cp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE);
+		if (dma_mapping_error(&cp->pdev->dev, mapping))
+			goto out_dma_error;
+
 		txd->opts2 = opts2;
 		txd->addr = cpu_to_le64(mapping);
 		wmb();
@@ -786,6 +811,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
 		first_len = skb_headlen(skb);
 		first_mapping = dma_map_single(&cp->pdev->dev, skb->data,
 					       first_len, PCI_DMA_TODEVICE);
+		if (dma_mapping_error(&cp->pdev->dev, first_mapping))
+			goto out_dma_error;
+
 		cp->tx_skb[entry] = skb;
 		entry = NEXT_TX(entry);
 
@@ -799,6 +827,11 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
 			mapping = dma_map_single(&cp->pdev->dev,
 						 skb_frag_address(this_frag),
 						 len, PCI_DMA_TODEVICE);
+			if (dma_mapping_error(&cp->pdev->dev, mapping)) {
+				unwind_tx_frag_mapping(cp, skb, first_entry, entry);
+				goto out_dma_error;
+			}
+
 			eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
 
 			ctrl = eor | len | DescOwn;
@@ -859,11 +892,16 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
 	if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
 		netif_stop_queue(dev);
 
+out_unlock:
 	spin_unlock_irqrestore(&cp->lock, intr_flags);
 
 	cpw8(TxPoll, NormalTxPoll);
 
 	return NETDEV_TX_OK;
+out_dma_error:
+	kfree_skb(skb);
+	cp->dev->stats.tx_dropped++;
+	goto out_unlock;
 }
 
 /* Set or clear the multicast filter for this adaptor.
@@ -1054,6 +1092,10 @@ static int cp_refill_rx(struct cp_private *cp)
 
 		mapping = dma_map_single(&cp->pdev->dev, skb->data,
 					 cp->rx_buf_sz, PCI_DMA_FROMDEVICE);
+		if (dma_mapping_error(&cp->pdev->dev, mapping)) {
+			kfree_skb(skb);
+			goto err_out;
+		}
 		cp->rx_skb[i] = skb;
 
 		cp->rx_ring[i].opts2 = 0;
-- 
1.8.1.2


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

* [PATCH 133/133] net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param
  2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
                   ` (131 preceding siblings ...)
  2013-08-16 22:34 ` [PATCH 132/133] 8139cp: Add dma_mapping_error checking Kamal Mostafa
@ 2013-08-16 22:34 ` Kamal Mostafa
  132 siblings, 0 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-16 22:34 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jack Morgenstein, Or Gerlitz, David S. Miller, Kamal Mostafa

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

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

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

[ Upstream commit b30513202c6c14120f70b2e9aa1e97d47bbc2313 ]

Slaves get the 64B CQE/EQE state from QUERY_HCA, not from the module parameter.

If the parameter is set to zero, the slave outputs an incorrect/irrelevant
warning message that 64B CQEs/EQEs are supported but not enabled (even if the
hypervisor has enabled 64B CQEs/EQEs).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5163af3..573a3a0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -371,7 +371,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
 
 	dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0;
 
-	if (!enable_64b_cqe_eqe) {
+	if (!enable_64b_cqe_eqe && !mlx4_is_slave(dev)) {
 		if (dev_cap->flags &
 		    (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) {
 			mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n");
-- 
1.8.1.2


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

* Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors
  2013-08-16 22:33 ` [PATCH 076/133] ARM: update FIQ support for relocation of vectors Kamal Mostafa
@ 2013-08-18 21:09   ` Aaro Koskinen
  2013-08-19 16:02     ` [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors) Kamal Mostafa
  0 siblings, 1 reply; 141+ messages in thread
From: Aaro Koskinen @ 2013-08-18 21:09 UTC (permalink / raw)
  To: Kamal Mostafa, Greg Kroah-Hartman
  Cc: linux-kernel, stable, kernel-team, Russell King

On Fri, Aug 16, 2013 at 03:33:38PM -0700, Kamal Mostafa wrote:
> 3.8.13.7 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> commit e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 upstream.
> 
> FIQ should no longer copy the FIQ code into the user visible vector
> page.  Instead, it should use the hidden page.  This change makes
> that happen.

FYI, this patch introduced regression (kernel crash) at least on Amstrad
E1 board (where FIQ is used for the keyboard). See the following thread:
http://marc.info/?t=137583169900003&r=1&w=2

So any stable kernels where this patch was added should also take:

	commit 2ba85e7af4c639d933c9a87a6d7363f2983d5ada
	Author: Russell King <rmk+kernel@arm.linux.org.uk>
	Date:   Thu Aug 8 11:51:21 2013 +0100

	ARM: Fix FIQ code on VIVT CPUs

That patch fixes the regression.

A.

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

* [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors)
  2013-08-18 21:09   ` Aaro Koskinen
@ 2013-08-19 16:02     ` Kamal Mostafa
  2013-08-19 16:07       ` Russell King - ARM Linux
  2013-08-20 13:25       ` Luis Henriques
  0 siblings, 2 replies; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-19 16:02 UTC (permalink / raw)
  To: Aaro Koskinen, Greg Kroah-Hartman, Luis Henriques
  Cc: linux-kernel, stable, kernel-team, Russell King

[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]

Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
3.8-stable.

Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
need 2ba85e7 but it isn't marked cc: stable.

 -Kamal


On Mon, 2013-08-19 at 00:09 +0300, Aaro Koskinen wrote:
> On Fri, Aug 16, 2013 at 03:33:38PM -0700, Kamal Mostafa wrote:
> > 3.8.13.7 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Russell King <rmk+kernel@arm.linux.org.uk>
> > 
> > commit e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 upstream.
> > 
> > FIQ should no longer copy the FIQ code into the user visible vector
> > page.  Instead, it should use the hidden page.  This change makes
> > that happen.
> 
> FYI, this patch introduced regression (kernel crash) at least on Amstrad
> E1 board (where FIQ is used for the keyboard). See the following thread:
> http://marc.info/?t=137583169900003&r=1&w=2
> 
> So any stable kernels where this patch was added should also take:
> 
> 	commit 2ba85e7af4c639d933c9a87a6d7363f2983d5ada
> 	Author: Russell King <rmk+kernel@arm.linux.org.uk>
> 	Date:   Thu Aug 8 11:51:21 2013 +0100
> 
> 	ARM: Fix FIQ code on VIVT CPUs
> 
> That patch fixes the regression.
> 
> A.
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors)
  2013-08-19 16:02     ` [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors) Kamal Mostafa
@ 2013-08-19 16:07       ` Russell King - ARM Linux
  2013-08-20 22:50         ` Kamal Mostafa
  2013-08-22 21:52         ` Greg Kroah-Hartman
  2013-08-20 13:25       ` Luis Henriques
  1 sibling, 2 replies; 141+ messages in thread
From: Russell King - ARM Linux @ 2013-08-19 16:07 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Luis Henriques, linux-kernel,
	stable, kernel-team

On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> 3.8-stable.
> 
> Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> need 2ba85e7 but it isn't marked cc: stable.

There's others from that branch which are probably also needed but I want
them to sit in -rc for a bit before I request them to move into the stable
trees - in case anyone finds anything more from the security fixes a while
back.

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

* Re: [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors)
  2013-08-19 16:02     ` [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors) Kamal Mostafa
  2013-08-19 16:07       ` Russell King - ARM Linux
@ 2013-08-20 13:25       ` Luis Henriques
  1 sibling, 0 replies; 141+ messages in thread
From: Luis Henriques @ 2013-08-20 13:25 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: Aaro Koskinen, Greg Kroah-Hartman, linux-kernel, stable,
	kernel-team, Russell King

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

Kamal Mostafa <kamal@canonical.com> writes:

> Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> 3.8-stable.
>
> Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> need 2ba85e7 but it isn't marked cc: stable.
>
>  -Kamal
>

Thanks.  I've also seen your IRC msg.  I'll hold this commit for now.

Btw, not sure if you've seen the discussion around

58ad436 genetlink: fix family dump race

Looks like there's a regression introduced by this commit.  I'm
holding it as well.

Cheers,
-- 
Luis


>
> On Mon, 2013-08-19 at 00:09 +0300, Aaro Koskinen wrote:
>> On Fri, Aug 16, 2013 at 03:33:38PM -0700, Kamal Mostafa wrote:
>> > 3.8.13.7 -stable review patch.  If anyone has any objections, please let me know.
>> > 
>> > ------------------
>> > 
>> > From: Russell King <rmk+kernel@arm.linux.org.uk>
>> > 
>> > commit e39e3f3ebfef03450cf7bfa7a974a8c61f7980c8 upstream.
>> > 
>> > FIQ should no longer copy the FIQ code into the user visible vector
>> > page.  Instead, it should use the hidden page.  This change makes
>> > that happen.
>> 
>> FYI, this patch introduced regression (kernel crash) at least on Amstrad
>> E1 board (where FIQ is used for the keyboard). See the following thread:
>> http://marc.info/?t=137583169900003&r=1&w=2
>> 
>> So any stable kernels where this patch was added should also take:
>> 
>> 	commit 2ba85e7af4c639d933c9a87a6d7363f2983d5ada
>> 	Author: Russell King <rmk+kernel@arm.linux.org.uk>
>> 	Date:   Thu Aug 8 11:51:21 2013 +0100
>> 
>> 	ARM: Fix FIQ code on VIVT CPUs
>> 
>> That patch fixes the regression.
>> 
>> A.
>> 
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors)
  2013-08-19 16:07       ` Russell King - ARM Linux
@ 2013-08-20 22:50         ` Kamal Mostafa
  2013-08-20 22:57           ` Russell King - ARM Linux
  2013-08-22 21:52         ` Greg Kroah-Hartman
  1 sibling, 1 reply; 141+ messages in thread
From: Kamal Mostafa @ 2013-08-20 22:50 UTC (permalink / raw)
  To: Aaro Koskinen, Russell King - ARM Linux
  Cc: Greg Kroah-Hartman, Luis Henriques, linux-kernel, stable, kernel-team

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

On Mon, 2013-08-19 at 17:07 +0100, Russell King - ARM Linux wrote:
> On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> > Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> > 3.8-stable.
> > 
> > Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> > need 2ba85e7 but it isn't marked cc: stable.
> 
> There's others from that branch which are probably also needed but I want
> them to sit in -rc for a bit before I request them to move into the stable
> trees - in case anyone finds anything more from the security fixes a while
> back.


[ 3.8-stable ]

On Russell's advice I intend to hold off on applying some of the ARM
security-fixes commits to the imminent v3.8.13.7 release, and instead
pick them up in the next 3.8-stable cycle.  Specifically:

These previously announced commits will NOT be included in 3.8.13.7:

        2ba85e7 ARM: Fix FIQ code on VIVT CPUs
        f6f91b0 ARM: allow kuser helpers to be removed from the vector page
        e39e3f3 ARM: update FIQ support for relocation of vectors

These still WILL be included in 3.8.13.7:

        0cb79f8 ARM: use linker magic for vectors and vector stubs
        b9e2c32 ARM: move vector stubs
        6810219 ARM: poison memory between kuser helpers
        73c083a ARM: poison the vectors page

(Aaro, I'll make sure to keep e39e3f3 and 2ba85e7 together when I pick
them up).

Any objections?

 -Kamal


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors)
  2013-08-20 22:50         ` Kamal Mostafa
@ 2013-08-20 22:57           ` Russell King - ARM Linux
  0 siblings, 0 replies; 141+ messages in thread
From: Russell King - ARM Linux @ 2013-08-20 22:57 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: Aaro Koskinen, Greg Kroah-Hartman, Luis Henriques, linux-kernel,
	stable, kernel-team

On Tue, Aug 20, 2013 at 03:50:08PM -0700, Kamal Mostafa wrote:
> On Mon, 2013-08-19 at 17:07 +0100, Russell King - ARM Linux wrote:
> > On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> > > Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> > > 3.8-stable.
> > > 
> > > Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> > > need 2ba85e7 but it isn't marked cc: stable.
> > 
> > There's others from that branch which are probably also needed but I want
> > them to sit in -rc for a bit before I request them to move into the stable
> > trees - in case anyone finds anything more from the security fixes a while
> > back.
> 
> 
> [ 3.8-stable ]
> 
> On Russell's advice I intend to hold off on applying some of the ARM
> security-fixes commits to the imminent v3.8.13.7 release, and instead
> pick them up in the next 3.8-stable cycle.  Specifically:
> 
> These previously announced commits will NOT be included in 3.8.13.7:
> 
>         2ba85e7 ARM: Fix FIQ code on VIVT CPUs
>         f6f91b0 ARM: allow kuser helpers to be removed from the vector page
>         e39e3f3 ARM: update FIQ support for relocation of vectors
> 
> These still WILL be included in 3.8.13.7:
> 
>         0cb79f8 ARM: use linker magic for vectors and vector stubs
>         b9e2c32 ARM: move vector stubs
>         6810219 ARM: poison memory between kuser helpers
>         73c083a ARM: poison the vectors page
> 
> (Aaro, I'll make sure to keep e39e3f3 and 2ba85e7 together when I pick
> them up).
> 
> Any objections?

No, that sounds sensible, thanks.

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

* Re: [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors)
  2013-08-19 16:07       ` Russell King - ARM Linux
  2013-08-20 22:50         ` Kamal Mostafa
@ 2013-08-22 21:52         ` Greg Kroah-Hartman
  1 sibling, 0 replies; 141+ messages in thread
From: Greg Kroah-Hartman @ 2013-08-22 21:52 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Kamal Mostafa, Aaro Koskinen, Luis Henriques, linux-kernel,
	stable, kernel-team

On Mon, Aug 19, 2013 at 05:07:41PM +0100, Russell King - ARM Linux wrote:
> On Mon, Aug 19, 2013 at 09:02:23AM -0700, Kamal Mostafa wrote:
> > Thanks Aaro.  I'll apply "2ba85e7 ARM: Fix FIQ code on VIVT CPUs" to
> > 3.8-stable.
> > 
> > Greg KH and Luis Henriques:  Heads up!  3.10-stable and 3.5-stable also
> > need 2ba85e7 but it isn't marked cc: stable.
> 
> There's others from that branch which are probably also needed but I want
> them to sit in -rc for a bit before I request them to move into the stable
> trees - in case anyone finds anything more from the security fixes a while
> back.

Ok, I'll hold off on applying this one until you say it is good to go.

thanks,

greg k-h

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

end of thread, other threads:[~2013-08-22 21:52 UTC | newest]

Thread overview: 141+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 22:32 [ 3.8.y.z extended stable ] Linux 3.8.13.7 stable review Kamal Mostafa
2013-08-16 22:32 ` [PATCH 001/133] Input: elantech - fix for newer hardware versions (v7) Kamal Mostafa
2013-08-16 22:32 ` [PATCH 002/133] usb: dwc3: gadget: don't prevent gadget from being probed if we fail Kamal Mostafa
2013-08-16 22:32 ` [PATCH 003/133] usb: dwc3: fix wrong bit mask in dwc3_event_type Kamal Mostafa
2013-08-16 22:32 ` [PATCH 004/133] ASoC: max98088 - fix element type of the register cache Kamal Mostafa
2013-08-16 22:32 ` [PATCH 005/133] ata: Fix DVD not dectected at some platform with Wellsburg PCH Kamal Mostafa
2013-08-16 22:32 ` [PATCH 006/133] Tools: hv: KVP: Fix a bug in IPV6 subnet enumeration Kamal Mostafa
2013-08-16 22:32 ` [PATCH 007/133] ALSA: usb-audio: 6fire: return correct XRUN indication Kamal Mostafa
2013-08-16 22:32 ` [PATCH 008/133] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter Kamal Mostafa
2013-08-16 22:32 ` [PATCH 009/133] USB: storage: Add MicroVault Flash Drive to unusual_devs Kamal Mostafa
2013-08-16 22:32 ` [PATCH 010/133] USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga Kamal Mostafa
2013-08-16 22:32 ` [PATCH 011/133] USB: option: append Petatel NP10T device to GSM modems list Kamal Mostafa
2013-08-16 22:32 ` [PATCH 012/133] usb: cp210x support SEL C662 Vendor/Device Kamal Mostafa
2013-08-16 22:32 ` [PATCH 013/133] USB: cp210x: add MMB and PI ZigBee USB Device Support Kamal Mostafa
2013-08-16 22:32 ` [PATCH 014/133] USB: EHCI: Fix resume signalling on remote wakeup Kamal Mostafa
2013-08-16 22:32 ` [PATCH 015/133] drm/radeon: fix endian issues with DP handling (v3) Kamal Mostafa
2013-08-16 22:32 ` [PATCH 016/133] drm/radeon: Another card with wrong primary dac adj Kamal Mostafa
2013-08-16 22:32 ` [PATCH 017/133] drm/radeon: improve dac adjust heuristics for legacy pdac Kamal Mostafa
2013-08-16 22:32 ` [PATCH 018/133] drm/radeon: fix combios tables on older cards Kamal Mostafa
2013-08-16 22:32 ` [PATCH 019/133] ARM: footbridge: fix overlapping PCI mappings Kamal Mostafa
2013-08-16 22:32 ` [PATCH 020/133] [SCSI] isci: Fix a race condition in the SSP task management path Kamal Mostafa
2013-08-16 22:32 ` [PATCH 021/133] [SCSI] qla2xxx: Properly set the tagging for commands Kamal Mostafa
2013-08-16 22:32 ` [PATCH 022/133] [SCSI] sd: fix crash when UA received on DIF enabled device Kamal Mostafa
2013-08-16 22:32 ` [PATCH 023/133] nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file Kamal Mostafa
2013-08-16 22:32 ` [PATCH 024/133] USB: option: add D-Link DWM-152/C1 and DWM-156/C1 Kamal Mostafa
2013-08-16 22:32 ` [PATCH 025/133] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write Kamal Mostafa
2013-08-16 22:32 ` [PATCH 026/133] staging: comedi: fix a race between do_cmd_ioctl() and read/write Kamal Mostafa
2013-08-16 22:32 ` [PATCH 027/133] staging: android: logger: Correct write offset reset on error Kamal Mostafa
2013-08-16 22:32 ` [PATCH 028/133] usb: option: add TP-LINK MA260 Kamal Mostafa
2013-08-16 22:32 ` [PATCH 029/133] USB: ti_usb_3410_5052: fix dynamic-id matching Kamal Mostafa
2013-08-16 22:32 ` [PATCH 030/133] usb: serial: option: Add ONYX 3G device support Kamal Mostafa
2013-08-16 22:32 ` [PATCH 031/133] md/raid10: remove use-after-free bug Kamal Mostafa
2013-08-16 22:32 ` [PATCH 032/133] md/raid5: fix interaction of 'replace' and 'recovery' Kamal Mostafa
2013-08-16 22:32 ` [PATCH 033/133] drm/i915: initialize gt_lock early with other spin locks Kamal Mostafa
2013-08-16 22:32 ` [PATCH 034/133] xhci: Avoid NULL pointer deref when host dies Kamal Mostafa
2013-08-16 22:32 ` [PATCH 035/133] usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 Kamal Mostafa
2013-08-16 22:32 ` [PATCH 036/133] xhci: fix null pointer dereference on ring_doorbell_for_active_rings Kamal Mostafa
2013-08-16 22:32 ` [PATCH 037/133] usb: serial: option: blacklist ONDA MT689DC QMI interface Kamal Mostafa
2013-08-16 22:33 ` [PATCH 038/133] usb: serial: option: add Olivetti Olicard 200 Kamal Mostafa
2013-08-16 22:33 ` [PATCH 039/133] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver Kamal Mostafa
2013-08-16 22:33 ` [PATCH 040/133] USB: mos7840: fix memory leak in open Kamal Mostafa
2013-08-16 22:33 ` [PATCH 041/133] usb: Clear both buffers when clearing a control transfer TT buffer Kamal Mostafa
2013-08-16 22:33 ` [PATCH 042/133] nl80211: fix mgmt tx status and testmode reporting for netns Kamal Mostafa
2013-08-16 22:33 ` [PATCH 043/133] mac80211: fix ethtool stats for non-station interfaces Kamal Mostafa
2013-08-16 22:33 ` [PATCH 044/133] mac80211: fix duplicate retransmission detection Kamal Mostafa
2013-08-16 22:33 ` [PATCH 045/133] iwlwifi: mvm: refuse connection to APs with BI < 16 Kamal Mostafa
2013-08-16 22:33 ` [PATCH 046/133] iwlwifi: add DELL SKU for 5150 HMC Kamal Mostafa
2013-08-16 22:33 ` [PATCH 047/133] ath9k_htc: do some initial hardware configuration Kamal Mostafa
2013-08-16 22:33 ` [PATCH 048/133] ath9k_htc: reboot firmware if it was loaded Kamal Mostafa
2013-08-16 22:33 ` [PATCH 049/133] ARM: 7790/1: Fix deferred mm switch on VIVT processors Kamal Mostafa
2013-08-16 22:33 ` [PATCH 050/133] ARM: 7791/1: a.out: remove partial a.out support Kamal Mostafa
2013-08-16 22:33 ` [PATCH 051/133] mwifiex: Add missing endian conversion Kamal Mostafa
2013-08-16 22:33 ` [PATCH 052/133] USB: mos7840: fix race in register handling Kamal Mostafa
2013-08-16 22:33 ` [PATCH 053/133] USB: mos7840: fix device-type detection Kamal Mostafa
2013-08-16 22:33 ` [PATCH 054/133] USB: mos7840: fix race in led handling Kamal Mostafa
2013-08-16 22:33 ` [PATCH 055/133] serial/mxs-auart: fix race condition in interrupt handler Kamal Mostafa
2013-08-16 22:33 ` [PATCH 056/133] serial: mxs: fix buffer overflow Kamal Mostafa
2013-08-16 22:33 ` [PATCH 057/133] serial/mxs-auart: increase time to wait for transmitter to become idle Kamal Mostafa
2013-08-16 22:33 ` [PATCH 058/133] serial: arc_uart: Fix module alias Kamal Mostafa
2013-08-16 22:33 ` [PATCH 059/133] firewire: fix libdc1394/FlyCap2 iso event regression Kamal Mostafa
2013-08-16 22:33 ` [PATCH 060/133] dma: pl330: Fix cyclic transfers Kamal Mostafa
2013-08-16 22:33 ` [PATCH 061/133] USB: mos7840: fix pointer casts Kamal Mostafa
2013-08-16 22:33 ` [PATCH 062/133] ixgbe: Fix Tx Hang issue with lldpad on 82598EB Kamal Mostafa
2013-08-16 22:33 ` [PATCH 063/133] Revert "cpuidle: Quickly notice prediction failure in general case" Kamal Mostafa
2013-08-16 22:33 ` [PATCH 064/133] Revert "cpuidle: Quickly notice prediction failure for repeat mode" Kamal Mostafa
2013-08-16 22:33 ` [PATCH 065/133] ALSA: compress: fix the return value for SNDRV_COMPRESS_VERSION Kamal Mostafa
2013-08-16 22:33 ` [PATCH 066/133] rt2x00: fix stop queue Kamal Mostafa
2013-08-16 22:33 ` [PATCH 067/133] USB: serial: ftdi_sio: add more RT Systems ftdi devices Kamal Mostafa
2013-08-16 22:33 ` [PATCH 068/133] drm/nouveau: fix semaphore dmabuf obj Kamal Mostafa
2013-08-16 22:33 ` [PATCH 069/133] ACPI / battery: Fix parsing _BIX return value Kamal Mostafa
2013-08-16 22:33 ` [PATCH 070/133] drm/radeon/atom: initialize more atom interpretor elements to 0 Kamal Mostafa
2013-08-16 22:33 ` [PATCH 071/133] drm/i915: fix missed hunk after GT access breakage Kamal Mostafa
2013-08-16 22:33 ` [PATCH 072/133] ARM: poison the vectors page Kamal Mostafa
2013-08-16 22:33 ` [PATCH 073/133] ARM: poison memory between kuser helpers Kamal Mostafa
2013-08-16 22:33 ` [PATCH 074/133] ARM: move vector stubs Kamal Mostafa
2013-08-16 22:33 ` [PATCH 075/133] ARM: use linker magic for vectors and " Kamal Mostafa
2013-08-16 22:33 ` [PATCH 076/133] ARM: update FIQ support for relocation of vectors Kamal Mostafa
2013-08-18 21:09   ` Aaro Koskinen
2013-08-19 16:02     ` [3.10][3.8][3.5] ARM: Fix FIQ code on VIVT CPUs (was Re: [PATCH 076/133] ARM: update FIQ support for relocation of vectors) Kamal Mostafa
2013-08-19 16:07       ` Russell King - ARM Linux
2013-08-20 22:50         ` Kamal Mostafa
2013-08-20 22:57           ` Russell King - ARM Linux
2013-08-22 21:52         ` Greg Kroah-Hartman
2013-08-20 13:25       ` Luis Henriques
2013-08-16 22:33 ` [PATCH 077/133] ARM: allow kuser helpers to be removed from the vector page Kamal Mostafa
2013-08-16 22:33 ` [PATCH 078/133] mm: mempolicy: fix mbind_range() && vma_adjust() interaction Kamal Mostafa
2013-08-16 22:33 ` [PATCH 079/133] powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31) Kamal Mostafa
2013-08-16 22:33 ` [PATCH 080/133] drm/i915: Make data/link N value power of two Kamal Mostafa
2013-08-16 22:33 ` [PATCH 081/133] virtio/console: Quit from splice_write if pipe->nrbufs is 0 Kamal Mostafa
2013-08-16 22:33 ` [PATCH 082/133] virtio/console: Add pipe_lock/unlock for splice_write Kamal Mostafa
2013-08-16 22:33 ` [PATCH 083/133] x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset Kamal Mostafa
2013-08-16 22:33 ` [PATCH 084/133] s390/bitops: fix find_next_bit_left Kamal Mostafa
2013-08-16 22:33 ` [PATCH 085/133] x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz Kamal Mostafa
2013-08-16 22:33 ` [PATCH 086/133] ext4: make sure group number is bumped after a inode allocation race Kamal Mostafa
2013-08-16 22:33 ` [PATCH 087/133] ext4: destroy ext4_es_cachep on module unload Kamal Mostafa
2013-08-16 22:33 ` [PATCH 088/133] virtio: console: fix race with port unplug and open/close Kamal Mostafa
2013-08-16 22:33 ` [PATCH 089/133] virtio: console: fix race in port_fops_open() and port unplug Kamal Mostafa
2013-08-16 22:33 ` [PATCH 090/133] virtio: console: clean up port data immediately at time of unplug Kamal Mostafa
2013-08-16 22:33 ` [PATCH 091/133] virtio: console: fix raising SIGIO after port unplug Kamal Mostafa
2013-08-16 22:33 ` [PATCH 092/133] virtio: console: return -ENODEV on all read operations after unplug Kamal Mostafa
2013-08-16 22:33 ` [PATCH 093/133] KVM: s390: move kvm_guest_enter,exit closer to sie Kamal Mostafa
2013-08-16 22:33 ` [PATCH 094/133] ext4: fix retry handling in ext4_ext_truncate() Kamal Mostafa
2013-08-16 22:33 ` [PATCH 095/133] spi: spi-davinci: Fix direction in dma_map_single() Kamal Mostafa
2013-08-16 22:33 ` [PATCH 096/133] [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel Kamal Mostafa
2013-08-16 22:33 ` [PATCH 097/133] [SCSI] Don't attempt to send extended INQUIRY command if skip_vpd_pages is set Kamal Mostafa
2013-08-16 22:34 ` [PATCH 098/133] ACPI / PM: Fix /proc/acpi/wakeup for devices w/o bus or parent Kamal Mostafa
2013-08-16 22:34 ` [PATCH 099/133] ACPI / PM: Walk physical_node_list under physical_node_lock Kamal Mostafa
2013-08-16 22:34 ` [PATCH 100/133] regmap: Add missing header for !CONFIG_REGMAP stubs Kamal Mostafa
2013-08-16 22:34 ` [PATCH 101/133] userns: unshare_userns(&cred) should not populate cred on failure Kamal Mostafa
2013-08-16 22:34 ` [PATCH 102/133] userns: limit the maximum depth of user_namespace->parent chain Kamal Mostafa
2013-08-16 22:34 ` [PATCH 103/133] drm/cirrus: Invalidate page tables when pinning a BO Kamal Mostafa
2013-08-16 22:34 ` [PATCH 104/133] drm/mgag200: " Kamal Mostafa
2013-08-16 22:34 ` [PATCH 105/133] drm/ast: invalidate " Kamal Mostafa
2013-08-16 22:34 ` [PATCH 106/133] drm/i915: do not disable backlight on vgaswitcheroo switch off Kamal Mostafa
2013-08-16 22:34 ` [PATCH 107/133] ALSA: 6fire: fix DMA issues with URB transfer_buffer usage Kamal Mostafa
2013-08-16 22:34 ` [PATCH 108/133] drm: Don't pass negative delta to ktime_sub_ns() Kamal Mostafa
2013-08-16 22:34 ` [PATCH 109/133] ALSA: usb-audio: do not trust too-big wMaxPacketSize values Kamal Mostafa
2013-08-16 22:34 ` [PATCH 110/133] hwmon: (adt7470) Fix incorrect return code check Kamal Mostafa
2013-08-16 22:34 ` [PATCH 111/133] powerpc: On POWERNV enable PPC_DENORMALISATION by default Kamal Mostafa
2013-08-16 22:34 ` [PATCH 112/133] Btrfs: release both paths before logging dir/changed extents Kamal Mostafa
2013-08-16 22:34 ` [PATCH 113/133] sched: Ensure update_cfs_shares() is called for parents of continuously-running tasks Kamal Mostafa
2013-08-16 22:34 ` [PATCH 114/133] cifs: extend the buffer length enought for sprintf() using Kamal Mostafa
2013-08-16 22:34 ` [PATCH 115/133] perf/x86: Fix intel QPI uncore event definitions Kamal Mostafa
2013-08-16 22:34 ` [PATCH 116/133] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately Kamal Mostafa
2013-08-16 22:34 ` [PATCH 117/133] ext4: allow the mount options nodelalloc and data=journal Kamal Mostafa
2013-08-16 22:34 ` [PATCH 118/133] ext4: fix mount/remount error messages for incompatible mount options Kamal Mostafa
2013-08-16 22:34 ` [PATCH 119/133] perf/arm: Fix armpmu_map_hw_event() Kamal Mostafa
2013-08-16 22:34 ` [PATCH 120/133] microblaze: fix clone syscall Kamal Mostafa
2013-08-16 22:34 ` [PATCH 121/133] x86 get_unmapped_area(): use proper mmap base for bottom-up direction Kamal Mostafa
2013-08-16 22:34 ` [PATCH 122/133] fs/proc/task_mmu.c: fix buffer overflow in add_page_map() Kamal Mostafa
2013-08-16 22:34 ` [PATCH 123/133] arcnet: cleanup sizeof parameter Kamal Mostafa
2013-08-16 22:34 ` [PATCH 124/133] sysctl net: Keep tcp_syn_retries inside the boundary Kamal Mostafa
2013-08-16 22:34 ` [PATCH 125/133] ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup Kamal Mostafa
2013-08-16 22:34 ` [PATCH 126/133] usbnet: do not pretend to support SG/TSO Kamal Mostafa
2013-08-16 22:34 ` [PATCH 127/133] net_sched: Fix stack info leak in cbq_dump_wrr() Kamal Mostafa
2013-08-16 22:34 ` [PATCH 128/133] af_key: more info leaks in pfkey messages Kamal Mostafa
2013-08-16 22:34 ` [PATCH 129/133] atl1c: use custom skb allocator Kamal Mostafa
2013-08-16 22:34 ` [PATCH 130/133] net_sched: info leak in atm_tc_dump_class() Kamal Mostafa
2013-08-16 22:34 ` [PATCH 131/133] ndisc: Add missing inline to ndisc_addr_option_pad Kamal Mostafa
2013-08-16 22:34 ` [PATCH 132/133] 8139cp: Add dma_mapping_error checking Kamal Mostafa
2013-08-16 22:34 ` [PATCH 133/133] net/mlx4_core: VFs must ignore the enable_64b_cqe_eqe module param 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.