linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ 00/66] 3.6.7-stable review
@ 2012-11-15  4:10 Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 01/66] xen/gntdev: dont leak memory from IOCTL_GNTDEV_MAP_GRANT_REF Greg Kroah-Hartman
                   ` (65 more replies)
  0 siblings, 66 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, torvalds, akpm, alan

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

Responses should be made by Sat Nov 17 04:09:27 UTC 2012.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.6.7-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 3.6.7-rc1

Dave Chinner <david@fromorbit.com>
    xfs: fix buffer shudown reference count mismatch

Dave Chinner <dchinner@redhat.com>
    xfs: fix reading of wrapped log data

Benjamin Marzinski <bmarzins@redhat.com>
    GFS2: Test bufdata with buffer locked and gfs2_log_lock held

Alex Deucher <alexander.deucher@amd.com>
    drm/radeon/si: add some missing regs to the VM reg checker

Alex Deucher <alexander.deucher@amd.com>
    drm/radeon/cayman: add some missing regs to the VM reg checker

Thomas Hellstrom <thellstrom@vmware.com>
    drm/vmwgfx: Fix a case where the code would BUG when trying to pin GMR memory

Thomas Hellstrom <thellstrom@vmware.com>
    drm/vmwgfx: Fix hibernation device reset

Chris Ball <cjb@laptop.org>
    mmc: sdhci: fix NULL dereference in sdhci_request() tuning

Guennadi Liakhovetski <g.liakhovetski@gmx.de>
    mmc: sh_mmcif: fix use after free

Thomas Gleixner <tglx@linutronix.de>
    futex: Handle futex_pi OWNER_DIED take over correctly

Hannes Frederic Sowa <hannes@stressinduktion.org>
    ipv6: send unsolicited neighbour advertisements to all-nodes

Eric Leblond <eric@regit.org>
    af-packet: fix oops when socket is not present

Cyrill Gorcunov <gorcunov@openvz.org>
    net: inet_diag -- Return error code if protocol handler is missed

Pavel Emelyanov <xemul@parallels.com>
    tcp-repair: Handle zero-length data put in rcv queue

Tom Parkin <tparkin@katalix.com>
    l2tp: fix oops in l2tp_eth_create() error path

Peter Senna Tschudin <peter.senna@gmail.com>
    drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free

Jesper Dangaard Brouer <brouer@redhat.com>
    net: fix divide by zero in tcp algorithm illinois

Hemant Kumar <hemantk@codeaurora.org>
    net: usb: Fix memory leak on Tx data path

Li RongQing <roy.qing.li@gmail.com>
    ipv6: Set default hoplimit as zero.

Eric Dumazet <edumazet@google.com>
    net: fix secpath kmemleak

Eric Dumazet <edumazet@google.com>
    tcp: fix FIONREAD/SIOCINQ

Eric Dumazet <edumazet@google.com>
    netlink: use kfree_rcu() in netlink_release()

Steffen Klassert <steffen.klassert@secunet.com>
    ipv4: Fix flushing of cached routing informations

Zijie Pan <zijie.pan@6wind.com>
    sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()

Takashi Iwai <tiwai@suse.de>
    ALSA: Avoid endless sleep after disconnect

Takashi Iwai <tiwai@suse.de>
    ALSA: Add a reference counter to card instance

Takashi Iwai <tiwai@suse.de>
    ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c

Takashi Iwai <tiwai@suse.de>
    ALSA: usb-audio: Use rwsem for disconnect protection

Takashi Iwai <tiwai@suse.de>
    ALSA: usb-audio: Fix races at disconnection

Takashi Iwai <tiwai@suse.de>
    ALSA: PCM: Fix some races at disconnection

Jean Delvare <khali@linux-fr.org>
    hwmon: (w83627ehf) Force initial bank selection

Ilija Hadzic <ilijahadzic@gmail.com>
    drm: set dev_mapping before calling drm_open_helper

Ilija Hadzic <ilijahadzic@gmail.com>
    drm: restore open_count if drm_setup fails

Linus Lüssing <linus.luessing@web.de>
    batman-adv: Fix broadcast packet CRC calculation

NeilBrown <neilb@suse.de>
    NFS: fix bug in legacy DNS resolver.

Bryan Schumaker <bjschuma@netapp.com>
    NFS: Wait for session recovery to finish before returning

Trond Myklebust <Trond.Myklebust@netapp.com>
    NFSv4.1: We must release the sequence id when we fail to get a session slot

Trond Myklebust <Trond.Myklebust@netapp.com>
    NFSv4: nfs4_locku_done must release the sequence id

Ben Hutchings <ben@decadent.org.uk>
    nfs: Show original device name verbatim in /proc/*/mount{s,info}

Scott Mayhew <smayhew@redhat.com>
    nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts

Antonio Quartulli <ordex@autistici.org>
    mac80211: fix SSID copy on IBSS JOIN

Johannes Berg <johannes.berg@intel.com>
    mac80211: make sure data is accessible in EAPOL check

Johannes Berg <johannes.berg@intel.com>
    mac80211: verify that skb data is present

Johannes Berg <johannes.berg@intel.com>
    mac80211: check management frame header length

Chris Wilson <chris@chris-wilson.co.uk>
    drm/i915: Only kick out vesafb if we takeover the fbcon with KMS

Daniel Vetter <daniel.vetter@ffwll.ch>
    drm/i915: fix overlay on i830M

Daniel Vetter <daniel.vetter@ffwll.ch>
    drm/i915: clear the entire sdvo infoframe buffer

Dave Airlie <airlied@redhat.com>
    drm/udl: fix stride issues scanning out stride != width*bpp

Egbert Eich <eich@suse.de>
    DRM/Radeon: Fix Load Detection on legacy primary DAC.

Javier Cardona <javier@cozybit.com>
    mac80211: don't inspect Sequence Control field on control frames

Javier Cardona <javier@cozybit.com>
    mac80211: Only process mesh config header on frames that RA_MATCH

Johannes Berg <johannes.berg@intel.com>
    mac80211: use blacklist for duplicate IE check

Johannes Berg <johannes.berg@intel.com>
    wireless: drop invalid mesh address extension frames

Felix Fietkau <nbd@openwrt.org>
    cfg80211: fix antenna gain handling

Nicholas Bellinger <nab@linux-iscsi.org>
    target: Re-add explict zeroing of INQUIRY bounce buffer memory

Steve Hodgson <steve@purestorage.com>
    target: Fix incorrect usage of nested IRQ spinlocks in ABORT_TASK path

Roland Dreier <roland@purestorage.com>
    iscsi-target: Fix missed wakeup race in TX thread

Roland Dreier <roland@purestorage.com>
    target: Avoid integer overflow in se_dev_align_max_sectors()

Roland Dreier <roland@purestorage.com>
    target: Don't return success from module_init() if setup fails

Stanislaw Gruszka <sgruszka@redhat.com>
    rt2800: validate step value for temperature compensation

Sven Eckelmann <sven@narfation.org>
    ath9k: Test for TID only in BlockAcks while checking tx status

Felix Fietkau <nbd@openwrt.org>
    ath9k: fix stale pointers potentially causing access to free'd skbs

Rolf Eike Beer <eike-kernel@sf-tec.de>
    Input: tsc40 - remove wrong announcement of pressure support

Jacob Keller <jacob.e.keller@intel.com>
    ixgbe: PTP get_ts_info missing software support

Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    xen/mmu: Use Xen specific TLB flush instead of the generic one.

David Vrabel <david.vrabel@citrix.com>
    xen/gntdev: don't leak memory from IOCTL_GNTDEV_MAP_GRANT_REF


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

Diffstat:

 Makefile                                         |  4 +-
 arch/x86/xen/mmu.c                               | 21 ++++++-
 drivers/gpu/drm/drm_fops.c                       | 44 ++++++++++-----
 drivers/gpu/drm/i915/i915_dma.c                  |  3 +-
 drivers/gpu/drm/i915/intel_overlay.c             | 14 ++++-
 drivers/gpu/drm/i915/intel_sdvo.c                | 62 +++++++++++++-------
 drivers/gpu/drm/i915/intel_sdvo_regs.h           |  2 +
 drivers/gpu/drm/radeon/evergreen_cs.c            |  3 +
 drivers/gpu/drm/radeon/evergreend.h              |  4 ++
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c  |  1 +
 drivers/gpu/drm/radeon/si.c                      |  1 +
 drivers/gpu/drm/radeon/sid.h                     |  1 +
 drivers/gpu/drm/udl/udl_drv.h                    |  2 +-
 drivers/gpu/drm/udl/udl_fb.c                     | 12 ++--
 drivers/gpu/drm/udl/udl_transfer.c               |  5 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c           |  2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              |  5 ++
 drivers/hwmon/w83627ehf.c                        |  1 +
 drivers/input/touchscreen/tsc40.c                |  1 -
 drivers/mmc/host/sdhci.c                         | 23 ++++----
 drivers/mmc/host/sh_mmcif.c                      |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |  3 +
 drivers/net/ethernet/nxp/lpc_eth.c               |  1 +
 drivers/net/usb/usbnet.c                         |  3 +
 drivers/net/wireless/ath/ath9k/xmit.c            | 10 +++-
 drivers/net/wireless/rt2x00/rt2800lib.c          |  2 +-
 drivers/target/iscsi/iscsi_target.c              |  4 +-
 drivers/target/iscsi/iscsi_target_core.h         |  1 +
 drivers/target/iscsi/iscsi_target_login.c        |  1 +
 drivers/target/iscsi/iscsi_target_util.c         | 22 +++++++-
 drivers/target/iscsi/iscsi_target_util.h         |  1 +
 drivers/target/target_core_configfs.c            |  3 +-
 drivers/target/target_core_device.c              | 18 +++---
 drivers/target/target_core_spc.c                 |  2 +
 drivers/target/target_core_tmr.c                 |  6 +-
 drivers/xen/gntdev.c                             | 36 ++++++------
 fs/gfs2/lops.c                                   | 14 +----
 fs/gfs2/trans.c                                  |  8 +++
 fs/nfs/dns_resolve.c                             |  5 +-
 fs/nfs/internal.h                                |  5 +-
 fs/nfs/mount_clnt.c                              |  2 +-
 fs/nfs/namespace.c                               | 19 +++++--
 fs/nfs/nfs4namespace.c                           |  3 +-
 fs/nfs/nfs4proc.c                                | 40 ++++++++-----
 fs/nfs/super.c                                   |  2 +-
 fs/xfs/xfs_buf_item.c                            | 18 ++++++
 fs/xfs/xfs_log_recover.c                         |  2 +-
 include/net/cfg80211.h                           |  9 +++
 include/sound/core.h                             |  3 +
 include/trace/events/xen.h                       |  8 +++
 kernel/futex.c                                   | 41 +++++++-------
 net/batman-adv/bridge_loop_avoidance.c           |  8 +--
 net/batman-adv/routing.c                         |  8 ++-
 net/core/dev.c                                   |  2 +-
 net/core/skbuff.c                                |  6 +-
 net/ipv4/inet_diag.c                             |  5 +-
 net/ipv4/route.c                                 |  9 ++-
 net/ipv4/tcp.c                                   |  8 +--
 net/ipv4/tcp_illinois.c                          |  8 ++-
 net/ipv4/tcp_input.c                             |  3 +
 net/ipv6/ndisc.c                                 |  3 +-
 net/ipv6/route.c                                 |  4 +-
 net/l2tp/l2tp_eth.c                              |  1 +
 net/mac80211/ibss.c                              |  2 +-
 net/mac80211/rx.c                                | 72 ++++++++++++++++++------
 net/mac80211/util.c                              | 42 +++++++++++---
 net/netlink/af_netlink.c                         | 19 +++++--
 net/sctp/sm_sideeffect.c                         |  3 +-
 net/wireless/core.c                              |  3 +-
 net/wireless/util.c                              | 14 +++--
 sound/core/compress_offload.c                    |  9 ++-
 sound/core/control.c                             |  5 ++
 sound/core/hwdep.c                               | 12 +++-
 sound/core/init.c                                | 50 +++++++++-------
 sound/core/oss/mixer_oss.c                       | 10 +++-
 sound/core/oss/pcm_oss.c                         |  6 ++
 sound/core/pcm.c                                 | 13 ++++-
 sound/core/pcm_native.c                          | 33 +++++++++--
 sound/core/rawmidi.c                             | 26 ++++++++-
 sound/core/sound.c                               | 11 +++-
 sound/core/sound_oss.c                           | 10 +++-
 sound/usb/card.c                                 | 12 ++--
 sound/usb/card.h                                 |  1 +
 sound/usb/mixer.c                                | 65 +++++++++++++--------
 sound/usb/mixer_quirks.c                         | 58 ++++++++++++++++---
 sound/usb/pcm.c                                  | 49 +++++++++++-----
 sound/usb/proc.c                                 |  4 +-
 sound/usb/stream.c                               |  1 +
 sound/usb/usbaudio.h                             |  2 +-
 89 files changed, 794 insertions(+), 308 deletions(-)



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

* [ 01/66] xen/gntdev: dont leak memory from IOCTL_GNTDEV_MAP_GRANT_REF
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 02/66] xen/mmu: Use Xen specific TLB flush instead of the generic one Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, David Vrabel, Konrad Rzeszutek Wilk

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

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

From: David Vrabel <david.vrabel@citrix.com>

commit a67baeb77375199bbd842fa308cb565164dd1f19 upstream.

map->kmap_ops allocated in gntdev_alloc_map() wasn't freed by
gntdev_put_map().

Add a gntdev_free_map() helper function to free everything allocated
by gntdev_alloc_map().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/xen/gntdev.c |   36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gnt
 #endif
 }
 
+static void gntdev_free_map(struct grant_map *map)
+{
+	if (map == NULL)
+		return;
+
+	if (map->pages)
+		free_xenballooned_pages(map->count, map->pages);
+	kfree(map->pages);
+	kfree(map->grants);
+	kfree(map->map_ops);
+	kfree(map->unmap_ops);
+	kfree(map->kmap_ops);
+	kfree(map);
+}
+
 static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count)
 {
 	struct grant_map *add;
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_ma
 	return add;
 
 err:
-	kfree(add->pages);
-	kfree(add->grants);
-	kfree(add->map_ops);
-	kfree(add->unmap_ops);
-	kfree(add->kmap_ops);
-	kfree(add);
+	gntdev_free_map(add);
 	return NULL;
 }
 
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_
 		evtchn_put(map->notify.event);
 	}
 
-	if (map->pages) {
-		if (!use_ptemod)
-			unmap_grant_pages(map, 0, map->count);
-
-		free_xenballooned_pages(map->count, map->pages);
-	}
-	kfree(map->pages);
-	kfree(map->grants);
-	kfree(map->map_ops);
-	kfree(map->unmap_ops);
-	kfree(map);
+	if (map->pages && !use_ptemod)
+		unmap_grant_pages(map, 0, map->count);
+	gntdev_free_map(map);
 }
 
 /* ------------------------------------------------------------------ */



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

* [ 02/66] xen/mmu: Use Xen specific TLB flush instead of the generic one.
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 01/66] xen/gntdev: dont leak memory from IOCTL_GNTDEV_MAP_GRANT_REF Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 03/66] ixgbe: PTP get_ts_info missing software support Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Jingjie Jiang, Mukesh Rathor,
	Konrad Rzeszutek Wilk

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

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

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

commit 95a7d76897c1e7243d4137037c66d15cbf2cce76 upstream.

As Mukesh explained it, the MMUEXT_TLB_FLUSH_ALL allows the
hypervisor to do a TLB flush on all active vCPUs. If instead
we were using the generic one (which ends up being xen_flush_tlb)
we end up making the MMUEXT_TLB_FLUSH_LOCAL hypercall. But
before we make that hypercall the kernel will IPI all of the
vCPUs (even those that were asleep from the hypervisor
perspective). The end result is that we needlessly wake them
up and do a TLB flush when we can just let the hypervisor
do it correctly.

This patch gives around 50% speed improvement when migrating
idle guest's from one host to another.

Oracle-bug: 14630170

Tested-by:  Jingjie Jiang <jingjie.jiang@oracle.com>
Suggested-by:  Mukesh Rathor <mukesh.rathor@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/xen/mmu.c         |   21 ++++++++++++++++++++-
 include/trace/events/xen.h |    8 ++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1215,6 +1215,25 @@ unsigned long xen_read_cr2_direct(void)
 	return this_cpu_read(xen_vcpu_info.arch.cr2);
 }
 
+void xen_flush_tlb_all(void)
+{
+	struct mmuext_op *op;
+	struct multicall_space mcs;
+
+	trace_xen_mmu_flush_tlb_all(0);
+
+	preempt_disable();
+
+	mcs = xen_mc_entry(sizeof(*op));
+
+	op = mcs.args;
+	op->cmd = MMUEXT_TLB_FLUSH_ALL;
+	MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
+
+	xen_mc_issue(PARAVIRT_LAZY_MMU);
+
+	preempt_enable();
+}
 static void xen_flush_tlb(void)
 {
 	struct mmuext_op *op;
@@ -2366,7 +2385,7 @@ int xen_remap_domain_mfn_range(struct vm
 	err = 0;
 out:
 
-	flush_tlb_all();
+	xen_flush_tlb_all();
 
 	return err;
 }
--- a/include/trace/events/xen.h
+++ b/include/trace/events/xen.h
@@ -377,6 +377,14 @@ DECLARE_EVENT_CLASS(xen_mmu_pgd,
 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin);
 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin);
 
+TRACE_EVENT(xen_mmu_flush_tlb_all,
+	    TP_PROTO(int x),
+	    TP_ARGS(x),
+	    TP_STRUCT__entry(__array(char, x, 0)),
+	    TP_fast_assign((void)x),
+	    TP_printk("%s", "")
+	);
+
 TRACE_EVENT(xen_mmu_flush_tlb,
 	    TP_PROTO(int x),
 	    TP_ARGS(x),



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

* [ 03/66] ixgbe: PTP get_ts_info missing software support
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 01/66] xen/gntdev: dont leak memory from IOCTL_GNTDEV_MAP_GRANT_REF Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 02/66] xen/mmu: Use Xen specific TLB flush instead of the generic one Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 04/66] Input: tsc40 - remove wrong announcement of pressure support Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Jacob Keller, Stephen Ko, Jeff Kirsher,
	David S. Miller

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

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

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

commit 50f8d35de8ba4af311ea1176c534e8b73bb198e5 upstream.

This patch corrects the ethtool get_ts_info functon which did not state that
software timestamping was supported, even though it is.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2673,6 +2673,9 @@ static int ixgbe_get_ts_info(struct net_
 	case ixgbe_mac_X540:
 	case ixgbe_mac_82599EB:
 		info->so_timestamping =
+			SOF_TIMESTAMPING_TX_SOFTWARE |
+			SOF_TIMESTAMPING_RX_SOFTWARE |
+			SOF_TIMESTAMPING_SOFTWARE |
 			SOF_TIMESTAMPING_TX_HARDWARE |
 			SOF_TIMESTAMPING_RX_HARDWARE |
 			SOF_TIMESTAMPING_RAW_HARDWARE;



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

* [ 04/66] Input: tsc40 - remove wrong announcement of pressure support
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2012-11-15  4:10 ` [ 03/66] ixgbe: PTP get_ts_info missing software support Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 05/66] ath9k: fix stale pointers potentially causing access to freed skbs Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Rolf Eike Beer, Dmitry Torokhov

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

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

From: Rolf Eike Beer <eike-kernel@sf-tec.de>

commit 32ed1911fc79908d704023317d4ddeb3883fd07e upstream.

The tsc40 driver announces it supports the pressure event, but will never
send one. The announcement will cause tslib to wait for such events and
sending all touch events with a pressure of 0. Removing the announcement
will make tslib fall back to emulating the pressure on touch events so
everything works as expected.

Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/input/touchscreen/tsc40.c |    1 -
 1 file changed, 1 deletion(-)

--- a/drivers/input/touchscreen/tsc40.c
+++ b/drivers/input/touchscreen/tsc40.c
@@ -107,7 +107,6 @@ static int tsc_connect(struct serio *ser
 	__set_bit(BTN_TOUCH, input_dev->keybit);
 	input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0);
 	input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0);
-	input_set_abs_params(ptsc->dev, ABS_PRESSURE, 0, 0, 0, 0);
 
 	serio_set_drvdata(serio, ptsc);
 



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

* [ 05/66] ath9k: fix stale pointers potentially causing access to freed skbs
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2012-11-15  4:10 ` [ 04/66] Input: tsc40 - remove wrong announcement of pressure support Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 06/66] ath9k: Test for TID only in BlockAcks while checking tx status Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Felix Fietkau, John W. Linville

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

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

From: Felix Fietkau <nbd@openwrt.org>

commit 8c6e30936a7893a85f6222084f0f26aceb81137a upstream.

bf->bf_next is only while buffers are chained as part of an A-MPDU
in the tx queue. When a tid queue is flushed (e.g. on tearing down
an aggregation session), frames can be enqueued again as normal
transmission, without bf_next being cleared. This can lead to the
old pointer being dereferenced again later.

This patch might fix crashes and "Failed to stop TX DMA!" messages.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/ath/ath9k/xmit.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -312,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer
 	}
 
 	bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
+	bf->bf_next = NULL;
 	list_del(&bf->list);
 
 	spin_unlock_bh(&sc->tx.txbuflock);
@@ -1774,6 +1775,7 @@ static void ath_tx_send_normal(struct at
 	list_add_tail(&bf->list, &bf_head);
 	bf->bf_state.bf_type = 0;
 
+	bf->bf_next = NULL;
 	bf->bf_lastbf = bf;
 	ath_tx_fill_desc(sc, bf, txq, fi->framelen);
 	ath_tx_txqaddbuf(sc, txq, &bf_head, false);



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

* [ 06/66] ath9k: Test for TID only in BlockAcks while checking tx status
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2012-11-15  4:10 ` [ 05/66] ath9k: fix stale pointers potentially causing access to freed skbs Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 07/66] rt2800: validate step value for temperature compensation Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Sven Eckelmann, Simon Wunderlich,
	Felix Fietkau, John W. Linville

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

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

From: Sven Eckelmann <sven@narfation.org>

commit 6fe7cc71bbf3a0bc28c9cec3c00bc11e81344412 upstream.

The ath9k xmit functions for AMPDUs can send frames as non-aggregate in case
only one frame is currently available. The client will then answer using a
normal Ack instead of a BlockAck. This acknowledgement has no TID stored and
therefore the hardware is not able to provide us the corresponding TID.

The TID set by the hardware in the tx status descriptor has to be seen as
undefined and not as a valid TID value for normal acknowledgements. Doing
otherwise results in a massive amount of retransmissions and stalls of
connections.

Users may experience low bandwidth and complete connection stalls in
environments with transfers using multiple TIDs.

This regression was introduced in b11b160defc48e4daa283f785192ea3a23a51f8e
("ath9k: validate the TID in the tx status information").

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/ath/ath9k/xmit.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -394,7 +394,7 @@ static void ath_tx_complete_aggr(struct
 	u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first;
 	u32 ba[WME_BA_BMP_SIZE >> 5];
 	int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
-	bool rc_update = true;
+	bool rc_update = true, isba;
 	struct ieee80211_tx_rate rates[4];
 	struct ath_frame_info *fi;
 	int nframes;
@@ -438,13 +438,17 @@ static void ath_tx_complete_aggr(struct
 	tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
 	tid = ATH_AN_2_TID(an, tidno);
 	seq_first = tid->seq_start;
+	isba = ts->ts_flags & ATH9K_TX_BA;
 
 	/*
 	 * The hardware occasionally sends a tx status for the wrong TID.
 	 * In this case, the BA status cannot be considered valid and all
 	 * subframes need to be retransmitted
+	 *
+	 * Only BlockAcks have a TID and therefore normal Acks cannot be
+	 * checked
 	 */
-	if (tidno != ts->tid)
+	if (isba && tidno != ts->tid)
 		txok = false;
 
 	isaggr = bf_isaggr(bf);



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

* [ 07/66] rt2800: validate step value for temperature compensation
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2012-11-15  4:10 ` [ 06/66] ath9k: Test for TID only in BlockAcks while checking tx status Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 08/66] target: Dont return success from module_init() if setup fails Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Stanislaw Gruszka, Ivo van Doorn,
	John W. Linville

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

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

From: Stanislaw Gruszka <sgruszka@redhat.com>

commit bf7e1abe434ba9e22e8dc04a4cba4ab504b788b8 upstream.

Some hardware has correct (!= 0xff) value of tssi_bounds[4] in the
EEPROM, but step is equal to 0xff. This results on ridiculous delta
calculations and completely broke TX power settings.

Reported-and-tested-by: Pavel Lucik <pavel.lucik@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/rt2x00/rt2800lib.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2395,7 +2395,7 @@ static int rt2800_get_gain_calibration_d
 	/*
 	 * Check if temperature compensation is supported.
 	 */
-	if (tssi_bounds[4] == 0xff)
+	if (tssi_bounds[4] == 0xff || step == 0xff)
 		return 0;
 
 	/*



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

* [ 08/66] target: Dont return success from module_init() if setup fails
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2012-11-15  4:10 ` [ 07/66] rt2800: validate step value for temperature compensation Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 09/66] target: Avoid integer overflow in se_dev_align_max_sectors() Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Roland Dreier, Nicholas Bellinger

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

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

From: Roland Dreier <roland@purestorage.com>

commit 0d0f9dfb31e0a6c92063e235417b42df185b3275 upstream.

If the call to core_dev_release_virtual_lun0() fails, then nothing
sets ret to anything other than 0, so even though everything is
torn down and freed, target_core_init_configfs() will seem to succeed
and the module will be loaded.  Fix this by passing the return value
on up the chain.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/target_core_configfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -3214,7 +3214,8 @@ static int __init target_core_init_confi
 	if (ret < 0)
 		goto out;
 
-	if (core_dev_setup_virtual_lun0() < 0)
+	ret = core_dev_setup_virtual_lun0();
+	if (ret < 0)
 		goto out;
 
 	return 0;



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

* [ 09/66] target: Avoid integer overflow in se_dev_align_max_sectors()
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2012-11-15  4:10 ` [ 08/66] target: Dont return success from module_init() if setup fails Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 10/66] iscsi-target: Fix missed wakeup race in TX thread Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Roland Dreier, Nicholas Bellinger

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

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

From: Roland Dreier <roland@purestorage.com>

commit 3e03989b5868acf69a391a424dc71fcd6cc48167 upstream.

The expression (max_sectors * block_size) might overflow a u32
(indeed, since iblock sets max_hw_sectors to UINT_MAX, it is
guaranteed to overflow and end up with a much-too-small result in many
common cases).  Fix this by doing an equivalent calculation that
doesn't require multiplication.

While we're touching this code, avoid splitting a printk format across
two lines and use pr_info(...) instead of printk(KERN_INFO ...).

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/target_core_device.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_devi
 
 static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size)
 {
-	u32 tmp, aligned_max_sectors;
+	u32 aligned_max_sectors;
+	u32 alignment;
 	/*
 	 * Limit max_sectors to a PAGE_SIZE aligned value for modern
 	 * transport_allocate_data_tasks() operation.
 	 */
-	tmp = rounddown((max_sectors * block_size), PAGE_SIZE);
-	aligned_max_sectors = (tmp / block_size);
-	if (max_sectors != aligned_max_sectors) {
-		printk(KERN_INFO "Rounding down aligned max_sectors from %u"
-				" to %u\n", max_sectors, aligned_max_sectors);
-		return aligned_max_sectors;
-	}
+	alignment = max(1ul, PAGE_SIZE / block_size);
+	aligned_max_sectors = rounddown(max_sectors, alignment);
 
-	return max_sectors;
+	if (max_sectors != aligned_max_sectors)
+		pr_info("Rounding down aligned max_sectors from %u to %u\n",
+			max_sectors, aligned_max_sectors);
+
+	return aligned_max_sectors;
 }
 
 void se_dev_set_default_attribs(



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

* [ 10/66] iscsi-target: Fix missed wakeup race in TX thread
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2012-11-15  4:10 ` [ 09/66] target: Avoid integer overflow in se_dev_align_max_sectors() Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 11/66] target: Fix incorrect usage of nested IRQ spinlocks in ABORT_TASK path Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Roland Dreier, Andy Grover,
	Hannes Reinecke, Christoph Hellwig, Nicholas Bellinger

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

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

