linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [00/65] 3.6.11.5-stable review
@ 2013-06-03 22:10 Steven Rostedt
  2013-06-03 22:10 ` [01/65] KVM: VMX: fix halt emulation while emulating invalid guest sate Steven Rostedt
                   ` (64 more replies)
  0 siblings, 65 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 13620 bytes --]


This is the start of the stable review cycle for 3.6.11.5 release.
There are 65 patches in this series, which will be posted as responses
to this one. If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu Jun  18:08:30.
Anything received after that time might be too late.

Aaro Koskinen (1):
      ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices
         [e65f131a14726e5f1b880a528271a52428e5b3a5]

Amitkumar Karwar (1):
      mwifiex: fix memory leak issue when driver unload
         [f16fdc9d2dc1e5b270e9a08377587e831e0d36ac]

Anton Blanchard (2):
      powerpc/kexec: Fix kexec when using VMX optimised memcpy
         [79c66ce8f6448a3295a32efeac88c9debd7f7094]
      audit: Syscall rules are not applied to existing processes on non-x86
         [cdee3904b4ce7c03d1013ed6dd704b43ae7fc2e9]

Ben Hutchings (1):
      sfc: Fix naming of MTD partitions for FPGA bitfiles
         [89cc80a44b7c320e08599cb86f6aef0ead8986a1]

Benjamin LaHaise (1):
      ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex
         [6368087e851e697679af059b4247aca33a69cef3]

Bing Zhao (1):
      mwifiex: clear is_suspended flag when interrupt is received early
         [48795424acff7215d5eac0b52793a2c1eb3a6283]

Bjørn Mork (1):
      net: vlan,ethtool: netdev_features_t is more than 32 bit
         [b29d3145183da4e07d4b570fa8acdd3ac4a5c572]

Bob Moore (1):
      ACPICA: Fix possible buffer overflow during a field unit read operation
         [61388f9e5d93053cf399a356414f31f9b4814c6d]

Chen Gang (2):
      drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
         [a5f2b3d6a738e7d4180012fe7b541172f8c8dcea]
      net: mac802154: comparision issue of type cast, finding by EXTRA_CFLAGS=-W
         [2c1bbbffa0b644fab4f91878cde0c2e8f52e2dcc]

Chris Metcalf (1):
      tile: support new Tilera hypervisor
         [c539914dcd9a68c63305e055b14115a6a19578a8]

Christopher Harvey (2):
      drm/mgag200: Fix framebuffer base address programming
         [9f1d036648c1c5ed81b0e98d7a06d55df972701e]
      drm/mgag200: Fix writes into MGA1064_PIX_CLK_CTL register
         [fb70a6690875315a3a1454e52fa339441ee7612b]

Cong Wang (1):
      xfrm6: release dev before returning error
         [84c4a9dfbf430861e7588d95ae3ff61535dca351]

Dan Carpenter (1):
      ASoC: wm8994: missing break in wm8994_aif3_hw_params()
         [4495e46fe18f198366961bb2b324a694ef8a9b44]

Daniel Borkmann (1):
      packet: tpacket_v3: do not trigger bug() on wrong header status
         [8da3056c04bfc5f69f840ab038a38389e2de8189]

Daniel Drake (1):
      mwifiex: fix setting of multicast filter
         [ccd384b10420ac81ba3fb9b0a7d18272c7173552]

Eric Dumazet (2):
      ipv6: do not clear pinet6 field
         [f77d602124d865c38705df7fa25c03de9c284ad2]
      tcp: force a dst refcount when prequeue packet
         [093162553c33e9479283e107b4431378271c735d]

Felix Fietkau (1):
      ath9k: fix key allocation error handling for powersave keys
         [4ef69d0394cba8caa9f75d3f2e53429bfb8b3045]

Frederic Weisbecker (1):
      math64: New div64_u64_rem helper
         [f792685006274a850e6cc0ea9ade275ccdfc90bc]

Gabriel de Perthuis (1):
      btrfs: don't stop searching after encountering the wrong item
         [03b71c6ca6286625d8f1ed44aabab9b5bf5dac10]

Gleb Natapov (1):
      KVM: VMX: fix halt emulation while emulating invalid guest sate
         [8d76c49e9ffeee839bc0b7a3278a23f99101263e]

Guenter Roeck (1):
      watchdog: Fix race condition in registration code
         [60403f7a4d9368d187f79cba5e4672d01df37574]

Helge Deller (1):
      parisc: make default cross compiler search more robust (v3)
         [6880b0150a7c25fd75c5ece80abc49ebf53c38c1]

Inderpal Singh (1):
      ARM: EXYNOS5: Fix kernel dump in AFTR idle mode
         [088584618836b159947bc4ab5011a5cf1f081a62]

Jaccon Bastiaansen (1):
      ARM: 7720/1: ARM v6/v7 cmpxchg64 shouldn't clear upper 32 bits of the old/new value
         [6eabb3301b1facee669d9938f7c5a0295c21d71d]

Jamal Hadi Salim (1):
      net_sched: act_ipt forward compat with xtables
         [0dcffd09641f3abb21ac5cabc61542ab289d1a3c]

James Bottomley (1):
      sd: fix array cache flushing bug causing performance problems
         [39c60a0948cc06139e2fbfe084f83cb7e7deae3b]

Jiri Pirko (1):
      macvlan: fix passthru mode race between dev removal and rx path
         [233c7df0821c4190e2d3f4be0f2ca0ab40a5ed8c]

Joern Engel (1):
      target: close target_put_sess_cmd() vs. core_tmr_abort_task() race
         [ccf5ae83a6cf3d9cfe9a7038bfe7cd38ab03d5e1]

John David Anglin (2):
      parisc: fix SMP races when updating PTE and TLB entries in entry.S
         [f0a18819e261afc5fdbd8c5c6f9943123c5461ba]
      parisc: only re-enable interrupts if we need to schedule or deliver signals when returning to userspace
         [c207a76bf155cb5cf24cf849c08f6555e9180594]

Josef Ahmad (1):
      i2c: designware: fix RX FIFO overrun
         [e6f34cea56f5b95498070eaa9f4aa3ba4a9e4f62]

Josh Boyer (1):
      if_cablemodem.h: Add parenthesis around ioctl macros
         [4f924b2aa4d3cb30f07e57d6b608838edcbc0d88]

Kees Cook (1):
      drm/radeon: check incoming cliprects pointer
         [fefaedcfb82d2e57c2320acf60604ab03b750cc0]

Konrad Rzeszutek Wilk (1):
      xen/vcpu/pvhvm: Fix vcpu hotplugging hanging.
         [7f1fc268c47491fd5e63548f6415fc8604e13003]

Lachlan McIlroy (1):
      ext4: limit group search loop for non-extent files
         [e6155736ad76b2070652745f9e54cdea3f0d8567]

Lan Tianyu (1):
      ACPI / EC: Restart transaction even when the IBF flag set
         [28fe5c825f8e15744d04c7c1b8df197950923ecd]

Matthew Whitehead (1):
      3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA)
         [3b54912f9cd167641b91d4a697bd742f70e534fe]

Michael S. Tsirkin (1):
      virtio_console: fix uapi header
         [6407d75afd08545f2252bb39806ffd3f10c7faac]

Mika Westerberg (1):
      i2c: designware: always clear interrupts before enabling them
         [2a2d95e9d6d29e726cc294b65391917ed2e32bf4]

Mike Frysinger (1):
      parisc: fix NATIVE set up in build
         [93782eba49e23c3f311a6b05a19ba15927ec4e8b]

Mike Snitzer (1):
      dm stripe: fix regression in stripe_width calculation
         [d793e684277124d55c5d2444007e224635821346]

Mikulas Patocka (1):
      dm bufio: avoid a possible __vmalloc deadlock
         [502624bdad3dba45dfaacaf36b7d83e39e74b2d2]

Niels Ole Salscheider (1):
      drm/radeon: Fix VRAM size calculation for VRAM >= 4GB
         [fc986034540102cd090237bf3f70262e1ae80d9c]

Oleg Nesterov (1):
      usermodehelper: check subprocess_info->path != NULL
         [264b83c07a84223f0efd0d1db9ccc66d6f88288f]

Patrick McHardy (1):
      net: use netdev_features_t in skb_needs_linearize()
         [6708c9e5cc9bfc7c9a00ce9c0fdd0b1d4952b3d1]

Philipp Reisner (1):
      drbd: fix for deadlock when using automatic split-brain-recovery
         [7c689e63a847316c1b2500f86891b0a574ce7e69]

Robert Jennings (1):
      powerpc: Bring all threads online prior to migration/hibernation
         [120496ac2d2d60aee68d3123a68169502a85f4b5]

Sergei Shtylyov (2):
      3c59x: fix PCI resource management
         [4b264a1676e70dc656ba53a8cac690f2d4b65f4e]
      3c59x: fix freeing nonexistent resource on driver unload
         [c81400be716aa4c76f6ebf339ba94358dbbf6da6]

Shlomo Pongratz (1):
      iscsi-target: Fix processing of OOO commands
         [3eccfdb01da58fbd0f789ae6ca61cee3769e26de]

Shuah Khan (1):
      hp_accel: Ignore the error from lis3lv02d_poweron() at resume
         [7783819920ca52fc582a2782f654fe6ed373f465]

Steven Rostedt (Red Hat) (1):
      tracing: Fix leaks of filter preds
         [60705c89460fdc7227f2d153b68b3f34814738a4]

Thomas Gleixner (1):
      tick: Cleanup NOHZ per cpu data on cpu down
         [4b0c0f294f60abcdd20994a8341a95c8ac5eeb96]

Thommy Jakobsson (1):
      B43: Handle DMA RX descriptor underrun
         [73b82bf0bfbf58e6ff328d3726934370585f6e78]

Tirupathi Reddy (1):
      timer: Don't reinitialize the cpu base lock during CPU_UP_PREPARE
         [42a5cf46cd56f46267d2a9fcf2655f4078cd3042]

Tomoya MORINAGA (1):
      pch_dma: Use GFP_ATOMIC because called from interrupt context
         [5c1ef59168c485318e40ba485c1eba57d81d0faa]

Wang YanQing (1):
      ALSA: HDA: Fix Oops caused by dereference NULL pointer
         [2195b063f6609e4c6268f291683902f25eaf9aa6]

Wei Yongjun (3):
      hwmon: fix error return code in abituguru_probe()
         [ecacb0b17c08fae89f65468727f0e4b8e91da4e1]
      drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe()
         [35623715818dfa720cccf99cd280dcbb4b78da23]
      dm snapshot: fix error return code in snapshot_ctr
         [09e8b813897a0f85bb401435d009228644c81214]

stephen hemminger (1):
      bridge: fix race with topology change timer
         [83401eb4990ff6af55aeed8f49681558544192e6]

----
 arch/arm/include/asm/cmpxchg.h               |    8 +-
 arch/arm/mach-exynos/include/mach/regs-pmu.h |    1 +
 arch/arm/mach-exynos/pmu.c                   |    5 +-
 arch/arm/mach-omap2/board-rx51-peripherals.c |    4 +-
 arch/parisc/Makefile                         |   24 ++--
 arch/parisc/kernel/entry.S                   |  169 ++++++++++++++------------
 arch/powerpc/include/asm/rtas.h              |    2 +
 arch/powerpc/kernel/machine_kexec_64.c       |    4 +
 arch/powerpc/kernel/rtas.c                   |  113 +++++++++++++++++
 arch/powerpc/platforms/pseries/suspend.c     |   22 ++++
 arch/tile/Kconfig                            |   14 ++-
 arch/tile/include/hv/hypervisor.h            |   27 +++-
 arch/tile/kernel/head_32.S                   |    2 +-
 arch/tile/kernel/head_64.S                   |   12 +-
 arch/x86/kvm/vmx.c                           |    6 +
 arch/x86/xen/enlighten.c                     |   15 +++
 drivers/acpi/acpica/exfldio.c                |   14 ++-
 drivers/acpi/ec.c                            |    4 +-
 drivers/block/drbd/drbd_receiver.c           |    1 -
 drivers/char/ipmi/ipmi_bt_sm.c               |    4 +-
 drivers/char/ipmi/ipmi_devintf.c             |   14 ++-
 drivers/dma/pch_dma.c                        |    2 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c       |   69 +++++++----
 drivers/gpu/drm/radeon/evergreen.c           |    4 +-
 drivers/gpu/drm/radeon/r300_cmdbuf.c         |    2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c          |    2 +-
 drivers/gpu/drm/radeon/si.c                  |    4 +-
 drivers/hwmon/abituguru.c                    |   16 ++-
 drivers/i2c/busses/i2c-designware-core.c     |   14 ++-
 drivers/i2c/busses/i2c-designware-core.h     |    2 +
 drivers/md/dm-bufio.c                        |   26 +++-
 drivers/md/dm-snap.c                         |    1 +
 drivers/md/dm-stripe.c                       |   11 +-
 drivers/net/ethernet/3com/3c509.c            |    2 +
 drivers/net/ethernet/3com/3c59x.c            |   27 ++--
 drivers/net/ethernet/sfc/mcdi.c              |    2 +-
 drivers/net/ethernet/tile/tilegx.c           |    2 +-
 drivers/net/macvlan.c                        |    7 +-
 drivers/net/wireless/ath/ath9k/main.c        |    6 +-
 drivers/net/wireless/b43/dma.c               |   19 +++
 drivers/net/wireless/b43/dma.h               |    4 +-
 drivers/net/wireless/b43/main.c              |   43 +++----
 drivers/net/wireless/mwifiex/cfg80211.c      |    3 -
 drivers/net/wireless/mwifiex/cmdevt.c        |    1 +
 drivers/net/wireless/mwifiex/main.c          |    1 +
 drivers/net/wireless/mwifiex/sta_ioctl.c     |   21 +---
 drivers/platform/x86/hp_accel.c              |    3 +-
 drivers/rtc/rtc-pcf2123.c                    |    1 +
 drivers/scsi/sd.c                            |   20 +++
 drivers/scsi/sd.h                            |    1 +
 drivers/target/iscsi/iscsi_target_erl1.c     |    7 +-
 drivers/target/target_core_transport.c       |   11 +-
 drivers/watchdog/watchdog_dev.c              |    3 +-
 fs/btrfs/ioctl.c                             |   10 +-
 fs/ext4/mballoc.c                            |    6 +-
 include/linux/audit.h                        |    2 +-
 include/linux/if_cablemodem.h                |   12 +-
 include/linux/kref.h                         |   33 +++++
 include/linux/math64.h                       |   19 ++-
 include/linux/virtio_console.h               |    2 +-
 include/net/sock.h                           |   12 ++
 include/net/tcp.h                            |    1 +
 kernel/kmod.c                                |    5 +
 kernel/time/tick-sched.c                     |    2 +-
 kernel/timer.c                               |    2 +-
 kernel/trace/trace_events_filter.c           |    4 +
 lib/div64.c                                  |   19 ++-
 net/8021q/vlan_dev.c                         |    2 +-
 net/bridge/br_stp_timer.c                    |    2 +-
 net/core/dev.c                               |    2 +-
 net/core/ethtool.c                           |    2 +-
 net/core/sock.c                              |   12 --
 net/ipv6/tcp_ipv6.c                          |   12 ++
 net/ipv6/udp.c                               |   13 +-
 net/ipv6/udp_impl.h                          |    2 +
 net/ipv6/udplite.c                           |    2 +-
 net/ipv6/xfrm6_policy.c                      |    4 +-
 net/mac802154/mac802154.h                    |    2 +-
 net/packet/af_packet.c                       |   53 ++++----
 net/sched/act_ipt.c                          |   33 ++++-
 sound/pci/hda/hda_codec.c                    |    3 +
 sound/soc/codecs/wm8994.c                    |    1 +
 82 files changed, 761 insertions(+), 315 deletions(-)

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

* [01/65] KVM: VMX: fix halt emulation while emulating invalid guest sate
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [02/65] ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices Steven Rostedt
                   ` (63 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tomas Papan, Paolo Bonzini, Gleb Natapov

[-- Attachment #1: 0001-KVM-VMX-fix-halt-emulation-while-emulating-invalid-g.patch --]
[-- Type: text/plain, Size: 1350 bytes --]

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

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

From: Gleb Natapov <gleb@redhat.com>

[ Upstream commit 8d76c49e9ffeee839bc0b7a3278a23f99101263e ]

The invalid guest state emulation loop does not check halt_request
which causes 100% cpu loop while guest is in halt and in invalid
state, but more serious issue is that this leaves halt_request set, so
random instruction emulated by vm86 #GP exit can be interpreted
as halt which causes guest hang. Fix both problems by handling
halt_request in emulation loop.

Reported-by: Tomas Papan <tomas.papan@gmail.com>
Tested-by: Tomas Papan <tomas.papan@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
CC: stable@vger.kernel.org
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kvm/vmx.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ff66a3b..a0f8dc3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5030,6 +5030,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
 			return 0;
 		}
 
+		if (vcpu->arch.halt_request) {
+			vcpu->arch.halt_request = 0;
+			ret = kvm_emulate_halt(vcpu);
+			goto out;
+		}
+
 		if (signal_pending(current))
 			goto out;
 		if (need_resched())
-- 
1.7.10.4



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

* [02/65] ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
  2013-06-03 22:10 ` [01/65] KVM: VMX: fix halt emulation while emulating invalid guest sate Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [03/65] ASoC: wm8994: missing break in wm8994_aif3_hw_params() Steven Rostedt
                   ` (62 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sebastian Reichel, Aaro Koskinen, Pali Rohár,
	Joni Lapilainen, Tomi Valkeinen, Felipe Balbi, Tony Lindgren

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0002-ARM-OMAP-RX-51-change-probe-order-of-touchscreen-and.patch --]
[-- Type: text/plain, Size: 2218 bytes --]

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

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

From: Aaro Koskinen <aaro.koskinen@iki.fi>

[ Upstream commit e65f131a14726e5f1b880a528271a52428e5b3a5 ]

Commit 9fdca9df (spi: omap2-mcspi: convert to module_platform_driver)
broke the SPI display/panel driver probe on RX-51/N900. The exact cause is
not fully understood, but it seems to be related to the probe order. SPI
communication to the panel driver (spi1.2) fails unless the touchscreen
(spi1.0) has been probed/initialized before. When the omap2-mcspi driver
was converted to a platform driver, it resulted in that the devices are
probed immediately after the board registers them in the order they are
listed in the board file.

Fix the issue by moving the touchscreen before the panel in the SPI
device list.

The patch fixes the following failure:

[    1.260955] acx565akm spi1.2: invalid display ID
[    1.265899] panel-acx565akm display0: acx_panel_probe panel detect error
[    1.273071] omapdss CORE error: driver probe failed: -19

Tested-by: Sebastian Reichel <sre@debian.org>
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Joni Lapilainen <joni.lapilainen@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index df2534d..364e36a 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -67,11 +67,11 @@
 #define LIS302_IRQ1_GPIO 181
 #define LIS302_IRQ2_GPIO 180  /* Not yet in use */
 
-/* list all spi devices here */
+/* List all SPI devices here. Note that the list/probe order seems to matter! */
 enum {
 	RX51_SPI_WL1251,
-	RX51_SPI_MIPID,		/* LCD panel */
 	RX51_SPI_TSC2005,	/* Touch Controller */
+	RX51_SPI_MIPID,		/* LCD panel */
 };
 
 static struct wl12xx_platform_data wl1251_pdata;
-- 
1.7.10.4



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

* [03/65] ASoC: wm8994: missing break in wm8994_aif3_hw_params()
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
  2013-06-03 22:10 ` [01/65] KVM: VMX: fix halt emulation while emulating invalid guest sate Steven Rostedt
  2013-06-03 22:10 ` [02/65] ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [04/65] ACPICA: Fix possible buffer overflow during a field unit read operation Steven Rostedt
                   ` (61 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Dan Carpenter, Mark Brown

[-- Attachment #1: 0003-ASoC-wm8994-missing-break-in-wm8994_aif3_hw_params.patch --]
[-- Type: text/plain, Size: 907 bytes --]

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

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

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

[ Upstream commit 4495e46fe18f198366961bb2b324a694ef8a9b44 ]

The missing break here means that we always return early and the
function is a no-op.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 sound/soc/codecs/wm8994.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 6c9eeca..7911480 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -2778,6 +2778,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
 		default:
 			return 0;
 		}
+		break;
 	default:
 		return 0;
 	}
-- 
1.7.10.4



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

* [04/65] ACPICA: Fix possible buffer overflow during a field unit read operation
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (2 preceding siblings ...)
  2013-06-03 22:10 ` [03/65] ASoC: wm8994: missing break in wm8994_aif3_hw_params() Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [05/65] ALSA: HDA: Fix Oops caused by dereference NULL pointer Steven Rostedt
                   ` (60 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Bob Moore, Lv Zheng, Rafael J. Wysocki

[-- Attachment #1: 0004-ACPICA-Fix-possible-buffer-overflow-during-a-field-u.patch --]
[-- Type: text/plain, Size: 1623 bytes --]

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

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

From: Bob Moore <robert.moore@intel.com>

[ Upstream commit 61388f9e5d93053cf399a356414f31f9b4814c6d ]

Can only happen under these conditions: 1) The DSDT version is 1,
meaning integers are 32-bits.  2) The field is between 33 and 64
bits long.

It applies cleanly back to ACPICA 20100806+ (Linux v2.6.37+).

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: 2.6.37+ <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/acpi/acpica/exfldio.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index a778415..d5d9bf0 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -722,7 +722,19 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
 
 	if ((obj_desc->common_field.start_field_bit_offset == 0) &&
 	    (obj_desc->common_field.bit_length == access_bit_width)) {
-		status = acpi_ex_field_datum_io(obj_desc, 0, buffer, ACPI_READ);
+		if (buffer_length >= sizeof(u64)) {
+			status =
+			    acpi_ex_field_datum_io(obj_desc, 0, buffer,
+						   ACPI_READ);
+		} else {
+			/* Use raw_datum (u64) to handle buffers < 64 bits */
+
+			status =
+			    acpi_ex_field_datum_io(obj_desc, 0, &raw_datum,
+						   ACPI_READ);
+			ACPI_MEMCPY(buffer, &raw_datum, buffer_length);
+		}
+
 		return_ACPI_STATUS(status);
 	}
 
-- 
1.7.10.4



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