From: Roland Dreier <roland@purestorage.com>

commit d5627acba9ae584cf4928af19f7ddf5f6837de32 upstream.

The sleeping code in iscsi_target_tx_thread() is susceptible to the classic
missed wakeup race:

 - TX thread finishes handle_immediate_queue() and handle_response_queue(),
   thinks both queues are empty.
 - Another thread adds a queue entry and does wake_up_process(), which does
   nothing because the TX thread is still awake.
 - TX thread does schedule_timeout() and sleeps forever.

In practice this can kill an iSCSI connection if for example an initiator
does single-threaded writes and the target misses the wakeup window when
queueing an R2T; in this case the connection will be stuck until the
initiator loses patience and does some task management operation (or kills
the connection entirely).

Fix this by converting to wait_event_interruptible(), which does not
suffer from this sort of race.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Andy Grover <agrover@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/iscsi/iscsi_target.c       |    4 +++-
 drivers/target/iscsi/iscsi_target_core.h  |    1 +
 drivers/target/iscsi/iscsi_target_login.c |    1 +
 drivers/target/iscsi/iscsi_target_util.c  |   22 ++++++++++++++++++++--
 drivers/target/iscsi/iscsi_target_util.h  |    1 +
 5 files changed, 26 insertions(+), 3 deletions(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3735,7 +3735,9 @@ restart:
 		 */
 		iscsit_thread_check_cpumask(conn, current, 1);
 
-		schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);
+		wait_event_interruptible(conn->queues_wq,
+					 !iscsit_conn_all_queues_empty(conn) ||
+					 ts->status == ISCSI_THREAD_SET_RESET);
 
 		if ((ts->status == ISCSI_THREAD_SET_RESET) ||
 		     signal_pending(current))
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -486,6 +486,7 @@ struct iscsi_tmr_req {
 };
 
 struct iscsi_conn {
+	wait_queue_head_t	queues_wq;
 	/* Authentication Successful for this connection */
 	u8			auth_complete;
 	/* State connection is currently in */
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -45,6 +45,7 @@ extern spinlock_t sess_idr_lock;
 
 static int iscsi_login_init_conn(struct iscsi_conn *conn)
 {
+	init_waitqueue_head(&conn->queues_wq);
 	INIT_LIST_HEAD(&conn->conn_list);
 	INIT_LIST_HEAD(&conn->conn_cmd_list);
 	INIT_LIST_HEAD(&conn->immed_queue_list);
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -488,7 +488,7 @@ void iscsit_add_cmd_to_immediate_queue(
 	atomic_set(&conn->check_immediate_queue, 1);
 	spin_unlock_bh(&conn->immed_queue_lock);
 
-	wake_up_process(conn->thread_set->tx_thread);
+	wake_up(&conn->queues_wq);
 }
 
 struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn)
@@ -562,7 +562,7 @@ void iscsit_add_cmd_to_response_queue(
 	atomic_inc(&cmd->response_queue_count);
 	spin_unlock_bh(&conn->response_queue_lock);
 
-	wake_up_process(conn->thread_set->tx_thread);
+	wake_up(&conn->queues_wq);
 }
 
 struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn)
@@ -616,6 +616,24 @@ static void iscsit_remove_cmd_from_respo
 	}
 }
 
+bool iscsit_conn_all_queues_empty(struct iscsi_conn *conn)
+{
+	bool empty;
+
+	spin_lock_bh(&conn->immed_queue_lock);
+	empty = list_empty(&conn->immed_queue_list);
+	spin_unlock_bh(&conn->immed_queue_lock);
+
+	if (!empty)
+		return empty;
+
+	spin_lock_bh(&conn->response_queue_lock);
+	empty = list_empty(&conn->response_queue_list);
+	spin_unlock_bh(&conn->response_queue_lock);
+
+	return empty;
+}
+
 void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn)
 {
 	struct iscsi_queue_req *qr, *qr_tmp;
--- a/drivers/target/iscsi/iscsi_target_util.h
+++ b/drivers/target/iscsi/iscsi_target_util.h
@@ -25,6 +25,7 @@ extern struct iscsi_queue_req *iscsit_ge
 extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
 extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *);
 extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *);
+extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *);
 extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *);
 extern void iscsit_release_cmd(struct iscsi_cmd *);
 extern void iscsit_free_cmd(struct iscsi_cmd *);



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

* [ 11/66] target: Fix incorrect usage of nested IRQ spinlocks in ABORT_TASK path
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2012-11-15  4:10 ` [ 10/66] iscsi-target: Fix missed wakeup race in TX thread Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 12/66] target: Re-add explict zeroing of INQUIRY bounce buffer memory Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Steve Hodgson, Roland Dreier,
	Nicholas Bellinger

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

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

From: Steve Hodgson <steve@purestorage.com>

commit ab74b3d62f05192bf8fb8f169e7999d1183b2e08 upstream.

This patch changes core_tmr_abort_task() to use spin_lock -> spin_unlock
around se_cmd->t_state_lock while spin_lock_irqsave is held via
se_sess->sess_cmd_lock.

Signed-off-by: Steve Hodgson <steve@purestorage.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/target_core_tmr.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -140,15 +140,15 @@ void core_tmr_abort_task(
 		printk("ABORT_TASK: Found referenced %s task_tag: %u\n",
 			se_cmd->se_tfo->get_fabric_name(), ref_tag);
 
-		spin_lock_irq(&se_cmd->t_state_lock);
+		spin_lock(&se_cmd->t_state_lock);
 		if (se_cmd->transport_state & CMD_T_COMPLETE) {
 			printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag);
-			spin_unlock_irq(&se_cmd->t_state_lock);
+			spin_unlock(&se_cmd->t_state_lock);
 			spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
 			goto out;
 		}
 		se_cmd->transport_state |= CMD_T_ABORTED;
-		spin_unlock_irq(&se_cmd->t_state_lock);
+		spin_unlock(&se_cmd->t_state_lock);
 
 		list_del_init(&se_cmd->se_cmd_list);
 		kref_get(&se_cmd->cmd_kref);



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

* [ 12/66] target: Re-add explict zeroing of INQUIRY bounce buffer memory
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2012-11-15  4:10 ` [ 11/66] target: Fix incorrect usage of nested IRQ spinlocks in ABORT_TASK path Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 13/66] cfg80211: fix antenna gain handling Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Kelsey Prantis, Paolo Bonzini,
	Andy Grover, Nicholas Bellinger

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

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

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit dea5f0998aa82bdeca260b87c653db11e91329b2 upstream.

This patch fixes a regression in spc_emulate_inquiry() code where the
local scope bounce buffer was no longer getting it's memory zeroed,
causing various problems with SCSI initiators that depend upon areas
of INQUIRY EVPD=0x83 payload having been zeroed.

This bug was introduced with the following v3.7-rc1 patch + CC'ed
stable commit:

commit ffe7b0e9326d9c68f5688bef691dd49f1e0d3651
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Fri Sep 7 17:30:38 2012 +0200

    target: support zero allocation length in INQUIRY

Go ahead and re-add the missing memset of bounce buffer memory to be
copied into the outgoing se_cmd descriptor kmapped SGL payload.

Reported-by: Kelsey Prantis <kelsey.prantis@intel.com>
Cc: Kelsey Prantis <kelsey.prantis@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/target_core_spc.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -605,6 +605,8 @@ static int spc_emulate_inquiry(struct se
 	unsigned char buf[SE_INQUIRY_BUF];
 	int p, ret;
 
+	memset(buf, 0, SE_INQUIRY_BUF);
+
 	if (dev == tpg->tpg_virt_lun0.lun_se_dev)
 		buf[0] = 0x3f; /* Not connected */
 	else



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

* [ 13/66] cfg80211: fix antenna gain handling
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2012-11-15  4:10 ` [ 12/66] target: Re-add explict zeroing of INQUIRY bounce buffer memory Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 14/66] wireless: drop invalid mesh address extension frames Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Felix Fietkau, Johannes Berg

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

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

From: Felix Fietkau <nbd@openwrt.org>

commit c4a9fafc77a5318f5ed26c509bbcddf03e18c201 upstream.

No driver initializes chan->max_antenna_gain to something sensible, and
the only place where it is being used right now is inside ath9k. This
leads to ath9k potentially using less tx power than it can use, which can
decrease performance/range in some rare cases.

Rather than going through every single driver, this patch initializes
chan->orig_mag in wiphy_register(), ignoring whatever value the driver
left in there. If a driver for some reason wishes to limit it independent
from regulatory rulesets, it can do so internally.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/wireless/core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -506,8 +506,7 @@ int wiphy_register(struct wiphy *wiphy)
 		for (i = 0; i < sband->n_channels; i++) {
 			sband->channels[i].orig_flags =
 				sband->channels[i].flags;
-			sband->channels[i].orig_mag =
-				sband->channels[i].max_antenna_gain;
+			sband->channels[i].orig_mag = INT_MAX;
 			sband->channels[i].orig_mpwr =
 				sband->channels[i].max_power;
 			sband->channels[i].band = band;



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

* [ 14/66] wireless: drop invalid mesh address extension frames
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2012-11-15  4:10 ` [ 13/66] cfg80211: fix antenna gain handling Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 15/66] mac80211: use blacklist for duplicate IE check Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Javier Cardona, Johannes Berg

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

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

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

commit 7dd111e8ee10cc6816669eabcad3334447673236 upstream.

The mesh header can have address extension by a 4th
or a 5th and 6th address, but never both. Drop such
frames in 802.11 -> 802.3 conversion along with any
frames that have the wrong extension.

Reviewed-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/wireless/util.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -312,18 +312,15 @@ EXPORT_SYMBOL(ieee80211_get_hdrlen_from_
 static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
 {
 	int ae = meshhdr->flags & MESH_FLAGS_AE;
-	/* 7.1.3.5a.2 */
+	/* 802.11-2012, 8.2.4.7.3 */
 	switch (ae) {
+	default:
 	case 0:
 		return 6;
 	case MESH_FLAGS_AE_A4:
 		return 12;
 	case MESH_FLAGS_AE_A5_A6:
 		return 18;
-	case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6):
-		return 24;
-	default:
-		return 6;
 	}
 }
 
@@ -373,6 +370,8 @@ int ieee80211_data_to_8023(struct sk_buf
 			/* make sure meshdr->flags is on the linear part */
 			if (!pskb_may_pull(skb, hdrlen + 1))
 				return -1;
+			if (meshdr->flags & MESH_FLAGS_AE_A4)
+				return -1;
 			if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
 				skb_copy_bits(skb, hdrlen +
 					offsetof(struct ieee80211s_hdr, eaddr1),
@@ -397,6 +396,8 @@ int ieee80211_data_to_8023(struct sk_buf
 			/* make sure meshdr->flags is on the linear part */
 			if (!pskb_may_pull(skb, hdrlen + 1))
 				return -1;
+			if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
+				return -1;
 			if (meshdr->flags & MESH_FLAGS_AE_A4)
 				skb_copy_bits(skb, hdrlen +
 					offsetof(struct ieee80211s_hdr, eaddr1),



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

* [ 15/66] mac80211: use blacklist for duplicate IE check
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2012-11-15  4:10 ` [ 14/66] wireless: drop invalid mesh address extension frames Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 16/66] mac80211: Only process mesh config header on frames that RA_MATCH Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Paul Stewart, Johannes Berg

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

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

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

commit 9690fb169b433a66485c808e4fc352b8a0f8d866 upstream.

Instead of the current whitelist which accepts duplicates
only for the quiet and vendor IEs, use a blacklist of all
IEs (that we currently parse) that can't be duplicated.

This avoids detecting a beacon as corrupt in the future
when new IEs are added that can be duplicated.

Signed-off-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/util.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)

--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -637,13 +637,41 @@ u32 ieee802_11_parse_elems_crc(u8 *start
 			break;
 		}
 
-		if (id != WLAN_EID_VENDOR_SPECIFIC &&
-		    id != WLAN_EID_QUIET &&
-		    test_bit(id, seen_elems)) {
-			elems->parse_error = true;
-			left -= elen;
-			pos += elen;
-			continue;
+		switch (id) {
+		case WLAN_EID_SSID:
+		case WLAN_EID_SUPP_RATES:
+		case WLAN_EID_FH_PARAMS:
+		case WLAN_EID_DS_PARAMS:
+		case WLAN_EID_CF_PARAMS:
+		case WLAN_EID_TIM:
+		case WLAN_EID_IBSS_PARAMS:
+		case WLAN_EID_CHALLENGE:
+		case WLAN_EID_RSN:
+		case WLAN_EID_ERP_INFO:
+		case WLAN_EID_EXT_SUPP_RATES:
+		case WLAN_EID_HT_CAPABILITY:
+		case WLAN_EID_HT_OPERATION:
+		case WLAN_EID_VHT_CAPABILITY:
+		case WLAN_EID_VHT_OPERATION:
+		case WLAN_EID_MESH_ID:
+		case WLAN_EID_MESH_CONFIG:
+		case WLAN_EID_PEER_MGMT:
+		case WLAN_EID_PREQ:
+		case WLAN_EID_PREP:
+		case WLAN_EID_PERR:
+		case WLAN_EID_RANN:
+		case WLAN_EID_CHANNEL_SWITCH:
+		case WLAN_EID_EXT_CHANSWITCH_ANN:
+		case WLAN_EID_COUNTRY:
+		case WLAN_EID_PWR_CONSTRAINT:
+		case WLAN_EID_TIMEOUT_INTERVAL:
+			if (test_bit(id, seen_elems)) {
+				elems->parse_error = true;
+				left -= elen;
+				pos += elen;
+				continue;
+			}
+			break;
 		}
 
 		if (calc_crc && id < 64 && (filter & (1ULL << id)))



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

* [ 16/66] mac80211: Only process mesh config header on frames that RA_MATCH
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2012-11-15  4:10 ` [ 15/66] mac80211: use blacklist for duplicate IE check Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 17/66] mac80211: dont inspect Sequence Control field on control frames Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Chaoxing Lin, Javier Cardona, Johannes Berg

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

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

From: Javier Cardona <javier@cozybit.com>

commit 555cb715be8ef98b8ec362b23dfc254d432a35b1 upstream.

Doing otherwise is wrong, and may wreak havoc on the mpp tables,
specially if the frame is encrypted.

Reported-by: Chaoxing Lin <Chaoxing.Lin@ultra-3eti.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/rx.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1857,7 +1857,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
 	    mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata))
 		return RX_DROP_MONITOR;
 
-	if (!ieee80211_is_data(hdr->frame_control))
+	if (!ieee80211_is_data(hdr->frame_control) ||
+	    !(status->rx_flags & IEEE80211_RX_RA_MATCH))
 		return RX_CONTINUE;
 
 	if (!mesh_hdr->ttl)
@@ -1901,9 +1902,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
 	}
 	skb_set_queue_mapping(skb, q);
 
-	if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
-		goto out;
-
 	if (!--mesh_hdr->ttl) {
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
 		return RX_DROP_MONITOR;



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

* [ 17/66] mac80211: dont inspect Sequence Control field on control frames
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2012-11-15  4:10 ` [ 16/66] mac80211: Only process mesh config header on frames that RA_MATCH Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 18/66] DRM/Radeon: Fix Load Detection on legacy primary DAC Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Javier Cardona, Javier Lopez, Johannes Berg

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

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

From: Javier Cardona <javier@cozybit.com>

commit f7fbf70ee9db6da6033ae50d100e017ac1f26555 upstream.

Per IEEE Std. 802.11-2012, Sec 8.2.4.4.1, the sequence Control field is
not present in control frames.  We noticed this problem when processing
Block Ack Requests.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Javier Lopez <jlopex@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/rx.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1422,6 +1422,10 @@ ieee80211_rx_h_defragment(struct ieee802
 
 	hdr = (struct ieee80211_hdr *)rx->skb->data;
 	fc = hdr->frame_control;
+
+	if (ieee80211_is_ctl(fc))
+		return RX_CONTINUE;
+
 	sc = le16_to_cpu(hdr->seq_ctrl);
 	frag = sc & IEEE80211_SCTL_FRAG;
 



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

* [ 18/66] DRM/Radeon: Fix Load Detection on legacy primary DAC.
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2012-11-15  4:10 ` [ 17/66] mac80211: dont inspect Sequence Control field on control frames Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 19/66] drm/udl: fix stride issues scanning out stride != width*bpp Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Egbert Eich, Alex Deucher

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

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

From: Egbert Eich <eich@suse.de>

commit 83325d072185899b706de2956170b246585aaec9 upstream.

An uninitialized variable led to broken load detection.

Signed-off-by: Egbert Eich <eich@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -651,6 +651,7 @@ static enum drm_connector_status radeon_
 	tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN;
 	WREG32(RADEON_DAC_CNTL, tmp);
 
+	tmp = dac_macro_cntl;
 	tmp &= ~(RADEON_DAC_PDWN_R |
 		 RADEON_DAC_PDWN_G |
 		 RADEON_DAC_PDWN_B);



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

* [ 19/66] drm/udl: fix stride issues scanning out stride != width*bpp
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2012-11-15  4:10 ` [ 18/66] DRM/Radeon: Fix Load Detection on legacy primary DAC Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 20/66] drm/i915: clear the entire sdvo infoframe buffer Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Dave Airlie

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

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

From: Dave Airlie <airlied@redhat.com>

commit 3916e1d71b62b120888aa50bcc8d9a6200fc19a7 upstream.

When buffer sharing with the i915 and using a 1680x1050 monitor,
the i915 gives is a 6912 buffer for the 6720 width, the code doesn't
render this properly as it uses one value to set the base address for
reading from the vmap and for where to start on the device.

This fixes it by calculating the values correctly for the device and
for the pixmap. No idea how I haven't seen this before now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/udl/udl_drv.h      |    2 +-
 drivers/gpu/drm/udl/udl_fb.c       |   12 +++++++-----
 drivers/gpu/drm/udl/udl_transfer.c |    5 +++--
 3 files changed, 11 insertions(+), 8 deletions(-)

--- a/drivers/gpu/drm/udl/udl_drv.h
+++ b/drivers/gpu/drm/udl/udl_drv.h
@@ -104,7 +104,7 @@ udl_fb_user_fb_create(struct drm_device
 
 int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr,
 		     const char *front, char **urb_buf_ptr,
-		     u32 byte_offset, u32 byte_width,
+		     u32 byte_offset, u32 device_byte_offset, u32 byte_width,
 		     int *ident_ptr, int *sent_ptr);
 
 int udl_dumb_create(struct drm_file *file_priv,
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -114,9 +114,10 @@ static void udlfb_dpy_deferred_io(struct
 	list_for_each_entry(cur, &fbdefio->pagelist, lru) {
 
 		if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8),
-				  &urb, (char *) info->fix.smem_start,
-				  &cmd, cur->index << PAGE_SHIFT,
-				  PAGE_SIZE, &bytes_identical, &bytes_sent))
+				     &urb, (char *) info->fix.smem_start,
+				     &cmd, cur->index << PAGE_SHIFT,
+				     cur->index << PAGE_SHIFT,
+				     PAGE_SIZE, &bytes_identical, &bytes_sent))
 			goto error;
 		bytes_rendered += PAGE_SIZE;
 	}
@@ -187,10 +188,11 @@ int udl_handle_damage(struct udl_framebu
 	for (i = y; i < y + height ; i++) {
 		const int line_offset = fb->base.pitches[0] * i;
 		const int byte_offset = line_offset + (x * bpp);
-
+		const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp);
 		if (udl_render_hline(dev, bpp, &urb,
 				     (char *) fb->obj->vmapping,
-				     &cmd, byte_offset, width * bpp,
+				     &cmd, byte_offset, dev_byte_offset,
+				     width * bpp,
 				     &bytes_identical, &bytes_sent))
 			goto error;
 	}
--- a/drivers/gpu/drm/udl/udl_transfer.c
+++ b/drivers/gpu/drm/udl/udl_transfer.c
@@ -213,11 +213,12 @@ static void udl_compress_hline16(
  */
 int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr,
 		     const char *front, char **urb_buf_ptr,
-		     u32 byte_offset, u32 byte_width,
+		     u32 byte_offset, u32 device_byte_offset,
+		     u32 byte_width,
 		     int *ident_ptr, int *sent_ptr)
 {
 	const u8 *line_start, *line_end, *next_pixel;
-	u32 base16 = 0 + (byte_offset / bpp) * 2;
+	u32 base16 = 0 + (device_byte_offset / bpp) * 2;
 	struct urb *urb = *urb_ptr;
 	u8 *cmd = *urb_buf_ptr;
 	u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length;



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

* [ 20/66] drm/i915: clear the entire sdvo infoframe buffer
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2012-11-15  4:10 ` [ 19/66] drm/udl: fix stride issues scanning out stride != width*bpp Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 21/66] drm/i915: fix overlay on i830M Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Paulo Zanoni, Ben Hutchings,
	Rodrigo Vivi, Daniel Vetter

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

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

From: Daniel Vetter <daniel.vetter@ffwll.ch>

commit b6e0e543f75729f207b9c72b0162ae61170635b2 upstream.

Like in the case of native hdmi, which is fixed already in

commit adf00b26d18e1b3570451296e03bcb20e4798cdd
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date:   Tue Sep 25 13:23:34 2012 -0300

    drm/i915: make sure we write all the DIP data bytes

we need to clear the entire sdvo buffer to avoid upsetting the
display.

Since infoframe buffer writing is now a bit more elaborate, extract it
into it's own function. This will be useful if we ever get around to
properly update the ELD for sdvo. Also #define proper names for the
two buffer indexes with fixed usage.

v2: Cite the right commit above, spotted by Paulo Zanoni.

v3: I'm too stupid to paste the right commit.

v4: Ben Hutchings noticed that I've failed to handle an underflow in
my loop logic, breaking it for i >= length + 8. Since I've just lost C
programmer license, use his solution. Also, make the frustrated 0-base
buffer size a notch more clear.

Reported-and-tested-by: Jürg Billeter <j@bitron.ch>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Cc: Paulo Zanoni <przanoni@gmail.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/i915/intel_sdvo.c      |   62 ++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_sdvo_regs.h |    2 +
 2 files changed, 44 insertions(+), 20 deletions(-)

--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -882,6 +882,45 @@ static void intel_sdvo_dump_hdmi_buf(str
 }
 #endif
 
+static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
+				       unsigned if_index, uint8_t tx_rate,
+				       uint8_t *data, unsigned length)
+{
+	uint8_t set_buf_index[2] = { if_index, 0 };
+	uint8_t hbuf_size, tmp[8];
+	int i;
+
+	if (!intel_sdvo_set_value(intel_sdvo,
+				  SDVO_CMD_SET_HBUF_INDEX,
+				  set_buf_index, 2))
+		return false;
+
+	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
+				  &hbuf_size, 1))
+		return false;
+
+	/* Buffer size is 0 based, hooray! */
+	hbuf_size++;
+
+	DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
+		      if_index, length, hbuf_size);
+
+	for (i = 0; i < hbuf_size; i += 8) {
+		memset(tmp, 0, 8);
+		if (i < length)
+			memcpy(tmp, data + i, min_t(unsigned, 8, length - i));
+
+		if (!intel_sdvo_set_value(intel_sdvo,
+					  SDVO_CMD_SET_HBUF_DATA,
+					  tmp, 8))
+			return false;
+	}
+
+	return intel_sdvo_set_value(intel_sdvo,
+				    SDVO_CMD_SET_HBUF_TXRATE,
+				    &tx_rate, 1);
+}
+
 static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)
 {
 	struct dip_infoframe avi_if = {
@@ -889,11 +928,7 @@ static bool intel_sdvo_set_avi_infoframe
 		.ver = DIP_VERSION_AVI,
 		.len = DIP_LEN_AVI,
 	};
-	uint8_t tx_rate = SDVO_HBUF_TX_VSYNC;
-	uint8_t set_buf_index[2] = { 1, 0 };
 	uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];
-	uint64_t *data = (uint64_t *)sdvo_data;
-	unsigned i;
 
 	intel_dip_infoframe_csum(&avi_if);
 
@@ -903,22 +938,9 @@ static bool intel_sdvo_set_avi_infoframe
 	sdvo_data[3] = avi_if.checksum;
 	memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi));
 
-	if (!intel_sdvo_set_value(intel_sdvo,
-				  SDVO_CMD_SET_HBUF_INDEX,
-				  set_buf_index, 2))
-		return false;
-
-	for (i = 0; i < sizeof(sdvo_data); i += 8) {
-		if (!intel_sdvo_set_value(intel_sdvo,
-					  SDVO_CMD_SET_HBUF_DATA,
-					  data, 8))
-			return false;
-		data++;
-	}
-
-	return intel_sdvo_set_value(intel_sdvo,
-				    SDVO_CMD_SET_HBUF_TXRATE,
-				    &tx_rate, 1);
+	return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF,
+					  SDVO_HBUF_TX_VSYNC,
+					  sdvo_data, sizeof(sdvo_data));
 }
 
 static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo)
--- a/drivers/gpu/drm/i915/intel_sdvo_regs.h
+++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h
@@ -708,6 +708,8 @@ struct intel_sdvo_enhancements_arg {
 #define SDVO_CMD_SET_AUDIO_STAT		0x91
 #define SDVO_CMD_GET_AUDIO_STAT		0x92
 #define SDVO_CMD_SET_HBUF_INDEX		0x93
+  #define SDVO_HBUF_INDEX_ELD		0
+  #define SDVO_HBUF_INDEX_AVI_IF	1
 #define SDVO_CMD_GET_HBUF_INDEX		0x94
 #define SDVO_CMD_GET_HBUF_INFO		0x95
 #define SDVO_CMD_SET_HBUF_AV_SPLIT	0x96



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

* [ 21/66] drm/i915: fix overlay on i830M
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2012-11-15  4:10 ` [ 20/66] drm/i915: clear the entire sdvo infoframe buffer Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-16 16:14   ` Ben Hutchings
  2012-11-15  4:10 ` [ 22/66] drm/i915: Only kick out vesafb if we takeover the fbcon with KMS Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  65 siblings, 1 reply; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Rhys, Chris Wilson, Daniel Vetter

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

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

From: Daniel Vetter <daniel.vetter@ffwll.ch>

commit a9193983f4f292a82a00c72971c17ec0ee8c6c15 upstream.

The overlay on the i830M has a peculiar failure mode: It works the
first time around after boot-up, but consistenly hangs the second time
it's used.

Chris Wilson has dug out a nice errata:

"1.5.12 Clock Gating Disable for Display Register
Address Offset:	06200h–06203h

"Bit 3
Ovrunit Clock Gating Disable.
0 = Clock gating controlled by unit enabling logic
1 = Disable clock gating function
DevALM Errata ALM049: Overlay Clock Gating Must be Disabled:  Overlay
& L2 Cache clock gating must be disabled in order to prevent device
hangs when turning off overlay.SW must turn off Ovrunit clock gating
(6200h) and L2 Cache clock gating (C8h)."

Now I've nowhere found that 0xc8 register and hence couldn't apply the
l2 cache workaround. But I've remembered that part of the magic that
the OVERLAY_ON/OFF commands are supposed to do is to rearrange cache
allocations so that the overlay scaler has some scratch space.

And while pondering how that could explain the hang the 2nd time we
enable the overlay, I've remembered that the old ums overlay code did
_not_ issue the OVERLAY_OFF cmd.

And indeed, disabling the OFF cmd results in the overlay working
flawlessly, so I guess we can workaround the lack of the above
workaround by simply never disabling the overlay engine once it's
enabled.

Note that we have the first part of the above w/a already implemented
in i830_init_clock_gating - leave that as-is to avoid surprises.

v2: Add a comment in the code.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47827
Tested-by: Rhys <rhyspuk@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/i915/intel_overlay.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -431,9 +431,17 @@ static int intel_overlay_off(struct inte
 	intel_ring_emit(ring, flip_addr);
 	intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
 	/* turn overlay off */
-	intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
-	intel_ring_emit(ring, flip_addr);
-	intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
+	if (IS_I830(dev)) {
+		/* Workaround: Don't disable the overlay fully, since otherwise
+		 * it dies on the next OVERLAY_ON cmd. */
+		intel_ring_emit(ring, MI_NOOP);
+		intel_ring_emit(ring, MI_NOOP);
+		intel_ring_emit(ring, MI_NOOP);
+	} else {
+		intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
+		intel_ring_emit(ring, flip_addr);
+		intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
+	}
 	intel_ring_advance(ring);
 
 	return intel_overlay_do_wait_request(overlay, request,



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

* [ 22/66] drm/i915: Only kick out vesafb if we takeover the fbcon with KMS
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2012-11-15  4:10 ` [ 21/66] drm/i915: fix overlay on i830M Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 23/66] mac80211: check management frame header length Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Chris Wilson, Daniel Vetter

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

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

From: Chris Wilson <chris@chris-wilson.co.uk>

commit 1623392af9da983f3ad088a75076c9da05e5600d upstream.

Otherwise we may remove the only console for a nomodeset system.

We became more aggressive in our kicking with
commit e188719a2891f01b3100dca4ae3a055fb5a7ab52
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Jun 12 11:28:17 2012 +0200

    drm/i915: kick any firmware framebuffers before claiming the gtt

Reported-and-tested-by: monnier@iro.umontreal.ca
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54615
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/i915/i915_dma.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1484,7 +1484,8 @@ int i915_driver_load(struct drm_device *
 		goto put_gmch;
 	}
 
-	i915_kick_out_firmware_fb(dev_priv);
+	if (drm_core_check_feature(dev, DRIVER_MODESET))
+		i915_kick_out_firmware_fb(dev_priv);
 
 	pci_set_master(dev->pdev);
 



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

* [ 23/66] mac80211: check management frame header length
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2012-11-15  4:10 ` [ 22/66] drm/i915: Only kick out vesafb if we takeover the fbcon with KMS Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 24/66] mac80211: verify that skb data is present Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Johannes Berg

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

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

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

commit 4a4f1a5808c8bb0b72a4f6e5904c53fb8c9cd966 upstream.

Due to pskb_may_pull() checking the skb length, all
non-management frames are checked on input whether
their 802.11 header is fully present. Also add that
check for management frames and remove a check that
is now duplicate. This prevents accessing skb data
beyond the frame end.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/rx.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1430,7 +1430,6 @@ ieee80211_rx_h_defragment(struct ieee802
 	frag = sc & IEEE80211_SCTL_FRAG;
 
 	if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||
-		   (rx->skb)->len < 24 ||
 		   is_multicast_ether_addr(hdr->addr1))) {
 		/* not fragmented */
 		goto out;
@@ -2867,10 +2866,15 @@ static void __ieee80211_rx_handle_packet
 	if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
 		local->dot11ReceivedFragmentCount++;
 
-	if (ieee80211_is_mgmt(fc))
-		err = skb_linearize(skb);
-	else
+	if (ieee80211_is_mgmt(fc)) {
+		/* drop frame if too short for header */
+		if (skb->len < ieee80211_hdrlen(fc))
+			err = -ENOBUFS;
+		else
+			err = skb_linearize(skb);
+	} else {
 		err = !pskb_may_pull(skb, ieee80211_hdrlen(fc));
+	}
 
 	if (err) {
 		dev_kfree_skb(skb);



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

* [ 24/66] mac80211: verify that skb data is present
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2012-11-15  4:10 ` [ 23/66] mac80211: check management frame header length Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 25/66] mac80211: make sure data is accessible in EAPOL check Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Johannes Berg

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

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

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

commit 9b395bc3be1cebf0144a127c7e67d56dbdac0930 upstream.

A number of places in the mesh code don't check that
the frame data is present and in the skb header when
trying to access. Add those checks and the necessary
pskb_may_pull() calls. This prevents accessing data
that doesn't actually exist.

To do this, export ieee80211_get_mesh_hdrlen() to be
able to use it in mac80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/net/cfg80211.h |    9 +++++++++
 net/mac80211/rx.c      |   32 +++++++++++++++++++++++++++++++-
 net/wireless/util.c    |    3 ++-
 3 files changed, 42 insertions(+), 2 deletions(-)

--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2633,6 +2633,15 @@ unsigned int ieee80211_get_hdrlen_from_s
 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
 
 /**
+ * ieee80211_get_mesh_hdrlen - get mesh extension header length
+ * @meshhdr: the mesh extension header, only the flags field
+ *	(first byte) will be accessed
+ * Returns the length of the extension header, which is always at
+ * least 6 bytes and at most 18 if address 5 and 6 are present.
+ */
+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
+
+/**
  * DOC: Data path helpers
  *
  * In addition to generic utilities, cfg80211 also offers
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -491,6 +491,11 @@ ieee80211_rx_mesh_check(struct ieee80211
 
 		if (ieee80211_is_action(hdr->frame_control)) {
 			u8 category;
+
+			/* make sure category field is present */
+			if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE)
+				return RX_DROP_MONITOR;
+
 			mgmt = (struct ieee80211_mgmt *)hdr;
 			category = mgmt->u.action.category;
 			if (category != WLAN_CATEGORY_MESH_ACTION &&
@@ -1852,6 +1857,20 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
 
 	hdr = (struct ieee80211_hdr *) skb->data;
 	hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+	/* make sure fixed part of mesh header is there, also checks skb len */
+	if (!pskb_may_pull(rx->skb, hdrlen + 6))
+		return RX_DROP_MONITOR;
+
+	mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
+
+	/* make sure full mesh header is there, also checks skb len */
+	if (!pskb_may_pull(rx->skb,
+			   hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr)))
+		return RX_DROP_MONITOR;
+
+	/* reload pointers */
+	hdr = (struct ieee80211_hdr *) skb->data;
 	mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
 
 	/* frame is in RMC, don't forward */
@@ -1875,9 +1894,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
 		if (is_multicast_ether_addr(hdr->addr1)) {
 			mpp_addr = hdr->addr3;
 			proxied_addr = mesh_hdr->eaddr1;
-		} else {
+		} else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) {
+			/* has_a4 already checked in ieee80211_rx_mesh_check */
 			mpp_addr = hdr->addr4;
 			proxied_addr = mesh_hdr->eaddr2;
+		} else {
+			return RX_DROP_MONITOR;
 		}
 
 		rcu_read_lock();
@@ -2314,6 +2336,10 @@ ieee80211_rx_h_action(struct ieee80211_r
 		}
 		break;
 	case WLAN_CATEGORY_SELF_PROTECTED:
+		if (len < (IEEE80211_MIN_ACTION_SIZE +
+			   sizeof(mgmt->u.action.u.self_prot.action_code)))
+			break;
+
 		switch (mgmt->u.action.u.self_prot.action_code) {
 		case WLAN_SP_MESH_PEERING_OPEN:
 		case WLAN_SP_MESH_PEERING_CLOSE:
@@ -2332,6 +2358,10 @@ ieee80211_rx_h_action(struct ieee80211_r
 		}
 		break;
 	case WLAN_CATEGORY_MESH_ACTION:
+		if (len < (IEEE80211_MIN_ACTION_SIZE +
+			   sizeof(mgmt->u.action.u.mesh_action.action_code)))
+			break;
+
 		if (!ieee80211_vif_is_mesh(&sdata->vif))
 			break;
 		if (mesh_action_is_path_sel(mgmt) &&
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -309,7 +309,7 @@ unsigned int ieee80211_get_hdrlen_from_s
 }
 EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
 
-static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
 {
 	int ae = meshhdr->flags & MESH_FLAGS_AE;
 	/* 802.11-2012, 8.2.4.7.3 */
@@ -323,6 +323,7 @@ static int ieee80211_get_mesh_hdrlen(str
 		return 18;
 	}
 }
+EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
 
 int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
 			   enum nl80211_iftype iftype)



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

* [ 25/66] mac80211: make sure data is accessible in EAPOL check
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2012-11-15  4:10 ` [ 24/66] mac80211: verify that skb data is present Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 26/66] mac80211: fix SSID copy on IBSS JOIN Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Johannes Berg

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

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

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

commit 6dbda2d00d466225f9db1dc695ff852443f28832 upstream.

The code to allow EAPOL frames even when the station
isn't yet marked associated needs to check that the
incoming frame is long enough and due to paged RX it
also can't assume skb->data contains the right data,
it must use skb_copy_bits(). Fix this to avoid using
data that doesn't really exist.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/rx.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -848,14 +848,16 @@ ieee80211_rx_h_check(struct ieee80211_rx
 		 */
 		if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION &&
 		    ieee80211_is_data_present(hdr->frame_control)) {
-			u16 ethertype;
-			u8 *payload;
+			unsigned int hdrlen;
+			__be16 ethertype;
 
-			payload = rx->skb->data +
-				ieee80211_hdrlen(hdr->frame_control);
-			ethertype = (payload[6] << 8) | payload[7];
-			if (cpu_to_be16(ethertype) ==
-			    rx->sdata->control_port_protocol)
+			hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+			if (rx->skb->len < hdrlen + 8)
+				return RX_DROP_MONITOR;
+
+			skb_copy_bits(rx->skb, hdrlen + 6, &ethertype, 2);
+			if (ethertype == rx->sdata->control_port_protocol)
 				return RX_CONTINUE;
 		}
 



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

* [ 26/66] mac80211: fix SSID copy on IBSS JOIN
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2012-11-15  4:10 ` [ 25/66] mac80211: make sure data is accessible in EAPOL check Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 27/66] nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Antonio Quartulli, Johannes Berg

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

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

From: Antonio Quartulli <ordex@autistici.org>

commit badecb001a310408d3473b1fc2ed5aefd0bc92a9 upstream.

The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and
its length is likely to be less than IEEE80211_MAX_SSID_LEN most
of the time.

This patch fixes the ssid copy in ieee80211_ibss_join() by using
the SSID length to prevent it from reading beyond the string.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
[rewrapped commit message, small rewording]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/ibss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1074,7 +1074,7 @@ int ieee80211_ibss_join(struct ieee80211
 	sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
 	sdata->u.ibss.ibss_join_req = jiffies;
 
-	memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN);
+	memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len);
 	sdata->u.ibss.ssid_len = params->ssid_len;
 
 	mutex_unlock(&sdata->u.ibss.mtx);



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

* [ 27/66] nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2012-11-15  4:10 ` [ 26/66] mac80211: fix SSID copy on IBSS JOIN Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 28/66] nfs: Show original device name verbatim in /proc/*/mount{s,info} Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Steve Dickson, Trond Myklebust

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

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

From: Scott Mayhew <smayhew@redhat.com>

commit acce94e68a0f346115fd41cdc298197d2d5a59ad upstream.

In very busy v3 environment, rpc.mountd can respond to the NULL
procedure but not the MNT procedure in a timely manner causing
the MNT procedure to time out. The problem is the mount system
call returns EIO which causes the mount to fail, instead of
ETIMEDOUT, which would cause the mount to be retried.

This patch sets the RPC_TASK_SOFT|RPC_TASK_TIMEOUT flags to
the rpc_call_sync() call in nfs_mount() which causes
ETIMEDOUT to be returned on timed out connections.

Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/mount_clnt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -181,7 +181,7 @@ int nfs_mount(struct nfs_mount_request *
 	else
 		msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT];
 
-	status = rpc_call_sync(mnt_clnt, &msg, 0);
+	status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT);
 	rpc_shutdown_client(mnt_clnt);
 
 	if (status < 0)



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

* [ 28/66] nfs: Show original device name verbatim in /proc/*/mount{s,info}
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2012-11-15  4:10 ` [ 27/66] nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 29/66] NFSv4: nfs4_locku_done must release the sequence id Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Ben Hutchings, Jonathan Nieder,
	Trond Myklebust

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

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

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

commit 97a54868262da1629a3e65121e65b8e8c4419d9f upstream.

Since commit c7f404b ('vfs: new superblock methods to override
/proc/*/mount{s,info}'), nfs_path() is used to generate the mounted
device name reported back to userland.

nfs_path() always generates a trailing slash when the given dentry is
the root of an NFS mount, but userland may expect the original device
name to be returned verbatim (as it used to be).  Make this
canonicalisation optional and change the callers accordingly.

[jrnieder@gmail.com: use flag instead of bool argument]
Reported-and-tested-by: Chris Hiestand <chiestand@salk.edu>
Reference: http://bugs.debian.org/669314
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/internal.h      |    5 +++--
 fs/nfs/namespace.c     |   19 ++++++++++++++-----
 fs/nfs/nfs4namespace.c |    3 ++-
 fs/nfs/super.c         |    2 +-
 4 files changed, 20 insertions(+), 9 deletions(-)

--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -353,8 +353,9 @@ extern void nfs_sb_active(struct super_b
 extern void nfs_sb_deactive(struct super_block *sb);
 
 /* namespace.c */
+#define NFS_PATH_CANONICAL 1
 extern char *nfs_path(char **p, struct dentry *dentry,
-		      char *buffer, ssize_t buflen);
+		      char *buffer, ssize_t buflen, unsigned flags);
 extern struct vfsmount *nfs_d_automount(struct path *path);
 struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *,
 			      struct nfs_fh *, struct nfs_fattr *);
@@ -491,7 +492,7 @@ static inline char *nfs_devname(struct d
 				char *buffer, ssize_t buflen)
 {
 	char *dummy;
-	return nfs_path(&dummy, dentry, buffer, buflen);
+	return nfs_path(&dummy, dentry, buffer, buflen, NFS_PATH_CANONICAL);
 }
 
 /*
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -33,6 +33,7 @@ int nfs_mountpoint_expiry_timeout = 500
  * @dentry - pointer to dentry
  * @buffer - result buffer
  * @buflen - length of buffer
+ * @flags - options (see below)
  *
  * Helper function for constructing the server pathname
  * by arbitrary hashed dentry.
@@ -40,8 +41,14 @@ int nfs_mountpoint_expiry_timeout = 500
  * This is mainly for use in figuring out the path on the
  * server side when automounting on top of an existing partition
  * and in generating /proc/mounts and friends.
+ *
+ * Supported flags:
+ * NFS_PATH_CANONICAL: ensure there is exactly one slash after
+ *		       the original device (export) name
+ *		       (if unset, the original name is returned verbatim)
  */
-char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
+char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,
+	       unsigned flags)
 {
 	char *end;
 	int namelen;
@@ -74,7 +81,7 @@ rename_retry:
 		rcu_read_unlock();
 		goto rename_retry;
 	}
-	if (*end != '/') {
+	if ((flags & NFS_PATH_CANONICAL) && *end != '/') {
 		if (--buflen < 0) {
 			spin_unlock(&dentry->d_lock);
 			rcu_read_unlock();
@@ -91,9 +98,11 @@ rename_retry:
 		return end;
 	}
 	namelen = strlen(base);
-	/* Strip off excess slashes in base string */
-	while (namelen > 0 && base[namelen - 1] == '/')
-		namelen--;
+	if (flags & NFS_PATH_CANONICAL) {
+		/* Strip off excess slashes in base string */
+		while (namelen > 0 && base[namelen - 1] == '/')
+			namelen--;
+	}
 	buflen -= namelen;
 	if (buflen < 0) {
 		spin_unlock(&dentry->d_lock);
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -81,7 +81,8 @@ static char *nfs_path_component(const ch
 static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen)
 {
 	char *limit;
-	char *path = nfs_path(&limit, dentry, buffer, buflen);
+	char *path = nfs_path(&limit, dentry, buffer, buflen,
+			      NFS_PATH_CANONICAL);
 	if (!IS_ERR(path)) {
 		char *path_component = nfs_path_component(path, limit);
 		if (path_component)
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -765,7 +765,7 @@ int nfs_show_devname(struct seq_file *m,
 	int err = 0;
 	if (!page)
 		return -ENOMEM;
-	devname = nfs_path(&dummy, root, page, PAGE_SIZE);
+	devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
 	if (IS_ERR(devname))
 		err = PTR_ERR(devname);
 	else



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

* [ 29/66] NFSv4: nfs4_locku_done must release the sequence id
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2012-11-15  4:10 ` [ 28/66] nfs: Show original device name verbatim in /proc/*/mount{s,info} Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 30/66] NFSv4.1: We must release the sequence id when we fail to get a session slot Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Trond Myklebust

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

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

From: Trond Myklebust <Trond.Myklebust@netapp.com>

commit 2b1bc308f492589f7d49012ed24561534ea2be8c upstream.

If the state recovery machinery is triggered by the call to
nfs4_async_handle_error() then we can deadlock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4390,6 +4390,7 @@ static void nfs4_locku_done(struct rpc_t
 			if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN)
 				rpc_restart_call_prepare(task);
 	}
+	nfs_release_seqid(calldata->arg.seqid);
 }
 
 static void nfs4_locku_prepare(struct rpc_task *task, void *data)



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

* [ 30/66] NFSv4.1: We must release the sequence id when we fail to get a session slot
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2012-11-15  4:10 ` [ 29/66] NFSv4: nfs4_locku_done must release the sequence id Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 31/66] NFS: Wait for session recovery to finish before returning Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Trond Myklebust

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

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

From: Trond Myklebust <Trond.Myklebust@netapp.com>

commit 2240a9e2d013d8269ea425b73e1d7a54c7bc141f upstream.

If we do not release the sequence id in cases where we fail to get a
session slot, then we can deadlock if we hit a recovery scenario.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c |   36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1499,9 +1499,11 @@ static void nfs4_open_prepare(struct rpc
 	data->timestamp = jiffies;
 	if (nfs4_setup_sequence(data->o_arg.server,
 				&data->o_arg.seq_args,
-				&data->o_res.seq_res, task))
-		return;
-	rpc_call_start(task);
+				&data->o_res.seq_res,
+				task) != 0)
+		nfs_release_seqid(data->o_arg.seqid);
+	else
+		rpc_call_start(task);
 	return;
 unlock_no_action:
 	rcu_read_unlock();
@@ -2182,9 +2184,10 @@ static void nfs4_close_prepare(struct rp
 	if (nfs4_setup_sequence(NFS_SERVER(calldata->inode),
 				&calldata->arg.seq_args,
 				&calldata->res.seq_res,
-				task))
-		goto out;
-	rpc_call_start(task);
+				task) != 0)
+		nfs_release_seqid(calldata->arg.seqid);
+	else
+		rpc_call_start(task);
 out:
 	dprintk("%s: done!\n", __func__);
 }
@@ -4407,9 +4410,11 @@ static void nfs4_locku_prepare(struct rp
 	calldata->timestamp = jiffies;
 	if (nfs4_setup_sequence(calldata->server,
 				&calldata->arg.seq_args,
-				&calldata->res.seq_res, task))
-		return;
-	rpc_call_start(task);
+				&calldata->res.seq_res,
+				task) != 0)
+		nfs_release_seqid(calldata->arg.seqid);
+	else
+		rpc_call_start(task);
 }
 
 static const struct rpc_call_ops nfs4_locku_ops = {
@@ -4554,7 +4559,7 @@ static void nfs4_lock_prepare(struct rpc
 	/* Do we need to do an open_to_lock_owner? */
 	if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
 		if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
-			return;
+			goto out_release_lock_seqid;
 		data->arg.open_stateid = &state->stateid;
 		data->arg.new_lock_owner = 1;
 		data->res.open_seqid = data->arg.open_seqid;
@@ -4563,10 +4568,15 @@ static void nfs4_lock_prepare(struct rpc
 	data->timestamp = jiffies;
 	if (nfs4_setup_sequence(data->server,
 				&data->arg.seq_args,
-				&data->res.seq_res, task))
+				&data->res.seq_res,
+				task) == 0) {
+		rpc_call_start(task);
 		return;
-	rpc_call_start(task);
-	dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status);
+	}
+	nfs_release_seqid(data->arg.open_seqid);
+out_release_lock_seqid:
+	nfs_release_seqid(data->arg.lock_seqid);
+	dprintk("%s: done!, ret = %d\n", __func__, task->tk_status);
 }
 
 static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata)



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

* [ 31/66] NFS: Wait for session recovery to finish before returning
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2012-11-15  4:10 ` [ 30/66] NFSv4.1: We must release the sequence id when we fail to get a session slot Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-16 16:17   ` Ben Hutchings
  2012-11-15  4:10 ` [ 32/66] NFS: fix bug in legacy DNS resolver Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  65 siblings, 1 reply; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Bryan Schumaker, Trond Myklebust

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

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

From: Bryan Schumaker <bjschuma@netapp.com>

commit 399f11c3d872bd748e1575574de265a6304c7c43 upstream.

Currently, we will schedule session recovery and then return to the
caller of nfs4_handle_exception.  This works for most cases, but causes
a hang on the following test case:

	Client				Server
	------				------
	Open file over NFS v4.1
	Write to file
					Expire client
	Try to lock file

The server will return NFS4ERR_BADSESSION, prompting the client to
schedule recovery.  However, the client will continue placing lock
attempts and the open recovery never seems to be scheduled.  The
simplest solution is to wait for session recovery to run before retrying
the lock.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -331,8 +331,7 @@ static int nfs4_handle_exception(struct
 			dprintk("%s ERROR: %d Reset session\n", __func__,
 				errorcode);
 			nfs4_schedule_session_recovery(clp->cl_session, errorcode);
-			exception->retry = 1;
-			break;
+			goto wait_on_recovery;
 #endif /* defined(CONFIG_NFS_V4_1) */
 		case -NFS4ERR_FILE_OPEN:
 			if (exception->timeout > HZ) {



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

* [ 32/66] NFS: fix bug in legacy DNS resolver.
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2012-11-15  4:10 ` [ 31/66] NFS: Wait for session recovery to finish before returning Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 33/66] batman-adv: Fix broadcast packet CRC calculation Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Chuck Lever, NeilBrown, Trond Myklebust

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

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

From: NeilBrown <neilb@suse.de>

commit 8d96b10639fb402357b75b055b1e82a65ff95050 upstream.

The DNS resolver's use of the sunrpc cache involves a 'ttl' number
(relative) rather that a timeout (absolute).  This confused me when
I wrote
  commit c5b29f885afe890f953f7f23424045cdad31d3e4
     "sunrpc: use seconds since boot in expiry cache"

and I managed to break it.  The effect is that any TTL is interpreted
as 0, and nothing useful gets into the cache.

This patch removes the use of get_expiry() - which really expects an
expiry time - and uses get_uint() instead, treating the int correctly
as a ttl.

This fixes a regression that has been present since 2.6.37, causing
certain NFS accesses in certain environments to incorrectly fail.