* [05/65] ALSA: HDA: Fix Oops caused by dereference NULL pointer
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (3 preceding siblings ...)
  2013-06-03 22:10 ` [04/65] ACPICA: Fix possible buffer overflow during a field unit read operation Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [06/65] dm stripe: fix regression in stripe_width calculation Steven Rostedt
                   ` (59 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Wang YanQing, Takashi Iwai

[-- Attachment #1: 0005-ALSA-HDA-Fix-Oops-caused-by-dereference-NULL-pointer.patch --]
[-- Type: text/plain, Size: 1387 bytes --]

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

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

From: Wang YanQing <udknight@gmail.com>

[ Upstream commit 2195b063f6609e4c6268f291683902f25eaf9aa6 ]

The interrupt handler azx_interrupt will call azx_update_rirb,
which may call snd_hda_queue_unsol_event, snd_hda_queue_unsol_event
will dereference chip->bus pointer.

The problem is we alloc chip->bus in azx_codec_create
which will be called after we enable IRQ and enable unsolicited
event in azx_probe.

This will cause Oops due dereference NULL pointer. I meet it, good luck:)

[Rearranged the NULL check before the tracepoint and added another
 NULL check of bus->workq -- tiwai]

Signed-off-by: Wang YanQing <udknight@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 sound/pci/hda/hda_codec.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 558b6b0..693e890 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -609,6 +609,9 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
 	struct hda_bus_unsolicited *unsol;
 	unsigned int wp;
 
+	if (!bus || !bus->workq)
+		return 0;
+
 	trace_hda_unsol_event(bus, res, res_ex);
 	unsol = bus->unsol;
 	if (!unsol)
-- 
1.7.10.4



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

* [06/65] dm stripe: fix regression in stripe_width calculation
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (4 preceding siblings ...)
  2013-06-03 22:10 ` [05/65] ALSA: HDA: Fix Oops caused by dereference NULL pointer Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [07/65] dm bufio: avoid a possible __vmalloc deadlock Steven Rostedt
                   ` (58 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mike Snitzer, Alasdair G Kergon

[-- Attachment #1: 0006-dm-stripe-fix-regression-in-stripe_width-calculation.patch --]
[-- Type: text/plain, Size: 2712 bytes --]

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

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

From: Mike Snitzer <snitzer@redhat.com>

[ Upstream commit d793e684277124d55c5d2444007e224635821346 ]

Fix a regression in the calculation of the stripe_width in the
dm stripe target which led to incorrect processing of device limits.

The stripe_width is the stripe device length divided by the number of
stripes.  The group of commits in the range f14fa69 ("dm stripe: fix
size test") to eb850de ("dm stripe: support for non power of 2
chunksize") interfered with each other (a merging error) and led to the
stripe_width being set incorrectly to the stripe device length divided by
chunk_size * stripe_count.

For example, a stripe device's table with: 0 33553920 striped 3 512 ...
should result in a stripe_width of 11184640 (33553920 / 3), but due to
the bug it was getting set to 21845 (33553920 / (512 * 3)).

The impact of this bug is that device topologies that previously worked
fine with the stripe target are no longer considered valid.  In
particular, there is a higher risk of seeing this issue if one of the
stripe devices has a 4K logical block size.  Resulting in an error
message like this:
"device-mapper: table: 253:4: len=21845 not aligned to h/w logical block size 4096 of dm-1"

The fix is to swap the order of the divisions and to use a temporary
variable for the second one, so that width retains the intended
value.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 3.6+
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/md/dm-stripe.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index a087bf2..c6cdd1a 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -94,7 +94,7 @@ static int get_stripe(struct dm_target *ti, struct stripe_c *sc,
 static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 {
 	struct stripe_c *sc;
-	sector_t width;
+	sector_t width, tmp_len;
 	uint32_t stripes;
 	uint32_t chunk_size;
 	int r;
@@ -116,15 +116,16 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	}
 
 	width = ti->len;
-	if (sector_div(width, chunk_size)) {
+	if (sector_div(width, stripes)) {
 		ti->error = "Target length not divisible by "
-		    "chunk size";
+		    "number of stripes";
 		return -EINVAL;
 	}
 
-	if (sector_div(width, stripes)) {
+	tmp_len = width;
+	if (sector_div(tmp_len, chunk_size)) {
 		ti->error = "Target length not divisible by "
-		    "number of stripes";
+		    "chunk size";
 		return -EINVAL;
 	}
 
-- 
1.7.10.4



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

* [07/65] dm bufio: avoid a possible __vmalloc deadlock
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (5 preceding siblings ...)
  2013-06-03 22:10 ` [06/65] dm stripe: fix regression in stripe_width calculation Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-04 12:59   ` Mikulas Patocka
  2013-06-03 22:10 ` [08/65] dm snapshot: fix error return code in snapshot_ctr Steven Rostedt
                   ` (57 subsequent siblings)
  64 siblings, 1 reply; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mikulas Patocka, stable, Alasdair G Kergon

[-- Attachment #1: 0007-dm-bufio-avoid-a-possible-__vmalloc-deadlock.patch --]
[-- Type: text/plain, Size: 2930 bytes --]

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

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

From: Mikulas Patocka <mpatocka@redhat.com>

[ Upstream commit 502624bdad3dba45dfaacaf36b7d83e39e74b2d2 ]

This patch uses memalloc_noio_save to avoid a possible deadlock in
dm-bufio.  (it could happen only with large block size, at most
PAGE_SIZE << MAX_ORDER (typically 8MiB).

__vmalloc doesn't fully respect gfp flags. The specified gfp flags are
used for allocation of requested pages, structures vmap_area, vmap_block
and vm_struct and the radix tree nodes.

However, the kernel pagetables are allocated always with GFP_KERNEL.
Thus the allocation of pagetables can recurse back to the I/O layer and
cause a deadlock.

This patch uses the function memalloc_noio_save to set per-process
PF_MEMALLOC_NOIO flag and the function memalloc_noio_restore to restore
it. When this flag is set, all allocations in the process are done with
implied GFP_NOIO flag, thus the deadlock can't happen.

This should be backported to stable kernels, but they don't have the
PF_MEMALLOC_NOIO flag and memalloc_noio_save/memalloc_noio_restore
functions. So, PF_MEMALLOC should be set and restored instead.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
[ Set and clear PF_MEMALLOC manually - SR ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/md/dm-bufio.c |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index c0fc827..a1f2487 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -321,6 +321,9 @@ static void __cache_size_refresh(void)
 static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 			       enum data_mode *data_mode)
 {
+	unsigned noio_flag;
+	void *ptr;
+
 	if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) {
 		*data_mode = DATA_MODE_SLAB;
 		return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask);
@@ -334,7 +337,28 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 	}
 
 	*data_mode = DATA_MODE_VMALLOC;
-	return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
+
+	/*
+	 * __vmalloc allocates the data pages and auxiliary structures with
+	 * gfp_flags that were specified, but pagetables are always allocated
+	 * with GFP_KERNEL, no matter what was specified as gfp_mask.
+	 *
+	 * Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that
+	 * all allocations done by this process (including pagetables) are done
+	 * as if GFP_NOIO was specified.
+	 */
+
+	if (gfp_mask & __GFP_NORETRY) {
+		noio_flag = current->flags;
+		current->flags |= PF_MEMALLOC;
+	}
+
+	ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
+
+	if (gfp_mask & __GFP_NORETRY)
+		current->flags = (current->flags & ~PF_MEMALLOC) | noio_flag;
+
+	return ptr;
 }
 
 /*
-- 
1.7.10.4



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

* [08/65] dm snapshot: fix error return code in snapshot_ctr
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (6 preceding siblings ...)
  2013-06-03 22:10 ` [07/65] dm bufio: avoid a possible __vmalloc deadlock Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [09/65] math64: New div64_u64_rem helper Steven Rostedt
                   ` (56 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Wei Yongjun, Alasdair G Kergon

[-- Attachment #1: 0008-dm-snapshot-fix-error-return-code-in-snapshot_ctr.patch --]
[-- Type: text/plain, Size: 1038 bytes --]

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

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

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

[ Upstream commit 09e8b813897a0f85bb401435d009228644c81214 ]

Return -ENOMEM instead of success if unable to allocate pending
exception mempool in snapshot_ctr.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/md/dm-snap.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index a143921..456ef7a 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1117,6 +1117,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	s->pending_pool = mempool_create_slab_pool(MIN_IOS, pending_cache);
 	if (!s->pending_pool) {
 		ti->error = "Could not allocate mempool for pending exceptions";
+		r = -ENOMEM;
 		goto bad_pending_pool;
 	}
 
-- 
1.7.10.4



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

* [09/65] math64: New div64_u64_rem helper
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (7 preceding siblings ...)
  2013-06-03 22:10 ` [08/65] dm snapshot: fix error return code in snapshot_ctr Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-04 13:45   ` Stanislaw Gruszka
  2013-06-03 22:10 ` [10/65] hp_accel: Ignore the error from lis3lv02d_poweron() at resume Steven Rostedt
                   ` (55 subsequent siblings)
  64 siblings, 1 reply; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Frederic Weisbecker, Stanislaw Gruszka, Peter Zijlstra,
	Ingo Molnar, Andrew Morton

[-- Attachment #1: 0009-math64-New-div64_u64_rem-helper.patch --]
[-- Type: text/plain, Size: 3334 bytes --]

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

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

From: Frederic Weisbecker <fweisbec@gmail.com>

[ Upstream commit f792685006274a850e6cc0ea9ade275ccdfc90bc ]

Provide an extended version of div64_u64() that
also returns the remainder of the division.

We are going to need this to refine the cputime
scaling code.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/math64.h |   19 ++++++++++++++++++-
 lib/div64.c            |   19 +++++++++++++------
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/include/linux/math64.h b/include/linux/math64.h
index b8ba855..931a619 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -30,6 +30,15 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
 }
 
 /**
+ * div64_u64_rem - unsigned 64bit divide with 64bit divisor
+ */
+static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
+{
+	*remainder = dividend % divisor;
+	return dividend / divisor;
+}
+
+/**
  * div64_u64 - unsigned 64bit divide with 64bit divisor
  */
 static inline u64 div64_u64(u64 dividend, u64 divisor)
@@ -61,8 +70,16 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
 extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
 #endif
 
+#ifndef div64_u64_rem
+extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
+#endif
+
 #ifndef div64_u64
-extern u64 div64_u64(u64 dividend, u64 divisor);
+static inline u64 div64_u64(u64 dividend, u64 divisor)
+{
+	u64 remainder;
+	return div64_u64_rem(dividend, divisor, &remainder);
+}
 #endif
 
 #ifndef div64_s64
diff --git a/lib/div64.c b/lib/div64.c
index a163b6c..3af5728 100644
--- a/lib/div64.c
+++ b/lib/div64.c
@@ -79,9 +79,10 @@ EXPORT_SYMBOL(div_s64_rem);
 #endif
 
 /**
- * div64_u64 - unsigned 64bit divide with 64bit divisor
+ * div64_u64_rem - unsigned 64bit divide with 64bit divisor and 64bit remainder
  * @dividend:	64bit dividend
  * @divisor:	64bit divisor
+ * @remainder:  64bit remainder
  *
  * This implementation is a modified version of the algorithm proposed
  * by the book 'Hacker's Delight'.  The original source and full proof
@@ -89,27 +90,33 @@ EXPORT_SYMBOL(div_s64_rem);
  *
  * 'http://www.hackersdelight.org/HDcode/newCode/divDouble.c.txt'
  */
-#ifndef div64_u64
-u64 div64_u64(u64 dividend, u64 divisor)
+#ifndef div64_u64_rem
+u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
 {
 	u32 high = divisor >> 32;
 	u64 quot;
 
 	if (high == 0) {
-		quot = div_u64(dividend, divisor);
+		u32 rem32;
+		quot = div_u64_rem(dividend, divisor, &rem32);
+		*remainder = rem32;
 	} else {
 		int n = 1 + fls(high);
 		quot = div_u64(dividend >> n, divisor >> n);
 
 		if (quot != 0)
 			quot--;
-		if ((dividend - quot * divisor) >= divisor)
+
+		*remainder = dividend - quot * divisor;
+		if (*remainder >= divisor) {
 			quot++;
+			*remainder -= divisor;
+		}
 	}
 
 	return quot;
 }
-EXPORT_SYMBOL(div64_u64);
+EXPORT_SYMBOL(div64_u64_rem);
 #endif
 
 /**
-- 
1.7.10.4



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

* [10/65] hp_accel: Ignore the error from lis3lv02d_poweron() at resume
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (8 preceding siblings ...)
  2013-06-03 22:10 ` [09/65] math64: New div64_u64_rem helper Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [11/65] xen/vcpu/pvhvm: Fix vcpu hotplugging hanging Steven Rostedt
                   ` (54 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Takashi Iwai, Shuah Khan, Matthew Garrett

[-- Attachment #1: 0010-hp_accel-Ignore-the-error-from-lis3lv02d_poweron-at-.patch --]
[-- Type: text/plain, Size: 1363 bytes --]

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

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

From: Shuah Khan <shuah.khan@hp.com>

[ Upstream commit 7783819920ca52fc582a2782f654fe6ed373f465 ]

The error in lis3lv02_poweron() is harmless in the resume path, so
we should ignore it. It is inline with the other usages of lis3lv02_poweron()
and matches the 3.0 code for this routine. This patch is in suse git and
might have missed making it into the mainline.
opensuse - commit id: 66ccdac87c322cf7af12bddba8c805af640b1cff

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
CC: stable@vger.kernel.org 3.8, 3.4, 3.5, 3.2
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/platform/x86/hp_accel.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index 6b9af98..45f6b5c 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -362,7 +362,8 @@ static int lis3lv02d_suspend(struct device *dev)
 
 static int lis3lv02d_resume(struct device *dev)
 {
-	return lis3lv02d_poweron(&lis3_dev);
+	lis3lv02d_poweron(&lis3_dev);
+	return 0;
 }
 
 static SIMPLE_DEV_PM_OPS(hp_accel_pm, lis3lv02d_suspend, lis3lv02d_resume);
-- 
1.7.10.4



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

* [11/65] xen/vcpu/pvhvm: Fix vcpu hotplugging hanging.
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (9 preceding siblings ...)
  2013-06-03 22:10 ` [10/65] hp_accel: Ignore the error from lis3lv02d_poweron() at resume Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [12/65] sd: fix array cache flushing bug causing performance problems Steven Rostedt
                   ` (53 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Stefano Stabellini, Konrad Rzeszutek Wilk

[-- Attachment #1: 0011-xen-vcpu-pvhvm-Fix-vcpu-hotplugging-hanging.patch --]
[-- Type: text/plain, Size: 4522 bytes --]

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

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

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

[ Upstream commit 7f1fc268c47491fd5e63548f6415fc8604e13003 ]

If a user did:

	echo 0 > /sys/devices/system/cpu/cpu1/online
	echo 1 > /sys/devices/system/cpu/cpu1/online

we would (this a build with DEBUG enabled) get to:
smpboot: ++++++++++++++++++++=_---CPU UP  1
.. snip..
smpboot: Stack at about ffff880074c0ff44
smpboot: CPU1: has booted.

and hang. The RCU mechanism would kick in an try to IPI the CPU1
but the IPIs (and all other interrupts) would never arrive at the
CPU1. At first glance at least. A bit digging in the hypervisor
trace shows that (using xenanalyze):

[vla] d4v1 vec 243 injecting
   0.043163027 --|x d4v1 intr_window vec 243 src 5(vector) intr f3
]  0.043163639 --|x d4v1 vmentry cycles 1468
]  0.043164913 --|x d4v1 vmexit exit_reason PENDING_INTERRUPT eip ffffffff81673254
   0.043164913 --|x d4v1 inj_virq vec 243  real
  [vla] d4v1 vec 243 injecting
   0.043164913 --|x d4v1 intr_window vec 243 src 5(vector) intr f3
]  0.043165526 --|x d4v1 vmentry cycles 1472
]  0.043166800 --|x d4v1 vmexit exit_reason PENDING_INTERRUPT eip ffffffff81673254
   0.043166800 --|x d4v1 inj_virq vec 243  real
  [vla] d4v1 vec 243 injecting

there is a pending event (subsequent debugging shows it is the IPI
from the VCPU0 when smpboot.c on VCPU1 has done
"set_cpu_online(smp_processor_id(), true)") and the guest VCPU1 is
interrupted with the callback IPI (0xf3 aka 243) which ends up calling
__xen_evtchn_do_upcall.

The __xen_evtchn_do_upcall seems to do *something* but not acknowledge
the pending events. And the moment the guest does a 'cli' (that is the
ffffffff81673254 in the log above) the hypervisor is invoked again to
inject the IPI (0xf3) to tell the guest it has pending interrupts.
This repeats itself forever.

The culprit was the per_cpu(xen_vcpu, cpu) pointer. At the bootup
we set each per_cpu(xen_vcpu, cpu) to point to the
shared_info->vcpu_info[vcpu] but later on use the VCPUOP_register_vcpu_info
to register per-CPU  structures (xen_vcpu_setup).
This is used to allow events for more than 32 VCPUs and for performance
optimizations reasons.

When the user performs the VCPU hotplug we end up calling the
the xen_vcpu_setup once more. We make the hypercall which returns
-EINVAL as it does not allow multiple registration calls (and
already has re-assigned where the events are being set). We pick
the fallback case and set per_cpu(xen_vcpu, cpu) to point to the
shared_info->vcpu_info[vcpu] (which is a good fallback during bootup).
However the hypervisor is still setting events in the register
per-cpu structure (per_cpu(xen_vcpu_info, cpu)).

As such when the events are set by the hypervisor (such as timer one),
and when we iterate in __xen_evtchn_do_upcall we end up reading stale
events from the shared_info->vcpu_info[vcpu] instead of the
per_cpu(xen_vcpu_info, cpu) structures. Hence we never acknowledge the
events that the hypervisor has set and the hypervisor keeps on reminding
us to ack the events which we never do.

The fix is simple. Don't on the second time when xen_vcpu_setup is
called over-write the per_cpu(xen_vcpu, cpu) if it points to
per_cpu(xen_vcpu_info).

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: stable@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/xen/enlighten.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 0dc16d6..d11cf12 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -154,6 +154,21 @@ static void xen_vcpu_setup(int cpu)
 
 	BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
 
+	/*
+	 * This path is called twice on PVHVM - first during bootup via
+	 * smp_init -> xen_hvm_cpu_notify, and then if the VCPU is being
+	 * hotplugged: cpu_up -> xen_hvm_cpu_notify.
+	 * As we can only do the VCPUOP_register_vcpu_info once lets
+	 * not over-write its result.
+	 *
+	 * For PV it is called during restore (xen_vcpu_restore) and bootup
+	 * (xen_setup_vcpu_info_placement). The hotplug mechanism does not
+	 * use this function.
+	 */
+	if (xen_hvm_domain()) {
+		if (per_cpu(xen_vcpu, cpu) == &per_cpu(xen_vcpu_info, cpu))
+			return;
+	}
 	if (cpu < MAX_VIRT_CPUS)
 		per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
 
-- 
1.7.10.4



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

* [12/65] sd: fix array cache flushing bug causing performance problems
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (10 preceding siblings ...)
  2013-06-03 22:10 ` [11/65] xen/vcpu/pvhvm: Fix vcpu hotplugging hanging Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [13/65] audit: Syscall rules are not applied to existing processes on non-x86 Steven Rostedt
                   ` (52 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Ric Wheeler, James Bottomley

[-- Attachment #1: 0012-sd-fix-array-cache-flushing-bug-causing-performance-.patch --]
[-- Type: text/plain, Size: 3688 bytes --]

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

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

From: James Bottomley <JBottomley@Parallels.com>

[ Upstream commit 39c60a0948cc06139e2fbfe084f83cb7e7deae3b ]

Some arrays synchronize their full non volatile cache when the sd driver sends
a SYNCHRONIZE CACHE command.  Unfortunately, they can have Terrabytes of this
and we send a SYNCHRONIZE CACHE for every barrier if an array reports it has a
writeback cache.  This leads to massive slowdowns on journalled filesystems.

The fix is to allow userspace to turn off the writeback cache setting as a
temporary measure (i.e. without doing the MODE SELECT to write it back to the
device), so even though the device reported it has a writeback cache, the
user, knowing that the cache is non volatile and all they care about is
filesystem correctness, can turn that bit off in the kernel and avoid the
performance ruinous (and safety irrelevant) SYNCHRONIZE CACHE commands.

The way you do this is add a 'temporary' prefix when performing the usual
cache setting operations, so

echo temporary write through > /sys/class/scsi_disk/<disk>/cache_type

Reported-by: Ric Wheeler <rwheeler@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/scsi/sd.c |   20 ++++++++++++++++++++
 drivers/scsi/sd.h |    1 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 4df73e5..88ced02 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -141,6 +141,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 	char *buffer_data;
 	struct scsi_mode_data data;
 	struct scsi_sense_hdr sshdr;
+	const char *temp = "temporary ";
 	int len;
 
 	if (sdp->type != TYPE_DISK)
@@ -149,6 +150,13 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 		 * it's not worth the risk */
 		return -EINVAL;
 
+	if (strncmp(buf, temp, sizeof(temp) - 1) == 0) {
+		buf += sizeof(temp) - 1;
+		sdkp->cache_override = 1;
+	} else {
+		sdkp->cache_override = 0;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(sd_cache_types); i++) {
 		len = strlen(sd_cache_types[i]);
 		if (strncmp(sd_cache_types[i], buf, len) == 0 &&
@@ -161,6 +169,13 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
 		return -EINVAL;
 	rcd = ct & 0x01 ? 1 : 0;
 	wce = ct & 0x02 ? 1 : 0;
+
+	if (sdkp->cache_override) {
+		sdkp->WCE = wce;
+		sdkp->RCD = rcd;
+		return count;
+	}
+
 	if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT,
 			    SD_MAX_RETRIES, &data, NULL))
 		return -EINVAL;
@@ -2127,6 +2142,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
 	int old_rcd = sdkp->RCD;
 	int old_dpofua = sdkp->DPOFUA;
 
+
+	if (sdkp->cache_override)
+		return;
+
 	first_len = 4;
 	if (sdp->skip_ms_page_8) {
 		if (sdp->type == TYPE_RBC)
@@ -2613,6 +2632,7 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
 	sdkp->capacity = 0;
 	sdkp->media_present = 1;
 	sdkp->write_prot = 0;
+	sdkp->cache_override = 0;
 	sdkp->WCE = 0;
 	sdkp->RCD = 0;
 	sdkp->ATO = 0;
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index f703f48..e2b2956 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -67,6 +67,7 @@ struct scsi_disk {
 	u8		protection_type;/* Data Integrity Field */
 	u8		provisioning_mode;
 	unsigned	ATO : 1;	/* state of disk ATO bit */
+	unsigned	cache_override : 1; /* temp override of WCE,RCD */
 	unsigned	WCE : 1;	/* state of disk WCE bit */
 	unsigned	RCD : 1;	/* state of disk RCD bit, unused */
 	unsigned	DPOFUA : 1;	/* state of disk DPOFUA bit */
-- 
1.7.10.4



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

* [13/65] audit: Syscall rules are not applied to existing processes on non-x86
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (11 preceding siblings ...)
  2013-06-03 22:10 ` [12/65] sd: fix array cache flushing bug causing performance problems Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [14/65] timer: Dont reinitialize the cpu base lock during CPU_UP_PREPARE Steven Rostedt
                   ` (51 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Anton Blanchard, stable, Eric Paris

[-- Attachment #1: 0013-audit-Syscall-rules-are-not-applied-to-existing-proc.patch --]
[-- Type: text/plain, Size: 1904 bytes --]

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

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

From: Anton Blanchard <anton@samba.org>

[ Upstream commit cdee3904b4ce7c03d1013ed6dd704b43ae7fc2e9 ]

Commit b05d8447e782 (audit: inline audit_syscall_entry to reduce
burden on archs) changed audit_syscall_entry to check for a dummy
context before calling __audit_syscall_entry. Unfortunately the dummy
context state is maintained in __audit_syscall_entry so once set it
never gets cleared, even if the audit rules change.

As a result, if there are no auditing rules when a process starts
then it will never be subject to any rules added later. x86 doesn't
see this because it has an assembly fast path that calls directly into
__audit_syscall_entry.

I noticed this issue when working on audit performance optimisations.
I wrote a set of simple test cases available at:

http://ozlabs.org/~anton/junkcode/audit_tests.tar.gz

02_new_rule.py fails without the patch and passes with it. The
test case clears all rules, starts a process, adds a rule then
verifies the process produces a syscall audit record.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org> # 3.3+
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/audit.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 36abf2a..a36d567 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -481,7 +481,7 @@ static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
 				       unsigned long a1, unsigned long a2,
 				       unsigned long a3)
 {
-	if (unlikely(!audit_dummy_context()))
+	if (unlikely(current->audit_context))
 		__audit_syscall_entry(arch, major, a0, a1, a2, a3);
 }
 static inline void audit_syscall_exit(void *pt_regs)
-- 
1.7.10.4



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

* [14/65] timer: Dont reinitialize the cpu base lock during CPU_UP_PREPARE
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (12 preceding siblings ...)
  2013-06-03 22:10 ` [13/65] audit: Syscall rules are not applied to existing processes on non-x86 Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [15/65] tick: Cleanup NOHZ per cpu data on cpu down Steven Rostedt
                   ` (50 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tirupathi Reddy, Thomas Gleixner

[-- Attachment #1: 0014-timer-Don-t-reinitialize-the-cpu-base-lock-during-CP.patch --]
[-- Type: text/plain, Size: 3864 bytes --]

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

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

From: Tirupathi Reddy <tirupath@codeaurora.org>

[ Upstream commit 42a5cf46cd56f46267d2a9fcf2655f4078cd3042 ]

An inactive timer's base can refer to a offline cpu's base.

In the current code, cpu_base's lock is blindly reinitialized each
time a CPU is brought up. If a CPU is brought online during the period
that another thread is trying to modify an inactive timer on that CPU
with holding its timer base lock, then the lock will be reinitialized
under its feet. This leads to following SPIN_BUG().

<0> BUG: spinlock already unlocked on CPU#3, kworker/u:3/1466
<0> lock: 0xe3ebe000, .magic: dead4ead, .owner: kworker/u:3/1466, .owner_cpu: 1
<4> [<c0013dc4>] (unwind_backtrace+0x0/0x11c) from [<c026e794>] (do_raw_spin_unlock+0x40/0xcc)
<4> [<c026e794>] (do_raw_spin_unlock+0x40/0xcc) from [<c076c160>] (_raw_spin_unlock+0x8/0x30)
<4> [<c076c160>] (_raw_spin_unlock+0x8/0x30) from [<c009b858>] (mod_timer+0x294/0x310)
<4> [<c009b858>] (mod_timer+0x294/0x310) from [<c00a5e04>] (queue_delayed_work_on+0x104/0x120)
<4> [<c00a5e04>] (queue_delayed_work_on+0x104/0x120) from [<c04eae00>] (sdhci_msm_bus_voting+0x88/0x9c)
<4> [<c04eae00>] (sdhci_msm_bus_voting+0x88/0x9c) from [<c04d8780>] (sdhci_disable+0x40/0x48)
<4> [<c04d8780>] (sdhci_disable+0x40/0x48) from [<c04bf300>] (mmc_release_host+0x4c/0xb0)
<4> [<c04bf300>] (mmc_release_host+0x4c/0xb0) from [<c04c7aac>] (mmc_sd_detect+0x90/0xfc)
<4> [<c04c7aac>] (mmc_sd_detect+0x90/0xfc) from [<c04c2504>] (mmc_rescan+0x7c/0x2c4)
<4> [<c04c2504>] (mmc_rescan+0x7c/0x2c4) from [<c00a6a7c>] (process_one_work+0x27c/0x484)
<4> [<c00a6a7c>] (process_one_work+0x27c/0x484) from [<c00a6e94>] (worker_thread+0x210/0x3b0)
<4> [<c00a6e94>] (worker_thread+0x210/0x3b0) from [<c00aad9c>] (kthread+0x80/0x8c)
<4> [<c00aad9c>] (kthread+0x80/0x8c) from [<c000ea80>] (kernel_thread_exit+0x0/0x8)

As an example, this particular crash occurred when CPU #3 is executing
mod_timer() on an inactive timer whose base is refered to offlined CPU
#2.  The code locked the timer_base corresponding to CPU #2. Before it
could proceed, CPU #2 came online and reinitialized the spinlock
corresponding to its base. Thus now CPU #3 held a lock which was
reinitialized. When CPU #3 finally ended up unlocking the old cpu_base
corresponding to CPU #2, we hit the above SPIN_BUG().

CPU #0		CPU #3				       CPU #2
------		-------				       -------
.....		 ......				      <Offline>
		mod_timer()
		 lock_timer_base
		   spin_lock_irqsave(&base->lock)

cpu_up(2)	 .....				        ......
							init_timers_cpu()
....		 .....				    	spin_lock_init(&base->lock)
.....		   spin_unlock_irqrestore(&base->lock)  ......
		   <spin_bug>

Allocation of per_cpu timer vector bases is done only once under
"tvec_base_done[]" check. In the current code, spinlock_initialization
of base->lock isn't under this check. When a CPU is up each time the
base lock is reinitialized. Move base spinlock initialization under
the check.

Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1368520142-4136-1-git-send-email-tirupath@codeaurora.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/timer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index 46ef2b1..4cefc08 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1692,12 +1692,12 @@ static int __cpuinit init_timers_cpu(int cpu)
 			boot_done = 1;
 			base = &boot_tvec_bases;
 		}
+		spin_lock_init(&base->lock);
 		tvec_base_done[cpu] = 1;
 	} else {
 		base = per_cpu(tvec_bases, cpu);
 	}
 
-	spin_lock_init(&base->lock);
 
 	for (j = 0; j < TVN_SIZE; j++) {
 		INIT_LIST_HEAD(base->tv5.vec + j);
-- 
1.7.10.4



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

* [15/65] tick: Cleanup NOHZ per cpu data on cpu down
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (13 preceding siblings ...)
  2013-06-03 22:10 ` [14/65] timer: Dont reinitialize the cpu base lock during CPU_UP_PREPARE Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [16/65] tracing: Fix leaks of filter preds Steven Rostedt
                   ` (49 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Prarit Bhargava, Mike Galbraith, Thomas Gleixner

[-- Attachment #1: 0015-tick-Cleanup-NOHZ-per-cpu-data-on-cpu-down.patch --]
[-- Type: text/plain, Size: 1298 bytes --]

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

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

From: Thomas Gleixner <tglx@linutronix.de>

[ Upstream commit 4b0c0f294f60abcdd20994a8341a95c8ac5eeb96 ]

Prarit reported a crash on CPU offline/online. The reason is that on
CPU down the NOHZ related per cpu data of the dead cpu is not cleaned
up. If at cpu online an interrupt happens before the per cpu tick
device is registered the irq_enter() check potentially sees stale data
and dereferences a NULL pointer.

Cleanup the data after the cpu is dead.

Reported-by: Prarit Bhargava <prarit@redhat.com>
Cc: stable@vger.kernel.org
Cc: Mike Galbraith <bitbucket@online.de>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1305031451561.2886@ionos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/time/tick-sched.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index e430b97..7dba89d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -909,7 +909,7 @@ void tick_cancel_sched_timer(int cpu)
 		hrtimer_cancel(&ts->sched_timer);
 # endif
 
-	ts->nohz_mode = NOHZ_MODE_INACTIVE;
+	memset(ts, 0, sizeof(*ts));
 }
 #endif
 
-- 
1.7.10.4



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

* [16/65] tracing: Fix leaks of filter preds
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (14 preceding siblings ...)
  2013-06-03 22:10 ` [15/65] tick: Cleanup NOHZ per cpu data on cpu down Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [17/65] ext4: limit group search loop for non-extent files Steven Rostedt
                   ` (48 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tom Zanussi

[-- Attachment #1: 0016-tracing-Fix-leaks-of-filter-preds.patch --]
[-- Type: text/plain, Size: 2225 bytes --]

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

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

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

[ Upstream commit 60705c89460fdc7227f2d153b68b3f34814738a4 ]

Special preds are created when folding a series of preds that
can be done in serial. These are allocated in an ops field of
the pred structure. But they were never freed, causing memory
leaks.

This was discovered using the kmemleak checker:

unreferenced object 0xffff8800797fd5e0 (size 32):
  comm "swapper/0", pid 1, jiffies 4294690605 (age 104.608s)
  hex dump (first 32 bytes):
    00 00 01 00 03 00 05 00 07 00 09 00 0b 00 0d 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff814b52af>] kmemleak_alloc+0x73/0x98
    [<ffffffff8111ff84>] kmemleak_alloc_recursive.constprop.42+0x16/0x18
    [<ffffffff81120e68>] __kmalloc+0xd7/0x125
    [<ffffffff810d47eb>] kcalloc.constprop.24+0x2d/0x2f
    [<ffffffff810d4896>] fold_pred_tree_cb+0xa9/0xf4
    [<ffffffff810d3781>] walk_pred_tree+0x47/0xcc
    [<ffffffff810d5030>] replace_preds.isra.20+0x6f8/0x72f
    [<ffffffff810d50b5>] create_filter+0x4e/0x8b
    [<ffffffff81b1c30d>] ftrace_test_event_filter+0x5a/0x155
    [<ffffffff8100028d>] do_one_initcall+0xa0/0x137
    [<ffffffff81afbedf>] kernel_init_freeable+0x14d/0x1dc
    [<ffffffff814b24b7>] kernel_init+0xe/0xdb
    [<ffffffff814d539c>] ret_from_fork+0x7c/0xb0
    [<ffffffffffffffff>] 0xffffffffffffffff

Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: stable@vger.kernel.org # 2.6.39+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_events_filter.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 431dba8..289197a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -777,7 +777,11 @@ static int filter_set_pred(struct event_filter *filter,
 
 static void __free_preds(struct event_filter *filter)
 {
+	int i;
+
 	if (filter->preds) {
+		for (i = 0; i < filter->n_preds; i++)
+			kfree(filter->preds[i].ops);
 		kfree(filter->preds);
 		filter->preds = NULL;
 	}
-- 
1.7.10.4



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

* [17/65] ext4: limit group search loop for non-extent files
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (15 preceding siblings ...)
  2013-06-03 22:10 ` [16/65] tracing: Fix leaks of filter preds Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [18/65] ARM: 7720/1: ARM v6/v7 cmpxchg64 shouldnt clear upper 32 bits of the old/new value Steven Rostedt
                   ` (47 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lachlan McIlroy, Eric Sandeen, Theodore Tso

[-- Attachment #1: 0017-ext4-limit-group-search-loop-for-non-extent-files.patch --]
[-- Type: text/plain, Size: 1677 bytes --]

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

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

From: Lachlan McIlroy <lmcilroy@redhat.com>

[ Upstream commit e6155736ad76b2070652745f9e54cdea3f0d8567 ]

In the case where we are allocating for a non-extent file,
we must limit the groups we allocate from to those below
2^32 blocks, and ext4_mb_regular_allocator() attempts to
do this initially by putting a cap on ngroups for the
subsequent search loop.

However, the initial target group comes in from the
allocation context (ac), and it may already be beyond
the artificially limited ngroups.  In this case,
the limit

	if (group == ngroups)
		group = 0;

at the top of the loop is never true, and the loop will
run away.

Catch this case inside the loop and reset the search to
start at group 0.

[sandeen@redhat.com: add commit msg & comments]

Signed-off-by: Lachlan McIlroy <lmcilroy@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 fs/ext4/mballoc.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 773d341..bd62716 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1979,7 +1979,11 @@ repeat:
 		group = ac->ac_g_ex.fe_group;
 
 		for (i = 0; i < ngroups; group++, i++) {
-			if (group == ngroups)
+			/*
+			 * Artificially restricted ngroups for non-extent
+			 * files makes group > ngroups possible on first loop.
+			 */
+			if (group >= ngroups)
 				group = 0;
 
 			/* This now checks without needing the buddy page */
-- 
1.7.10.4



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

* [18/65] ARM: 7720/1: ARM v6/v7 cmpxchg64 shouldnt clear upper 32 bits of the old/new value
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (16 preceding siblings ...)
  2013-06-03 22:10 ` [17/65] ext4: limit group search loop for non-extent files Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [19/65] powerpc: Bring all threads online prior to migration/hibernation Steven Rostedt
                   ` (46 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Will Deacon, Jaccon Bastiaansen, Russell King

[-- Attachment #1: 0018-ARM-7720-1-ARM-v6-v7-cmpxchg64-shouldn-t-clear-upper.patch --]
[-- Type: text/plain, Size: 1947 bytes --]

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

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

From: Jaccon Bastiaansen <jaccon.bastiaansen@gmail.com>

[ Upstream commit 6eabb3301b1facee669d9938f7c5a0295c21d71d ]

The implementation of cmpxchg64() for the ARM v6 and v7 architecture
casts parameter 2 and 3 (the old and new 64bit values) to an unsigned
long before calling the atomic_cmpxchg64() function. This clears
the top 32 bits of the old and new values, resulting in the wrong
values being compare-exchanged. Luckily, this only appears to be used
for 64-bit sched_clock, which we don't (yet) have on ARM.

This bug was introduced by commit 3e0f5a15f500 ("ARM: 7404/1: cmpxchg64:
use atomic64 and local64 routines for cmpxchg64").

Cc: <stable@vger.kernel.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jaccon Bastiaansen <jaccon.bastiaansen@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/arm/include/asm/cmpxchg.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index 7eb18c1..4f009c1 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -233,15 +233,15 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
 	((__typeof__(*(ptr)))atomic64_cmpxchg(container_of((ptr),	\
 						atomic64_t,		\
 						counter),		\
-					      (unsigned long)(o),	\
-					      (unsigned long)(n)))
+					      (unsigned long long)(o),	\
+					      (unsigned long long)(n)))
 
 #define cmpxchg64_local(ptr, o, n)					\
 	((__typeof__(*(ptr)))local64_cmpxchg(container_of((ptr),	\
 						local64_t,		\
 						a),			\
-					     (unsigned long)(o),	\
-					     (unsigned long)(n)))
+					     (unsigned long long)(o),	\
+					     (unsigned long long)(n)))
 
 #endif	/* __LINUX_ARM_ARCH__ >= 6 */
 
-- 
1.7.10.4



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

* [19/65] powerpc: Bring all threads online prior to migration/hibernation
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (17 preceding siblings ...)
  2013-06-03 22:10 ` [18/65] ARM: 7720/1: ARM v6/v7 cmpxchg64 shouldnt clear upper 32 bits of the old/new value Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [20/65] powerpc/kexec: Fix kexec when using VMX optimised memcpy Steven Rostedt
                   ` (45 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: stable, Robert Jennings, Benjamin Herrenschmidt

[-- Attachment #1: 0019-powerpc-Bring-all-threads-online-prior-to-migration-.patch --]
[-- Type: text/plain, Size: 7124 bytes --]

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

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

From: Robert Jennings <rcj@linux.vnet.ibm.com>

[ Upstream commit 120496ac2d2d60aee68d3123a68169502a85f4b5 ]

This patch brings online all threads which are present but not online
prior to migration/hibernation.  After migration/hibernation those
threads are taken back offline.

During migration/hibernation all online CPUs must call H_JOIN, this is
required by the hypervisor.  Without this patch, threads that are offline
(H_CEDE'd) will not be woken to make the H_JOIN call and the OS will be
deadlocked (all threads either JOIN'd or CEDE'd).

Cc: <stable@kernel.org>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/powerpc/include/asm/rtas.h          |    2 +
 arch/powerpc/kernel/rtas.c               |  113 ++++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/suspend.c |   22 ++++++
 3 files changed, 137 insertions(+)

diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 557cff8..5e7e008 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -262,6 +262,8 @@ extern void rtas_progress(char *s, unsigned short hex);
 extern void rtas_initialize(void);
 extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data);
 extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data);
+extern int rtas_online_cpus_mask(cpumask_var_t cpus);
+extern int rtas_offline_cpus_mask(cpumask_var_t cpus);
 extern int rtas_ibm_suspend_me(struct rtas_args *);
 
 struct rtc_time;
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index fcec382..225e9f2 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -19,6 +19,7 @@
 #include <linux/init.h>
 #include <linux/capability.h>
 #include <linux/delay.h>
+#include <linux/cpu.h>
 #include <linux/smp.h>
 #include <linux/completion.h>
 #include <linux/cpumask.h>
@@ -808,6 +809,95 @@ static void rtas_percpu_suspend_me(void *info)
 	__rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1);
 }
 
+enum rtas_cpu_state {
+	DOWN,
+	UP,
+};
+
+#ifndef CONFIG_SMP
+static int rtas_cpu_state_change_mask(enum rtas_cpu_state state,
+				cpumask_var_t cpus)
+{
+	if (!cpumask_empty(cpus)) {
+		cpumask_clear(cpus);
+		return -EINVAL;
+	} else
+		return 0;
+}
+#else
+/* On return cpumask will be altered to indicate CPUs changed.
+ * CPUs with states changed will be set in the mask,
+ * CPUs with status unchanged will be unset in the mask. */
+static int rtas_cpu_state_change_mask(enum rtas_cpu_state state,
+				cpumask_var_t cpus)
+{
+	int cpu;
+	int cpuret = 0;
+	int ret = 0;
+
+	if (cpumask_empty(cpus))
+		return 0;
+
+	for_each_cpu(cpu, cpus) {
+		switch (state) {
+		case DOWN:
+			cpuret = cpu_down(cpu);
+			break;
+		case UP:
+			cpuret = cpu_up(cpu);
+			break;
+		}
+		if (cpuret) {
+			pr_debug("%s: cpu_%s for cpu#%d returned %d.\n",
+					__func__,
+					((state == UP) ? "up" : "down"),
+					cpu, cpuret);
+			if (!ret)
+				ret = cpuret;
+			if (state == UP) {
+				/* clear bits for unchanged cpus, return */
+				cpumask_shift_right(cpus, cpus, cpu);
+				cpumask_shift_left(cpus, cpus, cpu);
+				break;
+			} else {
+				/* clear bit for unchanged cpu, continue */
+				cpumask_clear_cpu(cpu, cpus);
+			}
+		}
+	}
+
+	return ret;
+}
+#endif
+
+int rtas_online_cpus_mask(cpumask_var_t cpus)
+{
+	int ret;
+
+	ret = rtas_cpu_state_change_mask(UP, cpus);
+
+	if (ret) {
+		cpumask_var_t tmp_mask;
+
+		if (!alloc_cpumask_var(&tmp_mask, GFP_TEMPORARY))
+			return ret;
+
+		/* Use tmp_mask to preserve cpus mask from first failure */
+		cpumask_copy(tmp_mask, cpus);
+		rtas_offline_cpus_mask(tmp_mask);
+		free_cpumask_var(tmp_mask);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(rtas_online_cpus_mask);
+
+int rtas_offline_cpus_mask(cpumask_var_t cpus)
+{
+	return rtas_cpu_state_change_mask(DOWN, cpus);
+}
+EXPORT_SYMBOL(rtas_offline_cpus_mask);
+
 int rtas_ibm_suspend_me(struct rtas_args *args)
 {
 	long state;
@@ -815,6 +905,8 @@ int rtas_ibm_suspend_me(struct rtas_args *args)
 	unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
 	struct rtas_suspend_me_data data;
 	DECLARE_COMPLETION_ONSTACK(done);
+	cpumask_var_t offline_mask;
+	int cpuret;
 
 	if (!rtas_service_present("ibm,suspend-me"))
 		return -ENOSYS;
@@ -838,11 +930,24 @@ int rtas_ibm_suspend_me(struct rtas_args *args)
 		return 0;
 	}
 
+	if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
+		return -ENOMEM;
+
 	atomic_set(&data.working, 0);
 	atomic_set(&data.done, 0);
 	atomic_set(&data.error, 0);
 	data.token = rtas_token("ibm,suspend-me");
 	data.complete = &done;
+
+	/* All present CPUs must be online */
+	cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask);
+	cpuret = rtas_online_cpus_mask(offline_mask);
+	if (cpuret) {
+		pr_err("%s: Could not bring present CPUs online.\n", __func__);
+		atomic_set(&data.error, cpuret);
+		goto out;
+	}
+
 	stop_topology_update();
 
 	/* Call function on all CPUs.  One of us will make the
@@ -858,6 +963,14 @@ int rtas_ibm_suspend_me(struct rtas_args *args)
 
 	start_topology_update();
 
+	/* Take down CPUs not online prior to suspend */
+	cpuret = rtas_offline_cpus_mask(offline_mask);
+	if (cpuret)
+		pr_warn("%s: Could not restore CPUs to offline state.\n",
+				__func__);
+
+out:
+	free_cpumask_var(offline_mask);
 	return atomic_read(&data.error);
 }
 #else /* CONFIG_PPC_PSERIES */
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 47226e0..5f997e7 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -16,6 +16,7 @@
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
   */
 
+#include <linux/cpu.h>
 #include <linux/delay.h>
 #include <linux/suspend.h>
 #include <linux/stat.h>
@@ -126,11 +127,15 @@ static ssize_t store_hibernate(struct device *dev,
 			       struct device_attribute *attr,
 			       const char *buf, size_t count)
 {
+	cpumask_var_t offline_mask;
 	int rc;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
+	if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
+		return -ENOMEM;
+
 	stream_id = simple_strtoul(buf, NULL, 16);
 
 	do {
@@ -140,15 +145,32 @@ static ssize_t store_hibernate(struct device *dev,
 	} while (rc == -EAGAIN);
 
 	if (!rc) {
+		/* All present CPUs must be online */
+		cpumask_andnot(offline_mask, cpu_present_mask,
+				cpu_online_mask);
+		rc = rtas_online_cpus_mask(offline_mask);
+		if (rc) {
+			pr_err("%s: Could not bring present CPUs online.\n",
+					__func__);
+			goto out;
+		}
+
 		stop_topology_update();
 		rc = pm_suspend(PM_SUSPEND_MEM);
 		start_topology_update();
+
+		/* Take down CPUs not online prior to suspend */
+		if (!rtas_offline_cpus_mask(offline_mask))
+			pr_warn("%s: Could not restore CPUs to offline "
+					"state.\n", __func__);
 	}
 
 	stream_id = 0;
 
 	if (!rc)
 		rc = count;
+out:
+	free_cpumask_var(offline_mask);
 	return rc;
 }
 
-- 
1.7.10.4



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

* [20/65] powerpc/kexec: Fix kexec when using VMX optimised memcpy
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (18 preceding siblings ...)
  2013-06-03 22:10 ` [19/65] powerpc: Bring all threads online prior to migration/hibernation Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [21/65] ath9k: fix key allocation error handling for powersave keys Steven Rostedt
                   ` (44 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Anton Blanchard, Benjamin Herrenschmidt

[-- Attachment #1: 0020-powerpc-kexec-Fix-kexec-when-using-VMX-optimised-mem.patch --]
[-- Type: text/plain, Size: 2177 bytes --]

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

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

From: Anton Blanchard <anton@au1.ibm.com>

[ Upstream commit 79c66ce8f6448a3295a32efeac88c9debd7f7094 ]

commit b3f271e86e5a (powerpc: POWER7 optimised memcpy using VMX and
enhanced prefetch) uses VMX when it is safe to do so (ie not in
interrupt). It also looks at the task struct to decide if we have to
save the current tasks' VMX state.

kexec calls memcpy() at a point where the task struct may have been
overwritten by the new kexec segments. If it has been overwritten
then when memcpy -> enable_altivec looks up current->thread.regs->msr
we get a cryptic oops or lockup.

I also notice we aren't initialising thread_info->cpu, which means
smp_processor_id is broken. Fix that too.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@vger.kernel.org> # 3.6+
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/powerpc/kernel/machine_kexec_64.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index d7f6090..7e5ff43 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/cpu.h>
+#include <linux/hardirq.h>
 
 #include <asm/page.h>
 #include <asm/current.h>
@@ -330,10 +331,13 @@ void default_machine_kexec(struct kimage *image)
 	pr_debug("kexec: Starting switchover sequence.\n");
 
 	/* switch to a staticly allocated stack.  Based on irq stack code.
+	 * We setup preempt_count to avoid using VMX in memcpy.
 	 * XXX: the task struct will likely be invalid once we do the copy!
 	 */
 	kexec_stack.thread_info.task = current_thread_info()->task;
 	kexec_stack.thread_info.flags = 0;
+	kexec_stack.thread_info.preempt_count = HARDIRQ_OFFSET;
+	kexec_stack.thread_info.cpu = current_thread_info()->cpu;
 
 	/* We need a static PACA, too; copy this CPU's PACA over and switch to
 	 * it.  Also poison per_cpu_offset to catch anyone using non-static
-- 
1.7.10.4



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

* [21/65] ath9k: fix key allocation error handling for powersave keys
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (19 preceding siblings ...)
  2013-06-03 22:10 ` [20/65] powerpc/kexec: Fix kexec when using VMX optimised memcpy Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [22/65] mwifiex: clear is_suspended flag when interrupt is received early Steven Rostedt
                   ` (43 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Felix Fietkau, John W. Linville

[-- Attachment #1: 0021-ath9k-fix-key-allocation-error-handling-for-powersav.patch --]
[-- Type: text/plain, Size: 1785 bytes --]

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

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

From: Felix Fietkau <nbd@openwrt.org>

[ Upstream commit 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 ]

If no keycache slots are available, ath_key_config can return -ENOSPC.
If the key index is not checked for errors, it can lead to logspam that
looks like this: "ath: wiphy0: keyreset: keycache entry 228 out of range"
This can cause follow-up errors if the invalid keycache index gets
used for tx.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/wireless/ath/ath9k/main.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 61e08e6..e032723 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1292,6 +1292,7 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_node *an = (struct ath_node *) sta->drv_priv;
 	struct ieee80211_key_conf ps_key = { };
+	int key;
 
 	ath_node_attach(sc, sta, vif);
 
@@ -1299,7 +1300,9 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
 	    vif->type != NL80211_IFTYPE_AP_VLAN)
 		return 0;
 
-	an->ps_key = ath_key_config(common, vif, sta, &ps_key);
+	key = ath_key_config(common, vif, sta, &ps_key);
+	if (key > 0)
+		an->ps_key = key;
 
 	return 0;
 }
@@ -1316,6 +1319,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc,
 	    return;
 
 	ath_key_delete(common, &ps_key);
+	an->ps_key = 0;
 }
 
 static int ath9k_sta_remove(struct ieee80211_hw *hw,
-- 
1.7.10.4



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

* [22/65] mwifiex: clear is_suspended flag when interrupt is received early
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (20 preceding siblings ...)
  2013-06-03 22:10 ` [21/65] ath9k: fix key allocation error handling for powersave keys Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [23/65] mwifiex: fix memory leak issue when driver unload Steven Rostedt
                   ` (42 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Daniel Drake, Bing Zhao, John W. Linville

[-- Attachment #1: 0022-mwifiex-clear-is_suspended-flag-when-interrupt-is-re.patch --]
[-- Type: text/plain, Size: 2641 bytes --]

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

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

From: Bing Zhao <bzhao@marvell.com>

[ Upstream commit 48795424acff7215d5eac0b52793a2c1eb3a6283 ]

When the XO-4 with 8787 wireless is woken up due to wake-on-WLAN
mwifiex is often flooded with "not allowed while suspended" messages
and the interface is unusable.

[  202.171609] int: sdio_ireg = 0x1
[  202.180700] info: mwifiex_process_hs_config: auto cancelling host
               sleep since there is interrupt from the firmware
[  202.201880] event: wakeup device...
[  202.211452] event: hs_deactivated
[  202.514638] info: --- Rx: Data packet ---
[  202.514753] data: 4294957544 BSS(0-0): Data <= kernel
[  202.514825] PREP_CMD: device in suspended state
[  202.514839] data: dequeuing the packet ec7248c0 ec4869c0
[  202.514886] mwifiex_write_data_sync: not allowed while suspended
[  202.514886] host_to_card, write iomem (1) failed: -1
[  202.514917] mwifiex_write_data_sync: not allowed while suspended
[  202.514936] host_to_card, write iomem (2) failed: -1
[  202.514949] mwifiex_write_data_sync: not allowed while suspended
[  202.514965] host_to_card, write iomem (3) failed: -1
[  202.514976] mwifiex_write_data_async failed: 0xFFFFFFFF

This can be readily reproduced when putting the XO-4 in a loop where
it goes to sleep due to inactivity, but then wakes up due to an
incoming ping. The error is hit within an hour or two.

This issue happens when an interrupt comes in early while host sleep
is still activated. Driver handles this case by auto cancelling host
sleep. However is_suspended flag is still set which prevents any cmd
or data from being sent to firmware. Fix it by clearing is_suspended
flag in this path.

Cc: <stable@vger.kernel.org>
Reported-by: Daniel Drake <dsd@laptop.org>
Tested-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/wireless/mwifiex/cmdevt.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 95382f1..31d641b 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -1159,6 +1159,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter)
 	adapter->if_ops.wakeup(adapter);
 	adapter->hs_activated = false;
 	adapter->is_hs_configured = false;
+	adapter->is_suspended = false;
 	mwifiex_hs_activated_event(mwifiex_get_priv(adapter,
 						    MWIFIEX_BSS_ROLE_ANY),
 				   false);
-- 
1.7.10.4



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

* [23/65] mwifiex: fix memory leak issue when driver unload
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (21 preceding siblings ...)
  2013-06-03 22:10 ` [22/65] mwifiex: clear is_suspended flag when interrupt is received early Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [24/65] mwifiex: fix setting of multicast filter Steven Rostedt
                   ` (41 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Daniel Drake, Amitkumar Karwar, Bing Zhao, John W. Linville

[-- Attachment #1: 0023-mwifiex-fix-memory-leak-issue-when-driver-unload.patch --]
[-- Type: text/plain, Size: 2039 bytes --]

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

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

From: Amitkumar Karwar <akarwar@marvell.com>

[ Upstream commit f16fdc9d2dc1e5b270e9a08377587e831e0d36ac ]

After unregister_netdevice() call the request is queued and
reg_state is changed to NETREG_UNREGISTERING.
As we check for NETREG_UNREGISTERED state, free_netdev() never
gets executed causing memory leak.

Initialize "dev->destructor" to free_netdev() to free device
data after unregistration.

Cc: <stable@vger.kernel.org>
Reported-by: Daniel Drake <dsd@laptop.org>
Tested-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/wireless/mwifiex/cfg80211.c |    3 ---
 drivers/net/wireless/mwifiex/main.c     |    1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index b4719ea..23a6d94 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1741,9 +1741,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 	if (wdev->netdev->reg_state == NETREG_REGISTERED)
 		unregister_netdevice(wdev->netdev);
 
-	if (wdev->netdev->reg_state == NETREG_UNREGISTERED)
-		free_netdev(wdev->netdev);
-
 	/* Clear the priv in adapter */
 	priv->netdev = NULL;
 
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 4680362..ec830ac 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -637,6 +637,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv,
 						struct net_device *dev)
 {
 	dev->netdev_ops = &mwifiex_netdev_ops;
+	dev->destructor = free_netdev;
 	/* Initialize private structure */
 	priv->current_key_index = 0;
 	priv->media_connected = false;
-- 
1.7.10.4



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

* [24/65] mwifiex: fix setting of multicast filter
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (22 preceding siblings ...)
  2013-06-03 22:10 ` [23/65] mwifiex: fix memory leak issue when driver unload Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [25/65] tile: support new Tilera hypervisor Steven Rostedt
                   ` (40 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Daniel Drake, Bing Zhao, John W. Linville

[-- Attachment #1: 0024-mwifiex-fix-setting-of-multicast-filter.patch --]
[-- Type: text/plain, Size: 2448 bytes --]

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

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

From: Daniel Drake <dsd@laptop.org>

[ Upstream commit ccd384b10420ac81ba3fb9b0a7d18272c7173552 ]

A small bug in this code was causing the ALLMULTI filter to be set
when in fact we were just wanting to program a selective multicast list
to the hardware.

Fix that bug and remove a redundant if condition in the code that
follows.

This fixes wakeup behaviour when multicast WOL is enabled. Previously,
all multicast packets would wake up the system. Now, only those that the
host intended to receive trigger wakeups.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Cc: <stable@vger.kernel.org>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/wireless/mwifiex/sta_ioctl.c |   21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index fb21360..667598e 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -106,7 +106,7 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
 	} else {
 		/* Multicast */
 		priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE;
-		if (mcast_list->mode == MWIFIEX_MULTICAST_MODE) {
+		if (mcast_list->mode == MWIFIEX_ALL_MULTI_MODE) {
 			dev_dbg(priv->adapter->dev,
 				"info: Enabling All Multicast!\n");
 			priv->curr_pkt_filter |=
@@ -118,20 +118,11 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,
 				dev_dbg(priv->adapter->dev,
 					"info: Set multicast list=%d\n",
 				       mcast_list->num_multicast_addr);
-				/* Set multicast addresses to firmware */
-				if (old_pkt_filter == priv->curr_pkt_filter) {
-					/* Send request to firmware */
-					ret = mwifiex_send_cmd_async(priv,
-						HostCmd_CMD_MAC_MULTICAST_ADR,
-						HostCmd_ACT_GEN_SET, 0,
-						mcast_list);
-				} else {
-					/* Send request to firmware */
-					ret = mwifiex_send_cmd_async(priv,
-						HostCmd_CMD_MAC_MULTICAST_ADR,
-						HostCmd_ACT_GEN_SET, 0,
-						mcast_list);
-				}
+				/* Send multicast addresses to firmware */
+				ret = mwifiex_send_cmd_async(priv,
+					HostCmd_CMD_MAC_MULTICAST_ADR,
+					HostCmd_ACT_GEN_SET, 0,
+					mcast_list);
 			}
 		}
 	}
-- 
1.7.10.4



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

* [25/65] tile: support new Tilera hypervisor
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (23 preceding siblings ...)
  2013-06-03 22:10 ` [24/65] mwifiex: fix setting of multicast filter Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [26/65] B43: Handle DMA RX descriptor underrun Steven Rostedt
                   ` (39 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Chris Metcalf, stable

[-- Attachment #1: 0025-tile-support-new-Tilera-hypervisor.patch --]
[-- Type: text/plain, Size: 6187 bytes --]

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

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

From: Chris Metcalf <cmetcalf@tilera.com>

[ Upstream commit c539914dcd9a68c63305e055b14115a6a19578a8 ]

The Tilera hypervisor shipped in releases up through MDE 4.1 launches
the client operating system (i.e. Linux) at privilege level 1 (PL1).
Starting with MDE 4.2, as part of the work to enable KVM, the
Tilera hypervisor launches Linux at PL2 instead.

This commit makes the KERNEL_PL option default to 2 for tilegx, while
still saying at 1 for tilepro, which doesn't have an updated hypervisor.
It also explains how and when you might want to choose another value.
In addition, we change a small buglet in the on-chip Ethernet driver,
where we were failing to use the KERNEL_PL constant in an API call.

To make the transition cleaner, this change also provides the updated
hv_init() API for the new hypervisor that supports announcing Linux's
compiled-in PL, so the hypervisor can generate a suitable error in the
case of a mismatched hypervisor and Linux binary.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: stable@vger.linux.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/tile/Kconfig                  |   14 ++++++++++----
 arch/tile/include/hv/hypervisor.h  |   27 ++++++++++++++++++++++++---
 arch/tile/kernel/head_32.S         |    2 +-
 arch/tile/kernel/head_64.S         |   12 +++++++++---
 drivers/net/ethernet/tile/tilegx.c |    2 +-
 5 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 932e443..569f719 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -360,11 +360,17 @@ config HARDWALL
 config KERNEL_PL
 	int "Processor protection level for kernel"
 	range 1 2
-	default "1"
+	default 2 if TILEGX
+	default 1 if !TILEGX
 	---help---
-	  This setting determines the processor protection level the
-	  kernel will be built to run at.  Generally you should use
-	  the default value here.
+	  Since MDE 4.2, the Tilera hypervisor runs the kernel
+	  at PL2 by default.  If running under an older hypervisor,
+	  or as a KVM guest, you must run at PL1.  (The current
+	  hypervisor may also be recompiled with "make HV_PL=2" to
+	  allow it to run a kernel at PL1, but clients running at PL1
+	  are not expected to be supported indefinitely.)
+
+	  If you're not sure, don't change the default.
 
 source "arch/tile/gxio/Kconfig"
 
diff --git a/arch/tile/include/hv/hypervisor.h b/arch/tile/include/hv/hypervisor.h
index ccd847e..837dca5 100644
--- a/arch/tile/include/hv/hypervisor.h
+++ b/arch/tile/include/hv/hypervisor.h
@@ -107,7 +107,22 @@
 #define HV_DISPATCH_ENTRY_SIZE 32
 
 /** Version of the hypervisor interface defined by this file */
-#define _HV_VERSION 11
+#define _HV_VERSION 13
+
+/** Last version of the hypervisor interface with old hv_init() ABI.
+ *
+ * The change from version 12 to version 13 corresponds to launching
+ * the client by default at PL2 instead of PL1 (corresponding to the
+ * hv itself running at PL3 instead of PL2).  To make this explicit,
+ * the hv_init() API was also extended so the client can report its
+ * desired PL, resulting in a more helpful failure diagnostic.  If you
+ * call hv_init() with _HV_VERSION_OLD_HV_INIT and omit the client_pl
+ * argument, the hypervisor will assume client_pl = 1.
+ *
+ * Note that this is a deprecated solution and we do not expect to
+ * support clients of the Tilera hypervisor running at PL1 indefinitely.
+ */
+#define _HV_VERSION_OLD_HV_INIT 12
 
 /* Index into hypervisor interface dispatch code blocks.
  *
@@ -377,7 +392,11 @@ typedef int HV_Errno;
 #ifndef __ASSEMBLER__
 
 /** Pass HV_VERSION to hv_init to request this version of the interface. */
-typedef enum { HV_VERSION = _HV_VERSION } HV_VersionNumber;
+typedef enum {
+  HV_VERSION = _HV_VERSION,
+  HV_VERSION_OLD_HV_INIT = _HV_VERSION_OLD_HV_INIT,
+
+} HV_VersionNumber;
 
 /** Initializes the hypervisor.
  *
@@ -385,9 +404,11 @@ typedef enum { HV_VERSION = _HV_VERSION } HV_VersionNumber;
  * that this program expects, typically HV_VERSION.
  * @param chip_num Architecture number of the chip the client was built for.
  * @param chip_rev_num Revision number of the chip the client was built for.
+ * @param client_pl Privilege level the client is built for
+ *   (not required if interface_version_number == HV_VERSION_OLD_HV_INIT).
  */
 void hv_init(HV_VersionNumber interface_version_number,
-             int chip_num, int chip_rev_num);
+             int chip_num, int chip_rev_num, int client_pl);
 
 
 /** Queries we can make for hv_sysconf().
diff --git a/arch/tile/kernel/head_32.S b/arch/tile/kernel/head_32.S
index f71bfee..ac11530 100644
--- a/arch/tile/kernel/head_32.S
+++ b/arch/tile/kernel/head_32.S
@@ -38,7 +38,7 @@ ENTRY(_start)
 	  movei r2, TILE_CHIP_REV
 	}
 	{
-	  moveli r0, _HV_VERSION
+	  moveli r0, _HV_VERSION_OLD_HV_INIT
 	  jal hv_init
 	}
 	/* Get a reasonable default ASID in r0 */
diff --git a/arch/tile/kernel/head_64.S b/arch/tile/kernel/head_64.S
index f9a2734..6093964 100644
--- a/arch/tile/kernel/head_64.S
+++ b/arch/tile/kernel/head_64.S
@@ -34,13 +34,19 @@
 ENTRY(_start)
 	/* Notify the hypervisor of what version of the API we want */
 	{
+#if KERNEL_PL == 1 && _HV_VERSION == 13
+	  /* Support older hypervisors by asking for API version 12. */
+	  movei r0, _HV_VERSION_OLD_HV_INIT
+#else
+	  movei r0, _HV_VERSION
+#endif
 	  movei r1, TILE_CHIP
-	  movei r2, TILE_CHIP_REV
 	}
 	{
-	  moveli r0, _HV_VERSION
-	  jal hv_init
+	  movei r2, TILE_CHIP_REV
+	  movei r3, KERNEL_PL
 	}
+	jal hv_init
 	/* Get a reasonable default ASID in r0 */
 	{
 	  move r0, zero
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 4e98100..04a321a 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -930,7 +930,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
 		if (info->has_iqueue) {
 			gxio_mpipe_request_notif_ring_interrupt(
 				&context, cpu_x(cpu), cpu_y(cpu),
-				1, ingress_irq, info->iqueue.ring);
+				KERNEL_PL, ingress_irq, info->iqueue.ring);
 		}
 	}
 
-- 
1.7.10.4



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

* [26/65] B43: Handle DMA RX descriptor underrun
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (24 preceding siblings ...)
  2013-06-03 22:10 ` [25/65] tile: support new Tilera hypervisor Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [27/65] drm/mgag200: Fix writes into MGA1064_PIX_CLK_CTL register Steven Rostedt
                   ` (38 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Michael Buesch, Thommy Jakobsson, John W. Linville

[-- Attachment #1: 0026-B43-Handle-DMA-RX-descriptor-underrun.patch --]
[-- Type: text/plain, Size: 5813 bytes --]

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

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

From: Thommy Jakobsson <thommyj@gmail.com>

[ Upstream commit 73b82bf0bfbf58e6ff328d3726934370585f6e78 ]

Add handling of rx descriptor underflow. This fixes a fault that could
happen on slow machines, where data is received faster than the CPU can
handle. In such a case the device will use up all rx descriptors and
refuse to send any more data before confirming that it is ok. This
patch enables necessary interrupt to discover such a situation and will
handle them by dropping everything in the ring buffer.

Reviewed-by: Michael Buesch <m@bues.ch>
Signed-off-by: Thommy Jakobsson <thommyj@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/wireless/b43/dma.c  |   19 +++++++++++++++++
 drivers/net/wireless/b43/dma.h  |    4 +++-
 drivers/net/wireless/b43/main.c |   43 ++++++++++++++++-----------------------
 3 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 92768d304..ba0738a 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1730,6 +1730,25 @@ drop_recycle_buffer:
 	sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
 }
 
+void b43_dma_handle_rx_overflow(struct b43_dmaring *ring)
+{
+	int current_slot, previous_slot;
+
+	B43_WARN_ON(ring->tx);
+
+	/* Device has filled all buffers, drop all packets and let TCP
+	 * decrease speed.
+	 * Decrement RX index by one will let the device to see all slots
+	 * as free again
+	 */
+	/*
+	*TODO: How to increase rx_drop in mac80211?
+	*/
+	current_slot = ring->ops->get_current_rxslot(ring);
+	previous_slot = prev_slot(ring, current_slot);
+	ring->ops->set_current_rxslot(ring, previous_slot);
+}
+
 void b43_dma_rx(struct b43_dmaring *ring)
 {
 	const struct b43_dma_ops *ops = ring->ops;
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index 315b96e..68d5e0c 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -9,7 +9,7 @@
 /* DMA-Interrupt reasons. */
 #define B43_DMAIRQ_FATALMASK	((1 << 10) | (1 << 11) | (1 << 12) \
 					 | (1 << 14) | (1 << 15))
-#define B43_DMAIRQ_NONFATALMASK	(1 << 13)
+#define B43_DMAIRQ_RDESC_UFLOW		(1 << 13)
 #define B43_DMAIRQ_RX_DONE		(1 << 16)
 
 /*** 32-bit DMA Engine. ***/
@@ -295,6 +295,8 @@ int b43_dma_tx(struct b43_wldev *dev,
 void b43_dma_handle_txstatus(struct b43_wldev *dev,
 			     const struct b43_txstatus *status);
 
+void b43_dma_handle_rx_overflow(struct b43_dmaring *ring);
+
 void b43_dma_rx(struct b43_dmaring *ring);
 
 void b43_dma_direct_fifo_rx(struct b43_wldev *dev,
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 46d9d4e..54ecf96 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1895,30 +1895,18 @@ static void b43_do_interrupt_thread(struct b43_wldev *dev)
 		}
 	}
 
-	if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK |
-					  B43_DMAIRQ_NONFATALMASK))) {
-		if (merged_dma_reason & B43_DMAIRQ_FATALMASK) {
-			b43err(dev->wl, "Fatal DMA error: "
-			       "0x%08X, 0x%08X, 0x%08X, "
-			       "0x%08X, 0x%08X, 0x%08X\n",
-			       dma_reason[0], dma_reason[1],
-			       dma_reason[2], dma_reason[3],
-			       dma_reason[4], dma_reason[5]);
-			b43err(dev->wl, "This device does not support DMA "
+	if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK))) {
+		b43err(dev->wl,
+			"Fatal DMA error: 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X\n",
+			dma_reason[0], dma_reason[1],
+			dma_reason[2], dma_reason[3],
+			dma_reason[4], dma_reason[5]);
+		b43err(dev->wl, "This device does not support DMA "
 			       "on your system. It will now be switched to PIO.\n");
-			/* Fall back to PIO transfers if we get fatal DMA errors! */
-			dev->use_pio = true;
-			b43_controller_restart(dev, "DMA error");
-			return;
-		}
-		if (merged_dma_reason & B43_DMAIRQ_NONFATALMASK) {
-			b43err(dev->wl, "DMA error: "
-			       "0x%08X, 0x%08X, 0x%08X, "
-			       "0x%08X, 0x%08X, 0x%08X\n",
-			       dma_reason[0], dma_reason[1],
-			       dma_reason[2], dma_reason[3],
-			       dma_reason[4], dma_reason[5]);
-		}
+		/* Fall back to PIO transfers if we get fatal DMA errors! */
+		dev->use_pio = true;
+		b43_controller_restart(dev, "DMA error");
+		return;
 	}
 
 	if (unlikely(reason & B43_IRQ_UCODE_DEBUG))
@@ -1937,6 +1925,11 @@ static void b43_do_interrupt_thread(struct b43_wldev *dev)
 		handle_irq_noise(dev);
 
 	/* Check the DMA reason registers for received data. */
+	if (dma_reason[0] & B43_DMAIRQ_RDESC_UFLOW) {
+		if (B43_DEBUG)
+			b43warn(dev->wl, "RX descriptor underrun\n");
+		b43_dma_handle_rx_overflow(dev->dma.rx_ring);
+	}
 	if (dma_reason[0] & B43_DMAIRQ_RX_DONE) {
 		if (b43_using_pio_transfers(dev))
 			b43_pio_rx(dev->pio.rx_queue);
@@ -1994,7 +1987,7 @@ static irqreturn_t b43_do_interrupt(struct b43_wldev *dev)
 		return IRQ_NONE;
 
 	dev->dma_reason[0] = b43_read32(dev, B43_MMIO_DMA0_REASON)
-	    & 0x0001DC00;
+	    & 0x0001FC00;
 	dev->dma_reason[1] = b43_read32(dev, B43_MMIO_DMA1_REASON)
 	    & 0x0000DC00;
 	dev->dma_reason[2] = b43_read32(dev, B43_MMIO_DMA2_REASON)
@@ -3098,7 +3091,7 @@ static int b43_chip_init(struct b43_wldev *dev)
 		b43_write32(dev, 0x018C, 0x02000000);
 	}
 	b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, 0x00004000);
-	b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001DC00);
+	b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001FC00);
 	b43_write32(dev, B43_MMIO_DMA1_IRQ_MASK, 0x0000DC00);
 	b43_write32(dev, B43_MMIO_DMA2_IRQ_MASK, 0x0000DC00);
 	b43_write32(dev, B43_MMIO_DMA3_IRQ_MASK, 0x0001DC00);
-- 
1.7.10.4



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

* [27/65] drm/mgag200: Fix writes into MGA1064_PIX_CLK_CTL register
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (25 preceding siblings ...)
  2013-06-03 22:10 ` [26/65] B43: Handle DMA RX descriptor underrun Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [28/65] drm/mgag200: Fix framebuffer base address programming Steven Rostedt
                   ` (37 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Christopher Harvey, Julia Lemire, Mathieu Larouche, Dave Airlie

[-- Attachment #1: 0027-drm-mgag200-Fix-writes-into-MGA1064_PIX_CLK_CTL-regi.patch --]
[-- Type: text/plain, Size: 7103 bytes --]

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

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

From: Christopher Harvey <charvey@matrox.com>

[ Upstream commit fb70a6690875315a3a1454e52fa339441ee7612b ]

The original line,
  WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp);
wrote tmp into MGA1064_PIX_CLK_CTL_CLK_DIS, where
MGA1064_PIX_CLK_CTL_CLK_DIS is an offset into
MGA1064_PIX_CLK_CTL. Change the line to write properly into
MGA1064_PIX_CLK_CTL. There were other chunks of code nearby that use
the same pattern (but work correctly), so this patch updates them all
to use this new (slightly more efficient) write pattern. The WREG_DAC
macro was causing the DAC_INDEX register to be set to the same value
twice. WREG8(DAC_DATA, foo) takes advantage of the fact that DAC_INDEX
is already at the value we want.

Signed-off-by: Christopher Harvey <charvey@matrox.com>
Acked-by: Julia Lemire <jlemire@matrox.com>
Tested-by: Julia Lemire <jlemire@matrox.com>
Acked-by: Mathieu Larouche <mathieu.larouche@matrox.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/gpu/drm/mgag200/mgag200_mode.c |   42 ++++++++++++++++----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index fa82ead..26518cc 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -190,12 +190,12 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock)
 		WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS;
-		WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		WREG8(DAC_INDEX, MGA1064_REMHEADCTL);
 		tmp = RREG8(DAC_DATA);
 		tmp |= MGA1064_REMHEADCTL_CLKDIS;
-		WREG_DAC(MGA1064_REMHEADCTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		/* select PLL Set C */
 		tmp = RREG8(MGAREG_MEM_MISC_READ);
@@ -205,7 +205,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock)
 		WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN | 0x80;
-		WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		udelay(500);
 
@@ -213,7 +213,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock)
 		WREG8(DAC_INDEX, MGA1064_VREF_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp &= ~0x04;
-		WREG_DAC(MGA1064_VREF_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		udelay(50);
 
@@ -237,13 +237,13 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock)
 		tmp = RREG8(DAC_DATA);
 		tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK;
 		tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL;
-		WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		WREG8(DAC_INDEX, MGA1064_REMHEADCTL);
 		tmp = RREG8(DAC_DATA);
 		tmp &= ~MGA1064_REMHEADCTL_CLKSL_MSK;
 		tmp |= MGA1064_REMHEADCTL_CLKSL_PLL;
-		WREG_DAC(MGA1064_REMHEADCTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		/* reset dotclock rate bit */
 		WREG8(MGAREG_SEQ_INDEX, 1);
@@ -254,7 +254,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock)
 		WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS;
-		WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		vcount = RREG8(MGAREG_VCOUNT);
 
@@ -319,7 +319,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock)
 	WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 	tmp = RREG8(DAC_DATA);
 	tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS;
-	WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	tmp = RREG8(MGAREG_MEM_MISC_READ);
 	tmp |= 0x3 << 2;
@@ -327,12 +327,12 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock)
 
 	WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT);
 	tmp = RREG8(DAC_DATA);
-	WREG_DAC(MGA1064_PIX_PLL_STAT, tmp & ~0x40);
+	WREG8(DAC_DATA, tmp & ~0x40);
 
 	WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 	tmp = RREG8(DAC_DATA);
 	tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
-	WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	WREG_DAC(MGA1064_EV_PIX_PLLC_M, m);
 	WREG_DAC(MGA1064_EV_PIX_PLLC_N, n);
@@ -343,7 +343,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock)
 	WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 	tmp = RREG8(DAC_DATA);
 	tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
-	WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	udelay(500);
 
@@ -351,11 +351,11 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock)
 	tmp = RREG8(DAC_DATA);
 	tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK;
 	tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL;
-	WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT);
 	tmp = RREG8(DAC_DATA);
-	WREG_DAC(MGA1064_PIX_PLL_STAT, tmp | 0x40);
+	WREG8(DAC_DATA, tmp | 0x40);
 
 	tmp = RREG8(MGAREG_MEM_MISC_READ);
 	tmp |= (0x3 << 2);
@@ -364,7 +364,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock)
 	WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 	tmp = RREG8(DAC_DATA);
 	tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS;
-	WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	return 0;
 }
@@ -417,7 +417,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
 		WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS;
-		WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		tmp = RREG8(MGAREG_MEM_MISC_READ);
 		tmp |= 0x3 << 2;
@@ -426,7 +426,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
 		WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
-		WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		udelay(500);
 
@@ -440,13 +440,13 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
 		tmp = RREG8(DAC_DATA);
 		tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK;
 		tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL;
-		WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 		tmp = RREG8(DAC_DATA);
 		tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS;
 		tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
-		WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+		WREG8(DAC_DATA, tmp);
 
 		vcount = RREG8(MGAREG_VCOUNT);
 
@@ -516,12 +516,12 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock)
 	WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
 	tmp = RREG8(DAC_DATA);
 	tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS;
-	WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	WREG8(DAC_INDEX, MGA1064_REMHEADCTL);
 	tmp = RREG8(DAC_DATA);
 	tmp |= MGA1064_REMHEADCTL_CLKDIS;
-	WREG_DAC(MGA1064_REMHEADCTL, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	tmp = RREG8(MGAREG_MEM_MISC_READ);
 	tmp |= (0x3<<2) | 0xc0;
@@ -531,7 +531,7 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock)
 	tmp = RREG8(DAC_DATA);
 	tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS;
 	tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN;
-	WREG_DAC(MGA1064_PIX_CLK_CTL, tmp);
+	WREG8(DAC_DATA, tmp);
 
 	udelay(500);
 
-- 
1.7.10.4



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

* [28/65] drm/mgag200: Fix framebuffer base address programming
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (26 preceding siblings ...)
  2013-06-03 22:10 ` [27/65] drm/mgag200: Fix writes into MGA1064_PIX_CLK_CTL register Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [29/65] tcp: force a dst refcount when prequeue packet Steven Rostedt
                   ` (36 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Christopher Harvey, Mathieu Larouche, Julia Lemire, Dave Airlie

[-- Attachment #1: 0028-drm-mgag200-Fix-framebuffer-base-address-programming.patch --]
[-- Type: text/plain, Size: 2743 bytes --]

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

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

From: Christopher Harvey <charvey@matrox.com>

[ Upstream commit 9f1d036648c1c5ed81b0e98d7a06d55df972701e ]

Higher bits of the base address of framebuffers weren't being
programmed properly. This caused framebuffers that didn't happen to be
allocated at a low enough address to not be displayed properly.

Signed-off-by: Christopher Harvey <charvey@matrox.com>
Signed-off-by: Mathieu Larouche <mathieu.larouche@matrox.com>
Acked-by: Julia Lemire <jlemire@matrox.com>
Tested-by: Julia Lemire <jlemire@matrox.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/gpu/drm/mgag200/mgag200_mode.c |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 26518cc..85ef6cc 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -658,12 +658,26 @@ static void mga_g200wb_commit(struct drm_crtc *crtc)
 	WREG_DAC(MGA1064_GEN_IO_DATA, tmp);
 }
 
-
+/*
+   This is how the framebuffer base address is stored in g200 cards:
+   * Assume @offset is the gpu_addr variable of the framebuffer object
+   * Then addr is the number of _pixels_ (not bytes) from the start of
+     VRAM to the first pixel we want to display. (divided by 2 for 32bit
+     framebuffers)
+   * addr is stored in the CRTCEXT0, CRTCC and CRTCD registers
+   addr<20> -> CRTCEXT0<6>
+   addr<19-16> -> CRTCEXT0<3-0>
+   addr<15-8> -> CRTCC<7-0>
+   addr<7-0> -> CRTCD<7-0>
+   CRTCEXT0 has to be programmed last to trigger an update and make the
+   new addr variable take effect.
+ */
 void mga_set_start_address(struct drm_crtc *crtc, unsigned offset)
 {
 	struct mga_device *mdev = crtc->dev->dev_private;
 	u32 addr;
 	int count;
+	u8 crtcext0;
 
 	while (RREG8(0x1fda) & 0x08);
 	while (!(RREG8(0x1fda) & 0x08));
@@ -671,10 +685,17 @@ void mga_set_start_address(struct drm_crtc *crtc, unsigned offset)
 	count = RREG8(MGAREG_VCOUNT) + 2;
 	while (RREG8(MGAREG_VCOUNT) < count);
 
-	addr = offset >> 2;
+	WREG8(MGAREG_CRTCEXT_INDEX, 0);
+	crtcext0 = RREG8(MGAREG_CRTCEXT_DATA);
+	crtcext0 &= 0xB0;
+	addr = offset / 8;
+	/* Can't store addresses any higher than that...
+	   but we also don't have more than 16MB of memory, so it should be fine. */
+	WARN_ON(addr > 0x1fffff);
+	crtcext0 |= (!!(addr & (1<<20)))<<6;
 	WREG_CRT(0x0d, (u8)(addr & 0xff));
 	WREG_CRT(0x0c, (u8)(addr >> 8) & 0xff);
-	WREG_CRT(0xaf, (u8)(addr >> 16) & 0xf);
+	WREG_ECRT(0x0, ((u8)(addr >> 16) & 0xf) | crtcext0);
 }
 
 
-- 
1.7.10.4



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

* [29/65] tcp: force a dst refcount when prequeue packet
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (27 preceding siblings ...)
  2013-06-03 22:10 ` [28/65] drm/mgag200: Fix framebuffer base address programming Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [30/65] sfc: Fix naming of MTD partitions for FPGA bitfiles Steven Rostedt
                   ` (35 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mike Galbraith, Eric Dumazet, David S. Miller

[-- Attachment #1: 0029-tcp-force-a-dst-refcount-when-prequeue-packet.patch --]
[-- Type: text/plain, Size: 1031 bytes --]

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

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 093162553c33e9479283e107b4431378271c735d ]

Before escaping RCU protected section and adding packet into
prequeue, make sure the dst is refcounted.

Reported-by: Mike Galbraith <bitbucket@online.de>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/net/tcp.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 1f000ff..9297897 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1015,6 +1015,7 @@ static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
 	if (sysctl_tcp_low_latency || !tp->ucopy.task)
 		return false;
 
+	skb_dst_force(skb);
 	__skb_queue_tail(&tp->ucopy.prequeue, skb);
 	tp->ucopy.memory += skb->truesize;
 	if (tp->ucopy.memory > sk->sk_rcvbuf) {
-- 
1.7.10.4



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

* [30/65] sfc: Fix naming of MTD partitions for FPGA bitfiles
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (28 preceding siblings ...)
  2013-06-03 22:10 ` [29/65] tcp: force a dst refcount when prequeue packet Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [31/65] net: mac802154: comparision issue of type cast, finding by EXTRA_CFLAGS=-W Steven Rostedt
                   ` (34 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Ben Hutchings, David S. Miller

[-- Attachment #1: 0030-sfc-Fix-naming-of-MTD-partitions-for-FPGA-bitfiles.patch --]
[-- Type: text/plain, Size: 1568 bytes --]

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

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

From: Ben Hutchings <bhutchings@solarflare.com>

[ Upstream commit 89cc80a44b7c320e08599cb86f6aef0ead8986a1 ]

efx_mcdi_get_board_cfg() uses a buffer for the firmware response that
is only large enough to hold subtypes for the originally defined set
of NVRAM partitions.  Longer responses are truncated, and we may read
off the end of the buffer when copying out subtypes for additional
partitions.  In particular, this can result in the MTD partition for
an FPGA bitfile being named e.g. 'eth5 sfc_fpga:00' when it should be
'eth5 sfc_fpga:01'.  This means the firmware update tool (sfupdate)
can't tell which bitfile should be written to the partition.

Correct the response buffer size.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/ethernet/sfc/mcdi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 29e5842..4ffa951 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -647,7 +647,7 @@ fail:
 int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
 			   u16 *fw_subtype_list, u32 *capabilities)
 {
-	uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
+	uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMAX];
 	size_t outlen, offset, i;
 	int port_num = efx_port_num(efx);
 	int rc;
-- 
1.7.10.4



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

* [31/65] net: mac802154: comparision issue of type cast, finding by EXTRA_CFLAGS=-W
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (29 preceding siblings ...)
  2013-06-03 22:10 ` [30/65] sfc: Fix naming of MTD partitions for FPGA bitfiles Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [32/65] 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA) Steven Rostedt
                   ` (33 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Chen Gang, David S. Miller

[-- Attachment #1: 0031-net-mac802154-comparision-issue-of-type-cast-finding.patch --]
[-- Type: text/plain, Size: 1259 bytes --]

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

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

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

[ Upstream commit 2c1bbbffa0b644fab4f91878cde0c2e8f52e2dcc ]

Change MAC802154_CHAN_NONE from ~(u8)0 to 0xff, or the comparison in
mac802154_wpan_xmit() for ``chan == MAC802154_CHAN_NONE'' will not
succeed.

This bug can be boiled down to ``u8 foo = 0xff; if (foo == ~(u8)0)
[...] else [...]'' where the condition will always take the else
branch.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/mac802154/mac802154.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac802154/mac802154.h b/net/mac802154/mac802154.h
index a4dcaf1..703c121 100644
--- a/net/mac802154/mac802154.h
+++ b/net/mac802154/mac802154.h
@@ -90,7 +90,7 @@ struct mac802154_sub_if_data {
 
 #define MAC802154_MAX_XMIT_ATTEMPTS	3
 
-#define MAC802154_CHAN_NONE		(~(u8)0) /* No channel is assigned */
+#define MAC802154_CHAN_NONE		0xff /* No channel is assigned */
 
 extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
 extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
-- 
1.7.10.4



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

* [32/65] 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA)
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (30 preceding siblings ...)
  2013-06-03 22:10 ` [31/65] net: mac802154: comparision issue of type cast, finding by EXTRA_CFLAGS=-W Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [33/65] net_sched: act_ipt forward compat with xtables Steven Rostedt
                   ` (32 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Matthew Whitehead, David S. Miller

[-- Attachment #1: 0032-3c509.c-call-SET_NETDEV_DEV-for-all-device-types-ISA.patch --]
[-- Type: text/plain, Size: 1657 bytes --]

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

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

From: Matthew Whitehead <tedheadster@gmail.com>

[ Upstream commit 3b54912f9cd167641b91d4a697bd742f70e534fe ]

The venerable 3c509 driver only sets its device parent in one case, the ISAPnP one.
It does this with the SET_NETDEV_DEV function. It should register with the device
hierarchy in two additional cases: standard (non-PnP) ISA and EISA.

- Currently they appear here:
/sys/devices/virtual/net/eth0 (standard ISA)
/sys/devices/virtual/net/eth1 (EISA)

- Rather, they should instead be here:
/sys/devices/isa/3c509.0/net/eth0 (standard ISA)
/sys/devices/pci0000:00/0000:00:07.0/00:04/net/eth1 (EISA)

Tested on ISA and EISA boards.

Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/ethernet/3com/3c509.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/3com/3c509.c b/drivers/net/ethernet/3com/3c509.c
index 1a8eef2..ce8fb21 100644
--- a/drivers/net/ethernet/3com/3c509.c
+++ b/drivers/net/ethernet/3com/3c509.c
@@ -308,6 +308,7 @@ static int __devinit el3_isa_match(struct device *pdev,
 	if (!dev)
 		return -ENOMEM;
 
+	SET_NETDEV_DEV(dev, pdev);
 	netdev_boot_setup_check(dev);
 
 	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
@@ -598,6 +599,7 @@ static int __init el3_eisa_probe (struct device *device)
 		return -ENOMEM;
 	}
 
+	SET_NETDEV_DEV(dev, device);
 	netdev_boot_setup_check(dev);
 
 	el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_EISA);
-- 
1.7.10.4



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

* [33/65] net_sched: act_ipt forward compat with xtables
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (31 preceding siblings ...)
  2013-06-03 22:10 ` [32/65] 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA) Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [34/65] net: use netdev_features_t in skb_needs_linearize() Steven Rostedt
                   ` (31 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jamal Hadi Salim, David S. Miller

[-- Attachment #1: 0033-net_sched-act_ipt-forward-compat-with-xtables.patch --]
[-- Type: text/plain, Size: 2143 bytes --]

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

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

From: Jamal Hadi Salim <jhs@mojatatu.com>

[ Upstream commit 0dcffd09641f3abb21ac5cabc61542ab289d1a3c ]

Deal with changes in newer xtables while maintaining backward
compatibility. Thanks to Jan Engelhardt for suggestions.

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/sched/act_ipt.c |   33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 58fb3c7..c1a8138 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -8,7 +8,7 @@
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
  *
- * Copyright:	Jamal Hadi Salim (2002-4)
+ * Copyright:	Jamal Hadi Salim (2002-13)
  */
 
 #include <linux/types.h>
@@ -305,17 +305,44 @@ static struct tc_action_ops act_ipt_ops = {
 	.walk		=	tcf_generic_walker
 };
 
-MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
+static struct tc_action_ops act_xt_ops = {
+	.kind		=	"xt",
+	.hinfo		=	&ipt_hash_info,
+	.type		=	TCA_ACT_IPT,
+	.capab		=	TCA_CAP_NONE,
+	.owner		=	THIS_MODULE,
+	.act		=	tcf_ipt,
+	.dump		=	tcf_ipt_dump,
+	.cleanup	=	tcf_ipt_cleanup,
+	.lookup		=	tcf_hash_search,
+	.init		=	tcf_ipt_init,
+	.walk		=	tcf_generic_walker
+};
+
+MODULE_AUTHOR("Jamal Hadi Salim(2002-13)");
 MODULE_DESCRIPTION("Iptables target actions");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("act_xt");
 
 static int __init ipt_init_module(void)
 {
-	return tcf_register_action(&act_ipt_ops);
+	int ret1, ret2;
+	ret1 = tcf_register_action(&act_xt_ops);
+	if (ret1 < 0)
+		printk("Failed to load xt action\n");
+	ret2 = tcf_register_action(&act_ipt_ops);
+	if (ret2 < 0)
+		printk("Failed to load ipt action\n");
+
+	if (ret1 < 0 && ret2 < 0)
+		return ret1;
+	else
+		return 0;
 }
 
 static void __exit ipt_cleanup_module(void)
 {
+	tcf_unregister_action(&act_xt_ops);
 	tcf_unregister_action(&act_ipt_ops);
 }
 
-- 
1.7.10.4



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

* [34/65] net: use netdev_features_t in skb_needs_linearize()
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (32 preceding siblings ...)
  2013-06-03 22:10 ` [33/65] net_sched: act_ipt forward compat with xtables Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [35/65] net: vlan,ethtool: netdev_features_t is more than 32 bit Steven Rostedt
                   ` (30 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Patrick McHardy, David S. Miller

[-- Attachment #1: 0034-net-use-netdev_features_t-in-skb_needs_linearize.patch --]
[-- Type: text/plain, Size: 851 bytes --]

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

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

From: Patrick McHardy <kaber@trash.net>

[ Upstream commit 6708c9e5cc9bfc7c9a00ce9c0fdd0b1d4952b3d1 ]

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index cefd2c2..9b5e388 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2182,7 +2182,7 @@ EXPORT_SYMBOL(netif_skb_features);
  *	   support DMA from it.
  */
 static inline int skb_needs_linearize(struct sk_buff *skb,
-				      int features)
+				      netdev_features_t features)
 {
 	return skb_is_nonlinear(skb) &&
 			((skb_has_frag_list(skb) &&
-- 
1.7.10.4



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

* [35/65] net: vlan,ethtool: netdev_features_t is more than 32 bit
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (33 preceding siblings ...)
  2013-06-03 22:10 ` [34/65] net: use netdev_features_t in skb_needs_linearize() Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [36/65] bridge: fix race with topology change timer Steven Rostedt
                   ` (29 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Bjørn Mork, David S. Miller

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0035-net-vlan-ethtool-netdev_features_t-is-more-than-32-b.patch --]
[-- Type: text/plain, Size: 1361 bytes --]

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

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

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

[ Upstream commit b29d3145183da4e07d4b570fa8acdd3ac4a5c572 ]

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/8021q/vlan_dev.c |    2 +-
 net/core/ethtool.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 4024424..a841735 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -611,7 +611,7 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
 	netdev_features_t features)
 {
 	struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
-	u32 old_features = features;
+	netdev_features_t old_features = features;
 
 	features &= real_dev->vlan_features;
 	features |= NETIF_F_RXCSUM;
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index cbf033d..fa1370c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1418,7 +1418,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 	void __user *useraddr = ifr->ifr_data;
 	u32 ethcmd;
 	int rc;
-	u32 old_features;
+	netdev_features_t old_features;
 
 	if (!dev || !netif_device_present(dev))
 		return -ENODEV;
-- 
1.7.10.4



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

* [36/65] bridge: fix race with topology change timer
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (34 preceding siblings ...)
  2013-06-03 22:10 ` [35/65] net: vlan,ethtool: netdev_features_t is more than 32 bit Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [37/65] packet: tpacket_v3: do not trigger bug() on wrong header status Steven Rostedt
                   ` (28 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: JerryKang, Stephen Hemminger, David S. Miller

[-- Attachment #1: 0036-bridge-fix-race-with-topology-change-timer.patch --]
[-- Type: text/plain, Size: 1401 bytes --]

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

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

From: stephen hemminger <stephen@networkplumber.org>

[ Upstream commit 83401eb4990ff6af55aeed8f49681558544192e6 ]

A bridge should only send topology change notice if it is not
the root bridge. It is possible for message age timer to elect itself
as a new root bridge, and still have a topology change timer running
but waiting for bridge lock on other CPU.

Solve the race by checking if we are root bridge before continuing.
This was the root cause of the cases where br_send_tcn_bpdu would OOPS.

Reported-by: JerryKang <jerry.kang@samsung.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/bridge/br_stp_timer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index a6747e6..acc63a4 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -107,7 +107,7 @@ static void br_tcn_timer_expired(unsigned long arg)
 
 	br_debug(br, "tcn timer expired\n");
 	spin_lock(&br->lock);
-	if (br->dev->flags & IFF_UP) {
+	if (!br_is_root_bridge(br) && (br->dev->flags & IFF_UP)) {
 		br_transmit_tcn(br);
 
 		mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time);
-- 
1.7.10.4



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

* [37/65] packet: tpacket_v3: do not trigger bug() on wrong header status
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (35 preceding siblings ...)
  2013-06-03 22:10 ` [36/65] bridge: fix race with topology change timer Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [38/65] 3c59x: fix freeing nonexistent resource on driver unload Steven Rostedt
                   ` (27 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jakub Zawadzki, Daniel Borkmann, David S. Miller

[-- Attachment #1: 0037-packet-tpacket_v3-do-not-trigger-bug-on-wrong-header.patch --]
[-- Type: text/plain, Size: 3973 bytes --]

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

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

From: Daniel Borkmann <dborkman@redhat.com>

[ Upstream commit 8da3056c04bfc5f69f840ab038a38389e2de8189 ]

Jakub reported that it is fairly easy to trigger the BUG() macro
from user space with TPACKET_V3's RX_RING by just giving a wrong
header status flag. We already had a similar situation in commit
7f5c3e3a80e6654 (``af_packet: remove BUG statement in
tpacket_destruct_skb'') where this was the case in the TX_RING
side that could be triggered from user space. So really, don't use
BUG() or BUG_ON() unless there's really no way out, and i.e.
don't use it for consistency checking when there's user space
involved, no excuses, especially not if you're slapping the user
with WARN + dump_stack + BUG all at once. The two functions are
of concern:

  prb_retire_current_block() [when block status != TP_STATUS_KERNEL]
  prb_open_block() [when block_status != TP_STATUS_KERNEL]

Calls to prb_open_block() are guarded by ealier checks if block_status
is really TP_STATUS_KERNEL (racy!), but the first one BUG() is easily
triggable from user space. System behaves still stable after they are
removed. Also remove that yoda condition entirely, since it's already
guarded.

Reported-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/packet/af_packet.c |   53 +++++++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 30 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 70f7e18..13dee6a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -806,36 +806,33 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1,
 
 	smp_rmb();
 
-	if (likely(TP_STATUS_KERNEL == BLOCK_STATUS(pbd1))) {
+	/* We could have just memset this but we will lose the
+	 * flexibility of making the priv area sticky
+	 */
 
-		/* We could have just memset this but we will lose the
-		 * flexibility of making the priv area sticky
-		 */
-		BLOCK_SNUM(pbd1) = pkc1->knxt_seq_num++;
-		BLOCK_NUM_PKTS(pbd1) = 0;
-		BLOCK_LEN(pbd1) = BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
-		getnstimeofday(&ts);
-		h1->ts_first_pkt.ts_sec = ts.tv_sec;
-		h1->ts_first_pkt.ts_nsec = ts.tv_nsec;
-		pkc1->pkblk_start = (char *)pbd1;
-		pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
-		BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
-		BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN;
-		pbd1->version = pkc1->version;
-		pkc1->prev = pkc1->nxt_offset;
-		pkc1->pkblk_end = pkc1->pkblk_start + pkc1->kblk_size;
-		prb_thaw_queue(pkc1);
-		_prb_refresh_rx_retire_blk_timer(pkc1);
+	BLOCK_SNUM(pbd1) = pkc1->knxt_seq_num++;
+	BLOCK_NUM_PKTS(pbd1) = 0;
+	BLOCK_LEN(pbd1) = BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
 
-		smp_wmb();
+	getnstimeofday(&ts);
 
-		return;
-	}
+	h1->ts_first_pkt.ts_sec = ts.tv_sec;
+	h1->ts_first_pkt.ts_nsec = ts.tv_nsec;
 
-	WARN(1, "ERROR block:%p is NOT FREE status:%d kactive_blk_num:%d\n",
-		pbd1, BLOCK_STATUS(pbd1), pkc1->kactive_blk_num);
-	dump_stack();
-	BUG();
+	pkc1->pkblk_start = (char *)pbd1;
+	pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
+
+	BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
+	BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN;
+
+	pbd1->version = pkc1->version;
+	pkc1->prev = pkc1->nxt_offset;
+	pkc1->pkblk_end = pkc1->pkblk_start + pkc1->kblk_size;
+
+	prb_thaw_queue(pkc1);
+	_prb_refresh_rx_retire_blk_timer(pkc1);
+
+	smp_wmb();
 }
 
 /*
@@ -926,10 +923,6 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,
 		prb_close_block(pkc, pbd, po, status);
 		return;
 	}
-
-	WARN(1, "ERROR-pbd[%d]:%p\n", pkc->kactive_blk_num, pbd);
-	dump_stack();
-	BUG();
 }
 
 static int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc,
-- 
1.7.10.4



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

* [38/65] 3c59x: fix freeing nonexistent resource on driver unload
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (36 preceding siblings ...)
  2013-06-03 22:10 ` [37/65] packet: tpacket_v3: do not trigger bug() on wrong header status Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [39/65] 3c59x: fix PCI resource management Steven Rostedt
                   ` (26 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Matthew Whitehead, Sergei Shtylyov, David S. Miller

[-- Attachment #1: 0038-3c59x-fix-freeing-nonexistent-resource-on-driver-unl.patch --]
[-- Type: text/plain, Size: 1557 bytes --]

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

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

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

[ Upstream commit c81400be716aa4c76f6ebf339ba94358dbbf6da6 ]

When unloading the driver that drives an EISA board, a message similar to the
following one is displayed:

Trying to free nonexistent resource <0000000000013000-000000000001301f>

Then an user is unable to reload the driver because the resource it requested in
the previous load hasn't been freed. This happens most probably due to a typo in
vortex_eisa_remove() which calls release_region() with 'dev->base_addr'  instead
of 'edev->base_addr'...

Reported-by: Matthew Whitehead <tedheadster@gmail.com>
Tested-by: Matthew Whitehead <tedheadster@gmail.com>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/ethernet/3com/3c59x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index e463d10..ccfc86f 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -951,7 +951,7 @@ static int __devexit vortex_eisa_remove(struct device *device)
 
 	unregister_netdev(dev);
 	iowrite16(TotalReset|0x14, ioaddr + EL3_CMD);
-	release_region(dev->base_addr, VORTEX_TOTAL_SIZE);
+	release_region(edev->base_addr, VORTEX_TOTAL_SIZE);
 
 	free_netdev(dev);
 	return 0;
-- 
1.7.10.4



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

* [39/65] 3c59x: fix PCI resource management
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (37 preceding siblings ...)
  2013-06-03 22:10 ` [38/65] 3c59x: fix freeing nonexistent resource on driver unload Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [40/65] if_cablemodem.h: Add parenthesis around ioctl macros Steven Rostedt
                   ` (25 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Sergei Shtylyov, David S. Miller

[-- Attachment #1: 0039-3c59x-fix-PCI-resource-management.patch --]
[-- Type: text/plain, Size: 3719 bytes --]

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

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

From: Sergei Shtylyov <sshtylyov@ru.mvista.com>

[ Upstream commit 4b264a1676e70dc656ba53a8cac690f2d4b65f4e ]

The driver wrongly claimed I/O ports at an address returned by pci_iomap() --
even if it was passed an MMIO address.  Fix this by claiming/releasing all PCI
resources in the PCI driver's probe()/remove() methods instead and get rid of
'must_free_region' flag weirdness (why would Cardbus claim anything for us?).

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/ethernet/3com/3c59x.c |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index ccfc86f..5673d6e 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -632,7 +632,6 @@ struct vortex_private {
 		pm_state_valid:1,				/* pci_dev->saved_config_space has sane contents */
 		open:1,
 		medialock:1,
-		must_free_region:1,				/* Flag: if zero, Cardbus owns the I/O region */
 		large_frames:1,			/* accept large frames */
 		handling_irq:1;			/* private in_irq indicator */
 	/* {get|set}_wol operations are already serialized by rtnl.
@@ -1012,6 +1011,12 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
 	if (rc < 0)
 		goto out;
 
+	rc = pci_request_regions(pdev, DRV_NAME);
+	if (rc < 0) {
+		pci_disable_device(pdev);
+		goto out;
+	}
+
 	unit = vortex_cards_found;
 
 	if (global_use_mmio < 0 && (unit >= MAX_UNITS || use_mmio[unit] < 0)) {
@@ -1027,6 +1032,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
 	if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */
 		ioaddr = pci_iomap(pdev, 0, 0);
 	if (!ioaddr) {
+		pci_release_regions(pdev);
 		pci_disable_device(pdev);
 		rc = -ENOMEM;
 		goto out;
@@ -1036,6 +1042,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
 			   ent->driver_data, unit);
 	if (rc < 0) {
 		pci_iounmap(pdev, ioaddr);
+		pci_release_regions(pdev);
 		pci_disable_device(pdev);
 		goto out;
 	}
@@ -1179,11 +1186,6 @@ static int __devinit vortex_probe1(struct device *gendev,
 
 	/* PCI-only startup logic */
 	if (pdev) {
-		/* EISA resources already marked, so only PCI needs to do this here */
-		/* Ignore return value, because Cardbus drivers already allocate for us */
-		if (request_region(dev->base_addr, vci->io_size, print_name) != NULL)
-			vp->must_free_region = 1;
-
 		/* enable bus-mastering if necessary */
 		if (vci->flags & PCI_USES_MASTER)
 			pci_set_master(pdev);
@@ -1221,7 +1223,7 @@ static int __devinit vortex_probe1(struct device *gendev,
 					   &vp->rx_ring_dma);
 	retval = -ENOMEM;
 	if (!vp->rx_ring)
-		goto free_region;
+		goto free_device;
 
 	vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE);
 	vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE;
@@ -1486,9 +1488,7 @@ free_ring:
 							+ sizeof(struct boom_tx_desc) * TX_RING_SIZE,
 						vp->rx_ring,
 						vp->rx_ring_dma);
-free_region:
-	if (vp->must_free_region)
-		release_region(dev->base_addr, vci->io_size);
+free_device:
 	free_netdev(dev);
 	pr_err(PFX "vortex_probe1 fails.  Returns %d\n", retval);
 out:
@@ -3256,8 +3256,9 @@ static void __devexit vortex_remove_one(struct pci_dev *pdev)
 							+ sizeof(struct boom_tx_desc) * TX_RING_SIZE,
 						vp->rx_ring,
 						vp->rx_ring_dma);
-	if (vp->must_free_region)
-		release_region(dev->base_addr, vp->io_size);
+
+	pci_release_regions(pdev);
+
 	free_netdev(dev);
 }
 
-- 
1.7.10.4



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

* [40/65] if_cablemodem.h: Add parenthesis around ioctl macros
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (38 preceding siblings ...)
  2013-06-03 22:10 ` [39/65] 3c59x: fix PCI resource management Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [41/65] macvlan: fix passthru mode race between dev removal and rx path Steven Rostedt
                   ` (24 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Paul Wouters, Josh Boyer, David S. Miller

[-- Attachment #1: 0040-if_cablemodem.h-Add-parenthesis-around-ioctl-macros.patch --]
[-- Type: text/plain, Size: 1709 bytes --]

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

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

From: Josh Boyer <jwboyer@redhat.com>

[ Upstream commit 4f924b2aa4d3cb30f07e57d6b608838edcbc0d88 ]

Protect the SIOCGCM* ioctl macros with parenthesis.

Reported-by: Paul Wouters <pwouters@redhat.com>
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/if_cablemodem.h |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/if_cablemodem.h b/include/linux/if_cablemodem.h
index 9ca1007..ee6b3c4 100644
--- a/include/linux/if_cablemodem.h
+++ b/include/linux/if_cablemodem.h
@@ -12,11 +12,11 @@
  */
 
 /* some useful defines for sb1000.c e cmconfig.c - fv */
-#define SIOCGCMSTATS		SIOCDEVPRIVATE+0	/* get cable modem stats */
-#define SIOCGCMFIRMWARE		SIOCDEVPRIVATE+1	/* get cm firmware version */
-#define SIOCGCMFREQUENCY	SIOCDEVPRIVATE+2	/* get cable modem frequency */
-#define SIOCSCMFREQUENCY	SIOCDEVPRIVATE+3	/* set cable modem frequency */
-#define SIOCGCMPIDS			SIOCDEVPRIVATE+4	/* get cable modem PIDs */
-#define SIOCSCMPIDS			SIOCDEVPRIVATE+5	/* set cable modem PIDs */
+#define SIOCGCMSTATS		(SIOCDEVPRIVATE+0)	/* get cable modem stats */
+#define SIOCGCMFIRMWARE		(SIOCDEVPRIVATE+1)	/* get cm firmware version */
+#define SIOCGCMFREQUENCY	(SIOCDEVPRIVATE+2)	/* get cable modem frequency */
+#define SIOCSCMFREQUENCY	(SIOCDEVPRIVATE+3)	/* set cable modem frequency */
+#define SIOCGCMPIDS			(SIOCDEVPRIVATE+4)	/* get cable modem PIDs */
+#define SIOCSCMPIDS			(SIOCDEVPRIVATE+5)	/* set cable modem PIDs */
 
 #endif
-- 
1.7.10.4



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

* [41/65] macvlan: fix passthru mode race between dev removal and rx path
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (39 preceding siblings ...)
  2013-06-03 22:10 ` [40/65] if_cablemodem.h: Add parenthesis around ioctl macros Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [42/65] ipv6: do not clear pinet6 field Steven Rostedt
                   ` (23 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jiri Pirko, Eric Dumazet, David S. Miller

[-- Attachment #1: 0041-macvlan-fix-passthru-mode-race-between-dev-removal-a.patch --]
[-- Type: text/plain, Size: 2612 bytes --]

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

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

From: Jiri Pirko <jiri@resnulli.us>

[ Upstream commit 233c7df0821c4190e2d3f4be0f2ca0ab40a5ed8c ]

Currently, if macvlan in passthru mode is created and data are rxed and
you remove this device, following panic happens:

NULL pointer dereference at 0000000000000198
IP: [<ffffffffa0196058>] macvlan_handle_frame+0x153/0x1f7 [macvlan]

I'm using following script to trigger this:
<script>
while [ 1 ]
do
	ip link add link e1 name macvtap0 type macvtap mode passthru
	ip link set e1 up
	ip link set macvtap0 up
	IFINDEX=`ip link |grep macvtap0 | cut -f 1 -d ':'`
	cat /dev/tap$IFINDEX  >/dev/null &
	ip link del dev macvtap0
done
</script>

I run this script while "ping -f" is running on another machine to send
packets to e1 rx.

Reason of the panic is that list_first_entry() is blindly called in
macvlan_handle_frame() even if the list was empty. vlan is set to
incorrect pointer which leads to the crash.

I'm fixing this by protecting port->vlans list by rcu and by preventing
from getting incorrect pointer in case the list is empty.

Introduced by: commit eb06acdc85585f2 "macvlan: Introduce 'passthru' mode to takeover the underlying device"

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/net/macvlan.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 666fc20..0bec603 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -204,7 +204,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
 	}
 
 	if (port->passthru)
-		vlan = list_first_entry(&port->vlans, struct macvlan_dev, list);
+		vlan = list_first_or_null_rcu(&port->vlans,
+					      struct macvlan_dev, list);
 	else
 		vlan = macvlan_hash_lookup(port, eth->h_dest);
 	if (vlan == NULL)
@@ -771,7 +772,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
 	if (err < 0)
 		goto destroy_port;
 
-	list_add_tail(&vlan->list, &port->vlans);
+	list_add_tail_rcu(&vlan->list, &port->vlans);
 	netif_stacked_transfer_operstate(lowerdev, dev);
 
 	return 0;
@@ -797,7 +798,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head)
 {
 	struct macvlan_dev *vlan = netdev_priv(dev);
 
-	list_del(&vlan->list);
+	list_del_rcu(&vlan->list);
 	unregister_netdevice_queue(dev, head);
 }
 EXPORT_SYMBOL_GPL(macvlan_dellink);
-- 
1.7.10.4



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

* [42/65] ipv6: do not clear pinet6 field
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (40 preceding siblings ...)
  2013-06-03 22:10 ` [41/65] macvlan: fix passthru mode race between dev removal and rx path Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:10 ` [43/65] xfrm6: release dev before returning error Steven Rostedt
                   ` (22 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Eric Dumazet, David S. Miller

[-- Attachment #1: 0042-ipv6-do-not-clear-pinet6-field.patch --]
[-- Type: text/plain, Size: 5649 bytes --]

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

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

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit f77d602124d865c38705df7fa25c03de9c284ad2 ]

We have seen multiple NULL dereferences in __inet6_lookup_established()

After analysis, I found that inet6_sk() could be NULL while the
check for sk_family == AF_INET6 was true.

Bug was added in linux-2.6.29 when RCU lookups were introduced in UDP
and TCP stacks.

Once an IPv6 socket, using SLAB_DESTROY_BY_RCU is inserted in a hash
table, we no longer can clear pinet6 field.

This patch extends logic used in commit fcbdf09d9652c891
("net: fix nulls list corruptions in sk_prot_alloc")

TCP/UDP/UDPLite IPv6 protocols provide their own .clear_sk() method
to make sure we do not clear pinet6 field.

At socket clone phase, we do not really care, as cloning the parent (non
NULL) pinet6 is not adding a fatal race.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/net/sock.h  |   12 ++++++++++++
 net/core/sock.c     |   12 ------------
 net/ipv6/tcp_ipv6.c |   12 ++++++++++++
 net/ipv6/udp.c      |   13 ++++++++++++-
 net/ipv6/udp_impl.h |    2 ++
 net/ipv6/udplite.c  |    2 +-
 6 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 450a2af..30662c9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -837,6 +837,18 @@ struct inet_hashinfo;
 struct raw_hashinfo;
 struct module;
 
+/*
+ * caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes
+ * un-modified. Special care is taken when initializing object to zero.
+ */
+static inline void sk_prot_clear_nulls(struct sock *sk, int size)
+{
+	if (offsetof(struct sock, sk_node.next) != 0)
+		memset(sk, 0, offsetof(struct sock, sk_node.next));
+	memset(&sk->sk_node.pprev, 0,
+	       size - offsetof(struct sock, sk_node.pprev));
+}
+
 /* Networking protocol blocks we attach to sockets.
  * socket layer -> transport layer interface
  * transport -> network interface is defined by struct inet_proto
diff --git a/net/core/sock.c b/net/core/sock.c
index e794a4a..be63d03 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1140,18 +1140,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk)
 #endif
 }
 
-/*
- * caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes
- * un-modified. Special care is taken when initializing object to zero.
- */
-static inline void sk_prot_clear_nulls(struct sock *sk, int size)
-{
-	if (offsetof(struct sock, sk_node.next) != 0)
-		memset(sk, 0, offsetof(struct sock, sk_node.next));
-	memset(&sk->sk_node.pprev, 0,
-	       size - offsetof(struct sock, sk_node.pprev));
-}
-
 void sk_prot_clear_portaddr_nulls(struct sock *sk, int size)
 {
 	unsigned long nulls1, nulls2;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e3eec75..e5ec801 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2013,6 +2013,17 @@ void tcp6_proc_exit(struct net *net)
 }
 #endif
 
+static void tcp_v6_clear_sk(struct sock *sk, int size)
+{
+	struct inet_sock *inet = inet_sk(sk);
+
+	/* we do not want to clear pinet6 field, because of RCU lookups */
+	sk_prot_clear_nulls(sk, offsetof(struct inet_sock, pinet6));
+
+	size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6);
+	memset(&inet->pinet6 + 1, 0, size);
+}
+
 struct proto tcpv6_prot = {
 	.name			= "TCPv6",
 	.owner			= THIS_MODULE,
@@ -2056,6 +2067,7 @@ struct proto tcpv6_prot = {
 #ifdef CONFIG_MEMCG_KMEM
 	.proto_cgroup		= tcp_proto_cgroup,
 #endif
+	.clear_sk		= tcp_v6_clear_sk,
 };
 
 static const struct inet6_protocol tcpv6_protocol = {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 07e2bfe..08a1878 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1517,6 +1517,17 @@ void udp6_proc_exit(struct net *net) {
 }
 #endif /* CONFIG_PROC_FS */
 
+void udp_v6_clear_sk(struct sock *sk, int size)
+{
+	struct inet_sock *inet = inet_sk(sk);
+
+	/* we do not want to clear pinet6 field, because of RCU lookups */
+	sk_prot_clear_portaddr_nulls(sk, offsetof(struct inet_sock, pinet6));
+
+	size -= offsetof(struct inet_sock, pinet6) + sizeof(inet->pinet6);
+	memset(&inet->pinet6 + 1, 0, size);
+}
+
 /* ------------------------------------------------------------------------ */
 
 struct proto udpv6_prot = {
@@ -1547,7 +1558,7 @@ struct proto udpv6_prot = {
 	.compat_setsockopt = compat_udpv6_setsockopt,
 	.compat_getsockopt = compat_udpv6_getsockopt,
 #endif
-	.clear_sk	   = sk_prot_clear_portaddr_nulls,
+	.clear_sk	   = udp_v6_clear_sk,
 };
 
 static struct inet_protosw udpv6_protosw = {
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index d757104..4691ed5 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -31,6 +31,8 @@ extern int	udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
 extern int	udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb);
 extern void	udpv6_destroy_sock(struct sock *sk);
 
+extern void udp_v6_clear_sk(struct sock *sk, int size);
+
 #ifdef CONFIG_PROC_FS
 extern int	udp6_seq_show(struct seq_file *seq, void *v);
 #endif
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 1d08e21..dfcc4be 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -56,7 +56,7 @@ struct proto udplitev6_prot = {
 	.compat_setsockopt = compat_udpv6_setsockopt,
 	.compat_getsockopt = compat_udpv6_getsockopt,
 #endif
-	.clear_sk	   = sk_prot_clear_portaddr_nulls,
+	.clear_sk	   = udp_v6_clear_sk,
 };
 
 static struct inet_protosw udplite6_protosw = {
-- 
1.7.10.4



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

* [43/65] xfrm6: release dev before returning error
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (41 preceding siblings ...)
  2013-06-03 22:10 ` [42/65] ipv6: do not clear pinet6 field Steven Rostedt
@ 2013-06-03 22:10 ` Steven Rostedt
  2013-06-03 22:11 ` [44/65] pch_dma: Use GFP_ATOMIC because called from interrupt context Steven Rostedt
                   ` (21 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Herbert Xu, Steffen Klassert, David S. Miller, Cong Wang

[-- Attachment #1: 0043-xfrm6-release-dev-before-returning-error.patch --]
[-- Type: text/plain, Size: 1145 bytes --]

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

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

From: Cong Wang <amwang@redhat.com>

[ Upstream commit 84c4a9dfbf430861e7588d95ae3ff61535dca351 ]

We forget to call dev_put() on error path in xfrm6_fill_dst(),
its caller doesn't handle this.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 net/ipv6/xfrm6_policy.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index bf6912e..a11f96c 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -103,8 +103,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
 	dev_hold(dev);
 
 	xdst->u.rt6.rt6i_idev = in6_dev_get(dev);
-	if (!xdst->u.rt6.rt6i_idev)
+	if (!xdst->u.rt6.rt6i_idev) {
+		dev_put(dev);
 		return -ENODEV;
+	}
 
 	rt6_transfer_peer(&xdst->u.rt6, rt);
 
-- 
1.7.10.4



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

* [44/65] pch_dma: Use GFP_ATOMIC because called from interrupt context
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (42 preceding siblings ...)
  2013-06-03 22:10 ` [43/65] xfrm6: release dev before returning error Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [45/65] watchdog: Fix race condition in registration code Steven Rostedt
                   ` (20 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tomoya MORINAGA, Vinod Koul

[-- Attachment #1: 0044-pch_dma-Use-GFP_ATOMIC-because-called-from-interrupt.patch --]
[-- Type: text/plain, Size: 1177 bytes --]

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

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

From: Tomoya MORINAGA <tomoya.rohm@gmail.com>

[ Upstream commit 5c1ef59168c485318e40ba485c1eba57d81d0faa ]

pdc_desc_get() is called from pd_prep_slave_sg, and the function is
called from interrupt context(e.g. Uart driver "pch_uart.c").
In fact, I saw kernel error message.
So, GFP_ATOMIC must be used not GFP_NOIO.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/dma/pch_dma.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 987ab5c..d5cbd44 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -476,7 +476,7 @@ static struct pch_dma_desc *pdc_desc_get(struct pch_dma_chan *pd_chan)
 	dev_dbg(chan2dev(&pd_chan->chan), "scanned %d descriptors\n", i);
 
 	if (!ret) {
-		ret = pdc_alloc_desc(&pd_chan->chan, GFP_NOIO);
+		ret = pdc_alloc_desc(&pd_chan->chan, GFP_ATOMIC);
 		if (ret) {
 			spin_lock(&pd_chan->lock);
 			pd_chan->descs_allocated++;
-- 
1.7.10.4



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

* [45/65] watchdog: Fix race condition in registration code
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (43 preceding siblings ...)
  2013-06-03 22:11 ` [44/65] pch_dma: Use GFP_ATOMIC because called from interrupt context Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [46/65] drbd: fix for deadlock when using automatic split-brain-recovery Steven Rostedt
                   ` (19 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arkadiusz Miskiewicz, Guenter Roeck, Wim Van Sebroeck

[-- Attachment #1: 0045-watchdog-Fix-race-condition-in-registration-code.patch --]
[-- Type: text/plain, Size: 1933 bytes --]

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

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

From: Guenter Roeck <linux@roeck-us.net>

[ Upstream commit 60403f7a4d9368d187f79cba5e4672d01df37574 ]

A race condition exists when registering the first watchdog device.
Sequence of events:

- watchdog_register_device calls watchdog_dev_register
- watchdog_dev_register creates the watchdog misc device by calling
  misc_register.
  At that time, the matching character device (/dev/watchdog0) does not yet
  exist, and old_wdd is not set either.
- Userspace gets an event and opens /dev/watchdog
- watchdog_open is called and sets wdd = old_wdd, which is still NULL,
  and tries to dereference it. This causes the kernel to panic.

Seen with systemd trying to open /dev/watchdog immediately after
it was created.

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/watchdog/watchdog_dev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index ef8edec..05a5310 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -524,6 +524,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
 	int err, devno;
 
 	if (watchdog->id == 0) {
+		old_wdd = watchdog;
 		watchdog_miscdev.parent = watchdog->parent;
 		err = misc_register(&watchdog_miscdev);
 		if (err != 0) {
@@ -532,9 +533,9 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
 			if (err == -EBUSY)
 				pr_err("%s: a legacy watchdog module is probably present.\n",
 					watchdog->info->identity);
+			old_wdd = NULL;
 			return err;
 		}
-		old_wdd = watchdog;
 	}
 
 	/* Fill in the data structures */
-- 
1.7.10.4



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

* [46/65] drbd: fix for deadlock when using automatic split-brain-recovery
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (44 preceding siblings ...)
  2013-06-03 22:11 ` [45/65] watchdog: Fix race condition in registration code Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [47/65] ARM: EXYNOS5: Fix kernel dump in AFTR idle mode Steven Rostedt
                   ` (18 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Philipp Reisner, Lars Ellenberg, Jens Axboe

[-- Attachment #1: 0046-drbd-fix-for-deadlock-when-using-automatic-split-bra.patch --]
[-- Type: text/plain, Size: 1667 bytes --]

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

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

From: Philipp Reisner <philipp.reisner@linbit.com>

[ Upstream commit 7c689e63a847316c1b2500f86891b0a574ce7e69 ]

With an automatic after split-brain recovery policy of
"after-sb-1pri call-pri-lost-after-sb",
when trying to drbd_set_role() to R_SECONDARY,
we run into a deadlock.

This was first recognized and supposedly fixed by
2009-06-10 "Fixed a deadlock when using automatic split brain recovery when both nodes are"
replacing drbd_set_role() with drbd_change_state() in that code-path,
but the first hunk of that patch forgets to remove the drbd_set_role().

We apparently only ever tested the "two primaries" case.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/block/drbd/drbd_receiver.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index c74ca2d..490b759 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -2271,7 +2271,6 @@ static int drbd_asb_recover_1p(struct drbd_conf *mdev) __must_hold(local)
 		if (hg == -1 && mdev->state.role == R_PRIMARY) {
 			enum drbd_state_rv rv2;
 
-			drbd_set_role(mdev, R_SECONDARY, 0);
 			 /* drbd_change_state() does not sleep while in SS_IN_TRANSIENT_STATE,
 			  * we might be here in C_WF_REPORT_PARAMS which is transient.
 			  * we do not need to wait for the after state change work either. */
-- 
1.7.10.4



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

* [47/65] ARM: EXYNOS5: Fix kernel dump in AFTR idle mode
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (45 preceding siblings ...)
  2013-06-03 22:11 ` [46/65] drbd: fix for deadlock when using automatic split-brain-recovery Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [48/65] drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe() Steven Rostedt
                   ` (17 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Inderpal Singh, Chander Kashyap, Olof Johansson

[-- Attachment #1: 0047-ARM-EXYNOS5-Fix-kernel-dump-in-AFTR-idle-mode.patch --]
[-- Type: text/plain, Size: 2628 bytes --]

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

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

From: Inderpal Singh <inderpal.singh@linaro.org>

[ Upstream commit 088584618836b159947bc4ab5011a5cf1f081a62 ]

The kernel crashes while resuming from AFTR idle mode. It happens
because L2 cache was not going into retention state.

This patch configures the USE_RETENTION bit of ARM_L2_OPTION register
so that it does not depend on MANUAL_L2RSTDISABLE_CONTROL of
ARM_COMMON_OPTION register for L2RSTDISABLE signal.

Signed-off-by: Inderpal Singh <inderpal.singh@linaro.org>
Tested-by: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/arm/mach-exynos/include/mach/regs-pmu.h |    1 +
 arch/arm/mach-exynos/pmu.c                   |    5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index d4e392b..ad3c020 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -342,6 +342,7 @@
 #define EXYNOS5_FSYS_ARM_OPTION					S5P_PMUREG(0x2208)
 #define EXYNOS5_ISP_ARM_OPTION					S5P_PMUREG(0x2288)
 #define EXYNOS5_ARM_COMMON_OPTION				S5P_PMUREG(0x2408)
+#define EXYNOS5_ARM_L2_OPTION					S5P_PMUREG(0x2608)
 #define EXYNOS5_TOP_PWR_OPTION					S5P_PMUREG(0x2C48)
 #define EXYNOS5_TOP_PWR_SYSMEM_OPTION				S5P_PMUREG(0x2CC8)
 #define EXYNOS5_JPEG_MEM_OPTION					S5P_PMUREG(0x2F48)
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 3a48c85..76691b3 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -227,6 +227,7 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = {
 	{ EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
 	{ EXYNOS5_ARM_COMMON_SYS_PWR_REG,		{ 0x0, 0x0, 0x2} },
 	{ EXYNOS5_ARM_L2_SYS_PWR_REG,			{ 0x3, 0x3, 0x3} },
+	{ EXYNOS5_ARM_L2_OPTION,			{ 0x10, 0x10, 0x0 } },
 	{ EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
 	{ EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
 	{ EXYNOS5_CMU_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
@@ -352,11 +353,9 @@ static void exynos5_init_pmu(void)
 
 	/*
 	 * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
-	 * MANUAL_L2RSTDISABLE_CONTROL_BITFIELD Enable
 	 */
 	tmp = __raw_readl(EXYNOS5_ARM_COMMON_OPTION);
-	tmp |= (EXYNOS5_MANUAL_L2RSTDISABLE_CONTROL |
-		EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN);
+	tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
 	__raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION);
 
 	/*
-- 
1.7.10.4



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

* [48/65] drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe()
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (46 preceding siblings ...)
  2013-06-03 22:11 ` [47/65] ARM: EXYNOS5: Fix kernel dump in AFTR idle mode Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [49/65] iscsi-target: Fix processing of OOO commands Steven Rostedt
                   ` (16 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Wei Yongjun, Jingoo Han, Andrew Morton

[-- Attachment #1: 0048-drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-p.patch --]
[-- Type: text/plain, Size: 1041 bytes --]

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

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

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

[ Upstream commit 35623715818dfa720cccf99cd280dcbb4b78da23 ]

Fix to return -ENODEV in the chip not found error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/rtc/rtc-pcf2123.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index 13e4df6..8620cbc 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -265,6 +265,7 @@ static int __devinit pcf2123_probe(struct spi_device *spi)
 
 	if (!(rxbuf[0] & 0x20)) {
 		dev_err(&spi->dev, "chip not found\n");
+		ret = -ENODEV;
 		goto kfree_exit;
 	}
 
-- 
1.7.10.4



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

* [49/65] iscsi-target: Fix processing of OOO commands
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (47 preceding siblings ...)
  2013-06-03 22:11 ` [48/65] drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe() Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [50/65] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race Steven Rostedt
                   ` (15 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Shlomo Pongratz, Nicholas Bellinger

[-- Attachment #1: 0049-iscsi-target-Fix-processing-of-OOO-commands.patch --]
[-- Type: text/plain, Size: 1825 bytes --]

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

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

From: Shlomo Pongratz <shlomop@mellanox.com>

[ Upstream commit 3eccfdb01da58fbd0f789ae6ca61cee3769e26de ]

Fix two issues in OOO commands processing done at iscsit_attach_ooo_cmdsn.

Handle command serial numbers wrap around by using iscsi_sna_lt and not regular comparisson.

The routine iterates until it finds an entry whose serial number is greater than the serial number of
the new one, thus the new entry should be inserted before that entry and not after.

Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/target/iscsi/iscsi_target_erl1.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 3df8a2c..a0b78d6 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -819,7 +819,7 @@ static int iscsit_attach_ooo_cmdsn(
 		/*
 		 * CmdSN is greater than the tail of the list.
 		 */
-		if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn)
+		if (iscsi_sna_lt(ooo_tail->cmdsn, ooo_cmdsn->cmdsn))
 			list_add_tail(&ooo_cmdsn->ooo_list,
 					&sess->sess_ooo_cmdsn_list);
 		else {
@@ -829,11 +829,12 @@ static int iscsit_attach_ooo_cmdsn(
 			 */
 			list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list,
 						ooo_list) {
-				if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)
+				if (iscsi_sna_lt(ooo_tmp->cmdsn, ooo_cmdsn->cmdsn))
 					continue;
 
+				/* Insert before this entry */
 				list_add(&ooo_cmdsn->ooo_list,
-					&ooo_tmp->ooo_list);
+					ooo_tmp->ooo_list.prev);
 				break;
 			}
 		}
-- 
1.7.10.4



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

* [50/65] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (48 preceding siblings ...)
  2013-06-03 22:11 ` [49/65] iscsi-target: Fix processing of OOO commands Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [51/65] ACPI / EC: Restart transaction even when the IBF flag set Steven Rostedt
                   ` (14 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Joern Engel, Greg Kroah-Hartman, Nicholas Bellinger

[-- Attachment #1: 0050-target-close-target_put_sess_cmd-vs.-core_tmr_abort_.patch --]
[-- Type: text/plain, Size: 4077 bytes --]

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

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

From: Joern Engel <joern@logfs.org>

[ Upstream commit ccf5ae83a6cf3d9cfe9a7038bfe7cd38ab03d5e1 ]

It is possible for one thread to to take se_sess->sess_cmd_lock in
core_tmr_abort_task() before taking a reference count on
se_cmd->cmd_kref, while another thread in target_put_sess_cmd() drops
se_cmd->cmd_kref before taking se_sess->sess_cmd_lock.

This introduces kref_put_spinlock_irqsave() and uses it in
target_put_sess_cmd() to close the race window.

Signed-off-by: Joern Engel <joern@logfs.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/target/target_core_transport.c |   11 +++++------
 include/linux/kref.h                   |   33 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index c87ef74..140bfb3 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2430,21 +2430,19 @@ static void target_release_cmd_kref(struct kref *kref)
 {
 	struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref);
 	struct se_session *se_sess = se_cmd->se_sess;
-	unsigned long flags;
 
-	spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
 	if (list_empty(&se_cmd->se_cmd_list)) {
-		spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
+		spin_unlock(&se_sess->sess_cmd_lock);
 		se_cmd->se_tfo->release_cmd(se_cmd);
 		return;
 	}
 	if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) {
-		spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
+		spin_unlock(&se_sess->sess_cmd_lock);
 		complete(&se_cmd->cmd_wait_comp);
 		return;
 	}
 	list_del(&se_cmd->se_cmd_list);
-	spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
+	spin_unlock(&se_sess->sess_cmd_lock);
 
 	se_cmd->se_tfo->release_cmd(se_cmd);
 }
@@ -2455,7 +2453,8 @@ static void target_release_cmd_kref(struct kref *kref)
  */
 int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd)
 {
-	return kref_put(&se_cmd->cmd_kref, target_release_cmd_kref);
+	return kref_put_spinlock_irqsave(&se_cmd->cmd_kref, target_release_cmd_kref,
+			&se_sess->sess_cmd_lock);
 }
 EXPORT_SYMBOL(target_put_sess_cmd);
 
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 4972e6e..7419c02 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -19,6 +19,7 @@
 #include <linux/atomic.h>
 #include <linux/kernel.h>
 #include <linux/mutex.h>
+#include <linux/spinlock.h>
 
 struct kref {
 	atomic_t refcount;
@@ -95,6 +96,38 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)
 	return kref_sub(kref, 1, release);
 }
 
+/**
+ * kref_put_spinlock_irqsave - decrement refcount for object.
+ * @kref: object.
+ * @release: pointer to the function that will clean up the object when the
+ *	     last reference to the object is released.
+ *	     This pointer is required, and it is not acceptable to pass kfree
+ *	     in as this function.
+ * @lock: lock to take in release case
+ *
+ * Behaves identical to kref_put with one exception.  If the reference count
+ * drops to zero, the lock will be taken atomically wrt dropping the reference
+ * count.  The release function has to call spin_unlock() without _irqrestore.
+ */
+static inline int kref_put_spinlock_irqsave(struct kref *kref,
+		void (*release)(struct kref *kref),
+		spinlock_t *lock)
+{
+	unsigned long flags;
+
+	WARN_ON(release == NULL);
+	if (atomic_add_unless(&kref->refcount, -1, 1))
+		return 0;
+	spin_lock_irqsave(lock, flags);
+	if (atomic_dec_and_test(&kref->refcount)) {
+		release(kref);
+		local_irq_restore(flags);
+		return 1;
+	}
+	spin_unlock_irqrestore(lock, flags);
+	return 0;
+}
+
 static inline int kref_put_mutex(struct kref *kref,
 				 void (*release)(struct kref *kref),
 				 struct mutex *lock)
-- 
1.7.10.4



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

* [51/65] ACPI / EC: Restart transaction even when the IBF flag set
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (49 preceding siblings ...)
  2013-06-03 22:11 ` [50/65] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [52/65] drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow Steven Rostedt
                   ` (13 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lan Tianyu, Rafael J. Wysocki

[-- Attachment #1: 0051-ACPI-EC-Restart-transaction-even-when-the-IBF-flag-s.patch --]
[-- Type: text/plain, Size: 2309 bytes --]

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

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

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

[ Upstream commit 28fe5c825f8e15744d04c7c1b8df197950923ecd ]

The EC driver works abnormally with IBF flag always set.
IBF means "The host has written a byte of data to the command
or data port, but the embedded controller has not yet read it".
If IBF is set in the EC status and not cleared, this will cause
all subsequent EC requests to fail with a timeout error.

Change the EC driver so that it doesn't refuse to restart a
transaction if IBF is set in the status.  Also increase the
number of transaction restarts to 5, as it turns out that 2
is not sufficient in some cases.

This bug happens on several different machines (Asus V1S,
Dell Latitude E6530, Samsung R719, Acer Aspire 5930G,
Sony Vaio SR19VN and others).

[rjw: Changelog]
References: https://bugzilla.kernel.org/show_bug.cgi?id=14733
References: https://bugzilla.kernel.org/show_bug.cgi?id=15560
References: https://bugzilla.kernel.org/show_bug.cgi?id=15946
References: https://bugzilla.kernel.org/show_bug.cgi?id=42945
References: https://bugzilla.kernel.org/show_bug.cgi?id=48221
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Cc: All <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/acpi/ec.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index a51df96..f9914e5 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -217,7 +217,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
 static int ec_poll(struct acpi_ec *ec)
 {
 	unsigned long flags;
-	int repeat = 2; /* number of command restarts */
+	int repeat = 5; /* number of command restarts */
 	while (repeat--) {
 		unsigned long delay = jiffies +
 			msecs_to_jiffies(ec_delay);
@@ -235,8 +235,6 @@ static int ec_poll(struct acpi_ec *ec)
 			}
 			advance_transaction(ec, acpi_ec_read_status(ec));
 		} while (time_before(jiffies, delay));
-		if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
-			break;
 		pr_debug(PREFIX "controller reset, restart transaction\n");
 		spin_lock_irqsave(&ec->curr_lock, flags);
 		start_transaction(ec);
-- 
1.7.10.4



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

* [52/65] drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (50 preceding siblings ...)
  2013-06-03 22:11 ` [51/65] ACPI / EC: Restart transaction even when the IBF flag set Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [53/65] ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex Steven Rostedt
                   ` (12 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Chen Gang, Corey Minyard

[-- Attachment #1: 0052-drivers-char-ipmi-memcpy-need-additional-2-bytes-to-.patch --]
[-- Type: text/plain, Size: 1580 bytes --]

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

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

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

[ Upstream commit a5f2b3d6a738e7d4180012fe7b541172f8c8dcea ]

When calling memcpy, read_data and write_data need additional 2 bytes.

  write_data:
    for checking:  "if (size > IPMI_MAX_MSG_LENGTH)"
    for operating: "memcpy(bt->write_data + 3, data + 1, size - 1)"

  read_data:
    for checking:  "if (msg_len < 3 || msg_len > IPMI_MAX_MSG_LENGTH)"
    for operating: "memcpy(data + 2, bt->read_data + 4, msg_len - 2)"

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/char/ipmi/ipmi_bt_sm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
index cdd4c09f..a22a7a5 100644
--- a/drivers/char/ipmi/ipmi_bt_sm.c
+++ b/drivers/char/ipmi/ipmi_bt_sm.c
@@ -95,9 +95,9 @@ struct si_sm_data {
 	enum bt_states	state;
 	unsigned char	seq;		/* BT sequence number */
 	struct si_sm_io	*io;
-	unsigned char	write_data[IPMI_MAX_MSG_LENGTH];
+	unsigned char	write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
 	int		write_count;
-	unsigned char	read_data[IPMI_MAX_MSG_LENGTH];
+	unsigned char	read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */
 	int		read_count;
 	int		truncated;
 	long		timeout;	/* microseconds countdown */
-- 
1.7.10.4



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

* [53/65] ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (51 preceding siblings ...)
  2013-06-03 22:11 ` [52/65] drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [54/65] drm/radeon: check incoming cliprects pointer Steven Rostedt
                   ` (11 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Benjamin LaHaise, Corey Minyard

[-- Attachment #1: 0053-ipmi-ipmi_devintf-compat_ioctl-method-fails-to-take-.patch --]
[-- Type: text/plain, Size: 1723 bytes --]

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

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

From: Benjamin LaHaise <bcrl@kvack.org>

[ Upstream commit 6368087e851e697679af059b4247aca33a69cef3 ]

When a 32 bit version of ipmitool is used on a 64 bit kernel, the
ipmi_devintf code fails to correctly acquire ipmi_mutex.  This results in
incomplete data being retrieved in some cases, or other possible failures.
Add a wrapper around compat_ipmi_ioctl() to take ipmi_mutex to fix this.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/char/ipmi/ipmi_devintf.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 9eb360f..d5a5f02 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
 		return ipmi_ioctl(filep, cmd, arg);
 	}
 }
+
+static long unlocked_compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
+				       unsigned long arg)
+{
+	int ret;
+
+	mutex_lock(&ipmi_mutex);
+	ret = compat_ipmi_ioctl(filep, cmd, arg);
+	mutex_unlock(&ipmi_mutex);
+
+	return ret;
+}
 #endif
 
 static const struct file_operations ipmi_fops = {
 	.owner		= THIS_MODULE,
 	.unlocked_ioctl	= ipmi_unlocked_ioctl,
 #ifdef CONFIG_COMPAT
-	.compat_ioctl   = compat_ipmi_ioctl,
+	.compat_ioctl   = unlocked_compat_ipmi_ioctl,
 #endif
 	.open		= ipmi_open,
 	.release	= ipmi_release,
-- 
1.7.10.4



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

* [54/65] drm/radeon: check incoming cliprects pointer
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (52 preceding siblings ...)
  2013-06-03 22:11 ` [53/65] ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [55/65] usermodehelper: check subprocess_info->path != NULL Steven Rostedt
                   ` (10 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Kees Cook, Dave Airlie

[-- Attachment #1: 0054-drm-radeon-check-incoming-cliprects-pointer.patch --]
[-- Type: text/plain, Size: 1176 bytes --]

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

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

From: Kees Cook <keescook@chromium.org>

[ Upstream commit fefaedcfb82d2e57c2320acf60604ab03b750cc0 ]

The "boxes" parameter points into userspace memory. It should be verified
like any other operation against user memory.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/gpu/drm/radeon/r300_cmdbuf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c
index 1fe98b4..9aa02be 100644
--- a/drivers/gpu/drm/radeon/r300_cmdbuf.c
+++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c
@@ -74,7 +74,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
 		OUT_RING(CP_PACKET0(R300_RE_CLIPRECT_TL_0, nr * 2 - 1));
 
 		for (i = 0; i < nr; ++i) {
-			if (DRM_COPY_FROM_USER_UNCHECKED
+			if (DRM_COPY_FROM_USER
 			    (&box, &cmdbuf->boxes[n + i], sizeof(box))) {
 				DRM_ERROR("copy cliprect faulted\n");
 				return -EFAULT;
-- 
1.7.10.4



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

* [55/65] usermodehelper: check subprocess_info->path != NULL
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (53 preceding siblings ...)
  2013-06-03 22:11 ` [54/65] drm/radeon: check incoming cliprects pointer Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [56/65] parisc: only re-enable interrupts if we need to schedule or deliver signals when returning to userspace Steven Rostedt
                   ` (9 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Oleg Nesterov, Lucas De Marchi

[-- Attachment #1: 0055-usermodehelper-check-subprocess_info-path-NULL.patch --]
[-- Type: text/plain, Size: 1256 bytes --]

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

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

From: Oleg Nesterov <oleg@redhat.com>

[ Upstream commit 264b83c07a84223f0efd0d1db9ccc66d6f88288f ]

argv_split(empty_or_all_spaces) happily succeeds, it simply returns
argc == 0 and argv[0] == NULL. Change call_usermodehelper_exec() to
check sub_info->path != NULL to avoid the crash.

This is the minimal fix, todo:

 - perhaps we should change argv_split() to return NULL or change the
   callers.

 - kill or justify ->path[0] check

 - narrow the scope of helper_lock()

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-By: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/kmod.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/kmod.c b/kernel/kmod.c
index 6f99aea..122a299 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -558,6 +558,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
 	int retval = 0;
 
 	helper_lock();
+	if (!sub_info->path) {
+		retval = -EINVAL;
+		goto out;
+	}
+
 	if (sub_info->path[0] == '\0')
 		goto out;
 
-- 
1.7.10.4



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

* [56/65] parisc: only re-enable interrupts if we need to schedule or deliver signals when returning to userspace
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (54 preceding siblings ...)
  2013-06-03 22:11 ` [55/65] usermodehelper: check subprocess_info->path != NULL Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [57/65] parisc: fix SMP races when updating PTE and TLB entries in entry.S Steven Rostedt
                   ` (8 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: John David Anglin, Helge Deller

[-- Attachment #1: 0056-parisc-only-re-enable-interrupts-if-we-need-to-sched.patch --]
[-- Type: text/plain, Size: 2409 bytes --]

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

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

From: John David Anglin <dave.anglin@bell.net>

[ Upstream commit c207a76bf155cb5cf24cf849c08f6555e9180594 ]

Helge and I have found that we have a kernel stack overflow problem
which causes a variety of random failures.
Currently, we re-enable interrupts when returning from an external
interrupt incase we need to schedule or delivery
signals.  As a result, a potentially unlimited number of interrupts
can occur while we are running on the kernel
stack.  It is very limited in space (currently, 16k).  This change
defers enabling interrupts until we have
actually decided to schedule or delivery signals.  This only occurs
when we about to return to userspace.  This
limits the number of interrupts on the kernel stack to one.  In other
cases, interrupts remain disabled until the
final return from interrupt (rfi).

Signed-off-by: John David Anglin  <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/parisc/kernel/entry.S |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 18670a0..38a4998 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -909,11 +909,6 @@ ENTRY(syscall_exit_rfi)
 	STREG   %r19,PT_SR7(%r16)
 
 intr_return:
-	/* NOTE: Need to enable interrupts incase we schedule. */
-	ssm     PSW_SM_I, %r0
-
-intr_check_resched:
-
 	/* check for reschedule */
 	mfctl   %cr30,%r1
 	LDREG   TI_FLAGS(%r1),%r19	/* sched.h: TIF_NEED_RESCHED */
@@ -940,6 +935,11 @@ intr_check_sig:
 	LDREG	PT_IASQ1(%r16), %r20
 	cmpib,COND(=),n 0,%r20,intr_restore /* backward */
 
+	/* NOTE: We need to enable interrupts if we have to deliver
+	 * signals. We used to do this earlier but it caused kernel
+	 * stack overflows. */
+	ssm     PSW_SM_I, %r0
+
 	copy	%r0, %r25			/* long in_syscall = 0 */
 #ifdef CONFIG_64BIT
 	ldo	-16(%r30),%r29			/* Reference param save area */
@@ -991,6 +991,10 @@ intr_do_resched:
 	cmpib,COND(=)	0, %r20, intr_do_preempt
 	nop
 
+	/* NOTE: We need to enable interrupts if we schedule.  We used
+	 * to do this earlier but it caused kernel stack overflows. */
+	ssm     PSW_SM_I, %r0
+
 #ifdef CONFIG_64BIT
 	ldo	-16(%r30),%r29		/* Reference param save area */
 #endif
-- 
1.7.10.4



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

* [57/65] parisc: fix SMP races when updating PTE and TLB entries in entry.S
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (55 preceding siblings ...)
  2013-06-03 22:11 ` [56/65] parisc: only re-enable interrupts if we need to schedule or deliver signals when returning to userspace Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [58/65] parisc: fix NATIVE set up in build Steven Rostedt
                   ` (7 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: John David Anglin, Helge Deller

[-- Attachment #1: 0057-parisc-fix-SMP-races-when-updating-PTE-and-TLB-entri.patch --]
[-- Type: text/plain, Size: 8075 bytes --]

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

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

From: John David Anglin <dave.anglin@bell.net>

[ Upstream commit f0a18819e261afc5fdbd8c5c6f9943123c5461ba ]

Currently, race conditions exist in the handling of TLB interruptions in
entry.S.  In particular, dirty bit updates can be lost if an accessed
interruption occurs just after the dirty bit interruption on a different
cpu.  Lost dirty bit updates result in user pages not being flushed and
general system instability.  This change adds lock and unlock macros to
synchronize all PTE and TLB updates done in entry.S.  As a result,
userspace stability is significantly improved.

Signed-off-by: John David Anglin  <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/parisc/kernel/entry.S |  155 ++++++++++++++++++++++++--------------------
 1 file changed, 83 insertions(+), 72 deletions(-)

diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 38a4998..1818c65 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -444,9 +444,41 @@
 	L2_ptep		\pgd,\pte,\index,\va,\fault
 	.endm
 
+	/* Acquire pa_dbit_lock lock. */
+	.macro		dbit_lock	spc,tmp,tmp1
+#ifdef CONFIG_SMP
+	cmpib,COND(=),n	0,\spc,2f
+	load32		PA(pa_dbit_lock),\tmp
+1:	LDCW		0(\tmp),\tmp1
+	cmpib,COND(=)	0,\tmp1,1b
+	nop
+2:
+#endif
+	.endm
+
+	/* Release pa_dbit_lock lock without reloading lock address. */
+	.macro		dbit_unlock0	spc,tmp
+#ifdef CONFIG_SMP
+	or,COND(=)	%r0,\spc,%r0
+	stw             \spc,0(\tmp)
+#endif
+	.endm
+
+	/* Release pa_dbit_lock lock. */
+	.macro		dbit_unlock1	spc,tmp
+#ifdef CONFIG_SMP
+	load32		PA(pa_dbit_lock),\tmp
+	dbit_unlock0	\spc,\tmp
+#endif
+	.endm
+
 	/* Set the _PAGE_ACCESSED bit of the PTE.  Be clever and
 	 * don't needlessly dirty the cache line if it was already set */
-	.macro		update_ptep	ptep,pte,tmp,tmp1
+	.macro		update_ptep	spc,ptep,pte,tmp,tmp1
+#ifdef CONFIG_SMP
+	or,COND(=)	%r0,\spc,%r0
+	LDREG		0(\ptep),\pte
+#endif
 	ldi		_PAGE_ACCESSED,\tmp1
 	or		\tmp1,\pte,\tmp
 	and,COND(<>)	\tmp1,\pte,%r0
@@ -455,7 +487,11 @@
 
 	/* Set the dirty bit (and accessed bit).  No need to be
 	 * clever, this is only used from the dirty fault */
-	.macro		update_dirty	ptep,pte,tmp
+	.macro		update_dirty	spc,ptep,pte,tmp
+#ifdef CONFIG_SMP
+	or,COND(=)	%r0,\spc,%r0
+	LDREG		0(\ptep),\pte
+#endif
 	ldi		_PAGE_ACCESSED|_PAGE_DIRTY,\tmp
 	or		\tmp,\pte,\pte
 	STREG		\pte,0(\ptep)
@@ -1187,11 +1223,13 @@ dtlb_miss_20w:
 
 	L3_ptep		ptp,pte,t0,va,dtlb_check_alias_20w
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 	
 	idtlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1211,11 +1249,13 @@ nadtlb_miss_20w:
 
 	L3_ptep		ptp,pte,t0,va,nadtlb_check_alias_20w
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	idtlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1237,7 +1277,8 @@ dtlb_miss_11:
 
 	L2_ptep		ptp,pte,t0,va,dtlb_check_alias_11
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb_11	spc,pte,prot
 
@@ -1248,6 +1289,7 @@ dtlb_miss_11:
 	idtlbp		prot,(%sr1,va)
 
 	mtsp		t0, %sr1	/* Restore sr1 */
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1268,7 +1310,8 @@ nadtlb_miss_11:
 
 	L2_ptep		ptp,pte,t0,va,nadtlb_check_alias_11
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb_11	spc,pte,prot
 
@@ -1280,6 +1323,7 @@ nadtlb_miss_11:
 	idtlbp		prot,(%sr1,va)
 
 	mtsp		t0, %sr1	/* Restore sr1 */
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1300,13 +1344,15 @@ dtlb_miss_20:
 
 	L2_ptep		ptp,pte,t0,va,dtlb_check_alias_20
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	f_extend	pte,t0
 
 	idtlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1326,13 +1372,15 @@ nadtlb_miss_20:
 
 	L2_ptep		ptp,pte,t0,va,nadtlb_check_alias_20
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	f_extend	pte,t0
 	
         idtlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1433,11 +1481,13 @@ itlb_miss_20w:
 
 	L3_ptep		ptp,pte,t0,va,itlb_fault
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 	
 	iitlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1455,11 +1505,13 @@ naitlb_miss_20w:
 
 	L3_ptep		ptp,pte,t0,va,naitlb_check_alias_20w
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	iitlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1481,7 +1533,8 @@ itlb_miss_11:
 
 	L2_ptep		ptp,pte,t0,va,itlb_fault
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb_11	spc,pte,prot
 
@@ -1492,6 +1545,7 @@ itlb_miss_11:
 	iitlbp		prot,(%sr1,va)
 
 	mtsp		t0, %sr1	/* Restore sr1 */
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1503,7 +1557,8 @@ naitlb_miss_11:
 
 	L2_ptep		ptp,pte,t0,va,naitlb_check_alias_11
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb_11	spc,pte,prot
 
@@ -1514,6 +1569,7 @@ naitlb_miss_11:
 	iitlbp		prot,(%sr1,va)
 
 	mtsp		t0, %sr1	/* Restore sr1 */
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1535,13 +1591,15 @@ itlb_miss_20:
 
 	L2_ptep		ptp,pte,t0,va,itlb_fault
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	f_extend	pte,t0	
 
 	iitlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1553,13 +1611,15 @@ naitlb_miss_20:
 
 	L2_ptep		ptp,pte,t0,va,naitlb_check_alias_20
 
-	update_ptep	ptp,pte,t0,t1
+	dbit_lock	spc,t0,t1
+	update_ptep	spc,ptp,pte,t0,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	f_extend	pte,t0
 
 	iitlbt          pte,prot
+	dbit_unlock1	spc,t0
 
 	rfir
 	nop
@@ -1583,29 +1643,13 @@ dbit_trap_20w:
 
 	L3_ptep		ptp,pte,t0,va,dbit_fault
 
-#ifdef CONFIG_SMP
-	cmpib,COND(=),n        0,spc,dbit_nolock_20w
-	load32		PA(pa_dbit_lock),t0
-
-dbit_spin_20w:
-	LDCW		0(t0),t1
-	cmpib,COND(=)         0,t1,dbit_spin_20w
-	nop
-
-dbit_nolock_20w:
-#endif
-	update_dirty	ptp,pte,t1
+	dbit_lock	spc,t0,t1
+	update_dirty	spc,ptp,pte,t1
 
 	make_insert_tlb	spc,pte,prot
 		
 	idtlbt          pte,prot
-#ifdef CONFIG_SMP
-	cmpib,COND(=),n        0,spc,dbit_nounlock_20w
-	ldi             1,t1
-	stw             t1,0(t0)
-
-dbit_nounlock_20w:
-#endif
+	dbit_unlock0	spc,t0
 
 	rfir
 	nop
@@ -1619,18 +1663,8 @@ dbit_trap_11:
 
 	L2_ptep		ptp,pte,t0,va,dbit_fault
 
-#ifdef CONFIG_SMP
-	cmpib,COND(=),n        0,spc,dbit_nolock_11
-	load32		PA(pa_dbit_lock),t0
-
-dbit_spin_11:
-	LDCW		0(t0),t1
-	cmpib,=         0,t1,dbit_spin_11
-	nop
-
-dbit_nolock_11:
-#endif
-	update_dirty	ptp,pte,t1
+	dbit_lock	spc,t0,t1
+	update_dirty	spc,ptp,pte,t1
 
 	make_insert_tlb_11	spc,pte,prot
 
@@ -1641,13 +1675,7 @@ dbit_nolock_11:
 	idtlbp		prot,(%sr1,va)
 
 	mtsp            t1, %sr1     /* Restore sr1 */
-#ifdef CONFIG_SMP
-	cmpib,COND(=),n        0,spc,dbit_nounlock_11
-	ldi             1,t1
-	stw             t1,0(t0)
-
-dbit_nounlock_11:
-#endif
+	dbit_unlock0	spc,t0
 
 	rfir
 	nop
@@ -1659,32 +1687,15 @@ dbit_trap_20:
 
 	L2_ptep		ptp,pte,t0,va,dbit_fault
 
-#ifdef CONFIG_SMP
-	cmpib,COND(=),n        0,spc,dbit_nolock_20
-	load32		PA(pa_dbit_lock),t0
-
-dbit_spin_20:
-	LDCW		0(t0),t1
-	cmpib,=         0,t1,dbit_spin_20
-	nop
-
-dbit_nolock_20:
-#endif
-	update_dirty	ptp,pte,t1
+	dbit_lock	spc,t0,t1
+	update_dirty	spc,ptp,pte,t1
 
 	make_insert_tlb	spc,pte,prot
 
 	f_extend	pte,t1
 	
         idtlbt          pte,prot
-
-#ifdef CONFIG_SMP
-	cmpib,COND(=),n        0,spc,dbit_nounlock_20
-	ldi             1,t1
-	stw             t1,0(t0)
-
-dbit_nounlock_20:
-#endif
+	dbit_unlock0	spc,t0
 
 	rfir
 	nop
-- 
1.7.10.4



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

* [58/65] parisc: fix NATIVE set up in build
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (56 preceding siblings ...)
  2013-06-03 22:11 ` [57/65] parisc: fix SMP races when updating PTE and TLB entries in entry.S Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [59/65] parisc: make default cross compiler search more robust (v3) Steven Rostedt
                   ` (6 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mike Frysinger, Helge Deller

[-- Attachment #1: 0058-parisc-fix-NATIVE-set-up-in-build.patch --]
[-- Type: text/plain, Size: 1100 bytes --]

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

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

From: Mike Frysinger <vapier@gentoo.org>

[ Upstream commit 93782eba49e23c3f311a6b05a19ba15927ec4e8b ]

The ifeq operator does not accept globs, so this little bit of code will
never match (unless uname literally prints out "parsic*").  Rewrite to
use a pattern matching operator so that NATIVE is set to 1 on parisc.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/parisc/Makefile |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 5707f1a..47cec3c 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -24,9 +24,7 @@ CHECKFLAGS	+= -D__hppa__=1
 LIBGCC		= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
 MACHINE		:= $(shell uname -m)
-ifeq ($(MACHINE),parisc*)
-NATIVE		:= 1
-endif
+NATIVE		:= $(if $(filter parisc%,$(MACHINE)),1,0)
 
 ifdef CONFIG_64BIT
 UTS_MACHINE	:= parisc64
-- 
1.7.10.4



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

* [59/65] parisc: make default cross compiler search more robust (v3)
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (57 preceding siblings ...)
  2013-06-03 22:11 ` [58/65] parisc: fix NATIVE set up in build Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [60/65] btrfs: dont stop searching after encountering the wrong item Steven Rostedt
                   ` (5 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Mike Frysinger, Jeroen Roovers, John David Anglin, Helge Deller

[-- Attachment #1: 0059-parisc-make-default-cross-compiler-search-more-robus.patch --]
[-- Type: text/plain, Size: 2299 bytes --]

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

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

From: Helge Deller <deller@gmx.de>

[ Upstream commit 6880b0150a7c25fd75c5ece80abc49ebf53c38c1 ]

People/distros vary how they prefix the toolchain name for 64bit builds.
Rather than enforce one convention over another, add a for loop which
does a search for all the general prefixes.

For 64bit builds, we now search for (in order):
	hppa64-unknown-linux-gnu
	hppa64-linux-gnu
	hppa64-linux

For 32bit builds, we look for:
	hppa-unknown-linux-gnu
	hppa-linux-gnu
	hppa-linux
	hppa2.0-unknown-linux-gnu
	hppa2.0-linux-gnu
	hppa2.0-linux
	hppa1.1-unknown-linux-gnu
	hppa1.1-linux-gnu
	hppa1.1-linux

This patch was initiated by Mike Frysinger, with feedback from Jeroen
Roovers, John David Anglin and Helge Deller.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 arch/parisc/Makefile |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 47cec3c..130fdd7 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -23,25 +23,21 @@ NM		= sh $(srctree)/arch/parisc/nm
 CHECKFLAGS	+= -D__hppa__=1
 LIBGCC		= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-MACHINE		:= $(shell uname -m)
-NATIVE		:= $(if $(filter parisc%,$(MACHINE)),1,0)
-
 ifdef CONFIG_64BIT
 UTS_MACHINE	:= parisc64
 CHECKFLAGS	+= -D__LP64__=1 -m64
-WIDTH		:= 64
-
-# FIXME: if no default set, should really try to locate dynamically
-ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE	:= hppa64-linux-gnu-
-endif
+CC_ARCHES	= hppa64
 else # 32-bit
-WIDTH		:=
+CC_ARCHES	= hppa hppa2.0 hppa1.1
 endif
 
-# attempt to help out folks who are cross-compiling
-ifeq ($(NATIVE),1)
-CROSS_COMPILE	:= hppa$(WIDTH)-linux-
+ifneq ($(SUBARCH),$(UTS_MACHINE))
+	ifeq ($(CROSS_COMPILE),)
+		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
+		CROSS_COMPILE := $(call cc-cross-prefix, \
+			$(foreach a,$(CC_ARCHES), \
+			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
+	endif
 endif
 
 OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
-- 
1.7.10.4



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

* [60/65] btrfs: dont stop searching after encountering the wrong item
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (58 preceding siblings ...)
  2013-06-03 22:11 ` [59/65] parisc: make default cross compiler search more robust (v3) Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [61/65] hwmon: fix error return code in abituguru_probe() Steven Rostedt
                   ` (4 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Gabriel de Perthuis, Josef Bacik

[-- Attachment #1: 0060-btrfs-don-t-stop-searching-after-encountering-the-wr.patch --]
[-- Type: text/plain, Size: 1585 bytes --]

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

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

From: Gabriel de Perthuis <g2p.code@gmail.com>

[ Upstream commit 03b71c6ca6286625d8f1ed44aabab9b5bf5dac10 ]

The search ioctl skips items that are too large for a result buffer, but
inline items of a certain size occuring before any search result is
found would trigger an overflow and stop the search entirely.

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

Cc: stable@vger.kernel.org
Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 fs/btrfs/ioctl.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 9df50fa..8613626 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1707,7 +1707,11 @@ static noinline int copy_to_sk(struct btrfs_root *root,
 		item_off = btrfs_item_ptr_offset(leaf, i);
 		item_len = btrfs_item_size_nr(leaf, i);
 
-		if (item_len > BTRFS_SEARCH_ARGS_BUFSIZE)
+		btrfs_item_key_to_cpu(leaf, key, i);
+		if (!key_in_sk(key, sk))
+			continue;
+
+		if (sizeof(sh) + item_len > BTRFS_SEARCH_ARGS_BUFSIZE)
 			item_len = 0;
 
 		if (sizeof(sh) + item_len + *sk_offset >
@@ -1716,10 +1720,6 @@ static noinline int copy_to_sk(struct btrfs_root *root,
 			goto overflow;
 		}
 
-		btrfs_item_key_to_cpu(leaf, key, i);
-		if (!key_in_sk(key, sk))
-			continue;
-
 		sh.objectid = key->objectid;
 		sh.offset = key->offset;
 		sh.type = key->type;
-- 
1.7.10.4



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

* [61/65] hwmon: fix error return code in abituguru_probe()
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (59 preceding siblings ...)
  2013-06-03 22:11 ` [60/65] btrfs: dont stop searching after encountering the wrong item Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [62/65] i2c: designware: fix RX FIFO overrun Steven Rostedt
                   ` (3 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Wei Yongjun, Guenter Roeck

[-- Attachment #1: 0061-hwmon-fix-error-return-code-in-abituguru_probe.patch --]
[-- Type: text/plain, Size: 1648 bytes --]

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

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

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

[ Upstream commit ecacb0b17c08fae89f65468727f0e4b8e91da4e1 ]

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/hwmon/abituguru.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index d4419b4..b13409c 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -1410,14 +1410,18 @@ static int __devinit abituguru_probe(struct platform_device *pdev)
 	pr_info("found Abit uGuru\n");
 
 	/* Register sysfs hooks */
-	for (i = 0; i < sysfs_attr_i; i++)
-		if (device_create_file(&pdev->dev,
-				&data->sysfs_attr[i].dev_attr))
+	for (i = 0; i < sysfs_attr_i; i++) {
+		res = device_create_file(&pdev->dev,
+					 &data->sysfs_attr[i].dev_attr);
+		if (res)
 			goto abituguru_probe_error;
-	for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
-		if (device_create_file(&pdev->dev,
-				&abituguru_sysfs_attr[i].dev_attr))
+	}
+	for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) {
+		res = device_create_file(&pdev->dev,
+					 &abituguru_sysfs_attr[i].dev_attr);
+		if (res)
 			goto abituguru_probe_error;
+	}
 
 	data->hwmon_dev = hwmon_device_register(&pdev->dev);
 	if (!IS_ERR(data->hwmon_dev))
-- 
1.7.10.4



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

* [62/65] i2c: designware: fix RX FIFO overrun
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (60 preceding siblings ...)
  2013-06-03 22:11 ` [61/65] hwmon: fix error return code in abituguru_probe() Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [63/65] i2c: designware: always clear interrupts before enabling them Steven Rostedt
                   ` (2 subsequent siblings)
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Josef Ahmad, Mika Westerberg, Wolfram Sang, stable

[-- Attachment #1: 0062-i2c-designware-fix-RX-FIFO-overrun.patch --]
[-- Type: text/plain, Size: 3162 bytes --]

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

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

From: Josef Ahmad <josef.ahmad@linux.intel.com>

[ Upstream commit e6f34cea56f5b95498070eaa9f4aa3ba4a9e4f62 ]

i2c_dw_xfer_msg() pushes a number of bytes to transmit/receive
to/from the bus into the TX FIFO.
For master-rx transactions, the maximum amount of data that can be
received is calculated depending solely on TX and RX FIFO load.

This is racy - TX FIFO may contain master-rx data yet to be
processed, which will eventually land into the RX FIFO. This
data is not taken into account and the function may request more
data than the controller is actually capable of storing.

This patch ensures the driver takes into account the outstanding
master-rx data in TX FIFO to prevent RX FIFO overrun.

Signed-off-by: Josef Ahmad <josef.ahmad@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/i2c/busses/i2c-designware-core.c |   11 ++++++++++-
 drivers/i2c/busses/i2c-designware-core.h |    2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 7b8ebbe..37b1221 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -413,8 +413,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev)
 
 		while (buf_len > 0 && tx_limit > 0 && rx_limit > 0) {
 			if (msgs[dev->msg_write_idx].flags & I2C_M_RD) {
+
+				/* avoid rx buffer overrun */
+				if (rx_limit - dev->rx_outstanding <= 0)
+					break;
+
 				dw_writel(dev, 0x100, DW_IC_DATA_CMD);
 				rx_limit--;
+				dev->rx_outstanding++;
 			} else
 				dw_writel(dev, *buf++, DW_IC_DATA_CMD);
 			tx_limit--; buf_len--;
@@ -467,8 +473,10 @@ i2c_dw_read(struct dw_i2c_dev *dev)
 
 		rx_valid = dw_readl(dev, DW_IC_RXFLR);
 
-		for (; len > 0 && rx_valid > 0; len--, rx_valid--)
+		for (; len > 0 && rx_valid > 0; len--, rx_valid--) {
 			*buf++ = dw_readl(dev, DW_IC_DATA_CMD);
+			dev->rx_outstanding--;
+		}
 
 		if (len > 0) {
 			dev->status |= STATUS_READ_IN_PROGRESS;
@@ -526,6 +534,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	dev->msg_err = 0;
 	dev->status = STATUS_IDLE;
 	dev->abort_source = 0;
+	dev->rx_outstanding = 0;
 
 	ret = i2c_dw_wait_bus_not_busy(dev);
 	if (ret < 0)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 9c1840e..e761ad1 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -60,6 +60,7 @@
  * @adapter: i2c subsystem adapter node
  * @tx_fifo_depth: depth of the hardware tx fifo
  * @rx_fifo_depth: depth of the hardware rx fifo
+ * @rx_outstanding: current master-rx elements in tx fifo
  */
 struct dw_i2c_dev {
 	struct device		*dev;
@@ -88,6 +89,7 @@ struct dw_i2c_dev {
 	u32			master_cfg;
 	unsigned int		tx_fifo_depth;
 	unsigned int		rx_fifo_depth;
+	int			rx_outstanding;
 };
 
 #define ACCESS_SWAP		0x00000001
-- 
1.7.10.4



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

* [63/65] i2c: designware: always clear interrupts before enabling them
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (61 preceding siblings ...)
  2013-06-03 22:11 ` [62/65] i2c: designware: fix RX FIFO overrun Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [64/65] drm/radeon: Fix VRAM size calculation for VRAM >= 4GB Steven Rostedt
  2013-06-03 22:11 ` [65/65] virtio_console: fix uapi header Steven Rostedt
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mika Westerberg, Wolfram Sang, stable

[-- Attachment #1: 0063-i2c-designware-always-clear-interrupts-before-enabli.patch --]
[-- Type: text/plain, Size: 1493 bytes --]

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

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

From: Mika Westerberg <mika.westerberg@linux.intel.com>

[ Upstream commit 2a2d95e9d6d29e726cc294b65391917ed2e32bf4 ]

If the I2C bus is put to a low power state by an ACPI method it might pull
the SDA line low (as its power is removed). Once the bus is put to full
power state again, the SDA line is pulled back to high. This transition
looks like a STOP condition from the controller point-of-view which sets
STOP detected bit in its status register causing the driver to fail
subsequent transfers.

Fix this by always clearing all interrupts before we start a transfer.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/i2c/busses/i2c-designware-core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 37b1221..534fc13 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -360,7 +360,8 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
 	/* Enable the adapter */
 	dw_writel(dev, 1, DW_IC_ENABLE);
 
-	/* Enable interrupts */
+	/* Clear and enable interrupts */
+	i2c_dw_clear_int(dev);
 	dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK);
 }
 
-- 
1.7.10.4



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

* [64/65] drm/radeon: Fix VRAM size calculation for VRAM >= 4GB
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (62 preceding siblings ...)
  2013-06-03 22:11 ` [63/65] i2c: designware: always clear interrupts before enabling them Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  2013-06-03 22:11 ` [65/65] virtio_console: fix uapi header Steven Rostedt
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Niels Ole Salscheider, Alex Deucher

[-- Attachment #1: 0064-drm-radeon-Fix-VRAM-size-calculation-for-VRAM-4GB.patch --]
[-- Type: text/plain, Size: 2764 bytes --]

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

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

From: Niels Ole Salscheider <niels_ole@salscheider-online.de>

[ Upstream commit fc986034540102cd090237bf3f70262e1ae80d9c ]

Add ULL prefix to avoid overflow.

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/gpu/drm/radeon/evergreen.c  |    4 ++--
 drivers/gpu/drm/radeon/radeon_ttm.c |    2 +-
 drivers/gpu/drm/radeon/si.c         |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 5c23991..5cec317 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2272,8 +2272,8 @@ int evergreen_mc_init(struct radeon_device *rdev)
 		rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
 	} else {
 		/* size in MB on evergreen/cayman/tn */
-		rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
-		rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
+		rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
+		rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
 	}
 	rdev->mc.visible_vram_size = rdev->mc.aper_size;
 	r700_vram_gtt_location(rdev, &rdev->mc);
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 5b71c71..7ba7d4b 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -725,7 +725,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
 		return r;
 	}
 	DRM_INFO("radeon: %uM of VRAM memory ready\n",
-		 (unsigned)rdev->mc.real_vram_size / (1024 * 1024));
+		 (unsigned) (rdev->mc.real_vram_size / (1024 * 1024)));
 	r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT,
 				rdev->mc.gtt_size >> PAGE_SHIFT);
 	if (r) {
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index f2b256c..7d0026b 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2343,8 +2343,8 @@ static int si_mc_init(struct radeon_device *rdev)
 	rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0);
 	rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0);
 	/* size in MB on si */
-	rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
-	rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
+	rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
+	rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
 	rdev->mc.visible_vram_size = rdev->mc.aper_size;
 	si_vram_gtt_location(rdev, &rdev->mc);
 	radeon_update_bandwidth_info(rdev);
-- 
1.7.10.4



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

* [65/65] virtio_console: fix uapi header
  2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
                   ` (63 preceding siblings ...)
  2013-06-03 22:11 ` [64/65] drm/radeon: Fix VRAM size calculation for VRAM >= 4GB Steven Rostedt
@ 2013-06-03 22:11 ` Steven Rostedt
  64 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Michael S. Tsirkin, Rusty Russell, stable

[-- Attachment #1: 0065-virtio_console-fix-uapi-header.patch --]
[-- Type: text/plain, Size: 1075 bytes --]

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

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

From: "Michael S. Tsirkin" <mst@redhat.com>

[ Upstream commit 6407d75afd08545f2252bb39806ffd3f10c7faac ]

uapi should use __u32 not u32.
Fix a macro in virtio_console.h which uses u32.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/virtio_console.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index bdf4b00..82e12ad 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -39,7 +39,7 @@
 #define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
 #define VIRTIO_CONSOLE_F_MULTIPORT 1	/* Does host provide multiple ports? */
 
-#define VIRTIO_CONSOLE_BAD_ID		(~(u32)0)
+#define VIRTIO_CONSOLE_BAD_ID		(~(__u32)0)
 
 struct virtio_console_config {
 	/* colums of the screens */
-- 
1.7.10.4



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

* Re: [07/65] dm bufio: avoid a possible __vmalloc deadlock
  2013-06-03 22:10 ` [07/65] dm bufio: avoid a possible __vmalloc deadlock Steven Rostedt
@ 2013-06-04 12:59   ` Mikulas Patocka
  2013-06-04 14:42     ` Steven Rostedt
  2013-06-05 14:54     ` Steven Rostedt
  0 siblings, 2 replies; 71+ messages in thread
From: Mikulas Patocka @ 2013-06-04 12:59 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, stable, stable, Alasdair G Kergon



On Mon, 3 Jun 2013, Steven Rostedt wrote:

> 3.6.11.5 stable review patch.
> If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Mikulas Patocka <mpatocka@redhat.com>
> 
> [ Upstream commit 502624bdad3dba45dfaacaf36b7d83e39e74b2d2 ]
> 
> This patch uses memalloc_noio_save to avoid a possible deadlock in
> dm-bufio.  (it could happen only with large block size, at most
> PAGE_SIZE << MAX_ORDER (typically 8MiB).
> 
> __vmalloc doesn't fully respect gfp flags. The specified gfp flags are
> used for allocation of requested pages, structures vmap_area, vmap_block
> and vm_struct and the radix tree nodes.
> 
> However, the kernel pagetables are allocated always with GFP_KERNEL.
> Thus the allocation of pagetables can recurse back to the I/O layer and
> cause a deadlock.
> 
> This patch uses the function memalloc_noio_save to set per-process
> PF_MEMALLOC_NOIO flag and the function memalloc_noio_restore to restore
> it. When this flag is set, all allocations in the process are done with
> implied GFP_NOIO flag, thus the deadlock can't happen.
> 
> This should be backported to stable kernels, but they don't have the
> PF_MEMALLOC_NOIO flag and memalloc_noio_save/memalloc_noio_restore
> functions. So, PF_MEMALLOC should be set and restored instead.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Cc: stable@kernel.org
> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
> [ Set and clear PF_MEMALLOC manually - SR ]
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  drivers/md/dm-bufio.c |   26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> index c0fc827..a1f2487 100644
> --- a/drivers/md/dm-bufio.c
> +++ b/drivers/md/dm-bufio.c
> @@ -321,6 +321,9 @@ static void __cache_size_refresh(void)
>  static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
>  			       enum data_mode *data_mode)
>  {
> +	unsigned noio_flag;
> +	void *ptr;
> +
>  	if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) {
>  		*data_mode = DATA_MODE_SLAB;
>  		return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask);
> @@ -334,7 +337,28 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
>  	}
>  
>  	*data_mode = DATA_MODE_VMALLOC;
> -	return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
> +
> +	/*
> +	 * __vmalloc allocates the data pages and auxiliary structures with
> +	 * gfp_flags that were specified, but pagetables are always allocated
> +	 * with GFP_KERNEL, no matter what was specified as gfp_mask.
> +	 *
> +	 * Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that
> +	 * all allocations done by this process (including pagetables) are done
> +	 * as if GFP_NOIO was specified.
> +	 */
> +
> +	if (gfp_mask & __GFP_NORETRY) {
> +		noio_flag = current->flags;

There should be noio_flag = current->flags & PF_MEMALLOC; because we don't 
want to restore other flags.

> +		current->flags |= PF_MEMALLOC;
> +	}
> +
> +	ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
> +
> +	if (gfp_mask & __GFP_NORETRY)
> +		current->flags = (current->flags & ~PF_MEMALLOC) | noio_flag;
> +
> +	return ptr;
>  }
>  
>  /*
> -- 
> 1.7.10.4

Mikulas

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

* Re: [09/65] math64: New div64_u64_rem helper
  2013-06-03 22:10 ` [09/65] math64: New div64_u64_rem helper Steven Rostedt
@ 2013-06-04 13:45   ` Stanislaw Gruszka
  2013-06-04 14:43     ` Steven Rostedt
  0 siblings, 1 reply; 71+ messages in thread
From: Stanislaw Gruszka @ 2013-06-04 13:45 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, stable, Frederic Weisbecker, Peter Zijlstra,
	Ingo Molnar, Andrew Morton

On Mon, Jun 03, 2013 at 06:10:25PM -0400, Steven Rostedt wrote:
> 3.6.11.5 stable review patch.
> If anyone has any objections, please let me know.

If you will not pull other commits (I do not see them in the set):

d9a3c9823a2e6a543eb7807fb3d15d8233817ec5
55eaa7c1f511af5fb6ef808b5328804f4d4e5243
772c808a252594692972773f6ee41c289b8e0b2a
f3002134158092178be81339ec5a22ff80e6c308
68aa8efcd1ab961e4684ef5af32f72a6ec1911deA

this one is not necessary and actually hit performance a bit.

Stanislaw


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

* Re: [07/65] dm bufio: avoid a possible __vmalloc deadlock
  2013-06-04 12:59   ` Mikulas Patocka
@ 2013-06-04 14:42     ` Steven Rostedt
  2013-06-05 14:54     ` Steven Rostedt
  1 sibling, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-04 14:42 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel, stable, stable, Alasdair G Kergon

On Tue, 2013-06-04 at 08:59 -0400, Mikulas Patocka wrote:
> 
> On Mon, 3 Jun 2013, Steven Rostedt wrote:
> 
> > 3.6.11.5 stable review patch.
> > If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Mikulas Patocka <mpatocka@redhat.com>
> > 
> > [ Upstream commit 502624bdad3dba45dfaacaf36b7d83e39e74b2d2 ]
> > 
> > This patch uses memalloc_noio_save to avoid a possible deadlock in
> > dm-bufio.  (it could happen only with large block size, at most
> > PAGE_SIZE << MAX_ORDER (typically 8MiB).
> > 
> > __vmalloc doesn't fully respect gfp flags. The specified gfp flags are
> > used for allocation of requested pages, structures vmap_area, vmap_block
> > and vm_struct and the radix tree nodes.
> > 
> > However, the kernel pagetables are allocated always with GFP_KERNEL.
> > Thus the allocation of pagetables can recurse back to the I/O layer and
> > cause a deadlock.
> > 
> > This patch uses the function memalloc_noio_save to set per-process
> > PF_MEMALLOC_NOIO flag and the function memalloc_noio_restore to restore
> > it. When this flag is set, all allocations in the process are done with
> > implied GFP_NOIO flag, thus the deadlock can't happen.
> > 
> > This should be backported to stable kernels, but they don't have the
> > PF_MEMALLOC_NOIO flag and memalloc_noio_save/memalloc_noio_restore
> > functions. So, PF_MEMALLOC should be set and restored instead.
> > 
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > Cc: stable@kernel.org
> > Signed-off-by: Alasdair G Kergon <agk@redhat.com>
> > [ Set and clear PF_MEMALLOC manually - SR ]
> > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> > ---
> >  drivers/md/dm-bufio.c |   26 +++++++++++++++++++++++++-
> >  1 file changed, 25 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> > index c0fc827..a1f2487 100644
> > --- a/drivers/md/dm-bufio.c
> > +++ b/drivers/md/dm-bufio.c
> > @@ -321,6 +321,9 @@ static void __cache_size_refresh(void)
> >  static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
> >  			       enum data_mode *data_mode)
> >  {
> > +	unsigned noio_flag;
> > +	void *ptr;
> > +
> >  	if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) {
> >  		*data_mode = DATA_MODE_SLAB;
> >  		return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask);
> > @@ -334,7 +337,28 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
> >  	}
> >  
> >  	*data_mode = DATA_MODE_VMALLOC;
> > -	return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
> > +
> > +	/*
> > +	 * __vmalloc allocates the data pages and auxiliary structures with
> > +	 * gfp_flags that were specified, but pagetables are always allocated
> > +	 * with GFP_KERNEL, no matter what was specified as gfp_mask.
> > +	 *
> > +	 * Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that
> > +	 * all allocations done by this process (including pagetables) are done
> > +	 * as if GFP_NOIO was specified.
> > +	 */
> > +
> > +	if (gfp_mask & __GFP_NORETRY) {
> > +		noio_flag = current->flags;
> 
> There should be noio_flag = current->flags & PF_MEMALLOC; because we don't 
> want to restore other flags.

Thanks for the review. Will fix.

-- Steve

> 
> > +		current->flags |= PF_MEMALLOC;
> > +	}
> > +
> > +	ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
> > +
> > +	if (gfp_mask & __GFP_NORETRY)
> > +		current->flags = (current->flags & ~PF_MEMALLOC) | noio_flag;
> > +
> > +	return ptr;
> >  }
> >  
> >  /*
> > -- 
> > 1.7.10.4
> 
> Mikulas



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

* Re: [09/65] math64: New div64_u64_rem helper
  2013-06-04 13:45   ` Stanislaw Gruszka
@ 2013-06-04 14:43     ` Steven Rostedt
  0 siblings, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-04 14:43 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-kernel, stable, Frederic Weisbecker, Peter Zijlstra,
	Ingo Molnar, Andrew Morton

On Tue, 2013-06-04 at 15:45 +0200, Stanislaw Gruszka wrote:
> On Mon, Jun 03, 2013 at 06:10:25PM -0400, Steven Rostedt wrote:
> > 3.6.11.5 stable review patch.
> > If anyone has any objections, please let me know.
> 
> If you will not pull other commits (I do not see them in the set):
> 
> d9a3c9823a2e6a543eb7807fb3d15d8233817ec5
> 55eaa7c1f511af5fb6ef808b5328804f4d4e5243
> 772c808a252594692972773f6ee41c289b8e0b2a
> f3002134158092178be81339ec5a22ff80e6c308
> 68aa8efcd1ab961e4684ef5af32f72a6ec1911deA

Yeah, they didn't apply well at all.

> 
> this one is not necessary and actually hit performance a bit.

Thanks, I'll remove it.

-- Steve



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

* Re: [07/65] dm bufio: avoid a possible __vmalloc deadlock
  2013-06-04 12:59   ` Mikulas Patocka
  2013-06-04 14:42     ` Steven Rostedt
@ 2013-06-05 14:54     ` Steven Rostedt
  1 sibling, 0 replies; 71+ messages in thread
From: Steven Rostedt @ 2013-06-05 14:54 UTC (permalink / raw)
  To: Mikulas Patocka; +Cc: linux-kernel, stable, stable, Alasdair G Kergon

On Tue, 2013-06-04 at 08:59 -0400, Mikulas Patocka wrote:
> > +	 */
> > +
> > +	if (gfp_mask & __GFP_NORETRY) {
> > +		noio_flag = current->flags;
> 
> There should be noio_flag = current->flags & PF_MEMALLOC; because we don't 
> want to restore other flags.
> 

Here's the updated version:

Thanks,

-- Steve


>From e265a702cb479f58f451ec4458a26dd2bebeedab Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <mpatocka@redhat.com>
Date: Fri, 10 May 2013 14:37:15 +0100
Subject: [PATCH] dm bufio: avoid a possible __vmalloc deadlock

[ Upstream commit 502624bdad3dba45dfaacaf36b7d83e39e74b2d2 ]

This patch uses memalloc_noio_save to avoid a possible deadlock in
dm-bufio.  (it could happen only with large block size, at most
PAGE_SIZE << MAX_ORDER (typically 8MiB).

__vmalloc doesn't fully respect gfp flags. The specified gfp flags are
used for allocation of requested pages, structures vmap_area, vmap_block
and vm_struct and the radix tree nodes.

However, the kernel pagetables are allocated always with GFP_KERNEL.
Thus the allocation of pagetables can recurse back to the I/O layer and
cause a deadlock.

This patch uses the function memalloc_noio_save to set per-process
PF_MEMALLOC_NOIO flag and the function memalloc_noio_restore to restore
it. When this flag is set, all allocations in the process are done with
implied GFP_NOIO flag, thus the deadlock can't happen.

This should be backported to stable kernels, but they don't have the
PF_MEMALLOC_NOIO flag and memalloc_noio_save/memalloc_noio_restore
functions. So, PF_MEMALLOC should be set and restored instead.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
[ Set and clear PF_MEMALLOC manually - SR ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/md/dm-bufio.c |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index c0fc827..e9097af 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -321,6 +321,9 @@ static void __cache_size_refresh(void)
 static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 			       enum data_mode *data_mode)
 {
+	unsigned noio_flag;
+	void *ptr;
+
 	if (c->block_size <= DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT) {
 		*data_mode = DATA_MODE_SLAB;
 		return kmem_cache_alloc(DM_BUFIO_CACHE(c), gfp_mask);
@@ -334,7 +337,28 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask,
 	}
 
 	*data_mode = DATA_MODE_VMALLOC;
-	return __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
+
+	/*
+	 * __vmalloc allocates the data pages and auxiliary structures with
+	 * gfp_flags that were specified, but pagetables are always allocated
+	 * with GFP_KERNEL, no matter what was specified as gfp_mask.
+	 *
+	 * Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that
+	 * all allocations done by this process (including pagetables) are done
+	 * as if GFP_NOIO was specified.
+	 */
+
+	if (gfp_mask & __GFP_NORETRY) {
+		noio_flag = current->flags & PF_MEMALLOC;
+		current->flags |= PF_MEMALLOC;
+	}
+
+	ptr = __vmalloc(c->block_size, gfp_mask, PAGE_KERNEL);
+
+	if (gfp_mask & __GFP_NORETRY)
+		current->flags = (current->flags & ~PF_MEMALLOC) | noio_flag;
+
+	return ptr;
 }
 
 /*
-- 
1.7.10.4




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

end of thread, other threads:[~2013-06-05 14:54 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 22:10 [00/65] 3.6.11.5-stable review Steven Rostedt
2013-06-03 22:10 ` [01/65] KVM: VMX: fix halt emulation while emulating invalid guest sate Steven Rostedt
2013-06-03 22:10 ` [02/65] ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices Steven Rostedt
2013-06-03 22:10 ` [03/65] ASoC: wm8994: missing break in wm8994_aif3_hw_params() Steven Rostedt
2013-06-03 22:10 ` [04/65] ACPICA: Fix possible buffer overflow during a field unit read operation Steven Rostedt
2013-06-03 22:10 ` [05/65] ALSA: HDA: Fix Oops caused by dereference NULL pointer Steven Rostedt
2013-06-03 22:10 ` [06/65] dm stripe: fix regression in stripe_width calculation Steven Rostedt
2013-06-03 22:10 ` [07/65] dm bufio: avoid a possible __vmalloc deadlock Steven Rostedt
2013-06-04 12:59   ` Mikulas Patocka
2013-06-04 14:42     ` Steven Rostedt
2013-06-05 14:54     ` Steven Rostedt
2013-06-03 22:10 ` [08/65] dm snapshot: fix error return code in snapshot_ctr Steven Rostedt
2013-06-03 22:10 ` [09/65] math64: New div64_u64_rem helper Steven Rostedt
2013-06-04 13:45   ` Stanislaw Gruszka
2013-06-04 14:43     ` Steven Rostedt
2013-06-03 22:10 ` [10/65] hp_accel: Ignore the error from lis3lv02d_poweron() at resume Steven Rostedt
2013-06-03 22:10 ` [11/65] xen/vcpu/pvhvm: Fix vcpu hotplugging hanging Steven Rostedt
2013-06-03 22:10 ` [12/65] sd: fix array cache flushing bug causing performance problems Steven Rostedt
2013-06-03 22:10 ` [13/65] audit: Syscall rules are not applied to existing processes on non-x86 Steven Rostedt
2013-06-03 22:10 ` [14/65] timer: Dont reinitialize the cpu base lock during CPU_UP_PREPARE Steven Rostedt
2013-06-03 22:10 ` [15/65] tick: Cleanup NOHZ per cpu data on cpu down Steven Rostedt
2013-06-03 22:10 ` [16/65] tracing: Fix leaks of filter preds Steven Rostedt
2013-06-03 22:10 ` [17/65] ext4: limit group search loop for non-extent files Steven Rostedt
2013-06-03 22:10 ` [18/65] ARM: 7720/1: ARM v6/v7 cmpxchg64 shouldnt clear upper 32 bits of the old/new value Steven Rostedt
2013-06-03 22:10 ` [19/65] powerpc: Bring all threads online prior to migration/hibernation Steven Rostedt
2013-06-03 22:10 ` [20/65] powerpc/kexec: Fix kexec when using VMX optimised memcpy Steven Rostedt
2013-06-03 22:10 ` [21/65] ath9k: fix key allocation error handling for powersave keys Steven Rostedt
2013-06-03 22:10 ` [22/65] mwifiex: clear is_suspended flag when interrupt is received early Steven Rostedt
2013-06-03 22:10 ` [23/65] mwifiex: fix memory leak issue when driver unload Steven Rostedt
2013-06-03 22:10 ` [24/65] mwifiex: fix setting of multicast filter Steven Rostedt
2013-06-03 22:10 ` [25/65] tile: support new Tilera hypervisor Steven Rostedt
2013-06-03 22:10 ` [26/65] B43: Handle DMA RX descriptor underrun Steven Rostedt
2013-06-03 22:10 ` [27/65] drm/mgag200: Fix writes into MGA1064_PIX_CLK_CTL register Steven Rostedt
2013-06-03 22:10 ` [28/65] drm/mgag200: Fix framebuffer base address programming Steven Rostedt
2013-06-03 22:10 ` [29/65] tcp: force a dst refcount when prequeue packet Steven Rostedt
2013-06-03 22:10 ` [30/65] sfc: Fix naming of MTD partitions for FPGA bitfiles Steven Rostedt
2013-06-03 22:10 ` [31/65] net: mac802154: comparision issue of type cast, finding by EXTRA_CFLAGS=-W Steven Rostedt
2013-06-03 22:10 ` [32/65] 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA) Steven Rostedt
2013-06-03 22:10 ` [33/65] net_sched: act_ipt forward compat with xtables Steven Rostedt
2013-06-03 22:10 ` [34/65] net: use netdev_features_t in skb_needs_linearize() Steven Rostedt
2013-06-03 22:10 ` [35/65] net: vlan,ethtool: netdev_features_t is more than 32 bit Steven Rostedt
2013-06-03 22:10 ` [36/65] bridge: fix race with topology change timer Steven Rostedt
2013-06-03 22:10 ` [37/65] packet: tpacket_v3: do not trigger bug() on wrong header status Steven Rostedt
2013-06-03 22:10 ` [38/65] 3c59x: fix freeing nonexistent resource on driver unload Steven Rostedt
2013-06-03 22:10 ` [39/65] 3c59x: fix PCI resource management Steven Rostedt
2013-06-03 22:10 ` [40/65] if_cablemodem.h: Add parenthesis around ioctl macros Steven Rostedt
2013-06-03 22:10 ` [41/65] macvlan: fix passthru mode race between dev removal and rx path Steven Rostedt
2013-06-03 22:10 ` [42/65] ipv6: do not clear pinet6 field Steven Rostedt
2013-06-03 22:10 ` [43/65] xfrm6: release dev before returning error Steven Rostedt
2013-06-03 22:11 ` [44/65] pch_dma: Use GFP_ATOMIC because called from interrupt context Steven Rostedt
2013-06-03 22:11 ` [45/65] watchdog: Fix race condition in registration code Steven Rostedt
2013-06-03 22:11 ` [46/65] drbd: fix for deadlock when using automatic split-brain-recovery Steven Rostedt
2013-06-03 22:11 ` [47/65] ARM: EXYNOS5: Fix kernel dump in AFTR idle mode Steven Rostedt
2013-06-03 22:11 ` [48/65] drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe() Steven Rostedt
2013-06-03 22:11 ` [49/65] iscsi-target: Fix processing of OOO commands Steven Rostedt
2013-06-03 22:11 ` [50/65] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race Steven Rostedt
2013-06-03 22:11 ` [51/65] ACPI / EC: Restart transaction even when the IBF flag set Steven Rostedt
2013-06-03 22:11 ` [52/65] drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow Steven Rostedt
2013-06-03 22:11 ` [53/65] ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex Steven Rostedt
2013-06-03 22:11 ` [54/65] drm/radeon: check incoming cliprects pointer Steven Rostedt
2013-06-03 22:11 ` [55/65] usermodehelper: check subprocess_info->path != NULL Steven Rostedt
2013-06-03 22:11 ` [56/65] parisc: only re-enable interrupts if we need to schedule or deliver signals when returning to userspace Steven Rostedt
2013-06-03 22:11 ` [57/65] parisc: fix SMP races when updating PTE and TLB entries in entry.S Steven Rostedt
2013-06-03 22:11 ` [58/65] parisc: fix NATIVE set up in build Steven Rostedt
2013-06-03 22:11 ` [59/65] parisc: make default cross compiler search more robust (v3) Steven Rostedt
2013-06-03 22:11 ` [60/65] btrfs: dont stop searching after encountering the wrong item Steven Rostedt
2013-06-03 22:11 ` [61/65] hwmon: fix error return code in abituguru_probe() Steven Rostedt
2013-06-03 22:11 ` [62/65] i2c: designware: fix RX FIFO overrun Steven Rostedt
2013-06-03 22:11 ` [63/65] i2c: designware: always clear interrupts before enabling them Steven Rostedt
2013-06-03 22:11 ` [64/65] drm/radeon: Fix VRAM size calculation for VRAM >= 4GB Steven Rostedt
2013-06-03 22:11 ` [65/65] virtio_console: fix uapi header Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).