Reported-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/dns_resolve.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -217,7 +217,7 @@ static int nfs_dns_parse(struct cache_de
 {
 	char buf1[NFS_DNS_HOSTNAME_MAXLEN+1];
 	struct nfs_dns_ent key, *item;
-	unsigned long ttl;
+	unsigned int ttl;
 	ssize_t len;
 	int ret = -EINVAL;
 
@@ -240,7 +240,8 @@ static int nfs_dns_parse(struct cache_de
 	key.namelen = len;
 	memset(&key.h, 0, sizeof(key.h));
 
-	ttl = get_expiry(&buf);
+	if (get_uint(&buf, &ttl) < 0)
+		goto out;
 	if (ttl == 0)
 		goto out;
 	key.h.expiry_time = ttl + seconds_since_boot();



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

* [ 33/66] batman-adv: Fix broadcast packet CRC calculation
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2012-11-15  4:10 ` [ 32/66] NFS: fix bug in legacy DNS resolver Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 34/66] drm: restore open_count if drm_setup fails Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Linus LÃŒssing,
	Simon Wunderlich, Marek Lindner

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

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

From: Linus Lüssing <linus.luessing@web.de>

commit 7f112af40fecf5399b61e69ffc6b55a9d82789f7 upstream.

So far the crc16 checksum for a batman-adv broadcast data packet, received
on a batman-adv hard interface, was calculated over zero bytes of its
content leading to many incoming broadcast data packets wrongly being
dropped (60-80% packet loss).

This patch fixes this issue by calculating the crc16 over the actual,
complete broadcast payload.

The issue is a regression introduced by
("batman-adv: add broadcast duplicate check").

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/batman-adv/bridge_loop_avoidance.c |    8 ++++----
 net/batman-adv/routing.c               |    8 +++++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1205,8 +1205,8 @@ int batadv_bla_init(struct batadv_priv *
 /**
  * batadv_bla_check_bcast_duplist
  * @bat_priv: the bat priv with all the soft interface information
- * @bcast_packet: originator mac address
- * @hdr_size: maximum length of the frame
+ * @bcast_packet: encapsulated broadcast frame plus batman header
+ * @bcast_packet_len: length of encapsulated broadcast frame plus batman header
  *
  * check if it is on our broadcast list. Another gateway might
  * have sent the same packet because it is connected to the same backbone,
@@ -1219,14 +1219,14 @@ int batadv_bla_init(struct batadv_priv *
  */
 int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
 				   struct batadv_bcast_packet *bcast_packet,
-				   int hdr_size)
+				   int bcast_packet_len)
 {
 	int i, length, curr;
 	uint8_t *content;
 	uint16_t crc;
 	struct batadv_bcast_duplist_entry *entry;
 
-	length = hdr_size - sizeof(*bcast_packet);
+	length = bcast_packet_len - sizeof(*bcast_packet);
 	content = (uint8_t *)bcast_packet;
 	content += sizeof(*bcast_packet);
 
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1136,8 +1136,14 @@ int batadv_recv_bcast_packet(struct sk_b
 
 	spin_unlock_bh(&orig_node->bcast_seqno_lock);
 
+	/* keep skb linear for crc calculation */
+	if (skb_linearize(skb) < 0)
+		goto out;
+
+	bcast_packet = (struct batadv_bcast_packet *)skb->data;
+
 	/* check whether this has been sent by another originator before */
-	if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size))
+	if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, skb->len))
 		goto out;
 
 	/* rebroadcast packet */



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

* [ 34/66] drm: restore open_count if drm_setup fails
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2012-11-15  4:10 ` [ 33/66] batman-adv: Fix broadcast packet CRC calculation Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 35/66] drm: set dev_mapping before calling drm_open_helper Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Ilija Hadzic, Thomas Hellstrom, Dave Airlie

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

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

From: Ilija Hadzic <ilijahadzic@gmail.com>

commit 0f1cb1bd94a9c967cd4ad3de51cfdabe61eb5dcc upstream.

If drm_setup (called at first open) fails, the whole
open call has failed, so we should not keep the
open_count incremented.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/drm_fops.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -135,8 +135,11 @@ int drm_open(struct inode *inode, struct
 	retcode = drm_open_helper(inode, filp, dev);
 	if (!retcode) {
 		atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
-		if (!dev->open_count++)
+		if (!dev->open_count++) {
 			retcode = drm_setup(dev);
+			if (retcode)
+				dev->open_count--;
+		}
 	}
 	if (!retcode) {
 		mutex_lock(&dev->struct_mutex);



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

* [ 35/66] drm: set dev_mapping before calling drm_open_helper
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2012-11-15  4:10 ` [ 34/66] drm: restore open_count if drm_setup fails Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 36/66] hwmon: (w83627ehf) Force initial bank selection Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Ilija Hadzic, Thomas Hellstrom, Dave Airlie

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

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

From: Ilija Hadzic <ilijahadzic@gmail.com>

commit fdb40a08ef7bc970899c3a1f471165f9c22763a1 upstream.

Some drivers (specifically vmwgfx) look at dev_mapping
in their open hook, so we have to set dev->dev_mapping
earlier in the process.

Reference:
http://lists.freedesktop.org/archives/dri-devel/2012-October/029420.html

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Reported-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/drm_fops.c |   47 ++++++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 17 deletions(-)

--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -121,6 +121,8 @@ int drm_open(struct inode *inode, struct
 	int minor_id = iminor(inode);
 	struct drm_minor *minor;
 	int retcode = 0;
+	int need_setup = 0;
+	struct address_space *old_mapping;
 
 	minor = idr_find(&drm_minors_idr, minor_id);
 	if (!minor)
@@ -132,26 +134,37 @@ int drm_open(struct inode *inode, struct
 	if (drm_device_is_unplugged(dev))
 		return -ENODEV;
 
+	if (!dev->open_count++)
+		need_setup = 1;
+	mutex_lock(&dev->struct_mutex);
+	old_mapping = dev->dev_mapping;
+	if (old_mapping == NULL)
+		dev->dev_mapping = &inode->i_data;
+	/* ihold ensures nobody can remove inode with our i_data */
+	ihold(container_of(dev->dev_mapping, struct inode, i_data));
+	inode->i_mapping = dev->dev_mapping;
+	filp->f_mapping = dev->dev_mapping;
+	mutex_unlock(&dev->struct_mutex);
+
 	retcode = drm_open_helper(inode, filp, dev);
-	if (!retcode) {
-		atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
-		if (!dev->open_count++) {
-			retcode = drm_setup(dev);
-			if (retcode)
-				dev->open_count--;
-		}
-	}
-	if (!retcode) {
-		mutex_lock(&dev->struct_mutex);
-		if (dev->dev_mapping == NULL)
-			dev->dev_mapping = &inode->i_data;
-		/* ihold ensures nobody can remove inode with our i_data */
-		ihold(container_of(dev->dev_mapping, struct inode, i_data));
-		inode->i_mapping = dev->dev_mapping;
-		filp->f_mapping = dev->dev_mapping;
-		mutex_unlock(&dev->struct_mutex);
+	if (retcode)
+		goto err_undo;
+	atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
+	if (need_setup) {
+		retcode = drm_setup(dev);
+		if (retcode)
+			goto err_undo;
 	}
+	return 0;
 
+err_undo:
+	mutex_lock(&dev->struct_mutex);
+	filp->f_mapping = old_mapping;
+	inode->i_mapping = old_mapping;
+	iput(container_of(dev->dev_mapping, struct inode, i_data));
+	dev->dev_mapping = old_mapping;
+	mutex_unlock(&dev->struct_mutex);
+	dev->open_count--;
 	return retcode;
 }
 EXPORT_SYMBOL(drm_open);



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

* [ 36/66] hwmon: (w83627ehf) Force initial bank selection
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2012-11-15  4:10 ` [ 35/66] drm: set dev_mapping before calling drm_open_helper Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 37/66] ALSA: PCM: Fix some races at disconnection Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Jean Delvare, Guenter Roeck

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

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

From: Jean Delvare <khali@linux-fr.org>

commit 3300fb4f88688029fff8dfb9ec0734f6e4cba3e7 upstream.

Don't assume bank 0 is selected at device probe time. This may not be
the case. Force bank selection at first register access to guarantee
that we read the right registers upon driver loading.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/w83627ehf.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -2083,6 +2083,7 @@ static int __devinit w83627ehf_probe(str
 	mutex_init(&data->lock);
 	mutex_init(&data->update_lock);
 	data->name = w83627ehf_device_names[sio_data->kind];
+	data->bank = 0xff;		/* Force initial bank selection */
 	platform_set_drvdata(pdev, data);
 
 	/* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */



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

* [ 37/66] ALSA: PCM: Fix some races at disconnection
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2012-11-15  4:10 ` [ 36/66] hwmon: (w83627ehf) Force initial bank selection Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 38/66] ALSA: usb-audio: Fix " Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Matthieu CASTET, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 9b0573c07f278e9888c352aa9724035c75784ea0 upstream.

Fix races at PCM disconnection:
- while a PCM device is being opened or closed
- while the PCM state is being changed without lock in prepare,
  hw_params, hw_free ops

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/core/pcm.c        |    7 ++++++-
 sound/core/pcm_native.c |   16 ++++++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -1086,11 +1086,15 @@ static int snd_pcm_dev_disconnect(struct
 	if (list_empty(&pcm->list))
 		goto unlock;
 
+	mutex_lock(&pcm->open_mutex);
 	list_del_init(&pcm->list);
 	for (cidx = 0; cidx < 2; cidx++)
-		for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
+		for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
+			snd_pcm_stream_lock_irq(substream);
 			if (substream->runtime)
 				substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
+			snd_pcm_stream_unlock_irq(substream);
+		}
 	list_for_each_entry(notify, &snd_pcm_notify_list, list) {
 		notify->n_disconnect(pcm);
 	}
@@ -1106,6 +1110,7 @@ static int snd_pcm_dev_disconnect(struct
 		}
 		snd_unregister_device(devtype, pcm->card, pcm->device);
 	}
+	mutex_unlock(&pcm->open_mutex);
  unlock:
 	mutex_unlock(&register_mutex);
 	return 0;
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pc
 	return usecs;
 }
 
+static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state)
+{
+	snd_pcm_stream_lock_irq(substream);
+	if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED)
+		substream->runtime->status->state = state;
+	snd_pcm_stream_unlock_irq(substream);
+}
+
 static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_pcm_hw_params *params)
 {
@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_
 		runtime->boundary *= 2;
 
 	snd_pcm_timer_resolution_change(substream);
-	runtime->status->state = SNDRV_PCM_STATE_SETUP;
+	snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
 
 	if (pm_qos_request_active(&substream->latency_pm_qos_req))
 		pm_qos_remove_request(&substream->latency_pm_qos_req);
@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_
 	/* hardware might be unusable from this time,
 	   so we force application to retry to set
 	   the correct hardware parameter settings */
-	runtime->status->state = SNDRV_PCM_STATE_OPEN;
+	snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
 	if (substream->ops->hw_free != NULL)
 		substream->ops->hw_free(substream);
 	return err;
@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pc
 		return -EBADFD;
 	if (substream->ops->hw_free)
 		result = substream->ops->hw_free(substream);
-	runtime->status->state = SNDRV_PCM_STATE_OPEN;
+	snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
 	pm_qos_remove_request(&substream->latency_pm_qos_req);
 	return result;
 }
@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	runtime->control->appl_ptr = runtime->status->hw_ptr;
-	runtime->status->state = SNDRV_PCM_STATE_PREPARED;
+	snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED);
 }
 
 static struct action_ops snd_pcm_action_prepare = {



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

* [ 38/66] ALSA: usb-audio: Fix races at disconnection
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2012-11-15  4:10 ` [ 37/66] ALSA: PCM: Fix some races at disconnection Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 39/66] ALSA: usb-audio: Use rwsem for disconnect protection Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Matthieu CASTET, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 978520b75f0a1ce82b17e1e8186417250de6d545 upstream.

Close some races at disconnection of a USB audio device by adding the
chip->shutdown_mutex and chip->shutdown check at appropriate places.

The spots to put bandaids are:
- PCM prepare, hw_params and hw_free
- where the usb device is accessed for communication or get speed, in
 mixer.c and others; the device speed is now cached in subs->speed
 instead of accessing to chip->dev

The accesses in PCM open and close don't need the mutex protection
because these are already handled in the core PCM disconnection code.

The autosuspend/autoresume codes are still uncovered by this patch
because of possible mutex deadlocks.  They'll be covered by the
upcoming change to rwsem.

Also the mixer codes are untouched, too.  These will be fixed in
another patch, too.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/card.h   |    1 
 sound/usb/mixer.c  |   65 +++++++++++++++++++++++++++++++++++------------------
 sound/usb/pcm.c    |   45 ++++++++++++++++++++++++++----------
 sound/usb/proc.c   |    4 +--
 sound/usb/stream.c |    1 
 5 files changed, 79 insertions(+), 37 deletions(-)

--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -125,6 +125,7 @@ struct snd_usb_substream {
 	struct snd_usb_endpoint *data_endpoint;
 	struct snd_usb_endpoint *sync_endpoint;
 	unsigned long flags;
+	unsigned int speed;		/* USB_SPEED_XXX */
 
 	u64 formats;			/* format bitmasks (all or'ed) */
 	unsigned int num_formats;		/* number of supported audio formats (list) */
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_m
 	unsigned char buf[2];
 	int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
 	int timeout = 10;
-	int err;
+	int idx = 0, err;
 
 	err = snd_usb_autoresume(cval->mixer->chip);
 	if (err < 0)
 		return -EIO;
+	mutex_lock(&chip->shutdown_mutex);
 	while (timeout-- > 0) {
+		if (chip->shutdown)
+			break;
+		idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
 		if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,
 				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
-				    buf, val_len) >= val_len) {
+				    validx, idx, buf, val_len) >= val_len) {
 			*value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
-			snd_usb_autosuspend(cval->mixer->chip);
-			return 0;
+			err = 0;
+			goto out;
 		}
 	}
-	snd_usb_autosuspend(cval->mixer->chip);
 	snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
-		    request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);
-	return -EINVAL;
+		    request, validx, idx, cval->val_type);
+	err = -EINVAL;
+
+ out:
+	mutex_unlock(&chip->shutdown_mutex);
+	snd_usb_autosuspend(cval->mixer->chip);
+	return err;
 }
 
 static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_m
 	struct snd_usb_audio *chip = cval->mixer->chip;
 	unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */
 	unsigned char *val;
-	int ret, size;
+	int idx = 0, ret, size;
 	__u8 bRequest;
 
 	if (request == UAC_GET_CUR) {
@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_m
 	if (ret)
 		goto error;
 
-	ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
+	mutex_lock(&chip->shutdown_mutex);
+	if (chip->shutdown)
+		ret = -ENODEV;
+	else {
+		idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
+		ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
 			      USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-			      validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
-			      buf, size);
+			      validx, idx, buf, size);
+	}
+	mutex_unlock(&chip->shutdown_mutex);
 	snd_usb_autosuspend(chip);
 
 	if (ret < 0) {
 error:
 		snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
-			   request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);
+			   request, validx, idx, cval->val_type);
 		return ret;
 	}
 
@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct u
 {
 	struct snd_usb_audio *chip = cval->mixer->chip;
 	unsigned char buf[2];
-	int val_len, err, timeout = 10;
+	int idx = 0, val_len, err, timeout = 10;
 
 	if (cval->mixer->protocol == UAC_VERSION_1) {
 		val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct u
 	err = snd_usb_autoresume(chip);
 	if (err < 0)
 		return -EIO;
-	while (timeout-- > 0)
+	mutex_lock(&chip->shutdown_mutex);
+	while (timeout-- > 0) {
+		if (chip->shutdown)
+			break;
+		idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
 		if (snd_usb_ctl_msg(chip->dev,
 				    usb_sndctrlpipe(chip->dev, 0), request,
 				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
-				    buf, val_len) >= 0) {
-			snd_usb_autosuspend(chip);
-			return 0;
+				    validx, idx, buf, val_len) >= 0) {
+			err = 0;
+			goto out;
 		}
-	snd_usb_autosuspend(chip);
+	}
 	snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",
-		    request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]);
-	return -EINVAL;
+		    request, validx, idx, cval->val_type, buf[0], buf[1]);
+	err = -EINVAL;
+
+ out:
+	mutex_unlock(&chip->shutdown_mutex);
+	snd_usb_autosuspend(chip);
+	return err;
 }
 
 static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_poi
 	unsigned int hwptr_done;
 
 	subs = (struct snd_usb_substream *)substream->runtime->private_data;
+	if (subs->stream->chip->shutdown)
+		return SNDRV_PCM_POS_XRUN;
 	spin_lock(&subs->lock);
 	hwptr_done = subs->hwptr_done;
 	substream->runtime->delay = snd_usb_pcm_delay(subs,
@@ -471,8 +473,14 @@ static int snd_usb_hw_params(struct snd_
 	changed = subs->cur_audiofmt != fmt ||
 		subs->period_bytes != params_period_bytes(hw_params) ||
 		subs->cur_rate != rate;
+
+	mutex_lock(&subs->stream->chip->shutdown_mutex);
+	if (subs->stream->chip->shutdown) {
+		ret = -ENODEV;
+		goto unlock;
+	}
 	if ((ret = set_format(subs, fmt)) < 0)
-		return ret;
+		goto unlock;
 
 	if (subs->cur_rate != rate) {
 		struct usb_host_interface *alts;
@@ -481,12 +489,11 @@ static int snd_usb_hw_params(struct snd_
 		alts = &iface->altsetting[fmt->altset_idx];
 		ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate);
 		if (ret < 0)
-			return ret;
+			goto unlock;
 		subs->cur_rate = rate;
 	}
 
 	if (changed) {
-		mutex_lock(&subs->stream->chip->shutdown_mutex);
 		/* format changed */
 		stop_endpoints(subs, 0, 0, 0);
 		ret = snd_usb_endpoint_set_params(subs->data_endpoint, hw_params, fmt,
@@ -497,8 +504,6 @@ static int snd_usb_hw_params(struct snd_
 		if (subs->sync_endpoint)
 			ret = snd_usb_endpoint_set_params(subs->sync_endpoint,
 							  hw_params, fmt, NULL);
-unlock:
-		mutex_unlock(&subs->stream->chip->shutdown_mutex);
 	}
 
 	if (ret == 0) {
@@ -506,6 +511,8 @@ unlock:
 		subs->altset_idx = fmt->altset_idx;
 	}
 
+unlock:
+	mutex_unlock(&subs->stream->chip->shutdown_mutex);
 	return ret;
 }
 
@@ -522,8 +529,10 @@ static int snd_usb_hw_free(struct snd_pc
 	subs->cur_rate = 0;
 	subs->period_bytes = 0;
 	mutex_lock(&subs->stream->chip->shutdown_mutex);
-	stop_endpoints(subs, 0, 1, 1);
-	deactivate_endpoints(subs);
+	if (!subs->stream->chip->shutdown) {
+		stop_endpoints(subs, 0, 1, 1);
+		deactivate_endpoints(subs);
+	}
 	mutex_unlock(&subs->stream->chip->shutdown_mutex);
 	return snd_pcm_lib_free_vmalloc_buffer(substream);
 }
@@ -537,14 +546,22 @@ static int snd_usb_pcm_prepare(struct sn
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_usb_substream *subs = runtime->private_data;
+	int ret = 0;
 
 	if (! subs->cur_audiofmt) {
 		snd_printk(KERN_ERR "usbaudio: no format is specified!\n");
 		return -ENXIO;
 	}
 
-	if (snd_BUG_ON(!subs->data_endpoint))
-		return -EIO;
+	mutex_lock(&subs->stream->chip->shutdown_mutex);
+	if (subs->stream->chip->shutdown) {
+		ret = -ENODEV;
+		goto unlock;
+	}
+	if (snd_BUG_ON(!subs->data_endpoint)) {
+		ret = -EIO;
+		goto unlock;
+	}
 
 	/* some unit conversions in runtime */
 	subs->data_endpoint->maxframesize =
@@ -562,9 +579,11 @@ static int snd_usb_pcm_prepare(struct sn
 	/* for playback, submit the URBs now; otherwise, the first hwptr_done
 	 * updates for all URBs would happen at the same time when starting */
 	if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
-		return start_endpoints(subs, 1);
+		ret = start_endpoints(subs, 1);
 
-	return 0;
+ unlock:
+	mutex_unlock(&subs->stream->chip->shutdown_mutex);
+	return ret;
 }
 
 static struct snd_pcm_hardware snd_usb_hardware =
@@ -617,7 +636,7 @@ static int hw_check_valid_format(struct
 		return 0;
 	}
 	/* check whether the period time is >= the data packet interval */
-	if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) {
+	if (subs->speed != USB_SPEED_FULL) {
 		ptime = 125 * (1 << fp->datainterval);
 		if (ptime > pt->max || (ptime == pt->max && pt->openmax)) {
 			hwc_debug("   > check: ptime %u > max %u\n", ptime, pt->max);
@@ -895,7 +914,7 @@ static int setup_hw_info(struct snd_pcm_
 		return err;
 
 	param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME;
-	if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
+	if (subs->speed == USB_SPEED_FULL)
 		/* full speed devices have fixed data packet interval */
 		ptmin = 1000;
 	if (ptmin == 1000)
--- a/sound/usb/proc.c
+++ b/sound/usb/proc.c
@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(
 			}
 			snd_iprintf(buffer, "\n");
 		}
-		if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL)
+		if (subs->speed != USB_SPEED_FULL)
 			snd_iprintf(buffer, "    Data packet interval: %d us\n",
 				    125 * (1 << fp->datainterval));
 		// snd_iprintf(buffer, "    Max Packet Size = %d\n", fp->maxpacksize);
@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct s
 		return;
 	snd_iprintf(buffer, "    Packet Size = %d\n", ep->curpacksize);
 	snd_iprintf(buffer, "    Momentary freq = %u Hz (%#x.%04x)\n",
-		    snd_usb_get_speed(subs->dev) == USB_SPEED_FULL
+		    subs->speed == USB_SPEED_FULL
 		    ? get_full_speed_hz(ep->freqm)
 		    : get_high_speed_hz(ep->freqm),
 		    ep->freqm >> 16, ep->freqm & 0xffff);
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struc
 	subs->direction = stream;
 	subs->dev = as->chip->dev;
 	subs->txfr_quirk = as->chip->txfr_quirk;
+	subs->speed = snd_usb_get_speed(subs->dev);
 
 	snd_usb_set_pcm_ops(as->pcm, stream);
 



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

* [ 39/66] ALSA: usb-audio: Use rwsem for disconnect protection
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2012-11-15  4:10 ` [ 38/66] ALSA: usb-audio: Fix " Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 40/66] ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Matthieu CASTET, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 34f3c89fda4fba9fe689db22253ca8db2f5e6386 upstream.

Replace mutex with rwsem for codec->shutdown protection so that
concurrent accesses are allowed.

Also add the protection to snd_usb_autosuspend() and
snd_usb_autoresume(), too.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/card.c     |   12 ++++++++----
 sound/usb/mixer.c    |   12 ++++++------
 sound/usb/pcm.c      |   12 ++++++------
 sound/usb/usbaudio.h |    2 +-
 4 files changed, 21 insertions(+), 17 deletions(-)

--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct u
 	}
 
 	mutex_init(&chip->mutex);
-	mutex_init(&chip->shutdown_mutex);
+	init_rwsem(&chip->shutdown_rwsem);
 	chip->index = idx;
 	chip->dev = dev;
 	chip->card = card;
@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(str
 
 	card = chip->card;
 	mutex_lock(&register_mutex);
-	mutex_lock(&chip->shutdown_mutex);
+	down_write(&chip->shutdown_rwsem);
 	chip->shutdown = 1;
 	chip->num_interfaces--;
 	if (chip->num_interfaces <= 0) {
@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(str
 			snd_usb_mixer_disconnect(p);
 		}
 		usb_chip[chip->index] = NULL;
-		mutex_unlock(&chip->shutdown_mutex);
+		up_write(&chip->shutdown_rwsem);
 		mutex_unlock(&register_mutex);
 		snd_card_free_when_closed(card);
 	} else {
-		mutex_unlock(&chip->shutdown_mutex);
+		up_write(&chip->shutdown_rwsem);
 		mutex_unlock(&register_mutex);
 	}
 }
@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_au
 {
 	int err = -ENODEV;
 
+	down_read(&chip->shutdown_rwsem);
 	if (!chip->shutdown && !chip->probing)
 		err = usb_autopm_get_interface(chip->pm_intf);
+	up_read(&chip->shutdown_rwsem);
 
 	return err;
 }
 
 void snd_usb_autosuspend(struct snd_usb_audio *chip)
 {
+	down_read(&chip->shutdown_rwsem);
 	if (!chip->shutdown && !chip->probing)
 		usb_autopm_put_interface(chip->pm_intf);
+	up_read(&chip->shutdown_rwsem);
 }
 
 static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -292,7 +292,7 @@ static int get_ctl_value_v1(struct usb_m
 	err = snd_usb_autoresume(cval->mixer->chip);
 	if (err < 0)
 		return -EIO;
-	mutex_lock(&chip->shutdown_mutex);
+	down_read(&chip->shutdown_rwsem);
 	while (timeout-- > 0) {
 		if (chip->shutdown)
 			break;
@@ -310,7 +310,7 @@ static int get_ctl_value_v1(struct usb_m
 	err = -EINVAL;
 
  out:
-	mutex_unlock(&chip->shutdown_mutex);
+	up_read(&chip->shutdown_rwsem);
 	snd_usb_autosuspend(cval->mixer->chip);
 	return err;
 }
@@ -337,7 +337,7 @@ static int get_ctl_value_v2(struct usb_m
 	if (ret)
 		goto error;
 
-	mutex_lock(&chip->shutdown_mutex);
+	down_read(&chip->shutdown_rwsem);
 	if (chip->shutdown)
 		ret = -ENODEV;
 	else {
@@ -346,7 +346,7 @@ static int get_ctl_value_v2(struct usb_m
 			      USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 			      validx, idx, buf, size);
 	}
-	mutex_unlock(&chip->shutdown_mutex);
+	up_read(&chip->shutdown_rwsem);
 	snd_usb_autosuspend(chip);
 
 	if (ret < 0) {
@@ -453,7 +453,7 @@ int snd_usb_mixer_set_ctl_value(struct u
 	err = snd_usb_autoresume(chip);
 	if (err < 0)
 		return -EIO;
-	mutex_lock(&chip->shutdown_mutex);
+	down_read(&chip->shutdown_rwsem);
 	while (timeout-- > 0) {
 		if (chip->shutdown)
 			break;
@@ -471,7 +471,7 @@ int snd_usb_mixer_set_ctl_value(struct u
 	err = -EINVAL;
 
  out:
-	mutex_unlock(&chip->shutdown_mutex);
+	up_read(&chip->shutdown_rwsem);
 	snd_usb_autosuspend(chip);
 	return err;
 }
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -474,7 +474,7 @@ static int snd_usb_hw_params(struct snd_
 		subs->period_bytes != params_period_bytes(hw_params) ||
 		subs->cur_rate != rate;
 
-	mutex_lock(&subs->stream->chip->shutdown_mutex);
+	down_read(&subs->stream->chip->shutdown_rwsem);
 	if (subs->stream->chip->shutdown) {
 		ret = -ENODEV;
 		goto unlock;
@@ -512,7 +512,7 @@ static int snd_usb_hw_params(struct snd_
 	}
 
 unlock:
-	mutex_unlock(&subs->stream->chip->shutdown_mutex);
+	up_read(&subs->stream->chip->shutdown_rwsem);
 	return ret;
 }
 
@@ -528,12 +528,12 @@ static int snd_usb_hw_free(struct snd_pc
 	subs->cur_audiofmt = NULL;
 	subs->cur_rate = 0;
 	subs->period_bytes = 0;
-	mutex_lock(&subs->stream->chip->shutdown_mutex);
+	down_read(&subs->stream->chip->shutdown_rwsem);
 	if (!subs->stream->chip->shutdown) {
 		stop_endpoints(subs, 0, 1, 1);
 		deactivate_endpoints(subs);
 	}
-	mutex_unlock(&subs->stream->chip->shutdown_mutex);
+	up_read(&subs->stream->chip->shutdown_rwsem);
 	return snd_pcm_lib_free_vmalloc_buffer(substream);
 }
 
@@ -553,7 +553,7 @@ static int snd_usb_pcm_prepare(struct sn
 		return -ENXIO;
 	}
 
-	mutex_lock(&subs->stream->chip->shutdown_mutex);
+	down_read(&subs->stream->chip->shutdown_rwsem);
 	if (subs->stream->chip->shutdown) {
 		ret = -ENODEV;
 		goto unlock;
@@ -582,7 +582,7 @@ static int snd_usb_pcm_prepare(struct sn
 		ret = start_endpoints(subs, 1);
 
  unlock:
-	mutex_unlock(&subs->stream->chip->shutdown_mutex);
+	up_read(&subs->stream->chip->shutdown_rwsem);
 	return ret;
 }
 
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -37,7 +37,7 @@ struct snd_usb_audio {
 	struct usb_interface *pm_intf;
 	u32 usb_id;
 	struct mutex mutex;
-	struct mutex shutdown_mutex;
+	struct rw_semaphore shutdown_rwsem;
 	unsigned int shutdown:1;
 	unsigned int probing:1;
 	unsigned int autosuspended:1;	



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

* [ 40/66] ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2012-11-15  4:10 ` [ 39/66] ALSA: usb-audio: Use rwsem for disconnect protection Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 41/66] ALSA: Add a reference counter to card instance Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Matthieu CASTET, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 888ea7d5ac6815ba16b3b3a20f665a92c7af6724 upstream.

Similar like the previous commit, cover with chip->shutdown_rwsem
and chip->shutdown checks.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/mixer_quirks.c |   58 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 7 deletions(-)

--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct
 	if (value > 1)
 		return -EINVAL;
 	changed = value != mixer->audigy2nx_leds[index];
+	down_read(&mixer->chip->shutdown_rwsem);
+	if (mixer->chip->shutdown) {
+		err = -ENODEV;
+		goto out;
+	}
 	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
 		err = snd_usb_ctl_msg(mixer->chip->dev,
 			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct
 			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
 			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
 			      value, index + 2, NULL, 0);
+ out:
+	up_read(&mixer->chip->shutdown_rwsem);
 	if (err < 0)
 		return err;
 	mixer->audigy2nx_leds[index] = value;
@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(stru
 
 	for (i = 0; jacks[i].name; ++i) {
 		snd_iprintf(buffer, "%s: ", jacks[i].name);
-		err = snd_usb_ctl_msg(mixer->chip->dev,
+		down_read(&mixer->chip->shutdown_rwsem);
+		if (mixer->chip->shutdown)
+			err = 0;
+		else
+			err = snd_usb_ctl_msg(mixer->chip->dev,
 				      usb_rcvctrlpipe(mixer->chip->dev, 0),
 				      UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
 				      USB_RECIP_INTERFACE, 0,
 				      jacks[i].unitid << 8, buf, 3);
+		up_read(&mixer->chip->shutdown_rwsem);
 		if (err == 3 && (buf[0] == 3 || buf[0] == 6))
 			snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
 		else
@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struc
 	else
 		new_status = old_status & ~0x02;
 	changed = new_status != old_status;
-	err = snd_usb_ctl_msg(mixer->chip->dev,
+	down_read(&mixer->chip->shutdown_rwsem);
+	if (mixer->chip->shutdown)
+		err = -ENODEV;
+	else
+		err = snd_usb_ctl_msg(mixer->chip->dev,
 			      usb_sndctrlpipe(mixer->chip->dev, 0), 0x08,
 			      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
 			      50, 0, &new_status, 1);
+	up_read(&mixer->chip->shutdown_rwsem);
 	if (err < 0)
 		return err;
 	mixer->xonar_u1_status = new_status;
@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control
 	u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
 	u16 wIndex = kcontrol->private_value & 0xffff;
 	u8 tmp;
+	int ret;
 
-	int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
+	down_read(&mixer->chip->shutdown_rwsem);
+	if (mixer->chip->shutdown)
+		ret = -ENODEV;
+	else
+		ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
 				  USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
 				  0, cpu_to_le16(wIndex),
 				  &tmp, sizeof(tmp), 1000);
+	up_read(&mixer->chip->shutdown_rwsem);
 
 	if (ret < 0) {
 		snd_printk(KERN_ERR
@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control
 	u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
 	u16 wIndex = kcontrol->private_value & 0xffff;
 	u16 wValue = ucontrol->value.integer.value[0];
+	int ret;
 
-	int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
+	down_read(&mixer->chip->shutdown_rwsem);
+	if (mixer->chip->shutdown)
+		ret = -ENODEV;
+	else
+		ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
 				  USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
 				  cpu_to_le16(wValue), cpu_to_le16(wIndex),
 				  NULL, 0, 1000);
+	up_read(&mixer->chip->shutdown_rwsem);
 
 	if (ret < 0) {
 		snd_printk(KERN_ERR
@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct
 		return -EINVAL;
 
 
-	err = snd_usb_ctl_msg(chip->dev,
+	down_read(&mixer->chip->shutdown_rwsem);
+	if (mixer->chip->shutdown)
+		err = -ENODEV;
+	else
+		err = snd_usb_ctl_msg(chip->dev,
 			usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
 			USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 			validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
 			value, val_len);
+	up_read(&mixer->chip->shutdown_rwsem);
 	if (err < 0)
 		return err;
 
@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct
 
 	if (!pval->is_cached) {
 		/* Read current value */
-		err = snd_usb_ctl_msg(chip->dev,
+		down_read(&mixer->chip->shutdown_rwsem);
+		if (mixer->chip->shutdown)
+			err = -ENODEV;
+		else
+			err = snd_usb_ctl_msg(chip->dev,
 				usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
 				USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 				validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
 				value, val_len);
+		up_read(&mixer->chip->shutdown_rwsem);
 		if (err < 0)
 			return err;
 
@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct
 	if (cur_val != new_val) {
 		value[0] = new_val;
 		value[1] = 0;
-		err = snd_usb_ctl_msg(chip->dev,
+		down_read(&mixer->chip->shutdown_rwsem);
+		if (mixer->chip->shutdown)
+			err = -ENODEV;
+		else
+			err = snd_usb_ctl_msg(chip->dev,
 				usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR,
 				USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
 				validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
 				value, val_len);
+		up_read(&mixer->chip->shutdown_rwsem);
 		if (err < 0)
 			return err;
 



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

* [ 41/66] ALSA: Add a reference counter to card instance
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2012-11-15  4:10 ` [ 40/66] ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 42/66] ALSA: Avoid endless sleep after disconnect Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Matthieu CASTET, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit a0830dbd4e42b38aefdf3fb61ba5019a1a99ea85 upstream.

For more strict protection for wild disconnections, a refcount is
introduced to the card instance, and let it up/down when an object is
referred via snd_lookup_*() in the open ops.

The free-after-last-close check is also changed to check this refcount
instead of the empty list, too.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/sound/core.h          |    3 ++
 sound/core/compress_offload.c |    9 +++++--
 sound/core/control.c          |    3 ++
 sound/core/hwdep.c            |    5 +++-
 sound/core/init.c             |   50 +++++++++++++++++++++++++-----------------
 sound/core/oss/mixer_oss.c    |   10 ++++++--
 sound/core/oss/pcm_oss.c      |    2 +
 sound/core/pcm_native.c       |    9 +++++--
 sound/core/rawmidi.c          |    6 ++++-
 sound/core/sound.c            |   11 +++++++--
 sound/core/sound_oss.c        |   10 ++++++--
 11 files changed, 86 insertions(+), 32 deletions(-)

--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -132,6 +132,7 @@ struct snd_card {
 	int shutdown;			/* this card is going down */
 	int free_on_last_close;		/* free in context of file_release */
 	wait_queue_head_t shutdown_sleep;
+	atomic_t refcount;		/* refcount for disconnection */
 	struct device *dev;		/* device assigned to this card */
 	struct device *card_dev;	/* cardX object for sysfs */
 
@@ -189,6 +190,7 @@ struct snd_minor {
 	const struct file_operations *f_ops;	/* file operations */
 	void *private_data;		/* private data for f_ops->open */
 	struct device *dev;		/* device for sysfs */
+	struct snd_card *card_ptr;	/* assigned card instance */
 };
 
 /* return a device pointer linked to each sound device as a parent */
@@ -295,6 +297,7 @@ int snd_card_info_done(void);
 int snd_component_add(struct snd_card *card, const char *component);
 int snd_card_file_add(struct snd_card *card, struct file *file);
 int snd_card_file_remove(struct snd_card *card, struct file *file);
+void snd_card_unref(struct snd_card *card);
 
 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
 
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *
 
 	if (dirn != compr->direction) {
 		pr_err("this device doesn't support this direction\n");
+		snd_card_unref(compr->card);
 		return -EINVAL;
 	}
 
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
-	if (!data)
+	if (!data) {
+		snd_card_unref(compr->card);
 		return -ENOMEM;
+	}
 	data->stream.ops = compr->ops;
 	data->stream.direction = dirn;
 	data->stream.private_data = compr->private_data;
@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *
 	runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
 	if (!runtime) {
 		kfree(data);
+		snd_card_unref(compr->card);
 		return -ENOMEM;
 	}
 	runtime->state = SNDRV_PCM_STATE_OPEN;
@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *
 		kfree(runtime);
 		kfree(data);
 	}
-	return ret;
+	snd_card_unref(compr->card);
+	return 0;
 }
 
 static int snd_compr_free(struct inode *inode, struct file *f)
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *in
 	write_lock_irqsave(&card->ctl_files_rwlock, flags);
 	list_add_tail(&ctl->list, &card->ctl_files);
 	write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
+	snd_card_unref(card);
 	return 0;
 
       __error:
@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *in
       __error2:
 	snd_card_file_remove(card, file);
       __error1:
+	if (card)
+		snd_card_unref(card);
       	return err;
 }
 
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *
 	if (hw == NULL)
 		return -ENODEV;
 
-	if (!try_module_get(hw->card->module))
+	if (!try_module_get(hw->card->module)) {
+		snd_card_unref(hw->card);
 		return -EFAULT;
+	}
 
 	init_waitqueue_entry(&wait, current);
 	add_wait_queue(&hw->open_wait, &wait);
@@ -148,6 +150,7 @@ static int snd_hwdep_open(struct inode *
 	mutex_unlock(&hw->open_mutex);
 	if (err < 0)
 		module_put(hw->card->module);
+	snd_card_unref(hw->card);
 	return err;
 }
 
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char
 	spin_lock_init(&card->files_lock);
 	INIT_LIST_HEAD(&card->files_list);
 	init_waitqueue_head(&card->shutdown_sleep);
+	atomic_set(&card->refcount, 0);
 #ifdef CONFIG_PM
 	mutex_init(&card->power_lock);
 	init_waitqueue_head(&card->power_sleep);
@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_c
 	return 0;
 }
 
+/**
+ * snd_card_unref - release the reference counter
+ * @card: the card instance
+ *
+ * Decrements the reference counter.  When it reaches to zero, wake up
+ * the sleeper and call the destructor if needed.
+ */
+void snd_card_unref(struct snd_card *card)
+{
+	if (atomic_dec_and_test(&card->refcount)) {
+		wake_up(&card->shutdown_sleep);
+		if (card->free_on_last_close)
+			snd_card_do_free(card);
+	}
+}
+EXPORT_SYMBOL(snd_card_unref);
+
 int snd_card_free_when_closed(struct snd_card *card)
 {
-	int free_now = 0;
-	int ret = snd_card_disconnect(card);
-	if (ret)
-		return ret;
+	int ret;
 
-	spin_lock(&card->files_lock);
-	if (list_empty(&card->files_list))
-		free_now = 1;
-	else
-		card->free_on_last_close = 1;
-	spin_unlock(&card->files_lock);
+	atomic_inc(&card->refcount);
+	ret = snd_card_disconnect(card);
+	if (ret) {
+		atomic_dec(&card->refcount);
+		return ret;
+	}
 
-	if (free_now)
+	card->free_on_last_close = 1;
+	if (atomic_dec_and_test(&card->refcount))
 		snd_card_do_free(card);
 	return 0;
 }
@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card)
 		return ret;
 
 	/* wait, until all devices are ready for the free operation */
-	wait_event(card->shutdown_sleep, list_empty(&card->files_list));
+	wait_event(card->shutdown_sleep, !atomic_read(&card->refcount));
 	snd_card_do_free(card);
 	return 0;
 }
@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *c
 		return -ENODEV;
 	}
 	list_add(&mfile->list, &card->files_list);
+	atomic_inc(&card->refcount);
 	spin_unlock(&card->files_lock);
 	return 0;
 }
@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add);
 int snd_card_file_remove(struct snd_card *card, struct file *file)
 {
 	struct snd_monitor_file *mfile, *found = NULL;
-	int last_close = 0;
 
 	spin_lock(&card->files_lock);
 	list_for_each_entry(mfile, &card->files_list, list) {
@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card
 			break;
 		}
 	}
-	if (list_empty(&card->files_list))
-		last_close = 1;
 	spin_unlock(&card->files_lock);
-	if (last_close) {
-		wake_up(&card->shutdown_sleep);
-		if (card->free_on_last_close)
-			snd_card_do_free(card);
-	}
 	if (!found) {
 		snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
 		return -ENOENT;
 	}
 	kfree(found);
+	snd_card_unref(card);
 	return 0;
 }
 
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct ino
 					 SNDRV_OSS_DEVICE_TYPE_MIXER);
 	if (card == NULL)
 		return -ENODEV;
-	if (card->mixer_oss == NULL)
+	if (card->mixer_oss == NULL) {
+		snd_card_unref(card);
 		return -ENODEV;
+	}
 	err = snd_card_file_add(card, file);
-	if (err < 0)
+	if (err < 0) {
+		snd_card_unref(card);
 		return err;
+	}
 	fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
 	if (fmixer == NULL) {
 		snd_card_file_remove(card, file);
+		snd_card_unref(card);
 		return -ENOMEM;
 	}
 	fmixer->card = card;
@@ -68,6 +73,7 @@ static int snd_mixer_oss_open(struct ino
 	if (!try_module_get(card->module)) {
 		kfree(fmixer);
 		snd_card_file_remove(card, file);
+		snd_card_unref(card);
 		return -EFAULT;
 	}
 	return 0;
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2457,6 +2457,8 @@ static int snd_pcm_oss_open(struct inode
       __error2:
       	snd_card_file_remove(pcm->card, file);
       __error1:
+	if (pcm)
+		snd_card_unref(pcm->card);
 	return err;
 }
 
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1641,6 +1641,7 @@ static int snd_pcm_link(struct snd_pcm_s
 	write_unlock_irq(&snd_pcm_link_rwlock);
 	up_write(&snd_pcm_link_rwsem);
  _nolock:
+	snd_card_unref(substream1->pcm->card);
 	fput(file);
 	if (res < 0)
 		kfree(group);
@@ -2115,7 +2116,9 @@ static int snd_pcm_playback_open(struct
 		return err;
 	pcm = snd_lookup_minor_data(iminor(inode),
 				    SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
-	return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
+	err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
+	snd_card_unref(pcm->card);
+	return err;
 }
 
 static int snd_pcm_capture_open(struct inode *inode, struct file *file)
@@ -2126,7 +2129,9 @@ static int snd_pcm_capture_open(struct i
 		return err;
 	pcm = snd_lookup_minor_data(iminor(inode),
 				    SNDRV_DEVICE_TYPE_PCM_CAPTURE);
-	return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
+	err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
+	snd_card_unref(pcm->card);
+	return err;
 }
 
 static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode
 	if (rmidi == NULL)
 		return -ENODEV;
 
-	if (!try_module_get(rmidi->card->module))
+	if (!try_module_get(rmidi->card->module)) {
+		snd_card_unref(rmidi->card);
 		return -ENXIO;
+	}
 
 	mutex_lock(&rmidi->open_mutex);
 	card = rmidi->card;
@@ -440,6 +442,7 @@ static int snd_rawmidi_open(struct inode
 #endif
 	file->private_data = rawmidi_file;
 	mutex_unlock(&rmidi->open_mutex);
+	snd_card_unref(rmidi->card);
 	return 0;
 
  __error:
@@ -447,6 +450,7 @@ static int snd_rawmidi_open(struct inode
  __error_card:
 	mutex_unlock(&rmidi->open_mutex);
 	module_put(rmidi->card->module);
+	snd_card_unref(rmidi->card);
 	return err;
 }
 
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -99,6 +99,10 @@ static void snd_request_other(int minor)
  *
  * Checks that a minor device with the specified type is registered, and returns
  * its user data pointer.
+ *
+ * This function increments the reference counter of the card instance
+ * if an associated instance with the given minor number and type is found.
+ * The caller must call snd_card_unref() appropriately later.
  */
 void *snd_lookup_minor_data(unsigned int minor, int type)
 {
@@ -109,9 +113,11 @@ void *snd_lookup_minor_data(unsigned int
 		return NULL;
 	mutex_lock(&sound_mutex);
 	mreg = snd_minors[minor];
-	if (mreg && mreg->type == type)
+	if (mreg && mreg->type == type) {
 		private_data = mreg->private_data;
-	else
+		if (mreg->card_ptr)
+			atomic_inc(&mreg->card_ptr->refcount);
+	} else
 		private_data = NULL;
 	mutex_unlock(&sound_mutex);
 	return private_data;
@@ -276,6 +282,7 @@ int snd_register_device_for_dev(int type
 	preg->device = dev;
 	preg->f_ops = f_ops;
 	preg->private_data = private_data;
+	preg->card_ptr = card;
 	mutex_lock(&sound_mutex);
 #ifdef CONFIG_SND_DYNAMIC_MINORS
 	minor = snd_find_free_minor(type);
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -40,6 +40,9 @@
 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
 static DEFINE_MUTEX(sound_oss_mutex);
 
+/* NOTE: This function increments the refcount of the associated card like
+ * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately
+ */
 void *snd_lookup_oss_minor_data(unsigned int minor, int type)
 {
 	struct snd_minor *mreg;
@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned
 		return NULL;
 	mutex_lock(&sound_oss_mutex);
 	mreg = snd_oss_minors[minor];
-	if (mreg && mreg->type == type)
+	if (mreg && mreg->type == type) {
 		private_data = mreg->private_data;
-	else
+		if (mreg->card_ptr)
+			atomic_inc(&mreg->card_ptr->refcount);
+	} else
 		private_data = NULL;
 	mutex_unlock(&sound_oss_mutex);
 	return private_data;
@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, st
 	preg->device = dev;
 	preg->f_ops = f_ops;
 	preg->private_data = private_data;
+	preg->card_ptr = card;
 	mutex_lock(&sound_oss_mutex);
 	snd_oss_minors[minor] = preg;
 	minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);



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

* [ 42/66] ALSA: Avoid endless sleep after disconnect
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2012-11-15  4:10 ` [ 41/66] ALSA: Add a reference counter to card instance Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  7:25   ` Takashi Iwai
  2012-11-15  4:10 ` [ 43/66] sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter() Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  65 siblings, 1 reply; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Takashi Iwai

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

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


From: Takashi Iwai <tiwai@suse.de>

commit 0914f7961babbf28aaa2f19b453951fb4841c03f upstream.

When disconnect callback is called, each component should wake up
sleepers and check card->shutdown flag for avoiding the endless sleep
blocking the proper resource release.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/core/control.c     |    2 ++
 sound/core/hwdep.c       |    7 +++++++
 sound/core/oss/pcm_oss.c |    4 ++++
 sound/core/pcm.c         |    6 +++++-
 sound/core/pcm_native.c  |    8 ++++++++
 sound/core/rawmidi.c     |   20 ++++++++++++++++++++
 6 files changed, 46 insertions(+), 1 deletion(-)

--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1436,6 +1436,8 @@ static ssize_t snd_ctl_read(struct file
 			spin_unlock_irq(&ctl->read_lock);
 			schedule();
 			remove_wait_queue(&ctl->change_sleep, &wait);
+			if (ctl->card->shutdown)
+				return -ENODEV;
 			if (signal_pending(current))
 				return -ERESTARTSYS;
 			spin_lock_irq(&ctl->read_lock);
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -131,6 +131,10 @@ static int snd_hwdep_open(struct inode *
 		mutex_unlock(&hw->open_mutex);
 		schedule();
 		mutex_lock(&hw->open_mutex);
+		if (hw->card->shutdown) {
+			err = -ENODEV;
+			break;
+		}
 		if (signal_pending(current)) {
 			err = -ERESTARTSYS;
 			break;
@@ -462,12 +466,15 @@ static int snd_hwdep_dev_disconnect(stru
 		mutex_unlock(&register_mutex);
 		return -EINVAL;
 	}
+	mutex_lock(&hwdep->open_mutex);
+	wake_up(&hwdep->open_wait);
 #ifdef CONFIG_SND_OSSEMUL
 	if (hwdep->ossreg)
 		snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
 #endif
 	snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
 	list_del_init(&hwdep->list);
+	mutex_unlock(&hwdep->open_mutex);
 	mutex_unlock(&register_mutex);
 	return 0;
 }
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode
 		mutex_unlock(&pcm->open_mutex);
 		schedule();
 		mutex_lock(&pcm->open_mutex);
+		if (pcm->card->shutdown) {
+			err = -ENODEV;
+			break;
+		}
 		if (signal_pending(current)) {
 			err = -ERESTARTSYS;
 			break;
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -1087,12 +1087,16 @@ static int snd_pcm_dev_disconnect(struct
 		goto unlock;
 
 	mutex_lock(&pcm->open_mutex);
+	wake_up(&pcm->open_wait);
 	list_del_init(&pcm->list);
 	for (cidx = 0; cidx < 2; cidx++)
 		for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
 			snd_pcm_stream_lock_irq(substream);
-			if (substream->runtime)
+			if (substream->runtime) {
 				substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
+				wake_up(&substream->runtime->sleep);
+				wake_up(&substream->runtime->tsleep);
+			}
 			snd_pcm_stream_unlock_irq(substream);
 		}
 	list_for_each_entry(notify, &snd_pcm_notify_list, list) {
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1518,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_
 		down_read(&snd_pcm_link_rwsem);
 		snd_pcm_stream_lock_irq(substream);
 		remove_wait_queue(&to_check->sleep, &wait);
+		if (card->shutdown) {
+			result = -ENODEV;
+			break;
+		}
 		if (tout == 0) {
 			if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
 				result = -ESTRPIPE;
@@ -2168,6 +2172,10 @@ static int snd_pcm_open(struct file *fil
 		mutex_unlock(&pcm->open_mutex);
 		schedule();
 		mutex_lock(&pcm->open_mutex);
+		if (pcm->card->shutdown) {
+			err = -ENODEV;
+			break;
+		}
 		if (signal_pending(current)) {
 			err = -ERESTARTSYS;
 			break;
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -424,6 +424,10 @@ static int snd_rawmidi_open(struct inode
 		mutex_unlock(&rmidi->open_mutex);
 		schedule();
 		mutex_lock(&rmidi->open_mutex);
+		if (rmidi->card->shutdown) {
+			err = -ENODEV;
+			break;
+		}
 		if (signal_pending(current)) {
 			err = -ERESTARTSYS;
 			break;
@@ -995,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct f
 			spin_unlock_irq(&runtime->lock);
 			schedule();
 			remove_wait_queue(&runtime->sleep, &wait);
+			if (rfile->rmidi->card->shutdown)
+				return -ENODEV;
 			if (signal_pending(current))
 				return result > 0 ? result : -ERESTARTSYS;
 			if (!runtime->avail)
@@ -1238,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct
 			spin_unlock_irq(&runtime->lock);
 			timeout = schedule_timeout(30 * HZ);
 			remove_wait_queue(&runtime->sleep, &wait);
+			if (rfile->rmidi->card->shutdown)
+				return -ENODEV;
 			if (signal_pending(current))
 				return result > 0 ? result : -ERESTARTSYS;
 			if (!runtime->avail && !timeout)
@@ -1613,9 +1621,20 @@ static int snd_rawmidi_dev_register(stru
 static int snd_rawmidi_dev_disconnect(struct snd_device *device)
 {
 	struct snd_rawmidi *rmidi = device->device_data;
+	int dir;
 
 	mutex_lock(&register_mutex);
+	mutex_lock(&rmidi->open_mutex);
+	wake_up(&rmidi->open_wait);
 	list_del_init(&rmidi->list);
+	for (dir = 0; dir < 2; dir++) {
+		struct snd_rawmidi_substream *s;
+		list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {
+			if (s->runtime)
+				wake_up(&s->runtime->sleep);
+		}
+	}
+
 #ifdef CONFIG_SND_OSSEMUL
 	if (rmidi->ossreg) {
 		if ((int)rmidi->device == midi_map[rmidi->card->number]) {
@@ -1630,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(st
 	}
 #endif /* CONFIG_SND_OSSEMUL */
 	snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
+	mutex_unlock(&rmidi->open_mutex);
 	mutex_unlock(&register_mutex);
 	return 0;
 }



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

* [ 43/66] sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2012-11-15  4:10 ` [ 42/66] ALSA: Avoid endless sleep after disconnect Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 44/66] ipv4: Fix flushing of cached routing informations Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Zijie Pan, Nicolas Dichtel,
	Vlad Yasevich, David S. Miller

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

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


From: Zijie Pan <zijie.pan@6wind.com>

[ Upstream commit f6e80abeab928b7c47cc1fbf53df13b4398a2bec ]

Bug introduced by commit edfee0339e681a784ebacec7e8c2dc97dc6d2839
(sctp: check src addr when processing SACK to update transport state)

Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sctp/sm_sideeffect.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1634,8 +1634,9 @@ static int sctp_cmd_interpreter(sctp_eve
 					asoc->outqueue.outstanding_bytes;
 			sackh.num_gap_ack_blocks = 0;
 			sackh.num_dup_tsns = 0;
+			chunk->subh.sack_hdr = &sackh;
 			sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK,
-					SCTP_SACKH(&sackh));
+					SCTP_CHUNK(chunk));
 			break;
 
 		case SCTP_CMD_DISCARD_PACKET:



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

* [ 44/66] ipv4: Fix flushing of cached routing informations
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2012-11-15  4:10 ` [ 43/66] sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter() Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 45/66] netlink: use kfree_rcu() in netlink_release() Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Steffen Klassert, Eric Dumazet,
	David S. Miller

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

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


From: Steffen Klassert <steffen.klassert@secunet.com>

[ Upstream commit 13d82bf50dce632355fcccafa4fe44a9b5e706d8 ]

Currently we can not flush cached pmtu/redirect informations via
the ipv4_sysctl_rtcache_flush sysctl. We need to check the rt_genid
of the old route and reset the nh exeption if the old route is
expired when we bind a new route to a nh exeption.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/route.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1166,8 +1166,12 @@ static bool rt_bind_exception(struct rta
 	spin_lock_bh(&fnhe_lock);
 
 	if (daddr == fnhe->fnhe_daddr) {
-		struct rtable *orig;
-
+		struct rtable *orig = rcu_dereference(fnhe->fnhe_rth);
+		if (orig && rt_is_expired(orig)) {
+			fnhe->fnhe_gw = 0;
+			fnhe->fnhe_pmtu = 0;
+			fnhe->fnhe_expires = 0;
+		}
 		if (fnhe->fnhe_pmtu) {
 			unsigned long expires = fnhe->fnhe_expires;
 			unsigned long diff = expires - jiffies;
@@ -1184,7 +1188,6 @@ static bool rt_bind_exception(struct rta
 		} else if (!rt->rt_gateway)
 			rt->rt_gateway = daddr;
 
-		orig = rcu_dereference(fnhe->fnhe_rth);
 		rcu_assign_pointer(fnhe->fnhe_rth, rt);
 		if (orig)
 			rt_free(orig);



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

* [ 45/66] netlink: use kfree_rcu() in netlink_release()
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2012-11-15  4:10 ` [ 44/66] ipv4: Fix flushing of cached routing informations Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 46/66] tcp: fix FIONREAD/SIOCINQ Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Jonathan Kliegman, Eric Dumazet,
	Stéphane Marchesin, Sam Leffler, David S. Miller

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

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


From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 6d772ac5578f711d1ce7b03535d1c95bffb21dff ]

On some suspend/resume operations involving wimax device, we have
noticed some intermittent memory corruptions in netlink code.

Stéphane Marchesin tracked this corruption in netlink_update_listeners()
and suggested a patch.

It appears netlink_release() should use kfree_rcu() instead of kfree()
for the listeners structure as it may be used by other cpus using RCU
protection.

netlink_release() must set to NULL the listeners pointer when
it is about to be freed.

Also have to protect netlink_update_listeners() and
netlink_has_listeners() if listeners is NULL.

Add a nl_deref_protected() lockdep helper to properly document which
locks protects us.

Reported-by: Jonathan Kliegman <kliegs@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stéphane Marchesin <marcheu@google.com>
Cc: Sam Leffler <sleffler@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/netlink/af_netlink.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -138,6 +138,8 @@ static int netlink_dump(struct sock *sk)
 static DEFINE_RWLOCK(nl_table_lock);
 static atomic_t nl_table_users = ATOMIC_INIT(0);
 
+#define nl_deref_protected(X) rcu_dereference_protected(X, lockdep_is_held(&nl_table_lock));
+
 static ATOMIC_NOTIFIER_HEAD(netlink_chain);
 
 static inline u32 netlink_group_mask(u32 group)
@@ -345,6 +347,11 @@ netlink_update_listeners(struct sock *sk
 	struct hlist_node *node;
 	unsigned long mask;
 	unsigned int i;
+	struct listeners *listeners;
+
+	listeners = nl_deref_protected(tbl->listeners);
+	if (!listeners)
+		return;
 
 	for (i = 0; i < NLGRPLONGS(tbl->groups); i++) {
 		mask = 0;
@@ -352,7 +359,7 @@ netlink_update_listeners(struct sock *sk
 			if (i < NLGRPLONGS(nlk_sk(sk)->ngroups))
 				mask |= nlk_sk(sk)->groups[i];
 		}
-		tbl->listeners->masks[i] = mask;
+		listeners->masks[i] = mask;
 	}
 	/* this function is only called with the netlink table "grabbed", which
 	 * makes sure updates are visible before bind or setsockopt return. */
@@ -536,7 +543,11 @@ static int netlink_release(struct socket
 	if (netlink_is_kernel(sk)) {
 		BUG_ON(nl_table[sk->sk_protocol].registered == 0);
 		if (--nl_table[sk->sk_protocol].registered == 0) {
-			kfree(nl_table[sk->sk_protocol].listeners);
+			struct listeners *old;
+
+			old = nl_deref_protected(nl_table[sk->sk_protocol].listeners);
+			RCU_INIT_POINTER(nl_table[sk->sk_protocol].listeners, NULL);
+			kfree_rcu(old, rcu);
 			nl_table[sk->sk_protocol].module = NULL;
 			nl_table[sk->sk_protocol].registered = 0;
 		}
@@ -978,7 +989,7 @@ int netlink_has_listeners(struct sock *s
 	rcu_read_lock();
 	listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners);
 
-	if (group - 1 < nl_table[sk->sk_protocol].groups)
+	if (listeners && group - 1 < nl_table[sk->sk_protocol].groups)
 		res = test_bit(group - 1, listeners->masks);
 
 	rcu_read_unlock();
@@ -1620,7 +1631,7 @@ int __netlink_change_ngroups(struct sock
 		new = kzalloc(sizeof(*new) + NLGRPSZ(groups), GFP_ATOMIC);
 		if (!new)
 			return -ENOMEM;
-		old = rcu_dereference_protected(tbl->listeners, 1);
+		old = nl_deref_protected(tbl->listeners);
 		memcpy(new->masks, old->masks, NLGRPSZ(tbl->groups));
 		rcu_assign_pointer(tbl->listeners, new);
 



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

* [ 46/66] tcp: fix FIONREAD/SIOCINQ
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2012-11-15  4:10 ` [ 45/66] netlink: use kfree_rcu() in netlink_release() Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 47/66] net: fix secpath kmemleak Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Elliot Hughes, Eric Dumazet,
	Neal Cardwell, Tom Herbert, David S. Miller

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

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


From: Eric Dumazet <edumazet@google.com>

[ Upstream commit a3374c42aa5f7237e87ff3b0622018636b0c847e ]

tcp_ioctl() tries to take into account if tcp socket received a FIN
to report correct number bytes in receive queue.

But its flaky because if the application ate the last skb,
we return 1 instead of 0.

Correct way to detect that FIN was received is to test SOCK_DONE.

Reported-by: Elliot Hughes <enh@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -548,14 +548,12 @@ int tcp_ioctl(struct sock *sk, int cmd,
 			 !tp->urg_data ||
 			 before(tp->urg_seq, tp->copied_seq) ||
 			 !before(tp->urg_seq, tp->rcv_nxt)) {
-			struct sk_buff *skb;
 
 			answ = tp->rcv_nxt - tp->copied_seq;
 
-			/* Subtract 1, if FIN is in queue. */
-			skb = skb_peek_tail(&sk->sk_receive_queue);
-			if (answ && skb)
-				answ -= tcp_hdr(skb)->fin;
+			/* Subtract 1, if FIN was received */
+			if (answ && sock_flag(sk, SOCK_DONE))
+				answ--;
 		} else
 			answ = tp->urg_seq - tp->copied_seq;
 		release_sock(sk);



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

* [ 47/66] net: fix secpath kmemleak
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2012-11-15  4:10 ` [ 46/66] tcp: fix FIONREAD/SIOCINQ Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 48/66] ipv6: Set default hoplimit as zero Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Mike Kazantsev, Eric Dumazet, David S. Miller

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

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


From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 3d861f661006606bf159fd6bd973e83dbf21d0f9 ]

Mike Kazantsev found 3.5 kernels and beyond were leaking memory,
and tracked the faulty commit to a1c7fff7e18f59e ("net:
netdev_alloc_skb() use build_skb()")

While this commit seems fine, it uncovered a bug introduced
in commit bad43ca8325 ("net: introduce skb_try_coalesce()), in function
kfree_skb_partial()"):

If head is stolen, we free the sk_buff,
without removing references on secpath (skb->sp).

So IPsec + IP defrag/reassembly (using skb coalescing), or
TCP coalescing could leak secpath objects.

Fix this bug by calling skb_release_head_state(skb) to properly
release all possible references to linked objects.

Reported-by: Mike Kazantsev <mk.fraggod@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Bisected-by: Mike Kazantsev <mk.fraggod@gmail.com>
Tested-by: Mike Kazantsev <mk.fraggod@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/skbuff.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3384,10 +3384,12 @@ EXPORT_SYMBOL(__skb_warn_lro_forwarding)
 
 void kfree_skb_partial(struct sk_buff *skb, bool head_stolen)
 {
-	if (head_stolen)
+	if (head_stolen) {
+		skb_release_head_state(skb);
 		kmem_cache_free(skbuff_head_cache, skb);
-	else
+	} else {
 		__kfree_skb(skb);
+	}
 }
 EXPORT_SYMBOL(kfree_skb_partial);
 



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

* [ 48/66] ipv6: Set default hoplimit as zero.
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2012-11-15  4:10 ` [ 47/66] net: fix secpath kmemleak Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 49/66] net: usb: Fix memory leak on Tx data path Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Li RongQing, David S. Miller

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

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


From: Li RongQing <roy.qing.li@gmail.com>

[ Upstream commit 14edd87dc67311556f1254a8f29cf4dd6cb5b7d1 ]

Commit a02e4b7dae4551(Demark default hoplimit as zero) only changes the
hoplimit checking condition and default value in ip6_dst_hoplimit, not
zeros all hoplimit default value.

Keep the zeroing ip6_template_metrics[RTAX_HOPLIMIT - 1] to force it as
const, cause as a37e6e344910(net: force dst_default_metrics to const
section)

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv6/route.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -219,7 +219,7 @@ static struct dst_ops ip6_dst_blackhole_
 };
 
 static const u32 ip6_template_metrics[RTAX_MAX] = {
-	[RTAX_HOPLIMIT - 1] = 255,
+	[RTAX_HOPLIMIT - 1] = 0,
 };
 
 static struct rt6_info ip6_null_entry_template = {
@@ -1241,7 +1241,7 @@ struct dst_entry *icmp6_dst_alloc(struct
 	rt->rt6i_dst.addr = fl6->daddr;
 	rt->rt6i_dst.plen = 128;
 	rt->rt6i_idev     = idev;
-	dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255);
+	dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 0);
 
 	spin_lock_bh(&icmp6_dst_lock);
 	rt->dst.next = icmp6_dst_gc_list;



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

* [ 49/66] net: usb: Fix memory leak on Tx data path
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2012-11-15  4:10 ` [ 48/66] ipv6: Set default hoplimit as zero Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 50/66] net: fix divide by zero in tcp algorithm illinois Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Hemant Kumar, Oliver Neukum, David S. Miller

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

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


From: Hemant Kumar <hemantk@codeaurora.org>

[ Upstream commit 39707c2a3ba5011038b363f84d37c8a98d2d9db1 ]

Driver anchors the tx urbs and defers the urb submission if
a transmit request comes when the interface is suspended.
Anchoring urb increments the urb reference count. These
deferred urbs are later accessed by calling usb_get_from_anchor()
for submission during interface resume. usb_get_from_anchor()
unanchors the urb but urb reference count remains same.
This causes the urb reference count to remain non-zero
after usb_free_urb() gets called and urb never gets freed.
Hence call usb_put_urb() after anchoring the urb to properly
balance the reference count for these deferred urbs. Also,
unanchor these deferred urbs during disconnect, to free them
up.

Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/usb/usbnet.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1158,6 +1158,7 @@ netdev_tx_t usbnet_start_xmit (struct sk
 		usb_anchor_urb(urb, &dev->deferred);
 		/* no use to process more packets */
 		netif_stop_queue(net);
+		usb_put_urb(urb);
 		spin_unlock_irqrestore(&dev->txq.lock, flags);
 		netdev_dbg(dev->net, "Delaying transmission for resumption\n");
 		goto deferred;
@@ -1310,6 +1311,8 @@ void usbnet_disconnect (struct usb_inter
 
 	cancel_work_sync(&dev->kevent);
 
+	usb_scuttle_anchored_urbs(&dev->deferred);
+
 	if (dev->driver_info->unbind)
 		dev->driver_info->unbind (dev, intf);
 



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

* [ 50/66] net: fix divide by zero in tcp algorithm illinois
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2012-11-15  4:10 ` [ 49/66] net: usb: Fix memory leak on Tx data path Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 51/66] drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Petr Matousek, Jesper Dangaard Brouer,
	Eric Dumazet, Stephen Hemminger, David S. Miller

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

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


From: Jesper Dangaard Brouer <brouer@redhat.com>

[ Upstream commit 8f363b77ee4fbf7c3bbcf5ec2c5ca482d396d664 ]

Reading TCP stats when using TCP Illinois congestion control algorithm
can cause a divide by zero kernel oops.

The division by zero occur in tcp_illinois_info() at:
 do_div(t, ca->cnt_rtt);
where ca->cnt_rtt can become zero (when rtt_reset is called)

Steps to Reproduce:
 1. Register tcp_illinois:
     # sysctl -w net.ipv4.tcp_congestion_control=illinois
 2. Monitor internal TCP information via command "ss -i"
     # watch -d ss -i
 3. Establish new TCP conn to machine

Either it fails at the initial conn, or else it needs to wait
for a loss or a reset.

This is only related to reading stats.  The function avg_delay() also
performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
calling point in update_params().  Thus, simply fix tcp_illinois_info().

Function tcp_illinois_info() / get_info() is called without
socket lock.  Thus, eliminate any race condition on ca->cnt_rtt
by using a local stack variable.  Simply reuse info.tcpv_rttcnt,
as its already set to ca->cnt_rtt.
Function avg_delay() is not affected by this race condition, as
its called with the socket lock.

Cc: Petr Matousek <pmatouse@redhat.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp_illinois.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -313,11 +313,13 @@ static void tcp_illinois_info(struct soc
 			.tcpv_rttcnt = ca->cnt_rtt,
 			.tcpv_minrtt = ca->base_rtt,
 		};
-		u64 t = ca->sum_rtt;
 
-		do_div(t, ca->cnt_rtt);
-		info.tcpv_rtt = t;
+		if (info.tcpv_rttcnt > 0) {
+			u64 t = ca->sum_rtt;
 
+			do_div(t, info.tcpv_rttcnt);
+			info.tcpv_rtt = t;
+		}
 		nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
 	}
 }



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

* [ 51/66] drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2012-11-15  4:10 ` [ 50/66] net: fix divide by zero in tcp algorithm illinois Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 52/66] l2tp: fix oops in l2tp_eth_create() error path Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Peter Senna Tschudin, Roland Stigge,
	Alexandre Pereira da Silva, David S. Miller

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

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


From: Peter Senna Tschudin <peter.senna@gmail.com>

[ Upstream commit 57c10b61c84bfed68b1b317d6f507a392724b9c4 ]

Based on commit b27393aecf66199f5ddad37c302d3e0cfadbe6c0

Calling mdiobus_free without calling mdiobus_unregister causes
BUG_ON(). This patch fixes the issue.

The semantic patch that found this issue(http://coccinelle.lip6.fr/):
// <smpl>
@@
expression E;
@@
  ... when != mdiobus_unregister(E);

+ mdiobus_unregister(E);
  mdiobus_free(E);
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Tested-by: Roland Stigge <stigge@antcom.de>
Tested-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/nxp/lpc_eth.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1524,6 +1524,7 @@ static int lpc_eth_drv_remove(struct pla
 				  pldat->dma_buff_base_p);
 	free_irq(ndev->irq, ndev);
 	iounmap(pldat->net_base);
+	mdiobus_unregister(pldat->mii_bus);
 	mdiobus_free(pldat->mii_bus);
 	clk_disable(pldat->clk);
 	clk_put(pldat->clk);



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

* [ 52/66] l2tp: fix oops in l2tp_eth_create() error path
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2012-11-15  4:10 ` [ 51/66] drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 53/66] tcp-repair: Handle zero-length data put in rcv queue Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Tom Parkin, David S. Miller

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

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


From: Tom Parkin <tparkin@katalix.com>

[ Upstream commit 789336360e0a2aeb9750c16ab704a02cbe035e9e ]

When creating an L2TPv3 Ethernet session, if register_netdev() should fail for
any reason (for example, automatic naming for "l2tpeth%d" interfaces hits the
32k-interface limit), the netdev is freed in the error path.  However, the
l2tp_eth_sess structure's dev pointer is left uncleared, and this results in
l2tp_eth_delete() then attempting to unregister the same netdev later in the
session teardown.  This results in an oops.

To avoid this, clear the session dev pointer in the error path.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/l2tp/l2tp_eth.c |    1 +
 1 file changed, 1 insertion(+)

--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -290,6 +290,7 @@ static int l2tp_eth_create(struct net *n
 
 out_del_dev:
 	free_netdev(dev);
+	spriv->dev = NULL;
 out_del_session:
 	l2tp_session_delete(session);
 out:



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

* [ 53/66] tcp-repair: Handle zero-length data put in rcv queue
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2012-11-15  4:10 ` [ 52/66] l2tp: fix oops in l2tp_eth_create() error path Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:10 ` [ 54/66] net: inet_diag -- Return error code if protocol handler is missed Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Pavel Emelyanov, Giorgos Mavrikas,
	David S. Miller

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

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


From: Pavel Emelyanov <xemul@parallels.com>

[ Upstream commit c454e6111d1ef4268fe98e87087216e51c2718c3 ]

When sending data into a tcp socket in repair state we should check
for the amount of data being 0 explicitly. Otherwise we'll have an skb
with seq == end_seq in rcv queue, but tcp doesn't expect this to happen
(in particular a warn_on in tcp_recvmsg shoots).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Reported-by: Giorgos Mavrikas <gmavrikas@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp_input.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4556,6 +4556,9 @@ int tcp_send_rcvq(struct sock *sk, struc
 	struct tcphdr *th;
 	bool fragstolen;
 
+	if (size == 0)
+		return 0;
+
 	skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
 	if (!skb)
 		goto err;



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

* [ 54/66] net: inet_diag -- Return error code if protocol handler is missed
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2012-11-15  4:10 ` [ 53/66] tcp-repair: Handle zero-length data put in rcv queue Greg Kroah-Hartman
@ 2012-11-15  4:10 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 55/66] af-packet: fix oops when socket is not present Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:10 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Cyrill Gorcunov, David Miller,
	Eric Dumazet, Pavel Emelyanov

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

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


From: Cyrill Gorcunov <gorcunov@openvz.org>

[ Upstream commit cacb6ba0f36ab14a507f4ee7697e8332899015d2 ]

We've observed that in case if UDP diag module is not
supported in kernel the netlink returns NLMSG_DONE without
notifying a caller that handler is missed.

This patch makes __inet_diag_dump to return error code instead.

So as example it become possible to detect such situation
and handle it gracefully on userspace level.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: David Miller <davem@davemloft.net>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/inet_diag.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -883,13 +883,16 @@ static int __inet_diag_dump(struct sk_bu
 		struct inet_diag_req_v2 *r, struct nlattr *bc)
 {
 	const struct inet_diag_handler *handler;
+	int err = 0;
 
 	handler = inet_diag_lock_handler(r->sdiag_protocol);
 	if (!IS_ERR(handler))
 		handler->dump(skb, cb, r, bc);
+	else
+		err = PTR_ERR(handler);
 	inet_diag_unlock_handler(handler);
 
-	return skb->len;
+	return err ? : skb->len;
 }
 
 static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)



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

* [ 55/66] af-packet: fix oops when socket is not present
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2012-11-15  4:10 ` [ 54/66] net: inet_diag -- Return error code if protocol handler is missed Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 56/66] ipv6: send unsolicited neighbour advertisements to all-nodes Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Eric Leblond, David S. Miller

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

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


From: Eric Leblond <eric@regit.org>

[ Upstream commit a3d744e995d2b936c500585ae39d99ee251c89b4 ]

Due to a NULL dereference, the following patch is causing oops
in normal trafic condition:

commit c0de08d04215031d68fa13af36f347a6cfa252ca
Author: Eric Leblond <eric@regit.org>
Date:   Thu Aug 16 22:02:58 2012 +0000

    af_packet: don't emit packet on orig fanout group

This buggy patch was a feature fix and has reached most stable
branches.

When skb->sk is NULL and when packet fanout is used, there is a
crash in match_fanout_group where skb->sk is accessed.
This patch fixes the issue by returning false as soon as the
socket is NULL: this correspond to the wanted behavior because
the kernel as to resend the skb to all the listening socket in
this case.

Signed-off-by: Eric Leblond <eric@regit.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1644,7 +1644,7 @@ static inline int deliver_skb(struct sk_
 
 static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb)
 {
-	if (ptype->af_packet_priv == NULL)
+	if (!ptype->af_packet_priv || !skb->sk)
 		return false;
 
 	if (ptype->id_match)



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

* [ 56/66] ipv6: send unsolicited neighbour advertisements to all-nodes
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2012-11-15  4:11 ` [ 55/66] af-packet: fix oops when socket is not present Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 57/66] futex: Handle futex_pi OWNER_DIED take over correctly Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Hannes Frederic Sowa, David S. Miller

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

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


From: Hannes Frederic Sowa <hannes@stressinduktion.org>

[ Upstream commit 60713a0ca7fd6651b951cc1b4dbd528d1fc0281b ]

As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
unsolicited neighbour advertisements should be sent to the all-nodes
multicast address.

Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv6/ndisc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -535,7 +535,7 @@ static void ndisc_send_unsol_na(struct n
 {
 	struct inet6_dev *idev;
 	struct inet6_ifaddr *ifa;
-	struct in6_addr mcaddr;
+	struct in6_addr mcaddr = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
 
 	idev = in6_dev_get(dev);
 	if (!idev)
@@ -543,7 +543,6 @@ static void ndisc_send_unsol_na(struct n
 
 	read_lock_bh(&idev->lock);
 	list_for_each_entry(ifa, &idev->addr_list, if_list) {
-		addrconf_addr_solict_mult(&ifa->addr, &mcaddr);
 		ndisc_send_na(dev, NULL, &mcaddr, &ifa->addr,
 			      /*router=*/ !!idev->cnf.forwarding,
 			      /*solicited=*/ false, /*override=*/ true,



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

* [ 57/66] futex: Handle futex_pi OWNER_DIED take over correctly
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2012-11-15  4:11 ` [ 56/66] ipv6: send unsolicited neighbour advertisements to all-nodes Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 58/66] mmc: sh_mmcif: fix use after free Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Darren Hart, Thomas Gleixner

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

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

From: Thomas Gleixner <tglx@linutronix.de>

commit 59fa6245192159ab5e1e17b8e31f15afa9cff4bf upstream.

Siddhesh analyzed a failure in the take over of pi futexes in case the
owner died and provided a workaround.
See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

The detailed problem analysis shows:

Futex F is initialized with PTHREAD_PRIO_INHERIT and
PTHREAD_MUTEX_ROBUST_NP attributes.

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Succeeds due to the check for F's userspace TID field == 0
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes T2 via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains real ownership of the
       pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T3 --> observes inconsistent state

This problem is independent of UP/SMP, preemptible/non preemptible
kernels, or process shared vs. private. The only difference is that
certain configurations are more likely to expose it.

So as Siddhesh correctly analyzed the following check in
futex_lock_pi_atomic() is the culprit:

	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {

We check the userspace value for a TID value of 0 and take over the
futex unconditionally if that's true.

AFAICT this check is there as it is correct for a different corner
case of futexes: the WAITERS bit became stale.

Now the proposed change

-	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
+       if (unlikely(ownerdied ||
+                       !(curval & (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

solves the problem, but it's not obvious why and it wreckages the
"stale WAITERS bit" case.

What happens is, that due to the WAITERS bit being set (T2 is blocked
on that futex) it enforces T3 to go through lookup_pi_state(), which
in the above case returns an existing pi_state and therefor forces T3
to legitimately fight with T2 over the ownership of the pi_state (via
pi_state->mutex). Probelm solved!

Though that does not work for the "WAITERS bit is stale" problem
because if lookup_pi_state() does not find existing pi_state it
returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
return -ESRCH to user space because the OWNER_DIED bit is not set.

Now there is a different solution to that problem. Do not look at the
user space value at all and enforce a lookup of possibly available
pi_state. If pi_state can be found, then the new incoming locker T3
blocks on that pi_state and legitimately races with T2 to acquire the
rt_mutex and the pi_state and therefor the proper ownership of the
user space futex.

lookup_pi_state() has the correct order of checks. It first tries to
find a pi_state associated with the user space futex and only if that
fails it checks for futex TID value = 0. If no pi_state is available
nothing can create new state at that point because this happens with
the hash bucket lock held.

So the above scenario changes to:

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Finds pi_state and blocks on pi_state->rt_mutex

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes it via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains ownership of the pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

This covers all gazillion points on which T3 might come in between
T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
also solves the "WAITERS bit stale" problem by forcing the take over.

Another benefit of changing the code this way is that it makes it less
dependent on untrusted user space values and therefor minimizes the
possible wreckage which might be inflicted.

As usual after staring for too long at the futex code my brain hurts
so much that I really want to ditch that whole optimization of
avoiding the syscall for the non contended case for PI futexes and rip
out the maze of corner case handling code. Unfortunately we can't as
user space relies on that existing behaviour, but at least thinking
about it helps me to preserve my mental sanity. Maybe we should
nevertheless :)

Reported-and-tested-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/futex.c |   41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -716,7 +716,7 @@ static int futex_lock_pi_atomic(u32 __us
 				struct futex_pi_state **ps,
 				struct task_struct *task, int set_waiters)
 {
-	int lock_taken, ret, ownerdied = 0;
+	int lock_taken, ret, force_take = 0;
 	u32 uval, newval, curval, vpid = task_pid_vnr(task);
 
 retry:
@@ -755,17 +755,15 @@ retry:
 	newval = curval | FUTEX_WAITERS;
 
 	/*
-	 * There are two cases, where a futex might have no owner (the
-	 * owner TID is 0): OWNER_DIED. We take over the futex in this
-	 * case. We also do an unconditional take over, when the owner
-	 * of the futex died.
-	 *
-	 * This is safe as we are protected by the hash bucket lock !
+	 * Should we force take the futex? See below.
 	 */
-	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
-		/* Keep the OWNER_DIED bit */
+	if (unlikely(force_take)) {
+		/*
+		 * Keep the OWNER_DIED and the WAITERS bit and set the
+		 * new TID value.
+		 */
 		newval = (curval & ~FUTEX_TID_MASK) | vpid;
-		ownerdied = 0;
+		force_take = 0;
 		lock_taken = 1;
 	}
 
@@ -775,7 +773,7 @@ retry:
 		goto retry;
 
 	/*
-	 * We took the lock due to owner died take over.
+	 * We took the lock due to forced take over.
 	 */
 	if (unlikely(lock_taken))
 		return 1;
@@ -790,20 +788,25 @@ retry:
 		switch (ret) {
 		case -ESRCH:
 			/*
-			 * No owner found for this futex. Check if the
-			 * OWNER_DIED bit is set to figure out whether
-			 * this is a robust futex or not.
+			 * We failed to find an owner for this
+			 * futex. So we have no pi_state to block
+			 * on. This can happen in two cases:
+			 *
+			 * 1) The owner died
+			 * 2) A stale FUTEX_WAITERS bit
+			 *
+			 * Re-read the futex value.
 			 */
 			if (get_futex_value_locked(&curval, uaddr))
 				return -EFAULT;
 
 			/*
-			 * We simply start over in case of a robust
-			 * futex. The code above will take the futex
-			 * and return happy.
+			 * If the owner died or we have a stale
+			 * WAITERS bit the owner TID in the user space
+			 * futex is 0.
 			 */
-			if (curval & FUTEX_OWNER_DIED) {
-				ownerdied = 1;
+			if (!(curval & FUTEX_TID_MASK)) {
+				force_take = 1;
 				goto retry;
 			}
 		default:



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

* [ 58/66] mmc: sh_mmcif: fix use after free
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2012-11-15  4:11 ` [ 57/66] futex: Handle futex_pi OWNER_DIED take over correctly Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 59/66] mmc: sdhci: fix NULL dereference in sdhci_request() tuning Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Guennadi Liakhovetski, Chris Ball

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

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

From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

commit a0d28ba01ebd048b4ba418142b37f5cf80e6d156 upstream.

A recent commit "mmc: sh_mmcif: fix clock management" has introduced a
use after free bug in sh_mmcif.c: in sh_mmcif_remove() the call to
mmc_free_host() frees private driver data, therefore using it afterwards
is a bug. Revert that hunk.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sh_mmcif.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1464,9 +1464,9 @@ static int __devexit sh_mmcif_remove(str
 
 	platform_set_drvdata(pdev, NULL);
 
+	clk_disable(host->hclk);
 	mmc_free_host(host->mmc);
 	pm_runtime_put_sync(&pdev->dev);
-	clk_disable(host->hclk);
 	pm_runtime_disable(&pdev->dev);
 
 	return 0;



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

* [ 59/66] mmc: sdhci: fix NULL dereference in sdhci_request() tuning
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2012-11-15  4:11 ` [ 58/66] mmc: sh_mmcif: fix use after free Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 60/66] drm/vmwgfx: Fix hibernation device reset Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg Kroah-Hartman, alan, Chris Ball

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

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

From: Chris Ball <cjb@laptop.org>

commit 14efd957209461bbdf285bf0d67e931955d04a4c upstream.

Commit 473b095a72a9 ("mmc: sdhci: fix incorrect command used in tuning")
introduced a NULL dereference at resume-time if an SD 3.0 host controller
raises the SDHCI_NEEDS_TUNING flag while no card is inserted.  Seen on an
OLPC XO-4 with sdhci-pxav3, but presumably affects other controllers too.

Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci.c |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1307,16 +1307,19 @@ static void sdhci_request(struct mmc_hos
 		 */
 		if ((host->flags & SDHCI_NEEDS_RETUNING) &&
 		    !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
-			/* eMMC uses cmd21 while sd and sdio use cmd19 */
-			tuning_opcode = mmc->card->type == MMC_TYPE_MMC ?
-				MMC_SEND_TUNING_BLOCK_HS200 :
-				MMC_SEND_TUNING_BLOCK;
-			spin_unlock_irqrestore(&host->lock, flags);
-			sdhci_execute_tuning(mmc, tuning_opcode);
-			spin_lock_irqsave(&host->lock, flags);
+			if (mmc->card) {
+				/* eMMC uses cmd21 but sd and sdio use cmd19 */
+				tuning_opcode =
+					mmc->card->type == MMC_TYPE_MMC ?
+					MMC_SEND_TUNING_BLOCK_HS200 :
+					MMC_SEND_TUNING_BLOCK;
+				spin_unlock_irqrestore(&host->lock, flags);
+				sdhci_execute_tuning(mmc, tuning_opcode);
+				spin_lock_irqsave(&host->lock, flags);
 
-			/* Restore original mmc_request structure */
-			host->mrq = mrq;
+				/* Restore original mmc_request structure */
+				host->mrq = mrq;
+			}
 		}
 
 		if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))



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

* [ 60/66] drm/vmwgfx: Fix hibernation device reset
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2012-11-15  4:11 ` [ 59/66] mmc: sdhci: fix NULL dereference in sdhci_request() tuning Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 61/66] drm/vmwgfx: Fix a case where the code would BUG when trying to pin GMR memory Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Thomas Hellstrom, Brian Paul,
	Dmitry Torokhov, Dave Airlie, linux-graphics-maintainer

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

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

From: Thomas Hellstrom <thellstrom@vmware.com>

commit 95e8f6a21996c4cc2c4574b231c6e858b749dce3 upstream.

The device would not reset properly when resuming from hibernation.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Cc: linux-graphics-maintainer@vmware.com
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1099,6 +1099,11 @@ static void vmw_pm_complete(struct devic
 	struct drm_device *dev = pci_get_drvdata(pdev);
 	struct vmw_private *dev_priv = vmw_priv(dev);
 
+	mutex_lock(&dev_priv->hw_mutex);
+	vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
+	(void) vmw_read(dev_priv, SVGA_REG_ID);
+	mutex_unlock(&dev_priv->hw_mutex);
+
 	/**
 	 * Reclaim 3d reference held by fbdev and potentially
 	 * start fifo.



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

* [ 61/66] drm/vmwgfx: Fix a case where the code would BUG when trying to pin GMR memory
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2012-11-15  4:11 ` [ 60/66] drm/vmwgfx: Fix hibernation device reset Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 62/66] drm/radeon/cayman: add some missing regs to the VM reg checker Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Thomas Hellstrom, Brian Paul,
	Dmitry Torokhov, Dave Airlie, linux-graphics-maintainer

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

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

From: Thomas Hellstrom <thellstrom@vmware.com>

commit afcc87aa6a233e52df73552dc1dc9ae3881b7cc8 upstream.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Cc: linux-graphics-maintainer@vmware.com
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
@@ -306,7 +306,7 @@ void vmw_bo_pin(struct ttm_buffer_object
 
 	BUG_ON(!atomic_read(&bo->reserved));
 	BUG_ON(old_mem_type != TTM_PL_VRAM &&
-	       old_mem_type != VMW_PL_FLAG_GMR);
+	       old_mem_type != VMW_PL_GMR);
 
 	pl_flags = TTM_PL_FLAG_VRAM | VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED;
 	if (pin)



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

* [ 62/66] drm/radeon/cayman: add some missing regs to the VM reg checker
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2012-11-15  4:11 ` [ 61/66] drm/vmwgfx: Fix a case where the code would BUG when trying to pin GMR memory Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 63/66] drm/radeon/si: " Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Alex Deucher, Michel DÀnzer

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

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

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

commit 860fe2f05fa2eacac84368e23547ec8cf3cc6652 upstream.

These regs were being wronly rejected leading to rendering
issues.

fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=56876

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/evergreen_cs.c |    3 +++
 drivers/gpu/drm/radeon/evergreend.h   |    4 ++++
 2 files changed, 7 insertions(+)

--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -2725,6 +2725,9 @@ static bool evergreen_vm_reg_valid(u32 r
 	/* check config regs */
 	switch (reg) {
 	case GRBM_GFX_INDEX:
+	case CP_STRMOUT_CNTL:
+	case CP_COHER_CNTL:
+	case CP_COHER_SIZE:
 	case VGT_VTX_VECT_EJECT_REG:
 	case VGT_CACHE_INVALIDATION:
 	case VGT_GS_VERTEX_REUSE:
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -87,6 +87,10 @@
 
 #define	CONFIG_MEMSIZE					0x5428
 
+#define	CP_STRMOUT_CNTL					0x84FC
+
+#define	CP_COHER_CNTL					0x85F0
+#define	CP_COHER_SIZE					0x85F4
 #define	CP_COHER_BASE					0x85F8
 #define	CP_STALLED_STAT1			0x8674
 #define	CP_STALLED_STAT2			0x8678



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

* [ 63/66] drm/radeon/si: add some missing regs to the VM reg checker
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2012-11-15  4:11 ` [ 62/66] drm/radeon/cayman: add some missing regs to the VM reg checker Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Alex Deucher, Michel DÀnzer

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

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

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

commit f418b88aad0c42b4caf4d79a0cf8d14a5d0a2284 upstream.

This register is needed for streamout to work properly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/si.c  |    1 +
 drivers/gpu/drm/radeon/sid.h |    1 +
 2 files changed, 2 insertions(+)

--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2472,6 +2472,7 @@ static bool si_vm_reg_valid(u32 reg)
 	/* check config regs */
 	switch (reg) {
 	case GRBM_GFX_INDEX:
+	case CP_STRMOUT_CNTL:
 	case VGT_VTX_VECT_EJECT_REG:
 	case VGT_CACHE_INVALIDATION:
 	case VGT_ESGS_RING_SIZE:
--- a/drivers/gpu/drm/radeon/sid.h
+++ b/drivers/gpu/drm/radeon/sid.h
@@ -424,6 +424,7 @@
 #       define RDERR_INT_ENABLE                         (1 << 0)
 #       define GUI_IDLE_INT_ENABLE                      (1 << 19)
 
+#define	CP_STRMOUT_CNTL					0x84FC
 #define	SCRATCH_REG0					0x8500
 #define	SCRATCH_REG1					0x8504
 #define	SCRATCH_REG2					0x8508



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

* [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2012-11-15  4:11 ` [ 63/66] drm/radeon/si: " Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-25 13:11   ` Ben Hutchings
  2012-11-15  4:11 ` [ 65/66] xfs: fix reading of wrapped log data Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 66/66] xfs: fix buffer shudown reference count mismatch Greg Kroah-Hartman
  65 siblings, 1 reply; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Benjamin Marzinski, Steven Whitehouse

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

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

From: Benjamin Marzinski <bmarzins@redhat.com>

commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.

In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the
buffer without having the gfs2_log_lock held. It was then assuming it would
stay attached for the rest of the function. However, without either the log
lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any
time.  This patch moves the locking before the test.  If there isn't a bd
already attached, gfs2 can safely allocate one and attach it before locking.
There is no way that the newly allocated bd could be on the ail list,
and thus no way for __gfs2_ail_flush() to detach it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/gfs2/lops.c  |   14 ++------------
 fs/gfs2/trans.c |    8 ++++++++
 2 files changed, 10 insertions(+), 12 deletions(-)

--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -393,12 +393,10 @@ static void buf_lo_add(struct gfs2_sbd *
 	struct gfs2_meta_header *mh;
 	struct gfs2_trans *tr;
 
-	lock_buffer(bd->bd_bh);
-	gfs2_log_lock(sdp);
 	tr = current->journal_info;
 	tr->tr_touched = 1;
 	if (!list_empty(&bd->bd_list))
-		goto out;
+		return;
 	set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
 	mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
@@ -414,9 +412,6 @@ static void buf_lo_add(struct gfs2_sbd *
 	sdp->sd_log_num_buf++;
 	list_add(&bd->bd_list, &sdp->sd_log_le_buf);
 	tr->tr_num_buf_new++;
-out:
-	gfs2_log_unlock(sdp);
-	unlock_buffer(bd->bd_bh);
 }
 
 static void gfs2_check_magic(struct buffer_head *bh)
@@ -777,12 +772,10 @@ static void databuf_lo_add(struct gfs2_s
 	struct address_space *mapping = bd->bd_bh->b_page->mapping;
 	struct gfs2_inode *ip = GFS2_I(mapping->host);
 
-	lock_buffer(bd->bd_bh);
-	gfs2_log_lock(sdp);
 	if (tr)
 		tr->tr_touched = 1;
 	if (!list_empty(&bd->bd_list))
-		goto out;
+		return;
 	set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
 	if (gfs2_is_jdata(ip)) {
@@ -793,9 +786,6 @@ static void databuf_lo_add(struct gfs2_s
 	} else {
 		list_add_tail(&bd->bd_list, &sdp->sd_log_le_ordered);
 	}
-out:
-	gfs2_log_unlock(sdp);
-	unlock_buffer(bd->bd_bh);
 }
 
 /**
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -155,14 +155,22 @@ void gfs2_trans_add_bh(struct gfs2_glock
 	struct gfs2_sbd *sdp = gl->gl_sbd;
 	struct gfs2_bufdata *bd;
 
+	lock_buffer(bh);
+	gfs2_log_lock(sdp);
 	bd = bh->b_private;
 	if (bd)
 		gfs2_assert(sdp, bd->bd_gl == gl);
 	else {
+		gfs2_log_unlock(sdp);
+		unlock_buffer(bh);
 		gfs2_attach_bufdata(gl, bh, meta);
 		bd = bh->b_private;
+		lock_buffer(bh);
+		gfs2_log_lock(sdp);
 	}
 	lops_add(sdp, bd);
+	gfs2_log_unlock(sdp);
+	unlock_buffer(bh);
 }
 
 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)



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

* [ 65/66] xfs: fix reading of wrapped log data
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2012-11-15  4:11 ` [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  2012-11-15  4:11 ` [ 66/66] xfs: fix buffer shudown reference count mismatch Greg Kroah-Hartman
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Torsten Kaiser, Dave Chinner,
	Christoph Hellwig, Mark Tinguely, Ben Myers

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

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

From: Dave Chinner <dchinner@redhat.com>

commit 6ce377afd1755eae5c93410ca9a1121dfead7b87 upstream.

Commit 4439647 ("xfs: reset buffer pointers before freeing them") in
3.0-rc1 introduced a regression when recovering log buffers that
wrapped around the end of log. The second part of the log buffer at
the start of the physical log was being read into the header buffer
rather than the data buffer, and hence recovery was seeing garbage
in the data buffer when it got to the region of the log buffer that
was incorrectly read.

Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_log_recover.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3541,7 +3541,7 @@ xlog_do_recovery_pass(
 				 *   - order is important.
 				 */
 				error = xlog_bread_offset(log, 0,
-						bblks - split_bblks, hbp,
+						bblks - split_bblks, dbp,
 						offset + BBTOB(split_bblks));
 				if (error)
 					goto bread_err2;



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

* [ 66/66] xfs: fix buffer shudown reference count mismatch
  2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2012-11-15  4:11 ` [ 65/66] xfs: fix reading of wrapped log data Greg Kroah-Hartman
@ 2012-11-15  4:11 ` Greg Kroah-Hartman
  65 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15  4:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg Kroah-Hartman, alan, Dave Chinner, Mark Tinguely, Ben Myers

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

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

From: Dave Chinner <david@fromorbit.com>

commit 03b1293edad462ad1ad62bcc5160c76758e450d5 upstream.

When we shut down the filesystem, we have to unpin and free all the
buffers currently active in the CIL. To do this we unpin and remove
them in one operation as a result of a failed iclogbuf write. For
buffers, we do this removal via a simultated IO completion of after
marking the buffer stale.

At the time we do this, we have two references to the buffer - the
active LRU reference and the buf log item.  The LRU reference is
removed by marking the buffer stale, and the active CIL reference is
by the xfs_buf_iodone() callback that is run by
xfs_buf_do_callbacks() during ioend processing (via the bp->b_iodone
callback).

However, ioend processing requires one more reference - that of the
IO that it is completing. We don't have this reference, so we free
the buffer prematurely and use it after it is freed. For buffers
marked with XBF_ASYNC, this leads to assert failures in
xfs_buf_rele() on debug kernels because the b_hold count is zero.

Fix this by making sure we take the necessary IO reference before
starting IO completion processing on the stale buffer, and set the
XBF_ASYNC flag to ensure that IO completion processing removes all
the active references from the buffer to ensure it is fully torn
down.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_buf_item.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -526,7 +526,25 @@ xfs_buf_item_unpin(
 		}
 		xfs_buf_relse(bp);
 	} else if (freed && remove) {
+		/*
+		 * There are currently two references to the buffer - the active
+		 * LRU reference and the buf log item. What we are about to do
+		 * here - simulate a failed IO completion - requires 3
+		 * references.
+		 *
+		 * The LRU reference is removed by the xfs_buf_stale() call. The
+		 * buf item reference is removed by the xfs_buf_iodone()
+		 * callback that is run by xfs_buf_do_callbacks() during ioend
+		 * processing (via the bp->b_iodone callback), and then finally
+		 * the ioend processing will drop the IO reference if the buffer
+		 * is marked XBF_ASYNC.
+		 *
+		 * Hence we need to take an additional reference here so that IO
+		 * completion processing doesn't free the buffer prematurely.
+		 */
 		xfs_buf_lock(bp);
+		xfs_buf_hold(bp);
+		bp->b_flags |= XBF_ASYNC;
 		xfs_buf_ioerror(bp, EIO);
 		XFS_BUF_UNDONE(bp);
 		xfs_buf_stale(bp);



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

* Re: [ 42/66] ALSA: Avoid endless sleep after disconnect
  2012-11-15  4:10 ` [ 42/66] ALSA: Avoid endless sleep after disconnect Greg Kroah-Hartman
@ 2012-11-15  7:25   ` Takashi Iwai
  2012-11-15 22:49     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 76+ messages in thread
From: Takashi Iwai @ 2012-11-15  7:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, stable, alan

At Wed, 14 Nov 2012 20:10:47 -0800,
Greg Kroah-Hartman wrote:
> 
> 3.6-stable review patch.  If anyone has any objections, please let me know.

It turned out that this patch series for fixing USB-audio
disconnection races need two more commits.  One is already in Linus
tree,

    commit 8bb4d9ce08b0a92ca174e41d92c180328f86173f
        ALSA: Fix card refcount unbalance
    
and another is included in the pull request I sent out to Linus right
now,

    commit 10e44239f67d0b6fb74006e61a7e883b8075247a
        ALSA: usb-audio: Fix mutex deadlock at disconnection
    
Please pick them up when possible, too.
Sorry for inconvenience.


thanks,

Takashi


> 
> ------------------
> 
> 
> From: Takashi Iwai <tiwai@suse.de>
> 
> commit 0914f7961babbf28aaa2f19b453951fb4841c03f upstream.
> 
> When disconnect callback is called, each component should wake up
> sleepers and check card->shutdown flag for avoiding the endless sleep
> blocking the proper resource release.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  sound/core/control.c     |    2 ++
>  sound/core/hwdep.c       |    7 +++++++
>  sound/core/oss/pcm_oss.c |    4 ++++
>  sound/core/pcm.c         |    6 +++++-
>  sound/core/pcm_native.c  |    8 ++++++++
>  sound/core/rawmidi.c     |   20 ++++++++++++++++++++
>  6 files changed, 46 insertions(+), 1 deletion(-)
> 
> --- a/sound/core/control.c
> +++ b/sound/core/control.c
> @@ -1436,6 +1436,8 @@ static ssize_t snd_ctl_read(struct file
>  			spin_unlock_irq(&ctl->read_lock);
>  			schedule();
>  			remove_wait_queue(&ctl->change_sleep, &wait);
> +			if (ctl->card->shutdown)
> +				return -ENODEV;
>  			if (signal_pending(current))
>  				return -ERESTARTSYS;
>  			spin_lock_irq(&ctl->read_lock);
> --- a/sound/core/hwdep.c
> +++ b/sound/core/hwdep.c
> @@ -131,6 +131,10 @@ static int snd_hwdep_open(struct inode *
>  		mutex_unlock(&hw->open_mutex);
>  		schedule();
>  		mutex_lock(&hw->open_mutex);
> +		if (hw->card->shutdown) {
> +			err = -ENODEV;
> +			break;
> +		}
>  		if (signal_pending(current)) {
>  			err = -ERESTARTSYS;
>  			break;
> @@ -462,12 +466,15 @@ static int snd_hwdep_dev_disconnect(stru
>  		mutex_unlock(&register_mutex);
>  		return -EINVAL;
>  	}
> +	mutex_lock(&hwdep->open_mutex);
> +	wake_up(&hwdep->open_wait);
>  #ifdef CONFIG_SND_OSSEMUL
>  	if (hwdep->ossreg)
>  		snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
>  #endif
>  	snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
>  	list_del_init(&hwdep->list);
> +	mutex_unlock(&hwdep->open_mutex);
>  	mutex_unlock(&register_mutex);
>  	return 0;
>  }
> --- a/sound/core/oss/pcm_oss.c
> +++ b/sound/core/oss/pcm_oss.c
> @@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode
>  		mutex_unlock(&pcm->open_mutex);
>  		schedule();
>  		mutex_lock(&pcm->open_mutex);
> +		if (pcm->card->shutdown) {
> +			err = -ENODEV;
> +			break;
> +		}
>  		if (signal_pending(current)) {
>  			err = -ERESTARTSYS;
>  			break;
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -1087,12 +1087,16 @@ static int snd_pcm_dev_disconnect(struct
>  		goto unlock;
>  
>  	mutex_lock(&pcm->open_mutex);
> +	wake_up(&pcm->open_wait);
>  	list_del_init(&pcm->list);
>  	for (cidx = 0; cidx < 2; cidx++)
>  		for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
>  			snd_pcm_stream_lock_irq(substream);
> -			if (substream->runtime)
> +			if (substream->runtime) {
>  				substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
> +				wake_up(&substream->runtime->sleep);
> +				wake_up(&substream->runtime->tsleep);
> +			}
>  			snd_pcm_stream_unlock_irq(substream);
>  		}
>  	list_for_each_entry(notify, &snd_pcm_notify_list, list) {
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -1518,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_
>  		down_read(&snd_pcm_link_rwsem);
>  		snd_pcm_stream_lock_irq(substream);
>  		remove_wait_queue(&to_check->sleep, &wait);
> +		if (card->shutdown) {
> +			result = -ENODEV;
> +			break;
> +		}
>  		if (tout == 0) {
>  			if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
>  				result = -ESTRPIPE;
> @@ -2168,6 +2172,10 @@ static int snd_pcm_open(struct file *fil
>  		mutex_unlock(&pcm->open_mutex);
>  		schedule();
>  		mutex_lock(&pcm->open_mutex);
> +		if (pcm->card->shutdown) {
> +			err = -ENODEV;
> +			break;
> +		}
>  		if (signal_pending(current)) {
>  			err = -ERESTARTSYS;
>  			break;
> --- a/sound/core/rawmidi.c
> +++ b/sound/core/rawmidi.c
> @@ -424,6 +424,10 @@ static int snd_rawmidi_open(struct inode
>  		mutex_unlock(&rmidi->open_mutex);
>  		schedule();
>  		mutex_lock(&rmidi->open_mutex);
> +		if (rmidi->card->shutdown) {
> +			err = -ENODEV;
> +			break;
> +		}
>  		if (signal_pending(current)) {
>  			err = -ERESTARTSYS;
>  			break;
> @@ -995,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct f
>  			spin_unlock_irq(&runtime->lock);
>  			schedule();
>  			remove_wait_queue(&runtime->sleep, &wait);
> +			if (rfile->rmidi->card->shutdown)
> +				return -ENODEV;
>  			if (signal_pending(current))
>  				return result > 0 ? result : -ERESTARTSYS;
>  			if (!runtime->avail)
> @@ -1238,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct
>  			spin_unlock_irq(&runtime->lock);
>  			timeout = schedule_timeout(30 * HZ);
>  			remove_wait_queue(&runtime->sleep, &wait);
> +			if (rfile->rmidi->card->shutdown)
> +				return -ENODEV;
>  			if (signal_pending(current))
>  				return result > 0 ? result : -ERESTARTSYS;
>  			if (!runtime->avail && !timeout)
> @@ -1613,9 +1621,20 @@ static int snd_rawmidi_dev_register(stru
>  static int snd_rawmidi_dev_disconnect(struct snd_device *device)
>  {
>  	struct snd_rawmidi *rmidi = device->device_data;
> +	int dir;
>  
>  	mutex_lock(&register_mutex);
> +	mutex_lock(&rmidi->open_mutex);
> +	wake_up(&rmidi->open_wait);
>  	list_del_init(&rmidi->list);
> +	for (dir = 0; dir < 2; dir++) {
> +		struct snd_rawmidi_substream *s;
> +		list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {
> +			if (s->runtime)
> +				wake_up(&s->runtime->sleep);
> +		}
> +	}
> +
>  #ifdef CONFIG_SND_OSSEMUL
>  	if (rmidi->ossreg) {
>  		if ((int)rmidi->device == midi_map[rmidi->card->number]) {
> @@ -1630,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(st
>  	}
>  #endif /* CONFIG_SND_OSSEMUL */
>  	snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
> +	mutex_unlock(&rmidi->open_mutex);
>  	mutex_unlock(&register_mutex);
>  	return 0;
>  }
> 
> 

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

* Re: [ 42/66] ALSA: Avoid endless sleep after disconnect
  2012-11-15  7:25   ` Takashi Iwai
@ 2012-11-15 22:49     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-15 22:49 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, stable, alan

On Thu, Nov 15, 2012 at 08:25:11AM +0100, Takashi Iwai wrote:
> At Wed, 14 Nov 2012 20:10:47 -0800,
> Greg Kroah-Hartman wrote:
> > 
> > 3.6-stable review patch.  If anyone has any objections, please let me know.
> 
> It turned out that this patch series for fixing USB-audio
> disconnection races need two more commits.  One is already in Linus
> tree,
> 
>     commit 8bb4d9ce08b0a92ca174e41d92c180328f86173f
>         ALSA: Fix card refcount unbalance
>     
> and another is included in the pull request I sent out to Linus right
> now,
> 
>     commit 10e44239f67d0b6fb74006e61a7e883b8075247a
>         ALSA: usb-audio: Fix mutex deadlock at disconnection
>     
> Please pick them up when possible, too.

Both now picked up, thanks.

> Sorry for inconvenience.

No problems at all, thanks for letting me know.

greg k-h

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

* Re: [ 21/66] drm/i915: fix overlay on i830M
  2012-11-15  4:10 ` [ 21/66] drm/i915: fix overlay on i830M Greg Kroah-Hartman
@ 2012-11-16 16:14   ` Ben Hutchings
  2012-11-21  1:25     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 76+ messages in thread
From: Ben Hutchings @ 2012-11-16 16:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, alan, Rhys, Chris Wilson, Daniel Vetter


[-- Attachment #1.1: Type: text/plain, Size: 551 bytes --]

On Wed, 2012-11-14 at 20:10 -0800, Greg Kroah-Hartman wrote:
> 3.6-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> commit a9193983f4f292a82a00c72971c17ec0ee8c6c15 upstream.
[...]

I notice you didn't apply this to 3.0 and 3.4.  I'm attaching the
version I used for 3.2.

Ben.

-- 
Ben Hutchings
Theory and practice are closer in theory than in practice.
                                - John Levine, moderator of comp.compilers

[-- Attachment #1.2: drm-i915-fix-overlay-on-i830m.patch --]
[-- Type: text/x-patch, Size: 3076 bytes --]

From: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Mon, 22 Oct 2012 12:55:55 +0200
Subject: drm/i915: fix overlay on i830M
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

commit a9193983f4f292a82a00c72971c17ec0ee8c6c15 upstream.

The overlay on the i830M has a peculiar failure mode: It works the
first time around after boot-up, but consistenly hangs the second time
it's used.

Chris Wilson has dug out a nice errata:

"1.5.12 Clock Gating Disable for Display Register
Address Offset:	06200h–06203h

"Bit 3
Ovrunit Clock Gating Disable.
0 = Clock gating controlled by unit enabling logic
1 = Disable clock gating function
DevALM Errata ALM049: Overlay Clock Gating Must be Disabled:  Overlay
& L2 Cache clock gating must be disabled in order to prevent device
hangs when turning off overlay.SW must turn off Ovrunit clock gating
(6200h) and L2 Cache clock gating (C8h)."

Now I've nowhere found that 0xc8 register and hence couldn't apply the
l2 cache workaround. But I've remembered that part of the magic that
the OVERLAY_ON/OFF commands are supposed to do is to rearrange cache
allocations so that the overlay scaler has some scratch space.

And while pondering how that could explain the hang the 2nd time we
enable the overlay, I've remembered that the old ums overlay code did
_not_ issue the OVERLAY_OFF cmd.

And indeed, disabling the OFF cmd results in the overlay working
flawlessly, so I guess we can workaround the lack of the above
workaround by simply never disabling the overlay engine once it's
enabled.

Note that we have the first part of the above w/a already implemented
in i830_init_clock_gating - leave that as-is to avoid surprises.

v2: Add a comment in the code.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47827
Tested-by: Rhys <rhyspuk@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[bwh: Backported to 3.2:
 - Adjust context
 - s/intel_ring_emit(ring, /OUT_RING(/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/i915/intel_overlay.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -428,9 +428,17 @@ static int intel_overlay_off(struct inte
 	OUT_RING(flip_addr);
 	OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
 	/* turn overlay off */
-	OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
-	OUT_RING(flip_addr);
-	OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
+	if (IS_I830(dev)) {
+		/* Workaround: Don't disable the overlay fully, since otherwise
+		 * it dies on the next OVERLAY_ON cmd. */
+		OUT_RING(MI_NOOP);
+		OUT_RING(MI_NOOP);
+		OUT_RING(MI_NOOP);
+	} else {
+		OUT_RING(MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
+		OUT_RING(flip_addr);
+		OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
+	}
 	ADVANCE_LP_RING();
 
 	return intel_overlay_do_wait_request(overlay, request,

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [ 31/66] NFS: Wait for session recovery to finish before returning
  2012-11-15  4:10 ` [ 31/66] NFS: Wait for session recovery to finish before returning Greg Kroah-Hartman
@ 2012-11-16 16:17   ` Ben Hutchings
  2012-11-21  1:26     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 76+ messages in thread
From: Ben Hutchings @ 2012-11-16 16:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, alan, Bryan Schumaker, Trond Myklebust


[-- Attachment #1.1: Type: text/plain, Size: 571 bytes --]

On Wed, 2012-11-14 at 20:10 -0800, Greg Kroah-Hartman wrote:
> 3.6-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Bryan Schumaker <bjschuma@netapp.com>
> 
> commit 399f11c3d872bd748e1575574de265a6304c7c43 upstream.
[...]

Also not applied to 3.0 and 3.4; here's my version for 3.2 which is
probably usable for at least one of those.

Ben.

-- 
Ben Hutchings
Theory and practice are closer in theory than in practice.
                                - John Levine, moderator of comp.compilers

[-- Attachment #1.2: nfs-wait-for-session-recovery-to-finish-before-returning.patch --]
[-- Type: text/x-patch, Size: 1511 bytes --]

From: Bryan Schumaker <bjschuma@netapp.com>
Date: Tue, 30 Oct 2012 16:06:35 -0400
Subject: NFS: Wait for session recovery to finish before returning

commit 399f11c3d872bd748e1575574de265a6304c7c43 upstream.

Currently, we will schedule session recovery and then return to the
caller of nfs4_handle_exception.  This works for most cases, but causes
a hang on the following test case:

	Client				Server
	------				------
	Open file over NFS v4.1
	Write to file
					Expire client
	Try to lock file

The server will return NFS4ERR_BADSESSION, prompting the client to
schedule recovery.  However, the client will continue placing lock
attempts and the open recovery never seems to be scheduled.  The
simplest solution is to wait for session recovery to run before retrying
the lock.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/nfs/nfs4proc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -303,8 +303,7 @@ static int nfs4_handle_exception(struct
 			dprintk("%s ERROR: %d Reset session\n", __func__,
 				errorcode);
 			nfs4_schedule_session_recovery(clp->cl_session);
-			exception->retry = 1;
-			break;
+			goto wait_on_recovery;
 #endif /* defined(CONFIG_NFS_V4_1) */
 		case -NFS4ERR_FILE_OPEN:
 			if (exception->timeout > HZ) {

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [ 21/66] drm/i915: fix overlay on i830M
  2012-11-16 16:14   ` Ben Hutchings
@ 2012-11-21  1:25     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-21  1:25 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, alan, Rhys, Chris Wilson, Daniel Vetter

On Fri, Nov 16, 2012 at 04:14:07PM +0000, Ben Hutchings wrote:
> On Wed, 2012-11-14 at 20:10 -0800, Greg Kroah-Hartman wrote:
> > 3.6-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > commit a9193983f4f292a82a00c72971c17ec0ee8c6c15 upstream.
> [...]
> 
> I notice you didn't apply this to 3.0 and 3.4.  I'm attaching the
> version I used for 3.2.

Now applied, thanks for the backport.

greg k-h

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

* Re: [ 31/66] NFS: Wait for session recovery to finish before returning
  2012-11-16 16:17   ` Ben Hutchings
@ 2012-11-21  1:26     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 76+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-21  1:26 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, alan, Bryan Schumaker, Trond Myklebust

On Fri, Nov 16, 2012 at 04:17:19PM +0000, Ben Hutchings wrote:
> On Wed, 2012-11-14 at 20:10 -0800, Greg Kroah-Hartman wrote:
> > 3.6-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Bryan Schumaker <bjschuma@netapp.com>
> > 
> > commit 399f11c3d872bd748e1575574de265a6304c7c43 upstream.
> [...]
> 
> Also not applied to 3.0 and 3.4; here's my version for 3.2 which is
> probably usable for at least one of those.

Now applied, thanks.

greg k-h

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

* Re: [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held
  2012-11-15  4:11 ` [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held Greg Kroah-Hartman
@ 2012-11-25 13:11   ` Ben Hutchings
  2012-11-26 15:13     ` Steven Whitehouse
  0 siblings, 1 reply; 76+ messages in thread
From: Ben Hutchings @ 2012-11-25 13:11 UTC (permalink / raw)
  To: Benjamin Marzinski, Steven Whitehouse
  Cc: linux-kernel, stable, alan, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]

On Wed, 2012-11-14 at 20:11 -0800, Greg Kroah-Hartman wrote:
> 3.6-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Benjamin Marzinski <bmarzins@redhat.com>
> 
> commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.
> 
> In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the
> buffer without having the gfs2_log_lock held. It was then assuming it would
> stay attached for the rest of the function. However, without either the log
> lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any
> time.  This patch moves the locking before the test.  If there isn't a bd
> already attached, gfs2 can safely allocate one and attach it before locking.
> There is no way that the newly allocated bd could be on the ail list,
> and thus no way for __gfs2_ail_flush() to detach it.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[...]

Is this needed for any earlier versions?  It looks applicable to 3.2
(with minor changes).

Ben.

-- 
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held
  2012-11-25 13:11   ` Ben Hutchings
@ 2012-11-26 15:13     ` Steven Whitehouse
  2012-12-02  3:52       ` Ben Hutchings
  0 siblings, 1 reply; 76+ messages in thread
From: Steven Whitehouse @ 2012-11-26 15:13 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Benjamin Marzinski, linux-kernel, stable, alan, Greg Kroah-Hartman

Hi,

On Sun, 2012-11-25 at 14:11 +0100, Ben Hutchings wrote:
> On Wed, 2012-11-14 at 20:11 -0800, Greg Kroah-Hartman wrote:
> > 3.6-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Benjamin Marzinski <bmarzins@redhat.com>
> > 
> > commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.
> > 
> > In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the
> > buffer without having the gfs2_log_lock held. It was then assuming it would
> > stay attached for the rest of the function. However, without either the log
> > lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any
> > time.  This patch moves the locking before the test.  If there isn't a bd
> > already attached, gfs2 can safely allocate one and attach it before locking.
> > There is no way that the newly allocated bd could be on the ail list,
> > and thus no way for __gfs2_ail_flush() to detach it.
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> [...]
> 
> Is this needed for any earlier versions?  It looks applicable to 3.2
> (with minor changes).
> 
> Ben.
> 

Potentially yes, although I don't think we've had any reports from that
far back,

Steve.



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

* Re: [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held
  2012-11-26 15:13     ` Steven Whitehouse
@ 2012-12-02  3:52       ` Ben Hutchings
  0 siblings, 0 replies; 76+ messages in thread
From: Ben Hutchings @ 2012-12-02  3:52 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: Benjamin Marzinski, linux-kernel, stable, alan, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 5222 bytes --]

On Mon, 2012-11-26 at 15:13 +0000, Steven Whitehouse wrote:
> Hi,
> 
> On Sun, 2012-11-25 at 14:11 +0100, Ben Hutchings wrote:
> > On Wed, 2012-11-14 at 20:11 -0800, Greg Kroah-Hartman wrote:
> > > 3.6-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Benjamin Marzinski <bmarzins@redhat.com>
> > > 
> > > commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.
> > > 
> > > In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the
> > > buffer without having the gfs2_log_lock held. It was then assuming it would
> > > stay attached for the rest of the function. However, without either the log
> > > lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any
> > > time.  This patch moves the locking before the test.  If there isn't a bd
> > > already attached, gfs2 can safely allocate one and attach it before locking.
> > > There is no way that the newly allocated bd could be on the ail list,
> > > and thus no way for __gfs2_ail_flush() to detach it.
> > > 
> > > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > > Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > [...]
> > 
> > Is this needed for any earlier versions?  It looks applicable to 3.2
> > (with minor changes).
> > 
> > Ben.
> > 
> 
> Potentially yes, although I don't think we've had any reports from that
> far back,

OK, I've queued up this version for 3.2.

Ben.

---
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 7 Nov 2012 00:38:06 -0600
Subject: GFS2: Test bufdata with buffer locked and gfs2_log_lock held

commit 96e5d1d3adf56f1c7eeb07258f6a1a0a7ae9c489 upstream.

In gfs2_trans_add_bh(), gfs2 was testing if a there was a bd attached to the
buffer without having the gfs2_log_lock held. It was then assuming it would
stay attached for the rest of the function. However, without either the log
lock being held of the buffer locked, __gfs2_ail_flush() could detach bd at any
time.  This patch moves the locking before the test.  If there isn't a bd
already attached, gfs2 can safely allocate one and attach it before locking.
There is no way that the newly allocated bd could be on the ail list,
and thus no way for __gfs2_ail_flush() to detach it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/gfs2/lops.c  |   14 ++------------
 fs/gfs2/trans.c |    8 ++++++++
 2 files changed, 10 insertions(+), 12 deletions(-)

--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -165,16 +165,14 @@ static void buf_lo_add(struct gfs2_sbd *
 	struct gfs2_meta_header *mh;
 	struct gfs2_trans *tr;
 
-	lock_buffer(bd->bd_bh);
-	gfs2_log_lock(sdp);
 	if (!list_empty(&bd->bd_list_tr))
-		goto out;
+		return;
 	tr = current->journal_info;
 	tr->tr_touched = 1;
 	tr->tr_num_buf++;
 	list_add(&bd->bd_list_tr, &tr->tr_list_buf);
 	if (!list_empty(&le->le_list))
-		goto out;
+		return;
 	set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
 	gfs2_meta_check(sdp, bd->bd_bh);
@@ -185,9 +183,6 @@ static void buf_lo_add(struct gfs2_sbd *
 	sdp->sd_log_num_buf++;
 	list_add(&le->le_list, &sdp->sd_log_le_buf);
 	tr->tr_num_buf_new++;
-out:
-	gfs2_log_unlock(sdp);
-	unlock_buffer(bd->bd_bh);
 }
 
 static void buf_lo_before_commit(struct gfs2_sbd *sdp)
@@ -518,11 +513,9 @@ static void databuf_lo_add(struct gfs2_s
 	struct address_space *mapping = bd->bd_bh->b_page->mapping;
 	struct gfs2_inode *ip = GFS2_I(mapping->host);
 
-	lock_buffer(bd->bd_bh);
-	gfs2_log_lock(sdp);
 	if (tr) {
 		if (!list_empty(&bd->bd_list_tr))
-			goto out;
+			return;
 		tr->tr_touched = 1;
 		if (gfs2_is_jdata(ip)) {
 			tr->tr_num_buf++;
@@ -530,7 +523,7 @@ static void databuf_lo_add(struct gfs2_s
 		}
 	}
 	if (!list_empty(&le->le_list))
-		goto out;
+		return;
 
 	set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
 	set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
@@ -542,9 +535,6 @@ static void databuf_lo_add(struct gfs2_s
 	} else {
 		list_add_tail(&le->le_list, &sdp->sd_log_le_ordered);
 	}
-out:
-	gfs2_log_unlock(sdp);
-	unlock_buffer(bd->bd_bh);
 }
 
 static void gfs2_check_magic(struct buffer_head *bh)
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -145,14 +145,22 @@ void gfs2_trans_add_bh(struct gfs2_glock
 	struct gfs2_sbd *sdp = gl->gl_sbd;
 	struct gfs2_bufdata *bd;
 
+	lock_buffer(bh);
+	gfs2_log_lock(sdp);
 	bd = bh->b_private;
 	if (bd)
 		gfs2_assert(sdp, bd->bd_gl == gl);
 	else {
+		gfs2_log_unlock(sdp);
+		unlock_buffer(bh);
 		gfs2_attach_bufdata(gl, bh, meta);
 		bd = bh->b_private;
+		lock_buffer(bh);
+		gfs2_log_lock(sdp);
 	}
 	lops_add(sdp, &bd->bd_le);
+	gfs2_log_unlock(sdp);
+	unlock_buffer(bh);
 }
 
 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)


-- 
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

end of thread, other threads:[~2012-12-02  3:52 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15  4:10 [ 00/66] 3.6.7-stable review Greg Kroah-Hartman
2012-11-15  4:10 ` [ 01/66] xen/gntdev: dont leak memory from IOCTL_GNTDEV_MAP_GRANT_REF Greg Kroah-Hartman
2012-11-15  4:10 ` [ 02/66] xen/mmu: Use Xen specific TLB flush instead of the generic one Greg Kroah-Hartman
2012-11-15  4:10 ` [ 03/66] ixgbe: PTP get_ts_info missing software support Greg Kroah-Hartman
2012-11-15  4:10 ` [ 04/66] Input: tsc40 - remove wrong announcement of pressure support Greg Kroah-Hartman
2012-11-15  4:10 ` [ 05/66] ath9k: fix stale pointers potentially causing access to freed skbs Greg Kroah-Hartman
2012-11-15  4:10 ` [ 06/66] ath9k: Test for TID only in BlockAcks while checking tx status Greg Kroah-Hartman
2012-11-15  4:10 ` [ 07/66] rt2800: validate step value for temperature compensation Greg Kroah-Hartman
2012-11-15  4:10 ` [ 08/66] target: Dont return success from module_init() if setup fails Greg Kroah-Hartman
2012-11-15  4:10 ` [ 09/66] target: Avoid integer overflow in se_dev_align_max_sectors() Greg Kroah-Hartman
2012-11-15  4:10 ` [ 10/66] iscsi-target: Fix missed wakeup race in TX thread Greg Kroah-Hartman
2012-11-15  4:10 ` [ 11/66] target: Fix incorrect usage of nested IRQ spinlocks in ABORT_TASK path Greg Kroah-Hartman
2012-11-15  4:10 ` [ 12/66] target: Re-add explict zeroing of INQUIRY bounce buffer memory Greg Kroah-Hartman
2012-11-15  4:10 ` [ 13/66] cfg80211: fix antenna gain handling Greg Kroah-Hartman
2012-11-15  4:10 ` [ 14/66] wireless: drop invalid mesh address extension frames Greg Kroah-Hartman
2012-11-15  4:10 ` [ 15/66] mac80211: use blacklist for duplicate IE check Greg Kroah-Hartman
2012-11-15  4:10 ` [ 16/66] mac80211: Only process mesh config header on frames that RA_MATCH Greg Kroah-Hartman
2012-11-15  4:10 ` [ 17/66] mac80211: dont inspect Sequence Control field on control frames Greg Kroah-Hartman
2012-11-15  4:10 ` [ 18/66] DRM/Radeon: Fix Load Detection on legacy primary DAC Greg Kroah-Hartman
2012-11-15  4:10 ` [ 19/66] drm/udl: fix stride issues scanning out stride != width*bpp Greg Kroah-Hartman
2012-11-15  4:10 ` [ 20/66] drm/i915: clear the entire sdvo infoframe buffer Greg Kroah-Hartman
2012-11-15  4:10 ` [ 21/66] drm/i915: fix overlay on i830M Greg Kroah-Hartman
2012-11-16 16:14   ` Ben Hutchings
2012-11-21  1:25     ` Greg Kroah-Hartman
2012-11-15  4:10 ` [ 22/66] drm/i915: Only kick out vesafb if we takeover the fbcon with KMS Greg Kroah-Hartman
2012-11-15  4:10 ` [ 23/66] mac80211: check management frame header length Greg Kroah-Hartman
2012-11-15  4:10 ` [ 24/66] mac80211: verify that skb data is present Greg Kroah-Hartman
2012-11-15  4:10 ` [ 25/66] mac80211: make sure data is accessible in EAPOL check Greg Kroah-Hartman
2012-11-15  4:10 ` [ 26/66] mac80211: fix SSID copy on IBSS JOIN Greg Kroah-Hartman
2012-11-15  4:10 ` [ 27/66] nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts Greg Kroah-Hartman
2012-11-15  4:10 ` [ 28/66] nfs: Show original device name verbatim in /proc/*/mount{s,info} Greg Kroah-Hartman
2012-11-15  4:10 ` [ 29/66] NFSv4: nfs4_locku_done must release the sequence id Greg Kroah-Hartman
2012-11-15  4:10 ` [ 30/66] NFSv4.1: We must release the sequence id when we fail to get a session slot Greg Kroah-Hartman
2012-11-15  4:10 ` [ 31/66] NFS: Wait for session recovery to finish before returning Greg Kroah-Hartman
2012-11-16 16:17   ` Ben Hutchings
2012-11-21  1:26     ` Greg Kroah-Hartman
2012-11-15  4:10 ` [ 32/66] NFS: fix bug in legacy DNS resolver Greg Kroah-Hartman
2012-11-15  4:10 ` [ 33/66] batman-adv: Fix broadcast packet CRC calculation Greg Kroah-Hartman
2012-11-15  4:10 ` [ 34/66] drm: restore open_count if drm_setup fails Greg Kroah-Hartman
2012-11-15  4:10 ` [ 35/66] drm: set dev_mapping before calling drm_open_helper Greg Kroah-Hartman
2012-11-15  4:10 ` [ 36/66] hwmon: (w83627ehf) Force initial bank selection Greg Kroah-Hartman
2012-11-15  4:10 ` [ 37/66] ALSA: PCM: Fix some races at disconnection Greg Kroah-Hartman
2012-11-15  4:10 ` [ 38/66] ALSA: usb-audio: Fix " Greg Kroah-Hartman
2012-11-15  4:10 ` [ 39/66] ALSA: usb-audio: Use rwsem for disconnect protection Greg Kroah-Hartman
2012-11-15  4:10 ` [ 40/66] ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c Greg Kroah-Hartman
2012-11-15  4:10 ` [ 41/66] ALSA: Add a reference counter to card instance Greg Kroah-Hartman
2012-11-15  4:10 ` [ 42/66] ALSA: Avoid endless sleep after disconnect Greg Kroah-Hartman
2012-11-15  7:25   ` Takashi Iwai
2012-11-15 22:49     ` Greg Kroah-Hartman
2012-11-15  4:10 ` [ 43/66] sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter() Greg Kroah-Hartman
2012-11-15  4:10 ` [ 44/66] ipv4: Fix flushing of cached routing informations Greg Kroah-Hartman
2012-11-15  4:10 ` [ 45/66] netlink: use kfree_rcu() in netlink_release() Greg Kroah-Hartman
2012-11-15  4:10 ` [ 46/66] tcp: fix FIONREAD/SIOCINQ Greg Kroah-Hartman
2012-11-15  4:10 ` [ 47/66] net: fix secpath kmemleak Greg Kroah-Hartman
2012-11-15  4:10 ` [ 48/66] ipv6: Set default hoplimit as zero Greg Kroah-Hartman
2012-11-15  4:10 ` [ 49/66] net: usb: Fix memory leak on Tx data path Greg Kroah-Hartman
2012-11-15  4:10 ` [ 50/66] net: fix divide by zero in tcp algorithm illinois Greg Kroah-Hartman
2012-11-15  4:10 ` [ 51/66] drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free Greg Kroah-Hartman
2012-11-15  4:10 ` [ 52/66] l2tp: fix oops in l2tp_eth_create() error path Greg Kroah-Hartman
2012-11-15  4:10 ` [ 53/66] tcp-repair: Handle zero-length data put in rcv queue Greg Kroah-Hartman
2012-11-15  4:10 ` [ 54/66] net: inet_diag -- Return error code if protocol handler is missed Greg Kroah-Hartman
2012-11-15  4:11 ` [ 55/66] af-packet: fix oops when socket is not present Greg Kroah-Hartman
2012-11-15  4:11 ` [ 56/66] ipv6: send unsolicited neighbour advertisements to all-nodes Greg Kroah-Hartman
2012-11-15  4:11 ` [ 57/66] futex: Handle futex_pi OWNER_DIED take over correctly Greg Kroah-Hartman
2012-11-15  4:11 ` [ 58/66] mmc: sh_mmcif: fix use after free Greg Kroah-Hartman
2012-11-15  4:11 ` [ 59/66] mmc: sdhci: fix NULL dereference in sdhci_request() tuning Greg Kroah-Hartman
2012-11-15  4:11 ` [ 60/66] drm/vmwgfx: Fix hibernation device reset Greg Kroah-Hartman
2012-11-15  4:11 ` [ 61/66] drm/vmwgfx: Fix a case where the code would BUG when trying to pin GMR memory Greg Kroah-Hartman
2012-11-15  4:11 ` [ 62/66] drm/radeon/cayman: add some missing regs to the VM reg checker Greg Kroah-Hartman
2012-11-15  4:11 ` [ 63/66] drm/radeon/si: " Greg Kroah-Hartman
2012-11-15  4:11 ` [ 64/66] GFS2: Test bufdata with buffer locked and gfs2_log_lock held Greg Kroah-Hartman
2012-11-25 13:11   ` Ben Hutchings
2012-11-26 15:13     ` Steven Whitehouse
2012-12-02  3:52       ` Ben Hutchings
2012-11-15  4:11 ` [ 65/66] xfs: fix reading of wrapped log data Greg Kroah-Hartman
2012-11-15  4:11 ` [ 66/66] xfs: fix buffer shudown reference count mismatch Greg Kroah-Hartman

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