All of lore.kernel.org
 help / color / mirror / Atom feed
* [ 000/122] 3.5.1-stable review
@ 2012-08-07 22:24 Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE Greg Kroah-Hartman
                   ` (121 more replies)
  0 siblings, 122 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan

From: Greg KH <gregkh@linuxfoundation.org>

--------------
Note, I still have a lot more patches in the "to-apply" queue for the
3.5-stable, and other stable trees, I am pushing this update out now due
to the size of it.  It will take a few releases to get caught up with
all of the patches tagged and requested for the stable kernel trees.
--------------

This is the start of the stable review cycle for the 3.5.1 release.
There are 122 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 Thu Aug  9 22:19:44 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.5.1-rc1.gz
and the diffstat can be found below.

thanks,

greg k-h

-------------
 Documentation/sound/alsa/HD-Audio-Models.txt    |    3 +-
 Documentation/stable_kernel_rules.txt           |   19 ++-
 Makefile                                        |    4 +-
 arch/arm/boot/dts/tegra-trimslice.dts           |    2 +
 arch/arm/mach-omap2/opp.c                       |    3 +-
 arch/m68k/kernel/sys_m68k.c                     |    8 +-
 arch/mips/kernel/kspd.c                         |    2 +-
 arch/powerpc/boot/dts/p1022ds.dtsi              |   16 ---
 arch/powerpc/include/asm/reg.h                  |    3 +-
 arch/powerpc/kernel/ftrace.c                    |   12 +-
 arch/powerpc/platforms/85xx/p1022_ds.c          |  106 ++++++++++++--
 arch/powerpc/platforms/pseries/eeh_event.c      |    6 +-
 arch/s390/include/asm/mmu_context.h             |   14 +-
 arch/s390/include/asm/processor.h               |    2 +
 arch/s390/kernel/processor.c                    |    2 +
 arch/s390/kernel/smp.c                          |    3 -
 arch/s390/mm/fault.c                            |   13 +-
 arch/s390/mm/mmap.c                             |   12 +-
 arch/s390/mm/pgtable.c                          |    5 -
 arch/x86/kernel/cpu/mcheck/mce.c                |    6 +-
 arch/x86/kernel/microcode_core.c                |   26 +++-
 drivers/acpi/ac.c                               |    4 +-
 drivers/acpi/apei/apei-base.c                   |    5 +
 drivers/base/power/main.c                       |   10 +-
 drivers/char/tpm/tpm.c                          |   12 +-
 drivers/gpu/drm/nouveau/nouveau_drv.h           |    2 -
 drivers/gpu/drm/nouveau/nouveau_irq.c           |    4 -
 drivers/gpu/drm/nouveau/nouveau_software.h      |    1 +
 drivers/gpu/drm/nouveau/nva3_copy.fuc           |    4 +-
 drivers/gpu/drm/nouveau/nva3_copy.fuc.h         |   94 +++++++++++-
 drivers/gpu/drm/nouveau/nvc0_copy.fuc.h         |   87 +++++++++++-
 drivers/gpu/drm/radeon/atombios_dp.c            |   10 +-
 drivers/gpu/drm/radeon/atombios_encoders.c      |   12 +-
 drivers/gpu/drm/radeon/radeon_connectors.c      |   35 +++--
 drivers/gpu/drm/radeon/radeon_cs.c              |    2 +-
 drivers/gpu/drm/radeon/radeon_cursor.c          |    8 +-
 drivers/gpu/drm/radeon/radeon_object.c          |    3 +-
 drivers/hid/hid-multitouch.c                    |   13 +-
 drivers/iommu/amd_iommu.c                       |   17 ++-
 drivers/iommu/amd_iommu_v2.c                    |    2 +
 drivers/md/dm-thin.c                            |    7 +-
 drivers/mmc/host/sdhci-pci.c                    |    1 +
 drivers/mmc/host/sdhci.c                        |    8 +-
 drivers/net/caif/caif_serial.c                  |    3 +
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |    5 +
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   16 ++-
 drivers/net/ethernet/broadcom/tg3.c             |   10 +-
 drivers/net/ethernet/emulex/benet/be_ethtool.c  |    5 +-
 drivers/net/ethernet/emulex/benet/be_main.c     |    2 +-
 drivers/net/ethernet/realtek/r8169.c            |   27 +---
 drivers/net/tun.c                               |    9 +-
 drivers/net/usb/kaweth.c                        |    2 +-
 drivers/net/wireless/b43/b43.h                  |    7 -
 drivers/net/wireless/b43/main.c                 |   32 ++---
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c      |    5 +
 drivers/net/wireless/iwlwifi/iwl-agn-sta.c      |    1 +
 drivers/net/wireless/mwifiex/cfg80211.c         |    4 +-
 drivers/net/wireless/rt2x00/rt2800usb.c         |    3 +-
 drivers/net/wireless/rtlwifi/rtl8192de/phy.c    |    6 +-
 drivers/net/wireless/rtlwifi/usb.c              |   14 +-
 drivers/net/wireless/rtlwifi/wifi.h             |    1 +
 drivers/s390/net/qeth_l3_main.c                 |    4 +
 drivers/scsi/hosts.c                            |    7 +-
 drivers/scsi/libsas/sas_expander.c              |   47 +++---
 drivers/scsi/scsi_error.c                       |   14 ++
 drivers/scsi/scsi_lib.c                         |   43 ++----
 drivers/scsi/scsi_priv.h                        |    1 -
 drivers/scsi/scsi_scan.c                        |    3 +
 drivers/scsi/scsi_sysfs.c                       |   46 +++---
 drivers/spi/spi-pl022.c                         |    5 +
 drivers/staging/zsmalloc/zsmalloc-main.c        |   33 +----
 drivers/target/iscsi/iscsi_target.c             |   22 +--
 drivers/target/iscsi/iscsi_target_core.h        |    2 -
 drivers/target/iscsi/iscsi_target_login.c       |   60 +-------
 drivers/target/target_core_transport.c          |   10 ++
 drivers/usb/core/devio.c                        |   10 +-
 drivers/usb/core/hub.c                          |   26 ++--
 drivers/usb/core/message.c                      |    8 +-
 drivers/usb/core/usb.c                          |    1 +
 drivers/usb/early/ehci-dbgp.c                   |    2 +-
 drivers/usb/gadget/u_ether.c                    |   12 +-
 drivers/usb/serial/option.c                     |    2 +
 drivers/usb/storage/uas.c                       |   90 ++----------
 fs/btrfs/async-thread.c                         |    9 +-
 fs/cifs/cifsglob.h                              |    6 +-
 fs/cifs/connect.c                               |    9 +-
 fs/cifs/file.c                                  |   17 ++-
 fs/exec.c                                       |    2 +-
 fs/ext4/balloc.c                                |    3 +-
 fs/ext4/bitmap.c                                |   12 +-
 fs/ext4/ext4.h                                  |    6 +-
 fs/ext4/extents.c                               |   46 +++---
 fs/ext4/ialloc.c                                |    3 +-
 fs/ext4/inode.c                                 |   41 ++++--
 fs/ext4/namei.c                                 |   11 +-
 fs/ext4/resize.c                                |    7 +-
 fs/ext4/super.c                                 |  174 ++++++++++++++++-------
 fs/ext4/xattr.c                                 |   11 +-
 fs/locks.c                                      |    6 +-
 fs/nfs/file.c                                   |    7 +-
 fs/nfs/idmap.c                                  |   26 +++-
 fs/nfsd/nfs4state.c                             |    4 +-
 fs/nfsd/nfs4xdr.c                               |    2 +-
 fs/select.c                                     |   10 +-
 fs/udf/super.c                                  |    2 +-
 include/linux/cpu.h                             |    5 +-
 include/linux/mm.h                              |    1 +
 include/linux/net.h                             |    1 +
 include/linux/posix_types.h                     |   18 +--
 include/linux/time.h                            |    8 --
 include/linux/usb.h                             |    1 -
 include/target/target_core_base.h               |    1 +
 kernel/cgroup.c                                 |    2 +-
 kernel/exit.c                                   |    2 +-
 kernel/futex.c                                  |   17 ++-
 kernel/power/hibernate.c                        |    6 +
 kernel/power/suspend.c                          |    3 +
 kernel/power/wakelock.c                         |    7 +
 kernel/printk.c                                 |   33 +++--
 kernel/workqueue.c                              |   38 ++++-
 mm/memory-failure.c                             |   14 +-
 net/batman-adv/routing.c                        |    2 +
 net/compat.c                                    |    4 +-
 net/core/rtnetlink.c                            |    8 +-
 net/ipv4/tcp.c                                  |    5 +-
 net/ipv4/tcp_input.c                            |    4 +-
 net/mac80211/mlme.c                             |    4 +-
 net/mac80211/tx.c                               |    2 +-
 net/mac80211/util.c                             |   12 +-
 net/socket.c                                    |    3 +
 net/sunrpc/sched.c                              |    2 +
 net/sunrpc/xprtrdma/transport.c                 |    3 +-
 net/sunrpc/xprtsock.c                           |   10 ++
 net/wanrouter/wanmain.c                         |   51 +++----
 security/selinux/hooks.c                        |    2 +-
 security/smack/smackfs.c                        |    8 +-
 sound/drivers/mpu401/mpu401_uart.c              |    1 +
 sound/pci/hda/hda_codec.c                       |    7 +
 sound/pci/hda/patch_hdmi.c                      |   12 +-
 sound/pci/hda/patch_realtek.c                   |   29 ++++
 sound/pci/hda/patch_sigmatel.c                  |   22 ++-
 sound/pci/hda/patch_via.c                       |    7 +-
 sound/soc/codecs/wm8962.c                       |    6 +
 sound/soc/codecs/wm8994.c                       |    2 +-
 sound/soc/soc-dapm.c                            |   15 +-
 sound/usb/clock.c                               |    3 +-
 146 files changed, 1273 insertions(+), 730 deletions(-)



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

* [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 002/122] iscsi-target: Drop bogus struct file usage for iSCSI/SCTP Greg Kroah-Hartman
                   ` (120 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Roland Dreier, Nicholas Bellinger

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Roland Dreier <roland@purestorage.com>

commit e2397c704429025bc6b331a970f699e52f34283e upstream.

Many SCSI commands are defined to return a CHECK CONDITION / ILLEGAL
REQUEST with ASC set to LOGICAL BLOCK ADDRESS OUT OF RANGE if the
initiator sends a command that accesses a too-big LBA.  Add an enum
value and case entries so that target code can return this status.

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_transport.c |   10 ++++++++++
 include/target/target_core_base.h      |    1 +
 2 files changed, 11 insertions(+)

--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1797,6 +1797,7 @@ void transport_generic_request_failure(s
 	case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
 	case TCM_UNKNOWN_MODE_PAGE:
 	case TCM_WRITE_PROTECTED:
+	case TCM_ADDRESS_OUT_OF_RANGE:
 	case TCM_CHECK_CONDITION_ABORT_CMD:
 	case TCM_CHECK_CONDITION_UNIT_ATTENTION:
 	case TCM_CHECK_CONDITION_NOT_READY:
@@ -4212,6 +4213,15 @@ int transport_send_check_condition_and_s
 		/* WRITE PROTECTED */
 		buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27;
 		break;
+	case TCM_ADDRESS_OUT_OF_RANGE:
+		/* CURRENT ERROR */
+		buffer[offset] = 0x70;
+		buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
+		/* ILLEGAL REQUEST */
+		buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
+		/* LOGICAL BLOCK ADDRESS OUT OF RANGE */
+		buffer[offset+SPC_ASC_KEY_OFFSET] = 0x21;
+		break;
 	case TCM_CHECK_CONDITION_UNIT_ATTENTION:
 		/* CURRENT ERROR */
 		buffer[offset] = 0x70;
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -220,6 +220,7 @@ enum tcm_sense_reason_table {
 	TCM_CHECK_CONDITION_UNIT_ATTENTION	= 0x0e,
 	TCM_CHECK_CONDITION_NOT_READY		= 0x0f,
 	TCM_RESERVATION_CONFLICT		= 0x10,
+	TCM_ADDRESS_OUT_OF_RANGE		= 0x11,
 };
 
 enum target_sc_flags_table {



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

* [ 002/122] iscsi-target: Drop bogus struct file usage for iSCSI/SCTP
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 003/122] mmc: sdhci-pci: CaFe has broken card detection Greg Kroah-Hartman
                   ` (119 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Al Viro, Andy Grover,
	Hannes Reinecke, Christoph Hellwig, Nicholas Bellinger

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit bf6932f44a7b3fa7e2246a8b18a44670e5eab6c2 upstream.

>From Al Viro:

	BTW, speaking of struct file treatment related to sockets -
        there's this piece of code in iscsi:
        /*
         * The SCTP stack needs struct socket->file.
         */
        if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
            (np->np_network_transport == ISCSI_SCTP_UDP)) {
                if (!new_sock->file) {
                        new_sock->file = kzalloc(
                                        sizeof(struct file), GFP_KERNEL);

For one thing, as far as I can see it'not true - sctp does *not* depend on
socket->file being non-NULL; it does, in one place, check socket->file->f_flags
for O_NONBLOCK, but there it treats NULL socket->file as "flag not set".
Which is the case here anyway - the fake struct file created in
__iscsi_target_login_thread() (and in iscsi_target_setup_login_socket(), with
the same excuse) do *not* get that flag set.

Moreover, it's a bloody serious violation of a bunch of asserts in VFS;
all struct file instances should come from filp_cachep, via get_empty_filp()
(or alloc_file(), which is a wrapper for it).  FWIW, I'm very tempted to
do this and be done with the entire mess:

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
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       |   22 +----------
 drivers/target/iscsi/iscsi_target_core.h  |    2 -
 drivers/target/iscsi/iscsi_target_login.c |   60 +-----------------------------
 3 files changed, 6 insertions(+), 78 deletions(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -429,19 +429,8 @@ int iscsit_reset_np_thread(
 
 int iscsit_del_np_comm(struct iscsi_np *np)
 {
-	if (!np->np_socket)
-		return 0;
-
-	/*
-	 * Some network transports allocate their own struct sock->file,
-	 * see  if we need to free any additional allocated resources.
-	 */
-	if (np->np_flags & NPF_SCTP_STRUCT_FILE) {
-		kfree(np->np_socket->file);
-		np->np_socket->file = NULL;
-	}
-
-	sock_release(np->np_socket);
+	if (np->np_socket)
+		sock_release(np->np_socket);
 	return 0;
 }
 
@@ -4077,13 +4066,8 @@ int iscsit_close_connection(
 	kfree(conn->conn_ops);
 	conn->conn_ops = NULL;
 
-	if (conn->sock) {
-		if (conn->conn_flags & CONNFLAG_SCTP_STRUCT_FILE) {
-			kfree(conn->sock->file);
-			conn->sock->file = NULL;
-		}
+	if (conn->sock)
 		sock_release(conn->sock);
-	}
 	conn->thread_set = NULL;
 
 	pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -224,7 +224,6 @@ enum iscsi_timer_flags_table {
 /* Used for struct iscsi_np->np_flags */
 enum np_flags_table {
 	NPF_IP_NETWORK		= 0x00,
-	NPF_SCTP_STRUCT_FILE	= 0x01 /* Bugfix */
 };
 
 /* Used for struct iscsi_np->np_thread_state */
@@ -503,7 +502,6 @@ struct iscsi_conn {
 	u16			local_port;
 	int			net_size;
 	u32			auth_id;
-#define CONNFLAG_SCTP_STRUCT_FILE			0x01
 	u32			conn_flags;
 	/* Used for iscsi_tx_login_rsp() */
 	u32			login_itt;
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -795,22 +795,6 @@ int iscsi_target_setup_login_socket(
 	}
 	np->np_socket = sock;
 	/*
-	 * The SCTP stack needs struct socket->file.
-	 */
-	if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
-	    (np->np_network_transport == ISCSI_SCTP_UDP)) {
-		if (!sock->file) {
-			sock->file = kzalloc(sizeof(struct file), GFP_KERNEL);
-			if (!sock->file) {
-				pr_err("Unable to allocate struct"
-						" file for SCTP\n");
-				ret = -ENOMEM;
-				goto fail;
-			}
-			np->np_flags |= NPF_SCTP_STRUCT_FILE;
-		}
-	}
-	/*
 	 * Setup the np->np_sockaddr from the passed sockaddr setup
 	 * in iscsi_target_configfs.c code..
 	 */
@@ -869,21 +853,15 @@ int iscsi_target_setup_login_socket(
 
 fail:
 	np->np_socket = NULL;
-	if (sock) {
-		if (np->np_flags & NPF_SCTP_STRUCT_FILE) {
-			kfree(sock->file);
-			sock->file = NULL;
-		}
-
+	if (sock)
 		sock_release(sock);
-	}
 	return ret;
 }
 
 static int __iscsi_target_login_thread(struct iscsi_np *np)
 {
 	u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0;
-	int err, ret = 0, set_sctp_conn_flag, stop;
+	int err, ret = 0, stop;
 	struct iscsi_conn *conn = NULL;
 	struct iscsi_login *login;
 	struct iscsi_portal_group *tpg = NULL;
@@ -894,7 +872,6 @@ static int __iscsi_target_login_thread(s
 	struct sockaddr_in6 sock_in6;
 
 	flush_signals(current);
-	set_sctp_conn_flag = 0;
 	sock = np->np_socket;
 
 	spin_lock_bh(&np->np_thread_lock);
@@ -917,35 +894,12 @@ static int __iscsi_target_login_thread(s
 		spin_unlock_bh(&np->np_thread_lock);
 		goto out;
 	}
-	/*
-	 * The SCTP stack needs struct socket->file.
-	 */
-	if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
-	    (np->np_network_transport == ISCSI_SCTP_UDP)) {
-		if (!new_sock->file) {
-			new_sock->file = kzalloc(
-					sizeof(struct file), GFP_KERNEL);
-			if (!new_sock->file) {
-				pr_err("Unable to allocate struct"
-						" file for SCTP\n");
-				sock_release(new_sock);
-				/* Get another socket */
-				return 1;
-			}
-			set_sctp_conn_flag = 1;
-		}
-	}
-
 	iscsi_start_login_thread_timer(np);
 
 	conn = kzalloc(sizeof(struct iscsi_conn), GFP_KERNEL);
 	if (!conn) {
 		pr_err("Could not allocate memory for"
 			" new connection\n");
-		if (set_sctp_conn_flag) {
-			kfree(new_sock->file);
-			new_sock->file = NULL;
-		}
 		sock_release(new_sock);
 		/* Get another socket */
 		return 1;
@@ -955,9 +909,6 @@ static int __iscsi_target_login_thread(s
 	conn->conn_state = TARG_CONN_STATE_FREE;
 	conn->sock = new_sock;
 
-	if (set_sctp_conn_flag)
-		conn->conn_flags |= CONNFLAG_SCTP_STRUCT_FILE;
-
 	pr_debug("Moving to TARG_CONN_STATE_XPT_UP.\n");
 	conn->conn_state = TARG_CONN_STATE_XPT_UP;
 
@@ -1205,13 +1156,8 @@ old_sess_out:
 		iscsi_release_param_list(conn->param_list);
 		conn->param_list = NULL;
 	}
-	if (conn->sock) {
-		if (conn->conn_flags & CONNFLAG_SCTP_STRUCT_FILE) {
-			kfree(conn->sock->file);
-			conn->sock->file = NULL;
-		}
+	if (conn->sock)
 		sock_release(conn->sock);
-	}
 	kfree(conn);
 
 	if (tpg) {



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

* [ 003/122] mmc: sdhci-pci: CaFe has broken card detection
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 002/122] iscsi-target: Drop bogus struct file usage for iSCSI/SCTP Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 004/122] mmc: sdhci: fix incorrect command used in tuning Greg Kroah-Hartman
                   ` (118 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Daniel Drake, Chris Ball

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Daniel Drake <dsd@laptop.org>

commit 55fc05b7414274f17795cd0e8a3b1546f3649d5e upstream.

At http://dev.laptop.org/ticket/11980 we have determined that the
Marvell CaFe SDHCI controller reports bad card presence during
resume. It reports that no card is present even when it is.
This is a regression -- resume worked back around 2.6.37.

Around 400ms after resuming, a "card inserted" interrupt is
generated, at which point it starts reporting presence.

Work around this hardware oddity by setting the
SDHCI_QUIRK_BROKEN_CARD_DETECTION flag.
Thanks to Chris Ball for helping with diagnosis.

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

---
 drivers/mmc/host/sdhci-pci.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -157,6 +157,7 @@ static const struct sdhci_pci_fixes sdhc
 static const struct sdhci_pci_fixes sdhci_cafe = {
 	.quirks		= SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
 			  SDHCI_QUIRK_NO_BUSY_IRQ |
+			  SDHCI_QUIRK_BROKEN_CARD_DETECTION |
 			  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
 };
 



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

* [ 004/122] mmc: sdhci: fix incorrect command used in tuning
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2012-08-07 22:24 ` [ 003/122] mmc: sdhci-pci: CaFe has broken card detection Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 005/122] powerpc/ftrace: Fix assembly trampoline register usage Greg Kroah-Hartman
                   ` (117 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Aaron Lu, Philip Rakity, Chris Ball

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Aaron Lu <aaron.lu@amd.com>

commit 473b095a72a95ba719905b1f2e82cd18d099a427 upstream.

For SD hosts using retuning mode 1, when retuning timer expired, it will
need to do retuning in sdhci_request before processing the actual
request. But the retuning command is fixed: cmd19 for SD card and cmd21
for eMMC card, so we can't use the original request's command to do the
tuning.

And since the tuning command depends on the card type attached to the
host, we will need to know the card type to use the correct tuning
command.

Signed-off-by: Aaron Lu <aaron.lu@amd.com>
Reviewed-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/host/sdhci.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -27,6 +27,7 @@
 
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
 
 #include "sdhci.h"
 
@@ -1245,6 +1246,7 @@ static void sdhci_request(struct mmc_hos
 	struct sdhci_host *host;
 	bool present;
 	unsigned long flags;
+	u32 tuning_opcode;
 
 	host = mmc_priv(mmc);
 
@@ -1292,8 +1294,12 @@ 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, mrq->cmd->opcode);
+			sdhci_execute_tuning(mmc, tuning_opcode);
 			spin_lock_irqsave(&host->lock, flags);
 
 			/* Restore original mmc_request structure */



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

* [ 005/122] powerpc/ftrace: Fix assembly trampoline register usage
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2012-08-07 22:24 ` [ 004/122] mmc: sdhci: fix incorrect command used in tuning Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 006/122] powerpc: Add "memory" attribute for mfmsr() Greg Kroah-Hartman
                   ` (116 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Roger Blofeld,
	Benjamin Herrenschmidt, Paul Gortmaker

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: roger blofeld <blofeldus@yahoo.com>

commit fd5a42980e1cf327b7240adf5e7b51ea41c23437 upstream.

Just like the module loader, ftrace needs to be updated to use r12
instead of r11 with newer gcc's.

Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/ftrace.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -245,9 +245,9 @@ __ftrace_make_nop(struct module *mod,
 
 	/*
 	 * On PPC32 the trampoline looks like:
-	 *  0x3d, 0x60, 0x00, 0x00  lis r11,sym@ha
-	 *  0x39, 0x6b, 0x00, 0x00  addi r11,r11,sym@l
-	 *  0x7d, 0x69, 0x03, 0xa6  mtctr r11
+	 *  0x3d, 0x80, 0x00, 0x00  lis r12,sym@ha
+	 *  0x39, 0x8c, 0x00, 0x00  addi r12,r12,sym@l
+	 *  0x7d, 0x89, 0x03, 0xa6  mtctr r12
 	 *  0x4e, 0x80, 0x04, 0x20  bctr
 	 */
 
@@ -262,9 +262,9 @@ __ftrace_make_nop(struct module *mod,
 	pr_devel(" %08x %08x ", jmp[0], jmp[1]);
 
 	/* verify that this is what we expect it to be */
-	if (((jmp[0] & 0xffff0000) != 0x3d600000) ||
-	    ((jmp[1] & 0xffff0000) != 0x396b0000) ||
-	    (jmp[2] != 0x7d6903a6) ||
+	if (((jmp[0] & 0xffff0000) != 0x3d800000) ||
+	    ((jmp[1] & 0xffff0000) != 0x398c0000) ||
+	    (jmp[2] != 0x7d8903a6) ||
 	    (jmp[3] != 0x4e800420)) {
 		printk(KERN_ERR "Not a trampoline\n");
 		return -EINVAL;



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

* [ 006/122] powerpc: Add "memory" attribute for mfmsr()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2012-08-07 22:24 ` [ 005/122] powerpc/ftrace: Fix assembly trampoline register usage Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 007/122] powerpc/eeh: Check handle_eeh_events() return value Greg Kroah-Hartman
                   ` (115 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tiejun Chen, Benjamin Herrenschmidt

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Tiejun Chen <tiejun.chen@windriver.com>

commit b416c9a10baae6a177b4f9ee858b8d309542fbef upstream.

Add "memory" attribute in inline assembly language as a compiler
barrier to make sure 4.6.x GCC don't reorder mfmsr().

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/include/asm/reg.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1024,7 +1024,8 @@
 /* Macros for setting and retrieving special purpose registers */
 #ifndef __ASSEMBLY__
 #define mfmsr()		({unsigned long rval; \
-			asm volatile("mfmsr %0" : "=r" (rval)); rval;})
+			asm volatile("mfmsr %0" : "=r" (rval) : \
+						: "memory"); rval;})
 #ifdef CONFIG_PPC_BOOK3S_64
 #define __mtmsrd(v, l)	asm volatile("mtmsrd %0," __stringify(l) \
 				     : : "r" (v) : "memory")



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

* [ 007/122] powerpc/eeh: Check handle_eeh_events() return value
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2012-08-07 22:24 ` [ 006/122] powerpc: Add "memory" attribute for mfmsr() Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 008/122] be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC Greg Kroah-Hartman
                   ` (114 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Kleber Sacilotto de Souza,
	Benjamin Herrenschmidt

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>

commit 10db8d212864cb6741df7d7fafda5ab6661f6f88 upstream.

Function eeh_event_handler() dereferences the pointer returned by
handle_eeh_events() without checking, causing a crash if NULL was
returned, which is expected in some situations.

This patch fixes this bug by checking for the value returned by
handle_eeh_events() before dereferencing it.

Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/platforms/pseries/eeh_event.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -85,8 +85,10 @@ static int eeh_event_handler(void * dumm
 	set_current_state(TASK_INTERRUPTIBLE);	/* Don't add to load average */
 	edev = handle_eeh_events(event);
 
-	eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
-	pci_dev_put(edev->pdev);
+	if (edev) {
+		eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
+		pci_dev_put(edev->pdev);
+	}
 
 	kfree(event);
 	mutex_unlock(&eeh_event_mutex);



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

* [ 008/122] be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2012-08-07 22:24 ` [ 007/122] powerpc/eeh: Check handle_eeh_events() return value Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 009/122] powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS Greg Kroah-Hartman
                   ` (113 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Anton Blanchard, Sathya Perla,
	David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Anton Blanchard <anton@samba.org>

commit ac46a4623815113a0305b2a491c125f473a88c53 upstream.

We are seeing an oops in be_get_fw_log_level on ppc64 where we walk
off the end of memory.

commit 941a77d582c8 (be2net: Fix to allow get/set of debug levels in
the firmware.) requires byteswapping of num_modes and num_modules.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Sathya Perla <sperla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/emulex/benet/be_ethtool.c |    5 +++--
 drivers/net/ethernet/emulex/benet/be_main.c    |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -910,8 +910,9 @@ static void be_set_fw_log_level(struct b
 	if (!status) {
 		cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
 					sizeof(struct be_cmd_resp_hdr));
-		for (i = 0; i < cfgs->num_modules; i++) {
-			for (j = 0; j < cfgs->module[i].num_modes; j++) {
+		for (i = 0; i < le32_to_cpu(cfgs->num_modules); i++) {
+			u32 num_modes = le32_to_cpu(cfgs->module[i].num_modes);
+			for (j = 0; j < num_modes; j++) {
 				if (cfgs->module[i].trace_lvl[j].mode ==
 								MODE_UART)
 					cfgs->module[i].trace_lvl[j].dbg_lvl =
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3479,7 +3479,7 @@ u32 be_get_fw_log_level(struct be_adapte
 	if (!status) {
 		cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +
 						sizeof(struct be_cmd_resp_hdr));
-		for (j = 0; j < cfgs->module[0].num_modes; j++) {
+		for (j = 0; j < le32_to_cpu(cfgs->module[0].num_modes); j++) {
 			if (cfgs->module[0].trace_lvl[j].mode == MODE_UART)
 				level = cfgs->module[0].trace_lvl[j].dbg_lvl;
 		}



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

* [ 009/122] powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2012-08-07 22:24 ` [ 008/122] be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
                   ` (112 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Timur Tabi, Kumar Gala

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Timur Tabi <timur@freescale.com>

commit 6bd825f02966be8ba544047cab313d6032c23819 upstream.

In order to enable the DIU video controller on the P1022DS, the FPGA needs
to be switched to "indirect mode", where the localbus is disabled and
the FPGA is accessed via writes to localbus chip select signals CS0 and CS1.

To obtain the address of CS0 and CS1, the platform driver uses an "indirect
pixis mode" device tree node.  This node assumes that the localbus 'ranges'
property is sorted in chip-select order.  That is, reg value 0 maps to
CS0, reg value 1 maps to CS1, etc.  This is how the 'ranges' property is
supposed to be arranged.

Unfortunately, the 'ranges' property is often mis-arranged, and not just on
the P1022DS.  Linux normally does not care, since it does not program the
localbus.  But the indirect-mode code on the P1022DS does care.

The "proper" fix is to have U-Boot fix the 'ranges' property, but this would
be too cumbersome.  The names and 'reg' properties of all the localbus
devices would also need to be updated, and determining which localbus device
maps to which chip select is board-specific.

Instead, we determine the CS0/CS1 base addresses the same way that U-boot
does -- by reading the BRx registers directly and mapping them to physical
addresses.  This code is simpler and more reliable, and it does not require
a U-boot or device tree change.

Since the indirect pixis device tree node is no longer needed, the node is
deleted from the DTS.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/boot/dts/p1022ds.dtsi     |   16 ----
 arch/powerpc/platforms/85xx/p1022_ds.c |  106 ++++++++++++++++++++++++++++-----
 2 files changed, 93 insertions(+), 29 deletions(-)

--- a/arch/powerpc/boot/dts/p1022ds.dtsi
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -33,22 +33,6 @@
  */
 
 &board_lbc {
-	/*
-	 * This node is used to access the pixis via "indirect" mode,
-	 * which is done by writing the pixis register index to chip
-	 * select 0 and the value to/from chip select 1.  Indirect
-	 * mode is the only way to access the pixis when DIU video
-	 * is enabled.  Note that this assumes that the first column
-	 * of the 'ranges' property above is the chip select number.
-	 */
-	board-control@0,0 {
-		compatible = "fsl,p1022ds-indirect-pixis";
-		reg = <0x0 0x0 1	/* CS0 */
-		       0x1 0x0 1>;	/* CS1 */
-		interrupt-parent = <&mpic>;
-		interrupts = <8 0 0 0>;
-	};
-
 	nor@0,0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -27,6 +27,7 @@
 #include <sysdev/fsl_pci.h>
 #include <asm/udbg.h>
 #include <asm/fsl_guts.h>
+#include <asm/fsl_lbc.h>
 #include "smp.h"
 
 #include "mpc85xx.h"
@@ -142,17 +143,73 @@ static void p1022ds_set_gamma_table(enum
 {
 }
 
+struct fsl_law {
+	u32	lawbar;
+	u32	reserved1;
+	u32	lawar;
+	u32	reserved[5];
+};
+
+#define LAWBAR_MASK	0x00F00000
+#define LAWBAR_SHIFT	12
+
+#define LAWAR_EN	0x80000000
+#define LAWAR_TGT_MASK	0x01F00000
+#define LAW_TRGT_IF_LBC	(0x04 << 20)
+
+#define LAWAR_MASK	(LAWAR_EN | LAWAR_TGT_MASK)
+#define LAWAR_MATCH	(LAWAR_EN | LAW_TRGT_IF_LBC)
+
+#define BR_BA		0xFFFF8000
+
+/*
+ * Map a BRx value to a physical address
+ *
+ * The localbus BRx registers only store the lower 32 bits of the address.  To
+ * obtain the upper four bits, we need to scan the LAW table.  The entry which
+ * maps to the localbus will contain the upper four bits.
+ */
+static phys_addr_t lbc_br_to_phys(const void *ecm, unsigned int count, u32 br)
+{
+#ifndef CONFIG_PHYS_64BIT
+	/*
+	 * If we only have 32-bit addressing, then the BRx address *is* the
+	 * physical address.
+	 */
+	return br & BR_BA;
+#else
+	const struct fsl_law *law = ecm + 0xc08;
+	unsigned int i;
+
+	for (i = 0; i < count; i++) {
+		u64 lawbar = in_be32(&law[i].lawbar);
+		u32 lawar = in_be32(&law[i].lawar);
+
+		if ((lawar & LAWAR_MASK) == LAWAR_MATCH)
+			/* Extract the upper four bits */
+			return (br & BR_BA) | ((lawbar & LAWBAR_MASK) << 12);
+	}
+
+	return 0;
+#endif
+}
+
 /**
  * p1022ds_set_monitor_port: switch the output to a different monitor port
- *
  */
 static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
 {
 	struct device_node *guts_node;
-	struct device_node *indirect_node = NULL;
+	struct device_node *lbc_node = NULL;
+	struct device_node *law_node = NULL;
 	struct ccsr_guts __iomem *guts;
+	struct fsl_lbc_regs *lbc = NULL;
+	void *ecm = NULL;
 	u8 __iomem *lbc_lcs0_ba = NULL;
 	u8 __iomem *lbc_lcs1_ba = NULL;
+	phys_addr_t cs0_addr, cs1_addr;
+	const __be32 *iprop;
+	unsigned int num_laws;
 	u8 b;
 
 	/* Map the global utilities registers. */
@@ -168,25 +225,43 @@ static void p1022ds_set_monitor_port(enu
 		goto exit;
 	}
 
-	indirect_node = of_find_compatible_node(NULL, NULL,
-					     "fsl,p1022ds-indirect-pixis");
-	if (!indirect_node) {
-		pr_err("p1022ds: missing pixis indirect mode node\n");
+	lbc_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
+	if (!lbc_node) {
+		pr_err("p1022ds: missing localbus node\n");
+		goto exit;
+	}
+
+	lbc = of_iomap(lbc_node, 0);
+	if (!lbc) {
+		pr_err("p1022ds: could not map localbus node\n");
 		goto exit;
 	}
 
-	lbc_lcs0_ba = of_iomap(indirect_node, 0);
-	if (!lbc_lcs0_ba) {
-		pr_err("p1022ds: could not map localbus chip select 0\n");
+	law_node = of_find_compatible_node(NULL, NULL, "fsl,ecm-law");
+	if (!law_node) {
+		pr_err("p1022ds: missing local access window node\n");
 		goto exit;
 	}
 
-	lbc_lcs1_ba = of_iomap(indirect_node, 1);
-	if (!lbc_lcs1_ba) {
-		pr_err("p1022ds: could not map localbus chip select 1\n");
+	ecm = of_iomap(law_node, 0);
+	if (!ecm) {
+		pr_err("p1022ds: could not map local access window node\n");
 		goto exit;
 	}
 
+	iprop = of_get_property(law_node, "fsl,num-laws", 0);
+	if (!iprop) {
+		pr_err("p1022ds: LAW node is missing fsl,num-laws property\n");
+		goto exit;
+	}
+	num_laws = be32_to_cpup(iprop);
+
+	cs0_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[0].br));
+	cs1_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[1].br));
+
+	lbc_lcs0_ba = ioremap(cs0_addr, 1);
+	lbc_lcs1_ba = ioremap(cs1_addr, 1);
+
 	/* Make sure we're in indirect mode first. */
 	if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
 	    PMUXCR_ELBCDIU_DIU) {
@@ -254,10 +329,15 @@ exit:
 		iounmap(lbc_lcs1_ba);
 	if (lbc_lcs0_ba)
 		iounmap(lbc_lcs0_ba);
+	if (lbc)
+		iounmap(lbc);
+	if (ecm)
+		iounmap(ecm);
 	if (guts)
 		iounmap(guts);
 
-	of_node_put(indirect_node);
+	of_node_put(law_node);
+	of_node_put(lbc_node);
 	of_node_put(guts_node);
 }
 



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

* [ 010/122] smack: off by one error
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2012-08-07 22:24 ` [ 009/122] powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:53   ` Casey Schaufler
  2012-08-08  0:11   ` Casey Schaufler
  2012-08-07 22:24 ` [ 011/122] SCSI: libsas: continue revalidation Greg Kroah-Hartman
                   ` (111 subsequent siblings)
  121 siblings, 2 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Alan Cox, Casey Schaufler, James Morris

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Alan Cox <alan@linux.intel.com>

commit 3b9fc37280c521b086943f9aedda767f5bf3b2d3 upstream.

Consider the input case of a rule that consists entirely of non space
symbols followed by a \0. Say 64 + \0

In this case strlen(data) = 64
kzalloc of subject and object are 64 byte objects
sscanfdata, "%s %s %s", subject, ...)

will put 65 bytes into subject.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 security/smack/smackfs.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -325,11 +325,11 @@ static int smk_parse_long_rule(const cha
 	int datalen;
 	int rc = -1;
 
-	/*
-	 * This is probably inefficient, but safe.
-	 */
+	/* This is inefficient */
 	datalen = strlen(data);
-	subject = kzalloc(datalen, GFP_KERNEL);
+
+	/* Our first element can be 64 + \0 with no spaces */
+	subject = kzalloc(datalen + 1, GFP_KERNEL);
 	if (subject == NULL)
 		return -1;
 	object = kzalloc(datalen, GFP_KERNEL);



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

* [ 011/122] SCSI: libsas: continue revalidation
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
@ 2012-08-07 22:24 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 012/122] SCSI: libsas: fix sas_discover_devices return code handling Greg Kroah-Hartman
                   ` (110 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dan Williams, James Bottomley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Dan Williams <dan.j.williams@intel.com>

commit 26f2f199ff150d8876b2641c41e60d1c92d2fb81 upstream.

Continue running revalidation until no more broadcast devices are
discovered.  Fixes cases where re-discovery completes too early in a
domain with multiple expanders with pending re-discovery events.
Servicing BCNs can get backed up behind error recovery.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/libsas/sas_expander.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -2109,9 +2109,7 @@ int sas_ex_revalidate_domain(struct doma
 	struct domain_device *dev = NULL;
 
 	res = sas_find_bcast_dev(port_dev, &dev);
-	if (res)
-		goto out;
-	if (dev) {
+	while (res == 0 && dev) {
 		struct expander_device *ex = &dev->ex_dev;
 		int i = 0, phy_id;
 
@@ -2123,8 +2121,10 @@ int sas_ex_revalidate_domain(struct doma
 			res = sas_rediscover(dev, phy_id);
 			i = phy_id + 1;
 		} while (i < ex->num_phys);
+
+		dev = NULL;
+		res = sas_find_bcast_dev(port_dev, &dev);
 	}
-out:
 	return res;
 }
 



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

* [ 012/122] SCSI: libsas: fix sas_discover_devices return code handling
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2012-08-07 22:24 ` [ 011/122] SCSI: libsas: continue revalidation Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 013/122] SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations) Greg Kroah-Hartman
                   ` (109 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dan Melnic, Dan Williams,
	Jack Wang, James Bottomley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Dan Williams <dan.j.williams@intel.com>

commit b17caa174a7e1fd2e17b26e210d4ee91c4c28b37 upstream.

commit 198439e4 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev()
commit 19252de6 [SCSI] libsas: fix wide port hotplug issues

The above commits seem to have confused the return value of
sas_ex_discover_dev which is non-zero on failure and
sas_ex_join_wide_port which just indicates short circuiting discovery on
already established ports.  The result is random discovery failures
depending on configuration.

Calls to sas_ex_join_wide_port are the source of the trouble as its
return value is errantly assigned to 'res'.  Convert it to bool and stop
returning its result up the stack.

Tested-by: Dan Melnic <dan.melnic@amd.com>
Reported-by: Dan Melnic <dan.melnic@amd.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/libsas/sas_expander.c |   39 +++++++++++--------------------------
 1 file changed, 12 insertions(+), 27 deletions(-)

--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -868,7 +868,7 @@ static struct domain_device *sas_ex_disc
 }
 
 /* See if this phy is part of a wide port */
-static int sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
+static bool sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
 {
 	struct ex_phy *phy = &parent->ex_dev.ex_phy[phy_id];
 	int i;
@@ -884,11 +884,11 @@ static int sas_ex_join_wide_port(struct
 			sas_port_add_phy(ephy->port, phy->phy);
 			phy->port = ephy->port;
 			phy->phy_state = PHY_DEVICE_DISCOVERED;
-			return 0;
+			return true;
 		}
 	}
 
-	return -ENODEV;
+	return false;
 }
 
 static struct domain_device *sas_ex_discover_expander(
@@ -1030,8 +1030,7 @@ static int sas_ex_discover_dev(struct do
 		return res;
 	}
 
-	res = sas_ex_join_wide_port(dev, phy_id);
-	if (!res) {
+	if (sas_ex_join_wide_port(dev, phy_id)) {
 		SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n",
 			    phy_id, SAS_ADDR(ex_phy->attached_sas_addr));
 		return res;
@@ -1077,8 +1076,7 @@ static int sas_ex_discover_dev(struct do
 			if (SAS_ADDR(ex->ex_phy[i].attached_sas_addr) ==
 			    SAS_ADDR(child->sas_addr)) {
 				ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED;
-				res = sas_ex_join_wide_port(dev, i);
-				if (!res)
+				if (sas_ex_join_wide_port(dev, i))
 					SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n",
 						    i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr));
 
@@ -1943,32 +1941,20 @@ static int sas_discover_new(struct domai
 {
 	struct ex_phy *ex_phy = &dev->ex_dev.ex_phy[phy_id];
 	struct domain_device *child;
-	bool found = false;
-	int res, i;
+	int res;
 
 	SAS_DPRINTK("ex %016llx phy%d new device attached\n",
 		    SAS_ADDR(dev->sas_addr), phy_id);
 	res = sas_ex_phy_discover(dev, phy_id);
 	if (res)
-		goto out;
-	/* to support the wide port inserted */
-	for (i = 0; i < dev->ex_dev.num_phys; i++) {
-		struct ex_phy *ex_phy_temp = &dev->ex_dev.ex_phy[i];
-		if (i == phy_id)
-			continue;
-		if (SAS_ADDR(ex_phy_temp->attached_sas_addr) ==
-		    SAS_ADDR(ex_phy->attached_sas_addr)) {
-			found = true;
-			break;
-		}
-	}
-	if (found) {
-		sas_ex_join_wide_port(dev, phy_id);
+		return res;
+
+	if (sas_ex_join_wide_port(dev, phy_id))
 		return 0;
-	}
+
 	res = sas_ex_discover_devices(dev, phy_id);
-	if (!res)
-		goto out;
+	if (res)
+		return res;
 	list_for_each_entry(child, &dev->ex_dev.children, siblings) {
 		if (SAS_ADDR(child->sas_addr) ==
 		    SAS_ADDR(ex_phy->attached_sas_addr)) {
@@ -1978,7 +1964,6 @@ static int sas_discover_new(struct domai
 			break;
 		}
 	}
-out:
 	return res;
 }
 



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

* [ 013/122] SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations)
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2012-08-07 22:25 ` [ 012/122] SCSI: libsas: fix sas_discover_devices return code handling Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 014/122] SCSI: fix hot unplug vs async scan race Greg Kroah-Hartman
                   ` (108 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tom Jackson, Dan Williams,
	James Bottomley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Dan Williams <dan.j.williams@intel.com>

commit 57fc2e335fd3c2f898ee73570dc81426c28dc7b4 upstream.

Rapid ata hotplug on a libsas controller results in cases where libsas
is waiting indefinitely on eh to perform an ata probe.

A race exists between scsi_schedule_eh() and scsi_restart_operations()
in the case when scsi_restart_operations() issues i/o to other devices
in the sas domain.  When this happens the host state transitions from
SHOST_RECOVERY (set by scsi_schedule_eh) back to SHOST_RUNNING and
->host_busy is non-zero so we put the eh thread to sleep even though
->host_eh_scheduled is active.

Before putting the error handler to sleep we need to check if the
host_state needs to return to SHOST_RECOVERY for another trip through
eh.  Since i/o that is released by scsi_restart_operations has been
blocked for at least one eh cycle, this implementation allows those
i/o's to run before another eh cycle starts to discourage hung task
timeouts.

Reported-by: Tom Jackson <thomas.p.jackson@intel.com>
Tested-by: Tom Jackson <thomas.p.jackson@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/scsi_error.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1687,6 +1687,20 @@ static void scsi_restart_operations(stru
 	 * requests are started.
 	 */
 	scsi_run_host_queues(shost);
+
+	/*
+	 * if eh is active and host_eh_scheduled is pending we need to re-run
+	 * recovery.  we do this check after scsi_run_host_queues() to allow
+	 * everything pent up since the last eh run a chance to make forward
+	 * progress before we sync again.  Either we'll immediately re-run
+	 * recovery or scsi_device_unbusy() will wake us again when these
+	 * pending commands complete.
+	 */
+	spin_lock_irqsave(shost->host_lock, flags);
+	if (shost->host_eh_scheduled)
+		if (scsi_host_set_state(shost, SHOST_RECOVERY))
+			WARN_ON(scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY));
+	spin_unlock_irqrestore(shost->host_lock, flags);
 }
 
 /**



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

* [ 014/122] SCSI: fix hot unplug vs async scan race
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2012-08-07 22:25 ` [ 013/122] SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations) Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 015/122] SCSI: Fix device removal NULL pointer dereference Greg Kroah-Hartman
                   ` (107 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dariusz Majchrzak, Dan Williams,
	James Bottomley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Dan Williams <dan.j.williams@intel.com>

commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.

The following crash results from cases where the end_device has been
removed before scsi_sysfs_add_sdev has had a chance to run.

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
 IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6
 ...
 Call Trace:
  [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3
  [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf
  [<ffffffff8125e641>] kobject_add_varg+0x41/0x50
  [<ffffffff8125e70b>] kobject_add+0x64/0x66
  [<ffffffff8131122b>] device_add+0x12d/0x63a
  [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56
  [<ffffffff8107de15>] ? module_refcount+0x89/0xa0
  [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a
  [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145

...teach scsi_sysfs_add_devices() to check for deleted devices() before
trying to add them, and teach scsi_remove_target() how to remove targets
that have not been added via device_add().

Reported-by: Dariusz Majchrzak <dariusz.majchrzak@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/scsi_scan.c  |    3 +++
 drivers/scsi/scsi_sysfs.c |   41 ++++++++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 15 deletions(-)

--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1717,6 +1717,9 @@ static void scsi_sysfs_add_devices(struc
 {
 	struct scsi_device *sdev;
 	shost_for_each_device(sdev, shost) {
+		/* target removed before the device could be added */
+		if (sdev->sdev_state == SDEV_DEL)
+			continue;
 		if (!scsi_host_scan_allowed(shost) ||
 		    scsi_sysfs_add_sdev(sdev) != 0)
 			__scsi_remove_device(sdev);
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1000,7 +1000,6 @@ static void __scsi_remove_target(struct
 	struct scsi_device *sdev;
 
 	spin_lock_irqsave(shost->host_lock, flags);
-	starget->reap_ref++;
  restart:
 	list_for_each_entry(sdev, &shost->__devices, siblings) {
 		if (sdev->channel != starget->channel ||
@@ -1014,14 +1013,6 @@ static void __scsi_remove_target(struct
 		goto restart;
 	}
 	spin_unlock_irqrestore(shost->host_lock, flags);
-	scsi_target_reap(starget);
-}
-
-static int __remove_child (struct device * dev, void * data)
-{
-	if (scsi_is_target_device(dev))
-		__scsi_remove_target(to_scsi_target(dev));
-	return 0;
 }
 
 /**
@@ -1034,14 +1025,34 @@ static int __remove_child (struct device
  */
 void scsi_remove_target(struct device *dev)
 {
-	if (scsi_is_target_device(dev)) {
-		__scsi_remove_target(to_scsi_target(dev));
-		return;
+	struct Scsi_Host *shost = dev_to_shost(dev->parent);
+	struct scsi_target *starget, *found;
+	unsigned long flags;
+
+ restart:
+	found = NULL;
+	spin_lock_irqsave(shost->host_lock, flags);
+	list_for_each_entry(starget, &shost->__targets, siblings) {
+		if (starget->state == STARGET_DEL)
+			continue;
+		if (starget->dev.parent == dev || &starget->dev == dev) {
+			found = starget;
+			found->reap_ref++;
+			break;
+		}
 	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
 
-	get_device(dev);
-	device_for_each_child(dev, NULL, __remove_child);
-	put_device(dev);
+	if (found) {
+		__scsi_remove_target(found);
+		scsi_target_reap(found);
+		/* in the case where @dev has multiple starget children,
+		 * continue removing.
+		 *
+		 * FIXME: does such a case exist?
+		 */
+		goto restart;
+	}
 }
 EXPORT_SYMBOL(scsi_remove_target);
 



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

* [ 015/122] SCSI: Fix device removal NULL pointer dereference
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2012-08-07 22:25 ` [ 014/122] SCSI: fix hot unplug vs async scan race Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 016/122] SCSI: Avoid dangling pointer in scsi_requeue_command() Greg Kroah-Hartman
                   ` (106 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Junichi Nomura, Bart Van Assche,
	Mike Christie, Tejun Heo, James Bottomley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Bart Van Assche <bvanassche@acm.org>

commit 67bd94130015c507011af37858989b199c52e1de upstream.

Use blk_queue_dead() to test whether the queue is dead instead
of !sdev. Since scsi_prep_fn() may be invoked concurrently with
__scsi_remove_device(), keep the queuedata (sdev) pointer in
__scsi_remove_device(). This patch fixes a kernel oops that
can be triggered by USB device removal. See also
http://www.spinics.net/lists/linux-scsi/msg56254.html.

Other changes included in this patch:
- Swap the blk_cleanup_queue() and kfree() calls in
  scsi_host_dev_release() to make that code easier to grasp.
- Remove the queue dead check from scsi_run_queue() since the
  queue state can change anyway at any point in that function
  where the queue lock is not held.
- Remove the queue dead check from the start of scsi_request_fn()
  since it is redundant with the scsi_device_online() check.

Reported-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/hosts.c      |    7 ++++---
 drivers/scsi/scsi_lib.c   |   32 ++++----------------------------
 drivers/scsi/scsi_priv.h  |    1 -
 drivers/scsi/scsi_sysfs.c |    5 +----
 4 files changed, 9 insertions(+), 36 deletions(-)

--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -290,6 +290,7 @@ static void scsi_host_dev_release(struct
 	struct Scsi_Host *shost = dev_to_shost(dev);
 	struct device *parent = dev->parent;
 	struct request_queue *q;
+	void *queuedata;
 
 	scsi_proc_hostdir_rm(shost->hostt);
 
@@ -299,9 +300,9 @@ static void scsi_host_dev_release(struct
 		destroy_workqueue(shost->work_q);
 	q = shost->uspace_req_q;
 	if (q) {
-		kfree(q->queuedata);
-		q->queuedata = NULL;
-		scsi_free_queue(q);
+		queuedata = q->queuedata;
+		blk_cleanup_queue(q);
+		kfree(queuedata);
 	}
 
 	scsi_destroy_command_freelist(shost);
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -406,10 +406,6 @@ static void scsi_run_queue(struct reques
 	LIST_HEAD(starved_list);
 	unsigned long flags;
 
-	/* if the device is dead, sdev will be NULL, so no queue to run */
-	if (!sdev)
-		return;
-
 	shost = sdev->host;
 	if (scsi_target(sdev)->single_lun)
 		scsi_single_lun_run(sdev);
@@ -1370,16 +1366,16 @@ static inline int scsi_host_queue_ready(
  * may be changed after request stacking drivers call the function,
  * regardless of taking lock or not.
  *
- * When scsi can't dispatch I/Os anymore and needs to kill I/Os
- * (e.g. !sdev), scsi needs to return 'not busy'.
- * Otherwise, request stacking drivers may hold requests forever.
+ * When scsi can't dispatch I/Os anymore and needs to kill I/Os scsi
+ * needs to return 'not busy'. Otherwise, request stacking drivers
+ * may hold requests forever.
  */
 static int scsi_lld_busy(struct request_queue *q)
 {
 	struct scsi_device *sdev = q->queuedata;
 	struct Scsi_Host *shost;
 
-	if (!sdev)
+	if (blk_queue_dead(q))
 		return 0;
 
 	shost = sdev->host;
@@ -1490,12 +1486,6 @@ static void scsi_request_fn(struct reque
 	struct scsi_cmnd *cmd;
 	struct request *req;
 
-	if (!sdev) {
-		while ((req = blk_peek_request(q)) != NULL)
-			scsi_kill_request(req, q);
-		return;
-	}
-
 	if(!get_device(&sdev->sdev_gendev))
 		/* We must be tearing the block queue down already */
 		return;
@@ -1697,20 +1687,6 @@ struct request_queue *scsi_alloc_queue(s
 	return q;
 }
 
-void scsi_free_queue(struct request_queue *q)
-{
-	unsigned long flags;
-
-	WARN_ON(q->queuedata);
-
-	/* cause scsi_request_fn() to kill all non-finished requests */
-	spin_lock_irqsave(q->queue_lock, flags);
-	q->request_fn(q);
-	spin_unlock_irqrestore(q->queue_lock, flags);
-
-	blk_cleanup_queue(q);
-}
-
 /*
  * Function:    scsi_block_requests()
  *
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -84,7 +84,6 @@ extern void scsi_next_command(struct scs
 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
 extern void scsi_run_host_queues(struct Scsi_Host *shost);
 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
-extern void scsi_free_queue(struct request_queue *q);
 extern int scsi_init_queue(void);
 extern void scsi_exit_queue(void);
 struct request_queue;
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -971,11 +971,8 @@ void __scsi_remove_device(struct scsi_de
 		sdev->host->hostt->slave_destroy(sdev);
 	transport_destroy_device(dev);
 
-	/* cause the request function to reject all I/O requests */
-	sdev->request_queue->queuedata = NULL;
-
 	/* Freeing the queue signals to block that we're done */
-	scsi_free_queue(sdev->request_queue);
+	blk_cleanup_queue(sdev->request_queue);
 	put_device(dev);
 }
 



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

* [ 016/122] SCSI: Avoid dangling pointer in scsi_requeue_command()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2012-08-07 22:25 ` [ 015/122] SCSI: Fix device removal NULL pointer dereference Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 017/122] rt2800usb: 2001:3c17 is an RT3370 device Greg Kroah-Hartman
                   ` (105 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Mike Christie, Bart Van Assche,
	Tejun Heo, James Bottomley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Bart Van Assche <bvanassche@acm.org>

commit 940f5d47e2f2e1fa00443921a0abf4822335b54d upstream.

When we call scsi_unprep_request() the command associated with the request
gets destroyed and therefore drops its reference on the device.  If this was
the only reference, the device may get released and we end up with a NULL
pointer deref when we call blk_requeue_request.

Reported-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Tejun Heo <tj@kernel.org>
[jejb: enhance commend and add commit log for stable]
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/scsi_lib.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -479,15 +479,26 @@ void scsi_requeue_run_queue(struct work_
  */
 static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
 {
+	struct scsi_device *sdev = cmd->device;
 	struct request *req = cmd->request;
 	unsigned long flags;
 
+	/*
+	 * We need to hold a reference on the device to avoid the queue being
+	 * killed after the unlock and before scsi_run_queue is invoked which
+	 * may happen because scsi_unprep_request() puts the command which
+	 * releases its reference on the device.
+	 */
+	get_device(&sdev->sdev_gendev);
+
 	spin_lock_irqsave(q->queue_lock, flags);
 	scsi_unprep_request(req);
 	blk_requeue_request(q, req);
 	spin_unlock_irqrestore(q->queue_lock, flags);
 
 	scsi_run_queue(q);
+
+	put_device(&sdev->sdev_gendev);
 }
 
 void scsi_next_command(struct scsi_cmnd *cmd)



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

* [ 017/122] rt2800usb: 2001:3c17 is an RT3370 device
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2012-08-07 22:25 ` [ 016/122] SCSI: Avoid dangling pointer in scsi_requeue_command() Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 018/122] ARM: dt: tegra trimslice: enable USB2 port Greg Kroah-Hartman
                   ` (104 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Albert Pool, Gertjan van Wingerde,
	John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Albert Pool <albertpool@solcon.nl>

commit 8fd9d059af12786341dec5a688e607bcdb372238 upstream.

D-Link DWA-123 rev A1

Signed-off-by: Albert Pool<albertpool@solcon.nl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/rt2x00/rt2800usb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1137,6 +1137,8 @@ static struct usb_device_id rt2800usb_de
 #ifdef CONFIG_RT2800USB_RT33XX
 	/* Belkin */
 	{ USB_DEVICE(0x050d, 0x945b) },
+	/* D-Link */
+	{ USB_DEVICE(0x2001, 0x3c17) },
 	/* Panasonic */
 	{ USB_DEVICE(0x083a, 0xb511) },
 	/* Philips */
@@ -1237,7 +1239,6 @@ static struct usb_device_id rt2800usb_de
 	/* D-Link */
 	{ USB_DEVICE(0x07d1, 0x3c0b) },
 	{ USB_DEVICE(0x07d1, 0x3c17) },
-	{ USB_DEVICE(0x2001, 0x3c17) },
 	/* Encore */
 	{ USB_DEVICE(0x203d, 0x14a1) },
 	/* Gemtek */



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

* [ 018/122] ARM: dt: tegra trimslice: enable USB2 port
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2012-08-07 22:25 ` [ 017/122] rt2800usb: 2001:3c17 is an RT3370 device Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 019/122] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one Greg Kroah-Hartman
                   ` (103 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Stephen Warren, Arnd Bergmann

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Stephen Warren <swarren@nvidia.com>

commit a6a3dd1aed31ace7c827236c53d83f4e845dcff2 upstream.

This was accidentally disabled by commit 2a5fdc9 "ARM: dt: tegra:
invert status=disable vs status=okay".

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/tegra-trimslice.dts |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/tegra-trimslice.dts
+++ b/arch/arm/boot/dts/tegra-trimslice.dts
@@ -279,6 +279,7 @@
 	};
 
 	usb@c5004000 {
+		status = "okay";
 		nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */
 	};
 



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

* [ 019/122] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2012-08-07 22:25 ` [ 018/122] ARM: dt: tegra trimslice: enable USB2 port Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 020/122] ARM: dt: tegra trimslice: add vbus-gpio property Greg Kroah-Hartman
                   ` (102 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Steve Sakoman, Tony Lindgren,
	Nishanth Menon, Kevin Hilman

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Nishanth Menon <nm@ti.com>

commit b110547e586eb5825bc1d04aa9147bff83b57672 upstream.

Commit 9fa2df6b90786301b175e264f5fa9846aba81a65
(ARM: OMAP2+: OPP: allow OPP enumeration to continue if device is not present)
makes the logic:
for (i = 0; i < opp_def_size; i++) {
	<snip>
	if (!oh || !oh->od) {
		<snip>
		continue;
	}
<snip>
opp_def++;
}

In short, the moment we hit a "Bad OPP", we end up looping the list
comparing against the bad opp definition pointer for the rest of the
iteration count. Instead, increment opp_def in the for loop itself
and allow continue to be used in code without much thought so that
we check the next set of OPP definition pointers :)

Signed-off-by: Nishanth Menon <nm@ti.com>
Cc: Steve Sakoman <steve@sakoman.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-omap2/opp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -53,7 +53,7 @@ int __init omap_init_opp_table(struct om
 	omap_table_init = 1;
 
 	/* Lets now register with OPP library */
-	for (i = 0; i < opp_def_size; i++) {
+	for (i = 0; i < opp_def_size; i++, opp_def++) {
 		struct omap_hwmod *oh;
 		struct device *dev;
 
@@ -86,7 +86,6 @@ int __init omap_init_opp_table(struct om
 					__func__, opp_def->freq,
 					opp_def->hwmod_name, i, r);
 		}
-		opp_def++;
 	}
 
 	return 0;



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

* [ 020/122] ARM: dt: tegra trimslice: add vbus-gpio property
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2012-08-07 22:25 ` [ 019/122] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 021/122] ASoC: dapm: Fix locking during codec shutdown Greg Kroah-Hartman
                   ` (101 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Stephen Warren, Arnd Bergmann

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Stephen Warren <swarren@nvidia.com>

commit 01ad8063a5db9ac8320f197577a34b423ba64eca upstream.

On TrimSlice, Tegra's USB1 port may be routed to either an external micro
USB port, or an internal USB->SATA bridge for SSD or HDD. This muxing is
controlled by a GPIO. Whilst not strictly a VBUS GPIO, the TrimSlice
board files caused this GPIO to be set appropriately to enable the SATA
bridge by passing it as the VBUS GPIO to the USB driver. Echo this same
configuration in device tree to enable the SATA bridge.

An alternative might be to implement a full USB bus mux driver. However,
that seems over-complex right now.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/tegra-trimslice.dts |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/tegra-trimslice.dts
+++ b/arch/arm/boot/dts/tegra-trimslice.dts
@@ -276,6 +276,7 @@
 
 	usb@c5000000 {
 		status = "okay";
+		nvidia,vbus-gpio = <&gpio 170 0>; /* gpio PV2 */
 	};
 
 	usb@c5004000 {



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

* [ 021/122] ASoC: dapm: Fix locking during codec shutdown
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2012-08-07 22:25 ` [ 020/122] ARM: dt: tegra trimslice: add vbus-gpio property Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 022/122] ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements Greg Kroah-Hartman
                   ` (100 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Misael Lopez Cruz, Liam Girdwood,
	Mark Brown

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Liam Girdwood <lrg@ti.com>

commit 01005a729a17ab419f61a366e22f3419e7a2c3fe upstream.

Codec shutdown performs a DAPM power sequence that might cause conflicts
and/or race conditions if another stream power event is running simultaneously.
Use card's dapm mutex to protect any potential race condition between them.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/soc-dapm.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3538,10 +3538,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_free);
 
 static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
 {
+	struct snd_soc_card *card = dapm->card;
 	struct snd_soc_dapm_widget *w;
 	LIST_HEAD(down_list);
 	int powerdown = 0;
 
+	mutex_lock(&card->dapm_mutex);
+
 	list_for_each_entry(w, &dapm->card->widgets, list) {
 		if (w->dapm != dapm)
 			continue;
@@ -3564,6 +3567,8 @@ static void soc_dapm_shutdown_codec(stru
 			snd_soc_dapm_set_bias_level(dapm,
 						    SND_SOC_BIAS_STANDBY);
 	}
+
+	mutex_unlock(&card->dapm_mutex);
 }
 
 /*



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

* [ 022/122] ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2012-08-07 22:25 ` [ 021/122] ASoC: dapm: Fix locking during codec shutdown Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 023/122] ASoC: wm8962: Redo early init of the part on resume Greg Kroah-Hartman
                   ` (99 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Mark Brown, Liam Girdwood

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 0ff97ebf0804d2e519d578fcb4db03f104d2ca8c upstream.

Ever since the DAPM performance improvements we've been marking all widgets
as not dirty after each DAPM run. Since _PRE and _POST events aren't part
of the DAPM graph this has rendered them non-functional, they will never be
marked dirty again and thus will never be run again.

Fix this by skipping them when marking widgets as not dirty.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/soc-dapm.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1570,7 +1570,15 @@ static int dapm_power_widgets(struct snd
 	}
 
 	list_for_each_entry(w, &card->widgets, list) {
-		list_del_init(&w->dirty);
+		switch (w->id) {
+		case snd_soc_dapm_pre:
+		case snd_soc_dapm_post:
+			/* These widgets always need to be powered */
+			break;
+		default:
+			list_del_init(&w->dirty);
+			break;
+		}
 
 		if (w->power) {
 			d = w->dapm;



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

* [ 023/122] ASoC: wm8962: Redo early init of the part on resume
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2012-08-07 22:25 ` [ 022/122] ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 024/122] ALSA: hda - Add support for Realtek ALC282 Greg Kroah-Hartman
                   ` (98 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Mark Brown

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit e4dd76788c7e5b27165890d712c8c4f6f0abd645 upstream.

Ensure robust startup of the part by going through the reset procedure
prior to resyncing the full register cache, avoiding potential intermittent
faults in some designs.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/codecs/wm8962.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3722,6 +3722,9 @@ static int wm8962_runtime_resume(struct
 	}
 
 	regcache_cache_only(wm8962->regmap, false);
+
+	wm8962_reset(wm8962);
+
 	regcache_sync(wm8962->regmap);
 
 	regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP,



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

* [ 024/122] ALSA: hda - Add support for Realtek ALC282
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2012-08-07 22:25 ` [ 023/122] ASoC: wm8962: Redo early init of the part on resume Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 025/122] ALSA: hda - Turn on PIN_OUT from hdmi playback prepare Greg Kroah-Hartman
                   ` (97 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Ray Chen, David Henningsson, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: David Henningsson <david.henningsson@canonical.com>

commit 4e01ec636e64707d202a1ca21a47bbc6d53085b7 upstream.

This codec has a separate dmic path (separate dmic only ADC),
and thus it looks mostly like ALC275.

BugLink: https://bugs.launchpad.net/bugs/1025377
Tested-by: Ray Chen <ray.chen@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6831,6 +6831,7 @@ static const struct hda_codec_preset snd
 	{ .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
 	{ .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
 	{ .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
+	{ .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
 	{ .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
 	  .patch = patch_alc861 },
 	{ .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },



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

* [ 025/122] ALSA: hda - Turn on PIN_OUT from hdmi playback prepare.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2012-08-07 22:25 ` [ 024/122] ALSA: hda - Add support for Realtek ALC282 Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 026/122] ALSA: hda - Dont power up when not powered down Greg Kroah-Hartman
                   ` (96 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dylan Reid, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Dylan Reid <dgreid@chromium.org>

commit 9e76e6d031482194a5b24d8e9ab88063fbd6b4b5 upstream.

Turn on the pin widget's PIN_OUT bit from playback prepare. The pin is
enabled in open, but is disabled in hdmi_init_pin which is called during
system resume.  This causes a system suspend/resume during playback to
mute HDMI/DP. Enabling the pin in prepare instead of open allows calling
snd_pcm_prepare after a system resume to restore audio.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_hdmi.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -876,7 +876,6 @@ static int hdmi_pcm_open(struct hda_pcm_
 	struct hdmi_spec_per_pin *per_pin;
 	struct hdmi_eld *eld;
 	struct hdmi_spec_per_cvt *per_cvt = NULL;
-	int pinctl;
 
 	/* Validate hinfo */
 	pin_idx = hinfo_to_pin_index(spec, hinfo);
@@ -912,11 +911,6 @@ static int hdmi_pcm_open(struct hda_pcm_
 	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
 			    AC_VERB_SET_CONNECT_SEL,
 			    mux_idx);
-	pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
-				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
-	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
-			    AC_VERB_SET_PIN_WIDGET_CONTROL,
-			    pinctl | PIN_OUT);
 	snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
 
 	/* Initially set the converter's capabilities */
@@ -1153,11 +1147,17 @@ static int generic_hdmi_playback_pcm_pre
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
+	int pinctl;
 
 	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
 	hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
+	pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+	snd_hda_codec_write(codec, pin_nid, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
+
 	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
 }
 



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

* [ 026/122] ALSA: hda - Dont power up when not powered down.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2012-08-07 22:25 ` [ 025/122] ALSA: hda - Turn on PIN_OUT from hdmi playback prepare Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 027/122] HID: hid-multitouch: fix input mode feature command Greg Kroah-Hartman
                   ` (95 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dylan Reid, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Dylan Reid <dgreid@chromium.org>

commit b43d224767e426cf1a8b6622d1d172f2b2b0e857 upstream.

After cancel_delayed_work_sync returns, the power down work either never
started (power_on == 1) or finished (power_on == 0).  In the former case
there is no need to power up again.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/hda_codec.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4418,6 +4418,13 @@ static void __snd_hda_power_up(struct hd
 	cancel_delayed_work_sync(&codec->power_work);
 
 	spin_lock(&codec->power_lock);
+	/* If the power down delayed work was cancelled above before starting,
+	 * then there is no need to go through power up here.
+	 */
+	if (codec->power_on) {
+		spin_unlock(&codec->power_lock);
+		return;
+	}
 	trace_hda_power_up(codec);
 	snd_hda_update_power_acct(codec);
 	codec->power_on = 1;



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

* [ 027/122] HID: hid-multitouch: fix input mode feature command
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2012-08-07 22:25 ` [ 026/122] ALSA: hda - Dont power up when not powered down Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 028/122] usbdevfs: Correct amount of data copied to user in processcompl_compat Greg Kroah-Hartman
                   ` (94 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Benjamin Tissoires, Jiri Kosina,
	Simon Farnsworth

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Benjamin Tissoires <benjamin.tissoires@enac.fr>

commit 4aceed37e315e8eaa26cb4c8dfd619a32fa24669 upstream.

Zytronic panels shows a new way of setting the Input Mode feature.
This feature is put in the second usage in the HID feature, instead
of the first, as the majority of the multitouch devices.

This patch adds a detection step when the feature is presented to know
where the feature is located in the report. We can then trigger the right
command to the device. This removes the magic number "0" in the function
mt_set_input_mode.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hid/hid-multitouch.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -83,6 +83,7 @@ struct mt_device {
 	unsigned last_field_index;	/* last field index of the report */
 	unsigned last_slot_field;	/* the last field of a slot */
 	__s8 inputmode;		/* InputMode HID feature, -1 if non-existent */
+	__s8 inputmode_index;	/* InputMode HID feature index in the report */
 	__s8 maxcontact_report_id;	/* Maximum Contact Number HID feature,
 				   -1 if non-existent */
 	__u8 num_received;	/* how many contacts we received */
@@ -260,10 +261,20 @@ static void mt_feature_mapping(struct hi
 		struct hid_field *field, struct hid_usage *usage)
 {
 	struct mt_device *td = hid_get_drvdata(hdev);
+	int i;
 
 	switch (usage->hid) {
 	case HID_DG_INPUTMODE:
 		td->inputmode = field->report->id;
+		td->inputmode_index = 0; /* has to be updated below */
+
+		for (i=0; i < field->maxusage; i++) {
+			if (field->usage[i].hid == usage->hid) {
+				td->inputmode_index = i;
+				break;
+			}
+		}
+
 		break;
 	case HID_DG_CONTACTMAX:
 		td->maxcontact_report_id = field->report->id;
@@ -618,7 +629,7 @@ static void mt_set_input_mode(struct hid
 	re = &(hdev->report_enum[HID_FEATURE_REPORT]);
 	r = re->report_id_hash[td->inputmode];
 	if (r) {
-		r->field[0]->value[0] = 0x02;
+		r->field[0]->value[td->inputmode_index] = 0x02;
 		usbhid_submit_report(hdev, r, USB_DIR_OUT);
 	}
 }



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

* [ 028/122] usbdevfs: Correct amount of data copied to user in processcompl_compat
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2012-08-07 22:25 ` [ 027/122] HID: hid-multitouch: fix input mode feature command Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 029/122] usb: gadget: Fix g_ether interface link status Greg Kroah-Hartman
                   ` (93 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Hans de Goede, Alan Stern

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Hans de Goede <hdegoede@redhat.com>

commit 2102e06a5f2e414694921f23591f072a5ba7db9f upstream.

iso data buffers may have holes in them if some packets were short, so for
iso urbs we should always copy the entire buffer, just like the regular
processcompl does.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/devio.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1604,10 +1604,14 @@ static int processcompl_compat(struct as
 	void __user *addr = as->userurb;
 	unsigned int i;
 
-	if (as->userbuffer && urb->actual_length)
-		if (copy_to_user(as->userbuffer, urb->transfer_buffer,
-				 urb->actual_length))
+	if (as->userbuffer && urb->actual_length) {
+		if (urb->number_of_packets > 0)		/* Isochronous */
+			i = urb->transfer_buffer_length;
+		else					/* Non-Isoc */
+			i = urb->actual_length;
+		if (copy_to_user(as->userbuffer, urb->transfer_buffer, i))
 			return -EFAULT;
+	}
 	if (put_user(as->status, &userurb->status))
 		return -EFAULT;
 	if (put_user(urb->actual_length, &userurb->actual_length))



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

* [ 029/122] usb: gadget: Fix g_ether interface link status
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2012-08-07 22:25 ` [ 028/122] usbdevfs: Correct amount of data copied to user in processcompl_compat Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 030/122] USB: option: add ZTE MF821D Greg Kroah-Hartman
                   ` (92 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Kevin Cernekee, Felipe Balbi

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Kevin Cernekee <cernekee@gmail.com>

commit 31bde1ceaa873bcaecd49e829bfabceacc4c512d upstream.

A "usb0" interface that has never been connected to a host has an unknown
operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted
when queried by ifconfig, ifplugd, etc.  This is a result of calling
netif_carrier_off() too early in the probe function; it should be called
after register_netdev().

Similar problems have been fixed in many other drivers, e.g.:

    e826eafa6 (bonding: Call netif_carrier_off after register_netdevice)
    0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe)
    6a3c869a6 (cxgb4: fix reported state of interfaces without link)

Fix is to move netif_carrier_off() to the end of the function.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/u_ether.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -798,12 +798,6 @@ int gether_setup_name(struct usb_gadget
 
 	SET_ETHTOOL_OPS(net, &ops);
 
-	/* two kinds of host-initiated state changes:
-	 *  - iff DATA transfer is active, carrier is "on"
-	 *  - tx queueing enabled if open *and* carrier is "on"
-	 */
-	netif_carrier_off(net);
-
 	dev->gadget = g;
 	SET_NETDEV_DEV(net, &g->dev);
 	SET_NETDEV_DEVTYPE(net, &gadget_type);
@@ -817,6 +811,12 @@ int gether_setup_name(struct usb_gadget
 		INFO(dev, "HOST MAC %pM\n", dev->host_mac);
 
 		the_dev = dev;
+
+		/* two kinds of host-initiated state changes:
+		 *  - iff DATA transfer is active, carrier is "on"
+		 *  - tx queueing enabled if open *and* carrier is "on"
+		 */
+		netif_carrier_off(net);
 	}
 
 	return status;



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

* [ 030/122] USB: option: add ZTE MF821D
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2012-08-07 22:25 ` [ 029/122] usb: gadget: Fix g_ether interface link status Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 031/122] Revert "usb/uas: make sure data urb is gone if we receive status before that" Greg Kroah-Hartman
                   ` (91 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Thomas Schäfer, Bjørn Mork

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Bjørn Mork <bjorn@mork.no>

commit 09110529780890804b22e997ae6b4fe3f0b3b158 upstream.

Sold by O2 (telefonica germany) under the name "LTE4G"

Tested-by: Thomas Schäfer <tschaefer@t-online.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/option.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -936,6 +936,8 @@ static const struct usb_device_id option
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),



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

* [ 031/122] Revert "usb/uas: make sure data urb is gone if we receive status before that"
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2012-08-07 22:25 ` [ 030/122] USB: option: add ZTE MF821D Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 032/122] USB: Disable LPM while the device is unconfigured Greg Kroah-Hartman
                   ` (90 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Gerd Hoffmann

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Gerd Hoffmann <kraxel@redhat.com>

commit c621a81edecdee85da32c566c21836332c764fda upstream.

This reverts commit e4d8318a85779b25b880187b1b1c44e797bd7d4b.

This patch makes uas.c call usb_unlink_urb on data urbs.  The data urbs
get freed in the completion callback.  This is illegal according to the
usb_unlink_urb documentation.

This patch also makes the code expect the data completion callback
being called before the status completion callback.  This isn't
guaranteed to be the case, even though the actual data transfer should
be finished by the time the status is received.

Background:  The ehci irq handler for example only know that there are
finished transfers, it then has go check the QHs & TDs to see which
transfers did actually finish.  It has no way to figure in which order
the transfers did complete.  The xhci driver can call the callbacks in
completion order thanks to the event queue.  This does nicely explain
why the driver is solid on a (usb2) xhci port whereas it goes crazy on
ehci in my testing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/storage/uas.c |   90 +++++++---------------------------------------
 1 file changed, 15 insertions(+), 75 deletions(-)

--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -58,9 +58,6 @@ enum {
 	SUBMIT_DATA_OUT_URB	= (1 << 5),
 	ALLOC_CMD_URB		= (1 << 6),
 	SUBMIT_CMD_URB		= (1 << 7),
-	COMPLETED_DATA_IN	= (1 << 8),
-	COMPLETED_DATA_OUT	= (1 << 9),
-	DATA_COMPLETES_CMD	= (1 << 10),
 };
 
 /* Overrides scsi_pointer */
@@ -114,7 +111,6 @@ static void uas_sense(struct urb *urb, s
 {
 	struct sense_iu *sense_iu = urb->transfer_buffer;
 	struct scsi_device *sdev = cmnd->device;
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
 
 	if (urb->actual_length > 16) {
 		unsigned len = be16_to_cpup(&sense_iu->len);
@@ -132,15 +128,13 @@ static void uas_sense(struct urb *urb, s
 	}
 
 	cmnd->result = sense_iu->status;
-	if (!(cmdinfo->state & DATA_COMPLETES_CMD))
-		cmnd->scsi_done(cmnd);
+	cmnd->scsi_done(cmnd);
 }
 
 static void uas_sense_old(struct urb *urb, struct scsi_cmnd *cmnd)
 {
 	struct sense_iu_old *sense_iu = urb->transfer_buffer;
 	struct scsi_device *sdev = cmnd->device;
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
 
 	if (urb->actual_length > 8) {
 		unsigned len = be16_to_cpup(&sense_iu->len) - 2;
@@ -158,8 +152,7 @@ static void uas_sense_old(struct urb *ur
 	}
 
 	cmnd->result = sense_iu->status;
-	if (!(cmdinfo->state & DATA_COMPLETES_CMD))
-		cmnd->scsi_done(cmnd);
+	cmnd->scsi_done(cmnd);
 }
 
 static void uas_xfer_data(struct urb *urb, struct scsi_cmnd *cmnd,
@@ -184,7 +177,6 @@ static void uas_stat_cmplt(struct urb *u
 	struct Scsi_Host *shost = urb->context;
 	struct uas_dev_info *devinfo = (void *)shost->hostdata[0];
 	struct scsi_cmnd *cmnd;
-	struct uas_cmd_info *cmdinfo;
 	u16 tag;
 	int ret;
 
@@ -210,32 +202,12 @@ static void uas_stat_cmplt(struct urb *u
 			dev_err(&urb->dev->dev, "failed submit status urb\n");
 		return;
 	}
-	cmdinfo = (void *)&cmnd->SCp;
 
 	switch (iu->iu_id) {
 	case IU_ID_STATUS:
 		if (devinfo->cmnd == cmnd)
 			devinfo->cmnd = NULL;
 
-		if (!(cmdinfo->state & COMPLETED_DATA_IN) &&
-				cmdinfo->data_in_urb) {
-		       if (devinfo->use_streams) {
-			       cmdinfo->state |= DATA_COMPLETES_CMD;
-			       usb_unlink_urb(cmdinfo->data_in_urb);
-		       } else {
-			       usb_free_urb(cmdinfo->data_in_urb);
-		       }
-		}
-		if (!(cmdinfo->state & COMPLETED_DATA_OUT) &&
-				cmdinfo->data_out_urb) {
-			if (devinfo->use_streams) {
-				cmdinfo->state |= DATA_COMPLETES_CMD;
-				usb_unlink_urb(cmdinfo->data_in_urb);
-			} else {
-				usb_free_urb(cmdinfo->data_out_urb);
-			}
-		}
-
 		if (urb->actual_length < 16)
 			devinfo->uas_sense_old = 1;
 		if (devinfo->uas_sense_old)
@@ -264,59 +236,27 @@ static void uas_stat_cmplt(struct urb *u
 		dev_err(&urb->dev->dev, "failed submit status urb\n");
 }
 
-static void uas_data_out_cmplt(struct urb *urb)
-{
-	struct scsi_cmnd *cmnd = urb->context;
-	struct scsi_data_buffer *sdb = scsi_out(cmnd);
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
-
-	cmdinfo->state |= COMPLETED_DATA_OUT;
-
-	sdb->resid = sdb->length - urb->actual_length;
-	usb_free_urb(urb);
-
-	if (cmdinfo->state & DATA_COMPLETES_CMD)
-		cmnd->scsi_done(cmnd);
-}
-
-static void uas_data_in_cmplt(struct urb *urb)
+static void uas_data_cmplt(struct urb *urb)
 {
-	struct scsi_cmnd *cmnd = urb->context;
-	struct scsi_data_buffer *sdb = scsi_in(cmnd);
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
-
-	cmdinfo->state |= COMPLETED_DATA_IN;
-
+	struct scsi_data_buffer *sdb = urb->context;
 	sdb->resid = sdb->length - urb->actual_length;
 	usb_free_urb(urb);
-
-	if (cmdinfo->state & DATA_COMPLETES_CMD)
-		cmnd->scsi_done(cmnd);
 }
 
 static struct urb *uas_alloc_data_urb(struct uas_dev_info *devinfo, gfp_t gfp,
-		unsigned int pipe, struct scsi_cmnd *cmnd,
-		enum dma_data_direction dir)
+				unsigned int pipe, u16 stream_id,
+				struct scsi_data_buffer *sdb,
+				enum dma_data_direction dir)
 {
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
 	struct usb_device *udev = devinfo->udev;
 	struct urb *urb = usb_alloc_urb(0, gfp);
-	struct scsi_data_buffer *sdb;
-	usb_complete_t complete_fn;
-	u16 stream_id = cmdinfo->stream;
 
 	if (!urb)
 		goto out;
-	if (dir == DMA_FROM_DEVICE) {
-		sdb = scsi_in(cmnd);
-		complete_fn = uas_data_in_cmplt;
-	} else {
-		sdb = scsi_out(cmnd);
-		complete_fn = uas_data_out_cmplt;
-	}
-	usb_fill_bulk_urb(urb, udev, pipe, NULL, sdb->length,
-			complete_fn, cmnd);
-	urb->stream_id = stream_id;
+	usb_fill_bulk_urb(urb, udev, pipe, NULL, sdb->length, uas_data_cmplt,
+									sdb);
+	if (devinfo->use_streams)
+		urb->stream_id = stream_id;
 	urb->num_sgs = udev->bus->sg_tablesize ? sdb->table.nents : 0;
 	urb->sg = sdb->table.sgl;
  out:
@@ -418,8 +358,8 @@ static int uas_submit_urbs(struct scsi_c
 
 	if (cmdinfo->state & ALLOC_DATA_IN_URB) {
 		cmdinfo->data_in_urb = uas_alloc_data_urb(devinfo, gfp,
-					devinfo->data_in_pipe, cmnd,
-					DMA_FROM_DEVICE);
+					devinfo->data_in_pipe, cmdinfo->stream,
+					scsi_in(cmnd), DMA_FROM_DEVICE);
 		if (!cmdinfo->data_in_urb)
 			return SCSI_MLQUEUE_DEVICE_BUSY;
 		cmdinfo->state &= ~ALLOC_DATA_IN_URB;
@@ -436,8 +376,8 @@ static int uas_submit_urbs(struct scsi_c
 
 	if (cmdinfo->state & ALLOC_DATA_OUT_URB) {
 		cmdinfo->data_out_urb = uas_alloc_data_urb(devinfo, gfp,
-					devinfo->data_out_pipe, cmnd,
-					DMA_TO_DEVICE);
+					devinfo->data_out_pipe, cmdinfo->stream,
+					scsi_out(cmnd), DMA_TO_DEVICE);
 		if (!cmdinfo->data_out_urb)
 			return SCSI_MLQUEUE_DEVICE_BUSY;
 		cmdinfo->state &= ~ALLOC_DATA_OUT_URB;



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

* [ 032/122] USB: Disable LPM while the device is unconfigured.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2012-08-07 22:25 ` [ 031/122] Revert "usb/uas: make sure data urb is gone if we receive status before that" Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 033/122] USB: Fix LPM disable/enable during device reset Greg Kroah-Hartman
                   ` (89 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Sarah Sharp

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 9cf65991dd93ac3d5f97f536171c388918b7c1a9 upstream.

The USB 3.0 Set/Clear Feature U1/U2 Enable cannot be sent to a device in
the Default or Addressed state.  It can only be sent to a configured
device.  Change the USB core to initialize the LPM disable count to 1
(disabled), which reflects this limitation.

Change usb_set_configuration() to ensure that if the device is
unconfigured on entry, usb_lpm_disable() is not called.  This avoids
sending the Clear Feature U1/U2 when the device is in the Addressed
state.  When usb_set_configuration() exits with a successfully installed
configuration, usb_lpm_enable() will be called.

Once the new configuration is installed, make sure
usb_set_configuration() only calls usb_enable_lpm() if the device moved
to the Configured state.  If we have unconfigured the device by sending
it a Set Configuration for config 0, don't enable LPM.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/message.c |    7 ++++---
 drivers/usb/core/usb.c     |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1791,14 +1791,15 @@ free_interfaces:
 	 * installed, so that the xHCI driver can recalculate the U1/U2
 	 * timeouts.
 	 */
-	if (usb_disable_lpm(dev)) {
+	if (dev->actconfig && usb_disable_lpm(dev)) {
 		dev_err(&dev->dev, "%s Failed to disable LPM\n.", __func__);
 		mutex_unlock(hcd->bandwidth_mutex);
 		return -ENOMEM;
 	}
 	ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
 	if (ret < 0) {
-		usb_enable_lpm(dev);
+		if (dev->actconfig)
+			usb_enable_lpm(dev);
 		mutex_unlock(hcd->bandwidth_mutex);
 		usb_autosuspend_device(dev);
 		goto free_interfaces;
@@ -1818,7 +1819,7 @@ free_interfaces:
 	if (!cp) {
 		usb_set_device_state(dev, USB_STATE_ADDRESS);
 		usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
-		usb_enable_lpm(dev);
+		/* Leave LPM disabled while the device is unconfigured. */
 		mutex_unlock(hcd->bandwidth_mutex);
 		usb_autosuspend_device(dev);
 		goto free_interfaces;
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -396,6 +396,7 @@ struct usb_device *usb_alloc_dev(struct
 	dev->dev.dma_mask = bus->controller->dma_mask;
 	set_dev_node(&dev->dev, dev_to_node(bus->controller));
 	dev->state = USB_STATE_ATTACHED;
+	dev->lpm_disable_count = 1;
 	atomic_set(&dev->urbnum, 0);
 
 	INIT_LIST_HEAD(&dev->ep0.urb_list);



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

* [ 033/122] USB: Fix LPM disable/enable during device reset.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2012-08-07 22:25 ` [ 032/122] USB: Disable LPM while the device is unconfigured Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 034/122] USB: Remove unused LPM variable Greg Kroah-Hartman
                   ` (88 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Sarah Sharp

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 6d1d051330ee096f575523647fbd8ffe703600b5 upstream.

The USB 3.0 specification says that sending a Set Feature or Clear
Feature for U1/U2 Enable is not a valid request when the device is in
the Default or Addressed state.  It is only valid when the device is in
the Configured state.

The original LPM patch attempted to disable LPM after the device had
been reset by hub_port_init(), before it had the configuration
reinstalled.  The TI hub I tested with did not fail the Clear Feature
U1/U2 Enable request that khubd sent while it was in the addressed
state, which is why I didn't catch it.

Move the LPM disable before the device reset, so that we can send the
Clear Feature U1/U2 Enable successfully, and balance the LPM disable
count.

Also delete any calls to usb_enable_lpm() on error paths that lead to
re-enumeration.  The calls will fail because the device isn't
configured, and it's not useful to balance the LPM disable count because
the usb_device is about to be destroyed before re-enumeration.

Fix the early exit path ("done" label) to call usb_enable_lpm() to
balance the LPM disable count.

Note that calling usb_reset_and_verify_device() with an unconfigured
device may fail on the first call to usb_disable_lpm().  That's because
the LPM disable count is initialized to 0 (LPM enabled), and
usb_disable_lpm() will attempt to send a Clear Feature U1/U2 request to
a device in the Addressed state.  The next patch will fix that.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/hub.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4672,6 +4672,16 @@ static int usb_reset_and_verify_device(s
 	}
 	parent_hub = hdev_to_hub(parent_hdev);
 
+	/* Disable LPM while we reset the device and reinstall the alt settings.
+	 * Device-initiated LPM settings, and system exit latency settings are
+	 * cleared when the device is reset, so we have to set them up again.
+	 */
+	ret = usb_unlocked_disable_lpm(udev);
+	if (ret) {
+		dev_err(&udev->dev, "%s Failed to disable LPM\n.", __func__);
+		goto re_enumerate;
+	}
+
 	set_bit(port1, parent_hub->busy_bits);
 	for (i = 0; i < SET_CONFIG_TRIES; ++i) {
 
@@ -4699,22 +4709,11 @@ static int usb_reset_and_verify_device(s
 		goto done;
 
 	mutex_lock(hcd->bandwidth_mutex);
-	/* Disable LPM while we reset the device and reinstall the alt settings.
-	 * Device-initiated LPM settings, and system exit latency settings are
-	 * cleared when the device is reset, so we have to set them up again.
-	 */
-	ret = usb_disable_lpm(udev);
-	if (ret) {
-		dev_err(&udev->dev, "%s Failed to disable LPM\n.", __func__);
-		mutex_unlock(hcd->bandwidth_mutex);
-		goto done;
-	}
 	ret = usb_hcd_alloc_bandwidth(udev, udev->actconfig, NULL, NULL);
 	if (ret < 0) {
 		dev_warn(&udev->dev,
 				"Busted HC?  Not enough HCD resources for "
 				"old configuration.\n");
-		usb_enable_lpm(udev);
 		mutex_unlock(hcd->bandwidth_mutex);
 		goto re_enumerate;
 	}
@@ -4726,7 +4725,6 @@ static int usb_reset_and_verify_device(s
 		dev_err(&udev->dev,
 			"can't restore configuration #%d (error=%d)\n",
 			udev->actconfig->desc.bConfigurationValue, ret);
-		usb_enable_lpm(udev);
 		mutex_unlock(hcd->bandwidth_mutex);
 		goto re_enumerate;
   	}
@@ -4765,17 +4763,17 @@ static int usb_reset_and_verify_device(s
 				desc->bInterfaceNumber,
 				desc->bAlternateSetting,
 				ret);
-			usb_unlocked_enable_lpm(udev);
 			goto re_enumerate;
 		}
 	}
 
+done:
 	/* Now that the alt settings are re-installed, enable LPM. */
 	usb_unlocked_enable_lpm(udev);
-done:
 	return 0;
  
 re_enumerate:
+	/* LPM state doesn't matter when we're about to destroy the device. */
 	hub_port_logical_disconnect(parent_hub, port1);
 	return -ENODEV;
 }



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

* [ 034/122] USB: Remove unused LPM variable.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2012-08-07 22:25 ` [ 033/122] USB: Fix LPM disable/enable during device reset Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 035/122] USB: Fix LPM disable count mismatch on driver unbind Greg Kroah-Hartman
                   ` (87 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Sarah Sharp

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit c5c4bdf02e518a281b229ae0891b346919e2d291 upstream.

hub_initiated_lpm_disable_count is not used by any code, so remove it.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/usb.h |    1 -
 1 file changed, 1 deletion(-)

--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -556,7 +556,6 @@ struct usb_device {
 	struct usb3_lpm_parameters u1_params;
 	struct usb3_lpm_parameters u2_params;
 	unsigned lpm_disable_count;
-	unsigned hub_initiated_lpm_disable_count;
 };
 #define	to_usb_device(d) container_of(d, struct usb_device, dev)
 



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

* [ 035/122] USB: Fix LPM disable count mismatch on driver unbind.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2012-08-07 22:25 ` [ 034/122] USB: Remove unused LPM variable Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 036/122] ALSA: hda - add dock support for Thinkpad X230 Tablet Greg Kroah-Hartman
                   ` (86 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Sarah Sharp

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 249719121bc2b841bdfcab5eb21b10d8b871743b upstream.

When a user runs `echo 0 > bConfigurationValue` for a USB 3.0 device,
usb_disable_device() is called.  This function disables all drivers,
deallocates interfaces, and sets the device configuration value to 0
(unconfigured).

With the new scheme to ensure that unconfigured devices have LPM
disabled, usb_disable_device() must call usb_unlocked_disable_lpm() once
it unconfigures the device.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/message.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1174,6 +1174,7 @@ void usb_disable_device(struct usb_devic
 			put_device(&dev->actconfig->interface[i]->dev);
 			dev->actconfig->interface[i] = NULL;
 		}
+		usb_unlocked_disable_lpm(dev);
 		dev->actconfig = NULL;
 		if (dev->state == USB_STATE_CONFIGURED)
 			usb_set_device_state(dev, USB_STATE_ADDRESS);



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

* [ 036/122] ALSA: hda - add dock support for Thinkpad X230 Tablet
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2012-08-07 22:25 ` [ 035/122] USB: Fix LPM disable count mismatch on driver unbind Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 037/122] x86, microcode: Sanitize per-cpu microcode reloading interface Greg Kroah-Hartman
                   ` (85 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, John McCarron, David Henningsson,
	Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: David Henningsson <david.henningsson@canonical.com>

commit 108cc108a3bb42fe4705df1317ff98e1e29428a6 upstream.

Also add a model/fixup string "lenovo-dock", so that other Thinkpad
users will be able to test this fixup easily, to see if it enables
dock I/O for them as well.

BugLink: https://bugs.launchpad.net/bugs/1026953
Tested-by: John McCarron <john.mccarron@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 Documentation/sound/alsa/HD-Audio-Models.txt |    3 ++-
 sound/pci/hda/patch_realtek.c                |   27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -21,10 +21,11 @@ ALC267/268
 ==========
   N/A
 
-ALC269
+ALC269/270/275/276/280/282
 ======
   laptop-amic	Laptops with analog-mic input
   laptop-dmic	Laptops with digital-mic input
+  lenovo-dock   Enables docking station I/O for some Lenovos
 
 ALC662/663/272
 ==============
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5704,6 +5704,15 @@ static int alc269_resume(struct hda_code
 }
 #endif /* CONFIG_PM */
 
+static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
+						 const struct alc_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+
+	if (action == ALC_FIXUP_ACT_PRE_PROBE)
+		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
+}
+
 static void alc269_fixup_hweq(struct hda_codec *codec,
 			       const struct alc_fixup *fix, int action)
 {
@@ -5828,6 +5837,8 @@ enum {
 	ALC269VB_FIXUP_AMIC,
 	ALC269VB_FIXUP_DMIC,
 	ALC269_FIXUP_MIC2_MUTE_LED,
+	ALC269_FIXUP_LENOVO_DOCK,
+	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
 };
 
 static const struct alc_fixup alc269_fixups[] = {
@@ -5952,6 +5963,20 @@ static const struct alc_fixup alc269_fix
 		.type = ALC_FIXUP_FUNC,
 		.v.func = alc269_fixup_mic2_mute,
 	},
+	[ALC269_FIXUP_LENOVO_DOCK] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+			{ 0x19, 0x23a11040 }, /* dock mic */
+			{ 0x1b, 0x2121103f }, /* dock headphone */
+			{ }
+		},
+		.chained = true,
+		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
+	},
+	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
+		.type = ALC_FIXUP_FUNC,
+		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
+	},
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -5975,6 +6000,7 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
+	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_QUANTA_MUTE),
 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K),
 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
@@ -6033,6 +6059,7 @@ static const struct snd_pci_quirk alc269
 static const struct alc_model_fixup alc269_fixup_models[] = {
 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
+	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
 	{}
 };
 



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

* [ 037/122] x86, microcode: Sanitize per-cpu microcode reloading interface
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2012-08-07 22:25 ` [ 036/122] ALSA: hda - add dock support for Thinkpad X230 Tablet Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 038/122] x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults Greg Kroah-Hartman
                   ` (84 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Henrique de Moraes Holschuh,
	Peter Zijlstra, Borislav Petkov, H. Peter Anvin

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Borislav Petkov <borislav.petkov@amd.com>

commit c9fc3f778a6a215ace14ee556067c73982b6d40f upstream.

Microcode reloading in a per-core manner is a very bad idea for both
major x86 vendors. And the thing is, we have such interface with which
we can end up with different microcode versions applied on different
cores of an otherwise homogeneous wrt (family,model,stepping) system.

So turn off the possibility of doing that per core and allow it only
system-wide.

This is a minimal fix which we'd like to see in stable too thus the
more-or-less arbitrary decision to allow system-wide reloading only on
the BSP:

$ echo 1 > /sys/devices/system/cpu/cpu0/microcode/reload
...

and disable the interface on the other cores:

$ echo 1 > /sys/devices/system/cpu/cpu23/microcode/reload
-bash: echo: write error: Invalid argument

Also, allowing the reload only from one CPU (the BSP in
that case) doesn't allow the reload procedure to degenerate
into an O(n^2) deal when triggering reloads from all
/sys/devices/system/cpu/cpuX/microcode/reload sysfs nodes
simultaneously.

A more generic fix will follow.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1340280437-7718-2-git-send-email-bp@amd64.org
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/microcode_core.c |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -298,19 +298,31 @@ static ssize_t reload_store(struct devic
 			    const char *buf, size_t size)
 {
 	unsigned long val;
-	int cpu = dev->id;
-	ssize_t ret = 0;
+	int cpu;
+	ssize_t ret = 0, tmp_ret;
+
+	/* allow reload only from the BSP */
+	if (boot_cpu_data.cpu_index != dev->id)
+		return -EINVAL;
 
 	ret = kstrtoul(buf, 0, &val);
 	if (ret)
 		return ret;
 
-	if (val == 1) {
-		get_online_cpus();
-		if (cpu_online(cpu))
-			ret = reload_for_cpu(cpu);
-		put_online_cpus();
+	if (val != 1)
+		return size;
+
+	get_online_cpus();
+	for_each_online_cpu(cpu) {
+		tmp_ret = reload_for_cpu(cpu);
+		if (tmp_ret != 0)
+			pr_warn("Error reloading microcode on CPU %d\n", cpu);
+
+		/* save retval of the first encountered reload error */
+		if (!ret)
+			ret = tmp_ret;
 	}
+	put_online_cpus();
 
 	if (!ret)
 		ret = size;



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

* [ 038/122] x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2012-08-07 22:25 ` [ 037/122] x86, microcode: Sanitize per-cpu microcode reloading interface Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 039/122] locks: fix checking of fcntl_setlease argument Greg Kroah-Hartman
                   ` (83 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tony Luck, Borislav Petkov

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Tony Luck <tony.luck@intel.com>

commit 6751ed65dc6642af64f7b8a440a75563c8aab7ae upstream.

In commit dad1743e5993f1 ("x86/mce: Only restart instruction after machine
check recovery if it is safe") we fixed mce_notify_process() to force a
signal to the current process if it was not restartable (RIPV bit not
set in MCG_STATUS). But doing it here means that the process doesn't
get told the virtual address of the fault via siginfo_t->si_addr. This
would prevent application level recovery from the fault.

Make a new MF_MUST_KILL flag bit for memory_failure() et al. to use so
that we will provide the right information with the signal.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Acked-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/cpu/mcheck/mce.c |    6 ++++--
 include/linux/mm.h               |    1 +
 mm/memory-failure.c              |   14 ++++++++------
 3 files changed, 13 insertions(+), 8 deletions(-)

--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1186,6 +1186,7 @@ void mce_notify_process(void)
 {
 	unsigned long pfn;
 	struct mce_info *mi = mce_find_info();
+	int flags = MF_ACTION_REQUIRED;
 
 	if (!mi)
 		mce_panic("Lost physical address for unconsumed uncorrectable error", NULL, NULL);
@@ -1200,8 +1201,9 @@ void mce_notify_process(void)
 	 * doomed. We still need to mark the page as poisoned and alert any
 	 * other users of the page.
 	 */
-	if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 ||
-			   mi->restartable == 0) {
+	if (!mi->restartable)
+		flags |= MF_MUST_KILL;
+	if (memory_failure(pfn, MCE_VECTOR, flags) < 0) {
 		pr_err("Memory error not recovered");
 		force_sig(SIGBUS, current);
 	}
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1591,6 +1591,7 @@ void vmemmap_populate_print_last(void);
 enum mf_flags {
 	MF_COUNT_INCREASED = 1 << 0,
 	MF_ACTION_REQUIRED = 1 << 1,
+	MF_MUST_KILL = 1 << 2,
 };
 extern int memory_failure(unsigned long pfn, int trapno, int flags);
 extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -345,14 +345,14 @@ static void add_to_kill(struct task_stru
  * Also when FAIL is set do a force kill because something went
  * wrong earlier.
  */
-static void kill_procs(struct list_head *to_kill, int doit, int trapno,
+static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
 			  int fail, struct page *page, unsigned long pfn,
 			  int flags)
 {
 	struct to_kill *tk, *next;
 
 	list_for_each_entry_safe (tk, next, to_kill, nd) {
-		if (doit) {
+		if (forcekill) {
 			/*
 			 * In case something went wrong with munmapping
 			 * make sure the process doesn't catch the
@@ -858,7 +858,7 @@ static int hwpoison_user_mappings(struct
 	struct address_space *mapping;
 	LIST_HEAD(tokill);
 	int ret;
-	int kill = 1;
+	int kill = 1, forcekill;
 	struct page *hpage = compound_head(p);
 	struct page *ppage;
 
@@ -888,7 +888,7 @@ static int hwpoison_user_mappings(struct
 	 * be called inside page lock (it's recommended but not enforced).
 	 */
 	mapping = page_mapping(hpage);
-	if (!PageDirty(hpage) && mapping &&
+	if (!(flags & MF_MUST_KILL) && !PageDirty(hpage) && mapping &&
 	    mapping_cap_writeback_dirty(mapping)) {
 		if (page_mkclean(hpage)) {
 			SetPageDirty(hpage);
@@ -965,12 +965,14 @@ static int hwpoison_user_mappings(struct
 	 * Now that the dirty bit has been propagated to the
 	 * struct page and all unmaps done we can decide if
 	 * killing is needed or not.  Only kill when the page
-	 * was dirty, otherwise the tokill list is merely
+	 * was dirty or the process is not restartable,
+	 * otherwise the tokill list is merely
 	 * freed.  When there was a problem unmapping earlier
 	 * use a more force-full uncatchable kill to prevent
 	 * any accesses to the poisoned memory.
 	 */
-	kill_procs(&tokill, !!PageDirty(ppage), trapno,
+	forcekill = PageDirty(ppage) || (flags & MF_MUST_KILL);
+	kill_procs(&tokill, forcekill, trapno,
 		      ret != SWAP_SUCCESS, p, pfn, flags);
 
 	return ret;



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

* [ 039/122] locks: fix checking of fcntl_setlease argument
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2012-08-07 22:25 ` [ 038/122] x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 040/122] batman-adv: fix skb->data assignment Greg Kroah-Hartman
                   ` (82 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, J. Bruce Fields

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: "J. Bruce Fields" <bfields@fieldses.org>

commit 0ec4f431eb56d633da3a55da67d5c4b88886ccc7 upstream.

The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.)
are done after converting the long to an int.  Thus some illegal values
may be let through and cause problems in later code.

[ They actually *don't* cause problems in mainline, as of Dave Jones's
  commit 8d657eb3b438 "Remove easily user-triggerable BUG from
  generic_setlease", but we should fix this anyway.  And this patch will
  be necessary to fix real bugs on earlier kernels. ]

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/locks.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/fs/locks.c
+++ b/fs/locks.c
@@ -308,7 +308,7 @@ static int flock_make_lock(struct file *
 	return 0;
 }
 
-static int assign_type(struct file_lock *fl, int type)
+static int assign_type(struct file_lock *fl, long type)
 {
 	switch (type) {
 	case F_RDLCK:
@@ -445,7 +445,7 @@ static const struct lock_manager_operati
 /*
  * Initialize a lease, use the default lock manager operations
  */
-static int lease_init(struct file *filp, int type, struct file_lock *fl)
+static int lease_init(struct file *filp, long type, struct file_lock *fl)
  {
 	if (assign_type(fl, type) != 0)
 		return -EINVAL;
@@ -463,7 +463,7 @@ static int lease_init(struct file *filp,
 }
 
 /* Allocate a file_lock initialised to this type of lease */
-static struct file_lock *lease_alloc(struct file *filp, int type)
+static struct file_lock *lease_alloc(struct file *filp, long type)
 {
 	struct file_lock *fl = locks_alloc_lock();
 	int error = -ENOMEM;



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

* [ 040/122] batman-adv: fix skb->data assignment
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2012-08-07 22:25 ` [ 039/122] locks: fix checking of fcntl_setlease argument Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-09  3:13   ` Ben Hutchings
  2012-08-07 22:25 ` [ 041/122] ftrace: Disable function tracing during suspend/resume and hibernation, again Greg Kroah-Hartman
                   ` (81 subsequent siblings)
  121 siblings, 1 reply; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Antonio Quartulli, Sven Eckelmann

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Antonio Quartulli <ordex@autistici.org>

commit d2b6cc8e460494251442a877fcbc150faa175b4f upstream.

skb_linearize(skb) possibly rearranges the skb internal data and then changes
the skb->data pointer value. For this reason any other pointer in the code that
was assigned skb->data before invoking skb_linearise(skb) must be re-assigned.

In the current tt_query message handling code this is not done and therefore, in
case of skb linearization, the pointer used to handle the packet header ends up
in pointing to poisoned memory. The packet is then dropped but the
translation-table mechanism is corrupted.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/batman-adv/routing.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -626,6 +626,8 @@ int recv_tt_query(struct sk_buff *skb, s
 			if (unlikely(skb_headlen(skb) <
 				     sizeof(struct tt_query_packet) + tt_len))
 				goto out;
+			/* skb_linearize() possibly changed skb->data */
+			tt_query = (struct tt_query_packet *)skb->data;
 
 			handle_tt_response(bat_priv, tt_query);
 		} else {



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

* [ 041/122] ftrace: Disable function tracing during suspend/resume and hibernation, again
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2012-08-07 22:25 ` [ 040/122] batman-adv: fix skb->data assignment Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 042/122] PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock Greg Kroah-Hartman
                   ` (80 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Srivatsa S. Bhat, Rafael J. Wysocki

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>

commit 443772d408a25af62498793f6f805ce3c559309a upstream.

If function tracing is enabled for some of the low-level suspend/resume
functions, it leads to triple fault during resume from suspend, ultimately
ending up in a reboot instead of a resume (or a total refusal to come out
of suspended state, on some machines).

This issue was explained in more detail in commit f42ac38c59e0a03d (ftrace:
disable tracing for suspend to ram). However, the changes made by that commit
got reverted by commit cbe2f5a6e84eebb (tracing: allow tracing of
suspend/resume & hibernation code again). So, unfortunately since things are
not yet robust enough to allow tracing of low-level suspend/resume functions,
suspend/resume is still broken when ftrace is enabled.

So fix this by disabling function tracing during suspend/resume & hibernation.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/power/hibernate.c |    6 ++++++
 kernel/power/suspend.c   |    3 +++
 2 files changed, 9 insertions(+)

--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -353,6 +353,7 @@ int hibernation_snapshot(int platform_mo
 	}
 
 	suspend_console();
+	ftrace_stop();
 	pm_restrict_gfp_mask();
 
 	error = dpm_suspend(PMSG_FREEZE);
@@ -378,6 +379,7 @@ int hibernation_snapshot(int platform_mo
 	if (error || !in_suspend)
 		pm_restore_gfp_mask();
 
+	ftrace_start();
 	resume_console();
 	dpm_complete(msg);
 
@@ -480,6 +482,7 @@ int hibernation_restore(int platform_mod
 
 	pm_prepare_console();
 	suspend_console();
+	ftrace_stop();
 	pm_restrict_gfp_mask();
 	error = dpm_suspend_start(PMSG_QUIESCE);
 	if (!error) {
@@ -487,6 +490,7 @@ int hibernation_restore(int platform_mod
 		dpm_resume_end(PMSG_RECOVER);
 	}
 	pm_restore_gfp_mask();
+	ftrace_start();
 	resume_console();
 	pm_restore_console();
 	return error;
@@ -513,6 +517,7 @@ int hibernation_platform_enter(void)
 
 	entering_platform_hibernation = true;
 	suspend_console();
+	ftrace_stop();
 	error = dpm_suspend_start(PMSG_HIBERNATE);
 	if (error) {
 		if (hibernation_ops->recover)
@@ -556,6 +561,7 @@ int hibernation_platform_enter(void)
  Resume_devices:
 	entering_platform_hibernation = false;
 	dpm_resume_end(PMSG_RESTORE);
+	ftrace_start();
 	resume_console();
 
  Close:
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -24,6 +24,7 @@
 #include <linux/export.h>
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
+#include <linux/ftrace.h>
 #include <trace/events/power.h>
 
 #include "power.h"
@@ -212,6 +213,7 @@ int suspend_devices_and_enter(suspend_st
 			goto Close;
 	}
 	suspend_console();
+	ftrace_stop();
 	suspend_test_start();
 	error = dpm_suspend_start(PMSG_SUSPEND);
 	if (error) {
@@ -231,6 +233,7 @@ int suspend_devices_and_enter(suspend_st
 	suspend_test_start();
 	dpm_resume_end(PMSG_RESUME);
 	suspend_test_finish("resume devices");
+	ftrace_start();
 	resume_console();
  Close:
 	if (suspend_ops->end)



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

* [ 042/122] PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2012-08-07 22:25 ` [ 041/122] ftrace: Disable function tracing during suspend/resume and hibernation, again Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 043/122] PM / Sleep: call early resume handlers when suspend_noirq fails Greg Kroah-Hartman
                   ` (79 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Rafael J. Wysocki, Michael Kerrisk

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: "Rafael J. Wysocki" <rjw@sisk.pl>

commit 11388c87d2abca1f01975ced28ce9eacea239104 upstream.

Require processes wanting to use the wake_lock/wake_unlock sysfs
files to have the CAP_BLOCK_SUSPEND capability, which also is
required for the eventpoll EPOLLWAKEUP flag to be effective, so that
all interfaces related to blocking autosleep depend on the same
capability.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Michael Kerrisk <mtk.man-pages@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/power/wakelock.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -9,6 +9,7 @@
  * manipulate wakelocks on Android.
  */
 
+#include <linux/capability.h>
 #include <linux/ctype.h>
 #include <linux/device.h>
 #include <linux/err.h>
@@ -188,6 +189,9 @@ int pm_wake_lock(const char *buf)
 	size_t len;
 	int ret = 0;
 
+	if (!capable(CAP_BLOCK_SUSPEND))
+		return -EPERM;
+
 	while (*str && !isspace(*str))
 		str++;
 
@@ -231,6 +235,9 @@ int pm_wake_unlock(const char *buf)
 	size_t len;
 	int ret = 0;
 
+	if (!capable(CAP_BLOCK_SUSPEND))
+		return -EPERM;
+
 	len = strlen(buf);
 	if (!len)
 		return -EINVAL;



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

* [ 043/122] PM / Sleep: call early resume handlers when suspend_noirq fails
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2012-08-07 22:25 ` [ 042/122] PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 044/122] TPM: chip disabled state erronously being reported as error Greg Kroah-Hartman
                   ` (78 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Colin Cross, Rafael J. Wysocki

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Colin Cross <ccross@android.com>

commit 064b021fbe470ecc9ca10f9f87af48c0fc0865fb upstream.

Commit cf579dfb82550e34de7ccf3ef090d8b834ccd3a9 (PM / Sleep: Introduce
"late suspend" and "early resume" of devices) introduced a bug where
suspend_late handlers would be called, but if dpm_suspend_noirq returned
an error the early_resume handlers would never be called.  All devices
would end up on the dpm_late_early_list, and would never be resumed
again.

Fix it by calling dpm_resume_early when dpm_suspend_noirq returns
an error.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/base/power/main.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -989,8 +989,16 @@ static int dpm_suspend_late(pm_message_t
 int dpm_suspend_end(pm_message_t state)
 {
 	int error = dpm_suspend_late(state);
+	if (error)
+		return error;
 
-	return error ? : dpm_suspend_noirq(state);
+	error = dpm_suspend_noirq(state);
+	if (error) {
+		dpm_resume_early(state);
+		return error;
+	}
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_end);
 



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

* [ 044/122] TPM: chip disabled state erronously being reported as error
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2012-08-07 22:25 ` [ 043/122] PM / Sleep: call early resume handlers when suspend_noirq fails Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 045/122] tun: fix a crash bug and a memory leak Greg Kroah-Hartman
                   ` (77 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Rajiv Andrade

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>

commit 24ebe6670de3d1f0dca11c9eb372134c7ab05503 upstream.

tpm_do_selftest() attempts to read a PCR in order to
decide if one can rely on the TPM being used or not.
The function that's used by __tpm_pcr_read() does not
expect the TPM to be disabled or deactivated, and if so,
reports an error.

It's fine if the TPM returns this error when trying to
use it for the first time after a power cycle, but it's
definitely not if it already returned success for a
previous attempt to read one of its PCRs.

The tpm_do_selftest() was modified so that the driver only
reports this return code as an error when it really is.

Reported-and-tested-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/char/tpm/tpm.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -827,10 +827,10 @@ EXPORT_SYMBOL_GPL(tpm_pcr_extend);
 int tpm_do_selftest(struct tpm_chip *chip)
 {
 	int rc;
-	u8 digest[TPM_DIGEST_SIZE];
 	unsigned int loops;
 	unsigned int delay_msec = 1000;
 	unsigned long duration;
+	struct tpm_cmd_t cmd;
 
 	duration = tpm_calc_ordinal_duration(chip,
 	                                     TPM_ORD_CONTINUE_SELFTEST);
@@ -845,7 +845,15 @@ int tpm_do_selftest(struct tpm_chip *chi
 		return rc;
 
 	do {
-		rc = __tpm_pcr_read(chip, 0, digest);
+		/* Attempt to read a PCR value */
+		cmd.header.in = pcrread_header;
+		cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
+		rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE);
+
+		if (rc < TPM_HEADER_SIZE)
+			return -EFAULT;
+
+		rc = be32_to_cpu(cmd.header.out.return_code);
 		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
 			dev_info(chip->dev,
 				 "TPM is disabled/deactivated (0x%X)\n", rc);



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

* [ 045/122] tun: fix a crash bug and a memory leak
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2012-08-07 22:25 ` [ 044/122] TPM: chip disabled state erronously being reported as error Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 046/122] mac80211: fix crash with single-queue drivers Greg Kroah-Hartman
                   ` (76 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Mikulas Patocka, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit b09e786bd1dd66418b69348cb110f3a64764626a upstream.

This patch fixes a crash
tun_chr_close -> netdev_run_todo -> tun_free_netdev -> sk_release_kernel ->
sock_release -> iput(SOCK_INODE(sock))
introduced by commit 1ab5ecb90cb6a3df1476e052f76a6e8f6511cb3d

The problem is that this socket is embedded in struct tun_struct, it has
no inode, iput is called on invalid inode, which modifies invalid memory
and optionally causes a crash.

sock_release also decrements sockets_in_use, this causes a bug that
"sockets: used" field in /proc/*/net/sockstat keeps on decreasing when
creating and closing tun devices.

This patch introduces a flag SOCK_EXTERNALLY_ALLOCATED that instructs
sock_release to not free the inode and not decrement sockets_in_use,
fixing both memory corruption and sockets_in_use underflow.

It should be backported to 3.3 an 3.4 stabke.

Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/tun.c   |    3 +++
 include/linux/net.h |    1 +
 net/socket.c        |    3 +++
 3 files changed, 7 insertions(+)

--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -358,6 +358,8 @@ static void tun_free_netdev(struct net_d
 {
 	struct tun_struct *tun = netdev_priv(dev);
 
+	BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, &tun->socket.flags));
+
 	sk_release_kernel(tun->socket.sk);
 }
 
@@ -1115,6 +1117,7 @@ static int tun_set_iff(struct net *net,
 		tun->flags = flags;
 		tun->txflt.count = 0;
 		tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);
+		set_bit(SOCK_EXTERNALLY_ALLOCATED, &tun->socket.flags);
 
 		err = -ENOMEM;
 		sk = sk_alloc(&init_net, AF_UNSPEC, GFP_KERNEL, &tun_proto);
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -72,6 +72,7 @@ struct net;
 #define SOCK_NOSPACE		2
 #define SOCK_PASSCRED		3
 #define SOCK_PASSSEC		4
+#define SOCK_EXTERNALLY_ALLOCATED 5
 
 #ifndef ARCH_HAS_SOCKET_TYPES
 /**
--- a/net/socket.c
+++ b/net/socket.c
@@ -522,6 +522,9 @@ void sock_release(struct socket *sock)
 	if (rcu_dereference_protected(sock->wq, 1)->fasync_list)
 		printk(KERN_ERR "sock_release: fasync list not empty!\n");
 
+	if (test_bit(SOCK_EXTERNALLY_ALLOCATED, &sock->flags))
+		return;
+
 	this_cpu_sub(sockets_in_use, 1);
 	if (!sock->file) {
 		iput(SOCK_INODE(sock));



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

* [ 046/122] mac80211: fix crash with single-queue drivers
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2012-08-07 22:25 ` [ 045/122] tun: fix a crash bug and a memory leak Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 047/122] b43: fix crash with OpenFWWF Greg Kroah-Hartman
                   ` (75 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Larry Finger, Johannes Berg

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit a6f38ac3cc853189705006cc1e0f17ce8467a1df upstream.

Larry (and some others I think) reported that with
single-queue drivers mac80211 crashes when waking
the queues. This happens because we allocate just
a single queue for each virtual interface in case
the driver doesn't have at least 4 queues, but the
code stopping/waking the virtual interface queues
wasn't taking this into account.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/util.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -268,6 +268,10 @@ EXPORT_SYMBOL(ieee80211_ctstoself_durati
 void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue)
 {
 	struct ieee80211_sub_if_data *sdata;
+	int n_acs = IEEE80211_NUM_ACS;
+
+	if (local->hw.queues < IEEE80211_NUM_ACS)
+		n_acs = 1;
 
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 		int ac;
@@ -279,7 +283,7 @@ void ieee80211_propagate_queue_wake(stru
 		    local->queue_stop_reasons[sdata->vif.cab_queue] != 0)
 			continue;
 
-		for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
+		for (ac = 0; ac < n_acs; ac++) {
 			int ac_queue = sdata->vif.hw_queue[ac];
 
 			if (ac_queue == queue ||
@@ -341,6 +345,7 @@ static void __ieee80211_stop_queue(struc
 {
 	struct ieee80211_local *local = hw_to_local(hw);
 	struct ieee80211_sub_if_data *sdata;
+	int n_acs = IEEE80211_NUM_ACS;
 
 	trace_stop_queue(local, queue, reason);
 
@@ -352,11 +357,14 @@ static void __ieee80211_stop_queue(struc
 
 	__set_bit(reason, &local->queue_stop_reasons[queue]);
 
+	if (local->hw.queues < IEEE80211_NUM_ACS)
+		n_acs = 1;
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 		int ac;
 
-		for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
+		for (ac = 0; ac < n_acs; ac++) {
 			if (sdata->vif.hw_queue[ac] == queue ||
 			    sdata->vif.cab_queue == queue)
 				netif_stop_subqueue(sdata->dev, ac);



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

* [ 047/122] b43: fix crash with OpenFWWF
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2012-08-07 22:25 ` [ 046/122] mac80211: fix crash with single-queue drivers Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 048/122] mac80211: fix read outside array bounds Greg Kroah-Hartman
                   ` (74 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Stefan Lippers-Hollmann,
	Johannes Berg, John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 097b0e1bf18a00195cd89bb13565ddbc9b0df942 upstream.

b43 with open firmware crashes mac80211 because
it changes the number of queues at runtime which,
while it was never really supported, now crashes
mac80211 due to the new hardware queue logic.

Fix this by detecting open vs. proprietary fw
earlier and registering with mac80211 with the
right number of queues.

Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

---
 drivers/net/wireless/b43/b43.h  |    7 -------
 drivers/net/wireless/b43/main.c |   32 ++++++++++----------------------
 2 files changed, 10 insertions(+), 29 deletions(-)

--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -870,13 +870,6 @@ struct b43_wl {
 	 * handler, only. This basically is just the IRQ mask register. */
 	spinlock_t hardirq_lock;
 
-	/* The number of queues that were registered with the mac80211 subsystem
-	 * initially. This is a backup copy of hw->queues in case hw->queues has
-	 * to be dynamically lowered at runtime (Firmware does not support QoS).
-	 * hw->queues has to be restored to the original value before unregistering
-	 * from the mac80211 subsystem. */
-	u16 mac80211_initially_registered_queues;
-
 	/* Set this if we call ieee80211_register_hw() and check if we call
 	 * ieee80211_unregister_hw(). */
 	bool hw_registred;
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2359,6 +2359,8 @@ static int b43_try_request_fw(struct b43
 	if (err)
 		goto err_load;
 
+	fw->opensource = (ctx->req_type == B43_FWTYPE_OPENSOURCE);
+
 	return 0;
 
 err_no_ucode:
@@ -2434,6 +2436,10 @@ static void b43_request_firmware(struct
 	goto out;
 
 start_ieee80211:
+	wl->hw->queues = B43_QOS_QUEUE_NUM;
+	if (!modparam_qos || dev->fw.opensource)
+		wl->hw->queues = 1;
+
 	err = ieee80211_register_hw(wl->hw);
 	if (err)
 		goto err_one_core_detach;
@@ -2537,11 +2543,9 @@ static int b43_upload_microcode(struct b
 		dev->fw.hdr_format = B43_FW_HDR_410;
 	else
 		dev->fw.hdr_format = B43_FW_HDR_351;
-	dev->fw.opensource = (fwdate == 0xFFFF);
+	WARN_ON(dev->fw.opensource != (fwdate == 0xFFFF));
 
-	/* Default to use-all-queues. */
-	dev->wl->hw->queues = dev->wl->mac80211_initially_registered_queues;
-	dev->qos_enabled = !!modparam_qos;
+	dev->qos_enabled = dev->wl->hw->queues > 1;
 	/* Default to firmware/hardware crypto acceleration. */
 	dev->hwcrypto_enabled = true;
 
@@ -2559,14 +2563,8 @@ static int b43_upload_microcode(struct b
 			/* Disable hardware crypto and fall back to software crypto. */
 			dev->hwcrypto_enabled = false;
 		}
-		if (!(fwcapa & B43_FWCAPA_QOS)) {
-			b43info(dev->wl, "QoS not supported by firmware\n");
-			/* Disable QoS. Tweak hw->queues to 1. It will be restored before
-			 * ieee80211_unregister to make sure the networking core can
-			 * properly free possible resources. */
-			dev->wl->hw->queues = 1;
-			dev->qos_enabled = false;
-		}
+		/* adding QoS support should use an offline discovery mechanism */
+		WARN(fwcapa & B43_FWCAPA_QOS, "QoS in OpenFW not supported\n");
 	} else {
 		b43info(dev->wl, "Loading firmware version %u.%u "
 			"(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
@@ -5298,8 +5296,6 @@ static struct b43_wl *b43_wireless_init(
 
 	hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
 
-	hw->queues = modparam_qos ? B43_QOS_QUEUE_NUM : 1;
-	wl->mac80211_initially_registered_queues = hw->queues;
 	wl->hw_registred = false;
 	hw->max_rates = 2;
 	SET_IEEE80211_DEV(hw, dev->dev);
@@ -5374,10 +5370,6 @@ static void b43_bcma_remove(struct bcma_
 
 	B43_WARN_ON(!wl);
 	if (wl->current_dev == wldev && wl->hw_registred) {
-		/* Restore the queues count before unregistering, because firmware detect
-		 * might have modified it. Restoring is important, so the networking
-		 * stack can properly free resources. */
-		wl->hw->queues = wl->mac80211_initially_registered_queues;
 		b43_leds_stop(wldev);
 		ieee80211_unregister_hw(wl->hw);
 	}
@@ -5452,10 +5444,6 @@ static void b43_ssb_remove(struct ssb_de
 
 	B43_WARN_ON(!wl);
 	if (wl->current_dev == wldev && wl->hw_registred) {
-		/* Restore the queues count before unregistering, because firmware detect
-		 * might have modified it. Restoring is important, so the networking
-		 * stack can properly free resources. */
-		wl->hw->queues = wl->mac80211_initially_registered_queues;
 		b43_leds_stop(wldev);
 		ieee80211_unregister_hw(wl->hw);
 	}



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

* [ 048/122] mac80211: fix read outside array bounds
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2012-08-07 22:25 ` [ 047/122] b43: fix crash with OpenFWWF Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 049/122] mac80211: fail authentication when AP denied authentication Greg Kroah-Hartman
                   ` (73 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Christian Lamparter, John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Christian Lamparter <chunkeey@googlemail.com>

commit 353d09c6ceedc1cb0c54fe5002c0ca80b6ee6e4f upstream.

ieee802_1d_to_ac is defined as a const int[8],
but the tid parameter has a range from 0 to 15.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2733,7 +2733,7 @@ EXPORT_SYMBOL(ieee80211_get_buffered_bc)
 void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
 			  struct sk_buff *skb, int tid)
 {
-	int ac = ieee802_1d_to_ac[tid];
+	int ac = ieee802_1d_to_ac[tid & 7];
 
 	skb_set_mac_header(skb, 0);
 	skb_set_network_header(skb, 0);



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

* [ 049/122] mac80211: fail authentication when AP denied authentication
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2012-08-07 22:25 ` [ 048/122] mac80211: fix read outside array bounds Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 050/122] iwlwifi: Check BSS ctx active before call mac80211 Greg Kroah-Hartman
                   ` (72 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Eliad Peller, Johannes Berg,
	John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Eliad Peller <eliad@wizery.com>

commit dac211ec10d268b9d09000093a9fa2ac1773894f upstream.

ieee80211_rx_mgmt_auth() doesn't handle denied authentication
properly - it authenticates the station and waits for association
(for 5 seconds) instead of failing the authentication.

Fix it by destroying auth_data and bailing out instead.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1805,7 +1805,8 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
 	if (status_code != WLAN_STATUS_SUCCESS) {
 		printk(KERN_DEBUG "%s: %pM denied authentication (status %d)\n",
 		       sdata->name, mgmt->sa, status_code);
-		goto out;
+		ieee80211_destroy_auth_data(sdata, false);
+		return RX_MGMT_CFG80211_RX_AUTH;
 	}
 
 	switch (ifmgd->auth_data->algorithm) {
@@ -1827,7 +1828,6 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
 	}
 
 	printk(KERN_DEBUG "%s: authenticated\n", sdata->name);
- out:
 	ifmgd->auth_data->done = true;
 	ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
 	run_again(ifmgd, ifmgd->auth_data->timeout);



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

* [ 050/122] iwlwifi: Check BSS ctx active before call mac80211
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2012-08-07 22:25 ` [ 049/122] mac80211: fail authentication when AP denied authentication Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 051/122] iwlwifi: fix debug print in iwl_sta_calc_ht_flags Greg Kroah-Hartman
                   ` (71 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Daniel J Blueman,
	Emmanuel Grumbach, Ilan Peer, Johannes Berg

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Ilan Peer <ilan.peer@intel.com>

commit e19ebcab01cc130fa832764d453b263460ec3b91 upstream.

It is possible that the BSS context is not active (for example
when the current mode is set to GO), or that the vif->type is
different than station. In such a case we cannot
call mac80211 to report the average rssi for the interface
(the function assumes that the vif is valid and that the type
is station).

Reported-by: Daniel J Blueman <daniel@quora.org>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -617,6 +617,11 @@ static bool iwlagn_fill_txpower_mode(str
 	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
 	int ave_rssi;
 
+	if (!ctx->vif || (ctx->vif->type != NL80211_IFTYPE_STATION)) {
+		IWL_DEBUG_INFO(priv, "BSS ctx not active or not in sta mode\n");
+		return false;
+	}
+
 	ave_rssi = ieee80211_ave_rssi(ctx->vif);
 	if (!ave_rssi) {
 		/* no rssi data, no changes to reduce tx power */



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

* [ 051/122] iwlwifi: fix debug print in iwl_sta_calc_ht_flags
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2012-08-07 22:25 ` [ 050/122] iwlwifi: Check BSS ctx active before call mac80211 Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 052/122] atl1c: fix issue of io access mode for AR8152 v2.1 Greg Kroah-Hartman
                   ` (70 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Meenakshi Venkataraman,
	Emmanuel Grumbach, Johannes Berg, John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>

commit a35e270881a5db1ec9ac8bc6d61ebc3e85c14f33 upstream.

We missed passing an argument to the
debug print. Fix it.

Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/iwlwifi/iwl-agn-sta.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -236,6 +236,7 @@ static void iwl_sta_calc_ht_flags(struct
 	mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
 
 	IWL_DEBUG_INFO(priv, "STA %pM SM PS mode: %s\n",
+			sta->addr,
 			(mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ?
 			"static" :
 			(mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ?



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

* [ 052/122] atl1c: fix issue of io access mode for AR8152 v2.1
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2012-08-07 22:25 ` [ 051/122] iwlwifi: fix debug print in iwl_sta_calc_ht_flags Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 053/122] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads Greg Kroah-Hartman
                   ` (69 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Cloud Ren, xiong, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Cloud Ren <cjren@qca.qualcomm.com>

commit fa0afcd10951afad2022dda09777d2bf70cdab3d upstream.

When io access mode is enabled by BOOTROM or BIOS for AR8152 v2.1,
the register can't be read/write by memory access mode.
Clearing Bit 8  of Register 0x21c could fixed the issue.

Signed-off-by: Cloud Ren <cjren@qca.qualcomm.com>
Signed-off-by: xiong <xiong@qca.qualcomm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |    5 +++++
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   16 +++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -74,6 +74,8 @@ void atl1c_post_phy_linkchg(struct atl1c
 #define PCI_DEVICE_ID_ATHEROS_L1D_2_0	0x1083 /* AR8151 v2.0 Gigabit 1000 */
 #define L2CB_V10			0xc0
 #define L2CB_V11			0xc1
+#define L2CB_V20			0xc0
+#define L2CB_V21			0xc1
 
 /* register definition */
 #define REG_DEVICE_CAP              	0x5C
@@ -87,6 +89,9 @@ void atl1c_post_phy_linkchg(struct atl1c
 #define LINK_CTRL_L1_EN			0x02
 #define LINK_CTRL_EXT_SYNC		0x80
 
+#define REG_PCIE_IND_ACC_ADDR		0x80
+#define REG_PCIE_IND_ACC_DATA		0x84
+
 #define REG_DEV_SERIALNUM_CTRL		0x200
 #define REG_DEV_MAC_SEL_MASK		0x0 /* 0:EUI; 1:MAC */
 #define REG_DEV_MAC_SEL_SHIFT		0
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -739,6 +739,8 @@ static const struct atl1c_platform_patch
 
 static void __devinit atl1c_patch_assign(struct atl1c_hw *hw)
 {
+	struct pci_dev	*pdev = hw->adapter->pdev;
+	u32 misc_ctrl;
 	int i = 0;
 
 	hw->msi_lnkpatch = false;
@@ -753,6 +755,18 @@ static void __devinit atl1c_patch_assign
 		}
 		i++;
 	}
+
+	if (hw->device_id == PCI_DEVICE_ID_ATHEROS_L2C_B2 &&
+	    hw->revision_id == L2CB_V21) {
+		/* config acess mode */
+		pci_write_config_dword(pdev, REG_PCIE_IND_ACC_ADDR,
+				       REG_PCIE_DEV_MISC_CTRL);
+		pci_read_config_dword(pdev, REG_PCIE_IND_ACC_DATA, &misc_ctrl);
+		misc_ctrl &= ~0x100;
+		pci_write_config_dword(pdev, REG_PCIE_IND_ACC_ADDR,
+				       REG_PCIE_DEV_MISC_CTRL);
+		pci_write_config_dword(pdev, REG_PCIE_IND_ACC_DATA, misc_ctrl);
+	}
 }
 /*
  * atl1c_sw_init - Initialize general software structures (struct atl1c_adapter)
@@ -780,7 +794,7 @@ static int __devinit atl1c_sw_init(struc
 	hw->device_id = pdev->device;
 	hw->subsystem_vendor_id = pdev->subsystem_vendor;
 	hw->subsystem_id = pdev->subsystem_device;
-	AT_READ_REG(hw, PCI_CLASS_REVISION, &revision);
+	pci_read_config_dword(pdev, PCI_CLASS_REVISION, &revision);
 	hw->revision_id = revision & 0xFF;
 	/* before link up, we assume hibernate is true */
 	hw->hibernate = true;



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

* [ 053/122] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2012-08-07 22:25 ` [ 052/122] atl1c: fix issue of io access mode for AR8152 v2.1 Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 054/122] rtlwifi: rtl8192de: Fix phy-based version calculation Greg Kroah-Hartman
                   ` (68 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Larry Finger, John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Larry Finger <Larry.Finger@lwfinger.net>

commit 3ce4d85b76010525adedcc2555fa164bf706a2f3 upstream.

In commit a7959c1, the USB part of rtlwifi was switched to convert
_usb_read_sync() to using a preallocated buffer rather than one
that has been acquired using kmalloc. Although this routine is named
as though it were synchronous, there seem to be simultaneous users,
and the selection of the index to the data buffer is not multi-user
safe. This situation is addressed by adding a new spinlock. The routine
cannot sleep, thus a mutex is not allowed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/rtlwifi/usb.c  |   14 +++++++++++---
 drivers/net/wireless/rtlwifi/wifi.h |    1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -131,15 +131,19 @@ static u32 _usb_read_sync(struct rtl_pri
 	u8 request;
 	u16 wvalue;
 	u16 index;
-	__le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index];
+	__le32 *data;
+	unsigned long flags;
 
+	spin_lock_irqsave(&rtlpriv->locks.usb_lock, flags);
+	if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT)
+		rtlpriv->usb_data_index = 0;
+	data = &rtlpriv->usb_data[rtlpriv->usb_data_index];
+	spin_unlock_irqrestore(&rtlpriv->locks.usb_lock, flags);
 	request = REALTEK_USB_VENQT_CMD_REQ;
 	index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */
 
 	wvalue = (u16)addr;
 	_usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len);
-	if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT)
-		rtlpriv->usb_data_index = 0;
 	return le32_to_cpu(*data);
 }
 
@@ -951,6 +955,10 @@ int __devinit rtl_usb_probe(struct usb_i
 				    GFP_KERNEL);
 	if (!rtlpriv->usb_data)
 		return -ENOMEM;
+
+	/* this spin lock must be initialized early */
+	spin_lock_init(&rtlpriv->locks.usb_lock);
+
 	rtlpriv->usb_data_index = 0;
 	init_completion(&rtlpriv->firmware_loading_complete);
 	SET_IEEE80211_DEV(hw, &intf->dev);
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1555,6 +1555,7 @@ struct rtl_locks {
 	spinlock_t rf_ps_lock;
 	spinlock_t rf_lock;
 	spinlock_t waitq_lock;
+	spinlock_t usb_lock;
 
 	/*Dual mac*/
 	spinlock_t cck_and_rw_pagea_lock;



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

* [ 054/122] rtlwifi: rtl8192de: Fix phy-based version calculation
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2012-08-07 22:25 ` [ 053/122] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 055/122] mwifiex: correction in mcs index check Greg Kroah-Hartman
                   ` (67 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Forest Bond, Larry Finger,
	John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Forest Bond <forest.bond@rapidrollout.com>

commit f1b00f4dab29b57bdf1bc03ef12020b280fd2a72 upstream.

Commit d83579e2a50ac68389e6b4c58b845c702cf37516 incorporated some
changes from the vendor driver that made it newly important that the
calculated hardware version correctly include the CHIP_92D bit, as all
of the IS_92D_* macros were changed to depend on it.  However, this bit
was being unset for dual-mac, dual-phy devices.  The vendor driver
behavior was modified to not do this, but unfortunately this change was
not picked up along with the others.  This caused scanning in the 2.4GHz
band to be broken, and possibly other bugs as well.

This patch brings the version calculation logic in parity with the
vendor driver in this regard, and in doing so fixes the regression.
However, the version calculation code in general continues to be largely
incoherent and messy, and needs to be cleaned up.

Signed-off-by: Forest Bond <forest.bond@rapidrollout.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/rtlwifi/rtl8192de/phy.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
@@ -3345,21 +3345,21 @@ void rtl92d_phy_config_macphymode_info(s
 	switch (rtlhal->macphymode) {
 	case DUALMAC_SINGLEPHY:
 		rtlphy->rf_type = RF_2T2R;
-		rtlhal->version |= CHIP_92D_SINGLEPHY;
+		rtlhal->version |= RF_TYPE_2T2R;
 		rtlhal->bandset = BAND_ON_BOTH;
 		rtlhal->current_bandtype = BAND_ON_2_4G;
 		break;
 
 	case SINGLEMAC_SINGLEPHY:
 		rtlphy->rf_type = RF_2T2R;
-		rtlhal->version |= CHIP_92D_SINGLEPHY;
+		rtlhal->version |= RF_TYPE_2T2R;
 		rtlhal->bandset = BAND_ON_BOTH;
 		rtlhal->current_bandtype = BAND_ON_2_4G;
 		break;
 
 	case DUALMAC_DUALPHY:
 		rtlphy->rf_type = RF_1T1R;
-		rtlhal->version &= (~CHIP_92D_SINGLEPHY);
+		rtlhal->version &= RF_TYPE_1T1R;
 		/* Now we let MAC0 run on 5G band. */
 		if (rtlhal->interfaceindex == 0) {
 			rtlhal->bandset = BAND_ON_5G;



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

* [ 055/122] mwifiex: correction in mcs index check
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2012-08-07 22:25 ` [ 054/122] rtlwifi: rtl8192de: Fix phy-based version calculation Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 056/122] s390/idle: fix sequence handling vs cpu hotplug Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Amitkumar Karwar, Bing Zhao,
	John W. Linville

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Amitkumar Karwar <akarwar@marvell.com>

commit fe020120cb863ba918c6d603345342a880272c4d upstream.

mwifiex driver supports 2x2 chips as well. Hence valid mcs values
are 0 to 15. The check for mcs index is corrected in this patch.

For example: if 40MHz is enabled and mcs index is 11, "iw link"
command would show "tx bitrate: 108.0 MBit/s" without this patch.
Now it shows "tx bitrate: 108.0 MBit/s MCS 11 40Mhz" with the patch.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/mwifiex/cfg80211.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -634,9 +634,9 @@ mwifiex_dump_station_info(struct mwifiex
 
 	/*
 	 * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid
-	 * MCS index values for us are 0 to 7.
+	 * MCS index values for us are 0 to 15.
 	 */
-	if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 8)) {
+	if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) {
 		sinfo->txrate.mcs = priv->tx_rate;
 		sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
 		/* 40MHz rate */



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

* [ 056/122] s390/idle: fix sequence handling vs cpu hotplug
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2012-08-07 22:25 ` [ 055/122] mwifiex: correction in mcs index check Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 057/122] s390/mm: downgrade page table after fork of a 31 bit process Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Heiko Carstens, Martin Schwidefsky

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Heiko Carstens <heiko.carstens@de.ibm.com>

commit 0008204ffe85d23382d6fd0f971f3f0fbe70bae2 upstream.

The s390 idle accounting code uses a sequence counter which gets used
when the per cpu idle statistics get updated and read.

One assumption on read access is that only when the sequence counter is
even and did not change while reading all values the result is valid.
On cpu hotplug however the per cpu data structure gets initialized via
a cpu hotplug notifier on CPU_ONLINE.
CPU_ONLINE however is too late, since the onlined cpu is already running
and might access the per cpu data. Worst case is that the data structure
gets initialized while an idle thread is updating its idle statistics.
This will result in an uneven sequence counter after an update.

As a result user space tools like top, which access /proc/stat in order
to get idle stats, will busy loop waiting for the sequence counter to
become even again, which will never happen until the queried cpu will
update its idle statistics again. And even then the sequence counter
will only have an even value for a couple of cpu cycles.

Fix this by moving the initialization of the per cpu idle statistics
to cpu_init(). I prefer that solution in favor of changing the
notifier to CPU_UP_PREPARE, which would be a different solution to
the problem.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/kernel/processor.c |    2 ++
 arch/s390/kernel/smp.c       |    3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -26,12 +26,14 @@ static DEFINE_PER_CPU(struct cpuid, cpu_
 void __cpuinit cpu_init(void)
 {
 	struct cpuid *id = &per_cpu(cpu_id, smp_processor_id());
+	struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
 
 	get_cpu_id(id);
 	atomic_inc(&init_mm.mm_count);
 	current->active_mm = &init_mm;
 	BUG_ON(current->mm);
 	enter_lazy_tlb(&init_mm, current);
+	memset(idle, 0, sizeof(*idle));
 }
 
 /*
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -984,14 +984,11 @@ static int __cpuinit smp_cpu_notify(stru
 	unsigned int cpu = (unsigned int)(long)hcpu;
 	struct cpu *c = &pcpu_devices[cpu].cpu;
 	struct device *s = &c->dev;
-	struct s390_idle_data *idle;
 	int err = 0;
 
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
-		idle = &per_cpu(s390_idle, cpu);
-		memset(idle, 0, sizeof(struct s390_idle_data));
 		err = sysfs_create_group(&s->kobj, &cpu_online_attr_group);
 		break;
 	case CPU_DEAD:



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

* [ 057/122] s390/mm: downgrade page table after fork of a 31 bit process
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2012-08-07 22:25 ` [ 056/122] s390/idle: fix sequence handling vs cpu hotplug Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 058/122] s390/mm: fix fault handling for page table walk case Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Martin Schwidefsky

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

commit 0f6f281b731d20bfe75c13f85d33f3f05b440222 upstream.

The downgrade of the 4 level page table created by init_new_context is
currently done only in start_thread31. If a 31 bit process forks the
new mm uses a 4 level page table, including the task size of 2<<42
that goes along with it. This is incorrect as now a 31 bit process
can map memory beyond 2GB. Define arch_dup_mmap to do the downgrade
after fork.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/include/asm/mmu_context.h |   14 +++++++++++++-
 arch/s390/include/asm/processor.h   |    2 ++
 arch/s390/mm/mmap.c                 |   12 ++++++++++--
 arch/s390/mm/pgtable.c              |    5 -----
 4 files changed, 25 insertions(+), 8 deletions(-)

--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -13,7 +13,6 @@
 #include <asm/uaccess.h>
 #include <asm/tlbflush.h>
 #include <asm/ctl_reg.h>
-#include <asm-generic/mm_hooks.h>
 
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
@@ -93,4 +92,17 @@ static inline void activate_mm(struct mm
         switch_mm(prev, next, current);
 }
 
+static inline void arch_dup_mmap(struct mm_struct *oldmm,
+				 struct mm_struct *mm)
+{
+#ifdef CONFIG_64BIT
+	if (oldmm->context.asce_limit < mm->context.asce_limit)
+		crst_table_downgrade(mm, oldmm->context.asce_limit);
+#endif
+}
+
+static inline void arch_exit_mmap(struct mm_struct *mm)
+{
+}
+
 #endif /* __S390_MMU_CONTEXT_H */
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -122,7 +122,9 @@ struct stack_frame {
 	regs->psw.mask	= psw_user_bits | PSW_MASK_BA;			\
 	regs->psw.addr	= new_psw | PSW_ADDR_AMODE;			\
 	regs->gprs[15]	= new_stackp;					\
+	__tlb_flush_mm(current->mm);					\
 	crst_table_downgrade(current->mm, 1UL << 31);			\
+	update_mm(current->mm, current);				\
 } while (0)
 
 /* Forward declaration, a strange C thing */
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -105,9 +105,15 @@ void arch_pick_mmap_layout(struct mm_str
 
 int s390_mmap_check(unsigned long addr, unsigned long len)
 {
+	int rc;
+
 	if (!is_compat_task() &&
-	    len >= TASK_SIZE && TASK_SIZE < (1UL << 53))
-		return crst_table_upgrade(current->mm, 1UL << 53);
+	    len >= TASK_SIZE && TASK_SIZE < (1UL << 53)) {
+		rc = crst_table_upgrade(current->mm, 1UL << 53);
+		if (rc)
+			return rc;
+		update_mm(current->mm, current);
+	}
 	return 0;
 }
 
@@ -127,6 +133,7 @@ s390_get_unmapped_area(struct file *filp
 		rc = crst_table_upgrade(mm, 1UL << 53);
 		if (rc)
 			return (unsigned long) rc;
+		update_mm(mm, current);
 		area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
 	}
 	return area;
@@ -149,6 +156,7 @@ s390_get_unmapped_area_topdown(struct fi
 		rc = crst_table_upgrade(mm, 1UL << 53);
 		if (rc)
 			return (unsigned long) rc;
+		update_mm(mm, current);
 		area = arch_get_unmapped_area_topdown(filp, addr, len,
 						      pgoff, flags);
 	}
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -85,7 +85,6 @@ repeat:
 		crst_table_free(mm, table);
 	if (mm->context.asce_limit < limit)
 		goto repeat;
-	update_mm(mm, current);
 	return 0;
 }
 
@@ -93,9 +92,6 @@ void crst_table_downgrade(struct mm_stru
 {
 	pgd_t *pgd;
 
-	if (mm->context.asce_limit <= limit)
-		return;
-	__tlb_flush_mm(mm);
 	while (mm->context.asce_limit > limit) {
 		pgd = mm->pgd;
 		switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) {
@@ -118,7 +114,6 @@ void crst_table_downgrade(struct mm_stru
 		mm->task_size = mm->context.asce_limit;
 		crst_table_free(mm, (unsigned long *) pgd);
 	}
-	update_mm(mm, current);
 }
 #endif
 



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

* [ 058/122] s390/mm: fix fault handling for page table walk case
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2012-08-07 22:25 ` [ 057/122] s390/mm: downgrade page table after fork of a 31 bit process Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 059/122] cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Heiko Carstens, Martin Schwidefsky

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Heiko Carstens <heiko.carstens@de.ibm.com>

commit 008c2e8f247f0a8db1e8e26139da12f3a3abcda0 upstream.

Make sure the kernel does not incorrectly create a SIGBUS signal during
user space accesses:

For user space accesses in the switched addressing mode case the kernel
may walk page tables and access user address space via the kernel
mapping. If a page table entry is invalid the function __handle_fault()
gets called in order to emulate a page fault and trigger all the usual
actions like paging in a missing page etc. by calling handle_mm_fault().

If handle_mm_fault() returns with an error fixup handling is necessary.
For the switched addressing mode case all errors need to be mapped to
-EFAULT, so that the calling uaccess function can return -EFAULT to
user space.

Unfortunately the __handle_fault() incorrectly calls do_sigbus() if
VM_FAULT_SIGBUS is set. This however should only happen if a page fault
was triggered by a user space instruction. For kernel mode uaccesses
the correct action is to only return -EFAULT.
So user space may incorrectly see SIGBUS signals because of this bug.

For current machines this would only be possible for the switched
addressing mode case in conjunction with futex operations.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/mm/fault.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -443,6 +443,7 @@ int __handle_fault(unsigned long uaddr,
 	struct pt_regs regs;
 	int access, fault;
 
+	/* Emulate a uaccess fault from kernel mode. */
 	regs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK;
 	if (!irqs_disabled())
 		regs.psw.mask |= PSW_MASK_IO | PSW_MASK_EXT;
@@ -452,12 +453,12 @@ int __handle_fault(unsigned long uaddr,
 	regs.int_parm_long = (uaddr & PAGE_MASK) | 2;
 	access = write ? VM_WRITE : VM_READ;
 	fault = do_exception(&regs, access);
-	if (unlikely(fault)) {
-		if (fault & VM_FAULT_OOM)
-			return -EFAULT;
-		else if (fault & VM_FAULT_SIGBUS)
-			do_sigbus(&regs);
-	}
+	/*
+	 * Since the fault happened in kernel mode while performing a uaccess
+	 * all we need to do now is emulating a fixup in case "fault" is not
+	 * zero.
+	 * For the calling uaccess functions this results always in -EFAULT.
+	 */
 	return fault ? -EFAULT : 0;
 }
 



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

* [ 059/122] cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2012-08-07 22:25 ` [ 058/122] s390/mm: fix fault handling for page table walk case Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 060/122] iommu/amd: Add missing spin_lock initialization Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tejun Heo, Al Viro, Li Zefan

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Tejun Heo <tj@kernel.org>

commit ce27e317ba22b359bde02216afab934dac3af095 upstream.

While refactoring cgroup file removal path, 05ef1d7c4a "cgroup:
introduce struct cfent" incorrectly changed the @dir argument of
simple_unlink() to the inode of the file being deleted instead of that
of the containing directory.

The effect of this bug is minor - ctime and mtime of the parent
weren't properly updated on file deletion.

Fix it by using @cgrp->dentry->d_inode instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/cgroup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -954,7 +954,7 @@ static int cgroup_rm_file(struct cgroup
 
 		dget(d);
 		d_delete(d);
-		simple_unlink(d->d_inode, d);
+		simple_unlink(cgrp->dentry->d_inode, d);
 		list_del_init(&cfe->node);
 		dput(d);
 



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

* [ 060/122] iommu/amd: Add missing spin_lock initialization
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2012-08-07 22:25 ` [ 059/122] cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 061/122] iommu/amd: Fix hotplug with iommu=pt Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Joerg Roedel

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Joerg Roedel <joerg.roedel@amd.com>

commit 2c13d47a1a7ee8808796016c617aef25fd1d1925 upstream.

Add missing spin_lock initialization in
amd_iommu_bind_pasid() function and make lockdep happy
again.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/amd_iommu_v2.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -681,6 +681,8 @@ int amd_iommu_bind_pasid(struct pci_dev
 
 	atomic_set(&pasid_state->count, 1);
 	init_waitqueue_head(&pasid_state->wq);
+	spin_lock_init(&pasid_state->lock);
+
 	pasid_state->task         = task;
 	pasid_state->mm           = get_task_mm(task);
 	pasid_state->device_state = dev_state;



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

* [ 061/122] iommu/amd: Fix hotplug with iommu=pt
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2012-08-07 22:25 ` [ 060/122] iommu/amd: Add missing spin_lock initialization Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 062/122] udf: Improve table length check to avoid possible overflow Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Joerg Roedel

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Joerg Roedel <joerg.roedel@amd.com>

commit 2c9195e990297068d0f1f1bd8e2f1d09538009da upstream.

This did not work because devices are not put into the
pt_domain. Fix this.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/amd_iommu.c |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2254,6 +2254,18 @@ static int device_change_notifier(struct
 
 		iommu_init_device(dev);
 
+		/*
+		 * dev_data is still NULL and
+		 * got initialized in iommu_init_device
+		 */
+		dev_data = get_dev_data(dev);
+
+		if (iommu_pass_through || dev_data->iommu_v2) {
+			dev_data->passthrough = true;
+			attach_device(dev, pt_domain);
+			break;
+		}
+
 		domain = domain_for_device(dev);
 
 		/* allocate a protection domain if a device is added */
@@ -2271,10 +2283,7 @@ static int device_change_notifier(struct
 
 		dev_data = get_dev_data(dev);
 
-		if (!dev_data->passthrough)
-			dev->archdata.dma_ops = &amd_iommu_dma_ops;
-		else
-			dev->archdata.dma_ops = &nommu_dma_ops;
+		dev->archdata.dma_ops = &amd_iommu_dma_ops;
 
 		break;
 	case BUS_NOTIFY_DEL_DEVICE:



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

* [ 062/122] udf: Improve table length check to avoid possible overflow
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2012-08-07 22:25 ` [ 061/122] iommu/amd: Fix hotplug with iommu=pt Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 063/122] stable: update references to older 2.6 versions for 3.x Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Ben Hutchings, Jan Kara

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jan Kara <jack@suse.cz>

commit 57b9655d01ef057a523e810d29c37ac09b80eead upstream.

When a partition table length is corrupted to be close to 1 << 32, the
check for its length may overflow on 32-bit systems and we will think
the length is valid. Later on the kernel can crash trying to read beyond
end of buffer. Fix the check to avoid possible overflow.

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1283,7 +1283,7 @@ static int udf_load_logicalvol(struct su
 	BUG_ON(ident != TAG_IDENT_LVD);
 	lvd = (struct logicalVolDesc *)bh->b_data;
 	table_len = le32_to_cpu(lvd->mapTableLength);
-	if (sizeof(*lvd) + table_len > sb->s_blocksize) {
+	if (table_len > sb->s_blocksize - sizeof(*lvd)) {
 		udf_err(sb, "error loading logical volume descriptor: "
 			"Partition table too long (%u > %lu)\n", table_len,
 			sb->s_blocksize - sizeof(*lvd));



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

* [ 063/122] stable: update references to older 2.6 versions for 3.x
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2012-08-07 22:25 ` [ 062/122] udf: Improve table length check to avoid possible overflow Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 064/122] staging: zsmalloc: Finish conversion to a separate module Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Paul Gortmaker, Rob Landley

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Paul Gortmaker <paul.gortmaker@windriver.com>

commit 2584f5212d97b664be250ad5700a2d0fee31a10d upstream.

Also add information on where the respective trees are.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Rob Landley <rob@landley.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 Documentation/stable_kernel_rules.txt |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -1,4 +1,4 @@
-Everything you ever wanted to know about Linux 2.6 -stable releases.
+Everything you ever wanted to know about Linux -stable releases.
 
 Rules on what kind of patches are accepted, and which ones are not, into the
 "-stable" tree:
@@ -42,10 +42,10 @@ Procedure for submitting patches to the
    cherry-picked than this can be specified in the following format in
    the sign-off area:
 
-     Cc: <stable@vger.kernel.org> # .32.x: a1f84a3: sched: Check for idle
-     Cc: <stable@vger.kernel.org> # .32.x: 1b9508f: sched: Rate-limit newidle
-     Cc: <stable@vger.kernel.org> # .32.x: fd21073: sched: Fix affinity logic
-     Cc: <stable@vger.kernel.org> # .32.x
+     Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle
+     Cc: <stable@vger.kernel.org> # 3.3.x: 1b9508f: sched: Rate-limit newidle
+     Cc: <stable@vger.kernel.org> # 3.3.x: fd21073: sched: Fix affinity logic
+     Cc: <stable@vger.kernel.org> # 3.3.x
     Signed-off-by: Ingo Molnar <mingo@elte.hu>
 
    The tag sequence has the meaning of:
@@ -79,6 +79,15 @@ Review cycle:
    security kernel team, and not go through the normal review cycle.
    Contact the kernel security team for more details on this procedure.
 
+Trees:
+
+ - The queues of patches, for both completed versions and in progress
+   versions can be found at:
+	http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
+ - The finalized and tagged releases of all stable kernels can be found
+   in separate branches per version at:
+	http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git
+
 
 Review committee:
 



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

* [ 064/122] staging: zsmalloc: Finish conversion to a separate module
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2012-08-07 22:25 ` [ 063/122] stable: update references to older 2.6 versions for 3.x Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 065/122] workqueue: perform cpu down operations from low priority cpu_notifier() Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Christian Ohm, Ben Hutchings,
	Jonathan Nieder

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 069f101fa463351f528773d73b74e9b606b3f66a upstream.

ZSMALLOC is tristate, but the code has no MODULE_LICENSE and since it
depends on GPL-only symbols it cannot be loaded as a module.  This in
turn breaks zram which now depends on it.  I assume it's meant to be
Dual BSD/GPL like the other z-stuff.

There is also no module_exit, which will make it impossible to unload.
Add the appropriate module_init and module_exit declarations suggested
by comments.

Reported-by: Christian Ohm <chr.ohm@gmx.net>
References: http://bugs.debian.org/677273
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/staging/zsmalloc/zsmalloc-main.c |   33 ++++++-------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -425,12 +425,6 @@ static struct page *find_get_zspage(stru
 }
 
 
-/*
- * If this becomes a separate module, register zs_init() with
- * module_init(), zs_exit with module_exit(), and remove zs_initialized
-*/
-static int zs_initialized;
-
 static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action,
 				void *pcpu)
 {
@@ -489,7 +483,7 @@ fail:
 
 struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
 {
-	int i, error, ovhd_size;
+	int i, ovhd_size;
 	struct zs_pool *pool;
 
 	if (!name)
@@ -516,28 +510,9 @@ struct zs_pool *zs_create_pool(const cha
 
 	}
 
-	/*
-	 * If this becomes a separate module, register zs_init with
-	 * module_init, and remove this block
-	*/
-	if (!zs_initialized) {
-		error = zs_init();
-		if (error)
-			goto cleanup;
-		zs_initialized = 1;
-	}
-
 	pool->flags = flags;
 	pool->name = name;
 
-	error = 0; /* Success */
-
-cleanup:
-	if (error) {
-		zs_destroy_pool(pool);
-		pool = NULL;
-	}
-
 	return pool;
 }
 EXPORT_SYMBOL_GPL(zs_create_pool);
@@ -753,3 +728,9 @@ u64 zs_get_total_size_bytes(struct zs_po
 	return npages << PAGE_SHIFT;
 }
 EXPORT_SYMBOL_GPL(zs_get_total_size_bytes);
+
+module_init(zs_init);
+module_exit(zs_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>");



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

* [ 065/122] workqueue: perform cpu down operations from low priority cpu_notifier()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2012-08-07 22:25 ` [ 064/122] staging: zsmalloc: Finish conversion to a separate module Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 066/122] ACPI, APEI: Fixup common access width firmware bug Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tejun Heo, Rafael J. Wysocki

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Tejun Heo <tj@kernel.org>

commit 6575820221f7a4dd6eadecf7bf83cdd154335eda upstream.

Currently, all workqueue cpu hotplug operations run off
CPU_PRI_WORKQUEUE which is higher than normal notifiers.  This is to
ensure that workqueue is up and running while bringing up a CPU before
other notifiers try to use workqueue on the CPU.

Per-cpu workqueues are supposed to remain working and bound to the CPU
for normal CPU_DOWN_PREPARE notifiers.  This holds mostly true even
with workqueue offlining running with higher priority because
workqueue CPU_DOWN_PREPARE only creates a bound trustee thread which
runs the per-cpu workqueue without concurrency management without
explicitly detaching the existing workers.

However, if the trustee needs to create new workers, it creates
unbound workers which may wander off to other CPUs while
CPU_DOWN_PREPARE notifiers are in progress.  Furthermore, if the CPU
down is cancelled, the per-CPU workqueue may end up with workers which
aren't bound to the CPU.

While reliably reproducible with a convoluted artificial test-case
involving scheduling and flushing CPU burning work items from CPU down
notifiers, this isn't very likely to happen in the wild, and, even
when it happens, the effects are likely to be hidden by the following
successful CPU down.

Fix it by using different priorities for up and down notifiers - high
priority for up operations and low priority for down operations.

Workqueue cpu hotplug operations will soon go through further cleanup.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/cpu.h |    5 +++--
 kernel/workqueue.c  |   38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 3 deletions(-)

--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -73,8 +73,9 @@ enum {
 	/* migration should happen before other stuff but after perf */
 	CPU_PRI_PERF		= 20,
 	CPU_PRI_MIGRATION	= 10,
-	/* prepare workqueues for other notifiers */
-	CPU_PRI_WORKQUEUE	= 5,
+	/* bring up workqueues before normal notifiers and down after */
+	CPU_PRI_WORKQUEUE_UP	= 5,
+	CPU_PRI_WORKQUEUE_DOWN	= -5,
 };
 
 #define CPU_ONLINE		0x0002 /* CPU (unsigned)v is up */
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3590,6 +3590,41 @@ static int __devinit workqueue_cpu_callb
 	return notifier_from_errno(0);
 }
 
+/*
+ * Workqueues should be brought up before normal priority CPU notifiers.
+ * This will be registered high priority CPU notifier.
+ */
+static int __devinit workqueue_cpu_up_callback(struct notifier_block *nfb,
+					       unsigned long action,
+					       void *hcpu)
+{
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_UP_PREPARE:
+	case CPU_UP_CANCELED:
+	case CPU_DOWN_FAILED:
+	case CPU_ONLINE:
+		return workqueue_cpu_callback(nfb, action, hcpu);
+	}
+	return NOTIFY_OK;
+}
+
+/*
+ * Workqueues should be brought down after normal priority CPU notifiers.
+ * This will be registered as low priority CPU notifier.
+ */
+static int __devinit workqueue_cpu_down_callback(struct notifier_block *nfb,
+						 unsigned long action,
+						 void *hcpu)
+{
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_DOWN_PREPARE:
+	case CPU_DYING:
+	case CPU_POST_DEAD:
+		return workqueue_cpu_callback(nfb, action, hcpu);
+	}
+	return NOTIFY_OK;
+}
+
 #ifdef CONFIG_SMP
 
 struct work_for_cpu {
@@ -3783,7 +3818,8 @@ static int __init init_workqueues(void)
 	unsigned int cpu;
 	int i;
 
-	cpu_notifier(workqueue_cpu_callback, CPU_PRI_WORKQUEUE);
+	cpu_notifier(workqueue_cpu_up_callback, CPU_PRI_WORKQUEUE_UP);
+	cpu_notifier(workqueue_cpu_down_callback, CPU_PRI_WORKQUEUE_DOWN);
 
 	/* initialize gcwqs */
 	for_each_gcwq_cpu(cpu) {



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

* [ 066/122] ACPI, APEI: Fixup common access width firmware bug
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2012-08-07 22:25 ` [ 065/122] workqueue: perform cpu down operations from low priority cpu_notifier() Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 067/122] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jean Delvare, Huang Ying,
	Gary Hade, Len Brown

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jean Delvare <jdelvare@suse.de>

commit f712c71f7b2b43b894d1e92e1b77385fcad8815f upstream.

Many firmwares have a common register definition bug where 8-bit
access width is specified for a 32-bit register. Ideally this should
be fixed in the BIOS, but earlier versions of the kernel did not
complain, so fix that up silently.

This closes kernel bug #43282:
https://bugzilla.kernel.org/show_bug.cgi?id=43282

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Huang Ying <ying.huang@intel.com>
Acked-by: Gary Hade <garyhade@us.ibm.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/acpi/apei/apei-base.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -586,6 +586,11 @@ static int apei_check_gar(struct acpi_ge
 	}
 	*access_bit_width = 1UL << (access_size_code + 2);
 
+	/* Fixup common BIOS bug */
+	if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 &&
+	    *access_bit_width < 32)
+		*access_bit_width = 32;
+
 	if ((bit_width + bit_offset) > *access_bit_width) {
 		pr_warning(FW_BUG APEI_PFX
 			   "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n",



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

* [ 067/122] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2012-08-07 22:25 ` [ 066/122] ACPI, APEI: Fixup common access width firmware bug Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 068/122] kmsg - properly print over-long continuation lines Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Lan Tianyu, Len Brown

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 upstream.

In the ac.c, power_supply_register()'s return value is not checked.

As a result, the driver's add() ops may return success
even though the device failed to initialize.

For example, some BIOS may describe two ACADs in the same DSDT.
The second ACAD device will fail to register,
but ACPI driver's add() ops returns sucessfully.
The ACPI device will receive ACPI notification and cause OOPS.

https://bugzilla.redhat.com/show_bug.cgi?id=772730

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/acpi/ac.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_devic
 	ac->charger.properties = ac_props;
 	ac->charger.num_properties = ARRAY_SIZE(ac_props);
 	ac->charger.get_property = get_ac_property;
-	power_supply_register(&ac->device->dev, &ac->charger);
+	result = power_supply_register(&ac->device->dev, &ac->charger);
+	if (result)
+		goto end;
 
 	printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
 	       acpi_device_name(device), acpi_device_bid(device),



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

* [ 068/122] kmsg - properly print over-long continuation lines
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (66 preceding siblings ...)
  2012-08-07 22:25 ` [ 067/122] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 069/122] Btrfs: call the ordered free operation without any locks held Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dave Jones, Kay Sievers

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Kay Sievers <kay@vrfy.org>

commit 70498253186586e5dca7bc3ebd3415203b059fbc upstream.

Reserve PREFIX_MAX bytes in the LOG_LINE_MAX line when buffering a
continuation line, to be able to properly prefix the LOG_LINE_MAX
line with the syslog prefix and timestamp when printing it.

Reported-By: Dave Jones <davej@redhat.com>
Signed-off-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/printk.c |   33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -235,7 +235,8 @@ static u32 log_next_idx;
 static u64 clear_seq;
 static u32 clear_idx;
 
-#define LOG_LINE_MAX 1024
+#define PREFIX_MAX		32
+#define LOG_LINE_MAX		1024 - PREFIX_MAX
 
 /* record buffer */
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
@@ -876,7 +877,7 @@ static size_t msg_print_text(const struc
 
 		if (buf) {
 			if (print_prefix(msg, syslog, NULL) +
-			    text_len + 1>= size - len)
+			    text_len + 1 >= size - len)
 				break;
 
 			if (prefix)
@@ -907,7 +908,7 @@ static int syslog_print(char __user *buf
 	struct log *msg;
 	int len = 0;
 
-	text = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
+	text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
 	if (!text)
 		return -ENOMEM;
 
@@ -930,7 +931,8 @@ static int syslog_print(char __user *buf
 
 		skip = syslog_partial;
 		msg = log_from_idx(syslog_idx);
-		n = msg_print_text(msg, syslog_prev, true, text, LOG_LINE_MAX);
+		n = msg_print_text(msg, syslog_prev, true, text,
+				   LOG_LINE_MAX + PREFIX_MAX);
 		if (n - syslog_partial <= size) {
 			/* message fits into buffer, move forward */
 			syslog_idx = log_next(syslog_idx);
@@ -969,7 +971,7 @@ static int syslog_print_all(char __user
 	char *text;
 	int len = 0;
 
-	text = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
+	text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
 	if (!text)
 		return -ENOMEM;
 
@@ -1022,7 +1024,8 @@ static int syslog_print_all(char __user
 			struct log *msg = log_from_idx(idx);
 			int textlen;
 
-			textlen = msg_print_text(msg, prev, true, text, LOG_LINE_MAX);
+			textlen = msg_print_text(msg, prev, true, text,
+						 LOG_LINE_MAX + PREFIX_MAX);
 			if (textlen < 0) {
 				len = textlen;
 				break;
@@ -1352,15 +1355,15 @@ static struct cont {
 	bool flushed:1;			/* buffer sealed and committed */
 } cont;
 
-static void cont_flush(void)
+static void cont_flush(enum log_flags flags)
 {
 	if (cont.flushed)
 		return;
 	if (cont.len == 0)
 		return;
 
-	log_store(cont.facility, cont.level, LOG_NOCONS, cont.ts_nsec,
-		  NULL, 0, cont.buf, cont.len);
+	log_store(cont.facility, cont.level, LOG_NOCONS | flags,
+		  cont.ts_nsec, NULL, 0, cont.buf, cont.len);
 
 	cont.flushed = true;
 }
@@ -1371,7 +1374,8 @@ static bool cont_add(int facility, int l
 		return false;
 
 	if (cont.len + len > sizeof(cont.buf)) {
-		cont_flush();
+		/* the line gets too long, split it up in separate records */
+		cont_flush(LOG_CONT);
 		return false;
 	}
 
@@ -1507,7 +1511,7 @@ asmlinkage int vprintk_emit(int facility
 		 * or another task also prints continuation lines.
 		 */
 		if (cont.len && (lflags & LOG_PREFIX || cont.owner != current))
-			cont_flush();
+			cont_flush(0);
 
 		/* buffer line if possible, otherwise store it right away */
 		if (!cont_add(facility, level, text, text_len))
@@ -1525,7 +1529,7 @@ asmlinkage int vprintk_emit(int facility
 		if (cont.len && cont.owner == current) {
 			if (!(lflags & LOG_PREFIX))
 				stored = cont_add(facility, level, text, text_len);
-			cont_flush();
+			cont_flush(0);
 		}
 
 		if (!stored)
@@ -1618,7 +1622,8 @@ EXPORT_SYMBOL(printk);
 
 #else
 
-#define LOG_LINE_MAX 0
+#define LOG_LINE_MAX		0
+#define PREFIX_MAX		0
 static struct cont {
 	size_t len;
 	size_t cons;
@@ -1923,7 +1928,7 @@ static enum log_flags console_prev;
  */
 void console_unlock(void)
 {
-	static char text[LOG_LINE_MAX];
+	static char text[LOG_LINE_MAX + PREFIX_MAX];
 	static u64 seen_seq;
 	unsigned long flags;
 	bool wake_klogd = false;



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

* [ 069/122] Btrfs: call the ordered free operation without any locks held
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (67 preceding siblings ...)
  2012-08-07 22:25 ` [ 068/122] kmsg - properly print over-long continuation lines Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 070/122] cifs: reinstate sec=ntlmv2 mount option Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Chris Mason

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Chris Mason <chris.mason@fusionio.com>

commit e9fbcb42201c862fd6ab45c48ead4f47bb2dea9d upstream.

Each ordered operation has a free callback, and this was called with the
worker spinlock held.  Josef made the free callback also call iput,
which we can't do with the spinlock.

This drops the spinlock for the free operation and grabs it again before
moving through the rest of the list.  We'll circle back around to this
and find a cleaner way that doesn't bounce the lock around so much.

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/btrfs/async-thread.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -206,10 +206,17 @@ static noinline void run_ordered_complet
 
 		work->ordered_func(work);
 
-		/* now take the lock again and call the freeing code */
+		/* now take the lock again and drop our item from the list */
 		spin_lock(&workers->order_lock);
 		list_del(&work->order_list);
+		spin_unlock(&workers->order_lock);
+
+		/*
+		 * we don't want to call the ordered free functions
+		 * with the lock held though
+		 */
 		work->ordered_free(work);
+		spin_lock(&workers->order_lock);
 	}
 
 	spin_unlock(&workers->order_lock);



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

* [ 070/122] cifs: reinstate sec=ntlmv2 mount option
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (68 preceding siblings ...)
  2012-08-07 22:25 ` [ 069/122] Btrfs: call the ordered free operation without any locks held Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:25 ` [ 071/122] cifs: ensure that we always do cifsFileInfo_get under the spinlock Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Sachin Prabhu,
	Günter Kukkukk, Jeff Layton, Steve French

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jeff Layton <jlayton@redhat.com>

commit 7659624ffb550d69c87f9af9ae63e717daa874bd upstream.

sec=ntlmv2 as a mount option got dropped in the mount option overhaul.

Cc: Sachin Prabhu <sprabhu@redhat.com>
Reported-by: Günter Kukkukk <linux@kukkukk.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/cifs/connect.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -238,8 +238,8 @@ static const match_table_t cifs_mount_op
 enum {
 	Opt_sec_krb5, Opt_sec_krb5i, Opt_sec_krb5p,
 	Opt_sec_ntlmsspi, Opt_sec_ntlmssp,
-	Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2i,
-	Opt_sec_nontlm, Opt_sec_lanman,
+	Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2,
+	Opt_sec_ntlmv2i, Opt_sec_lanman,
 	Opt_sec_none,
 
 	Opt_sec_err
@@ -253,8 +253,9 @@ static const match_table_t cifs_secflavo
 	{ Opt_sec_ntlmssp, "ntlmssp" },
 	{ Opt_ntlm, "ntlm" },
 	{ Opt_sec_ntlmi, "ntlmi" },
+	{ Opt_sec_ntlmv2, "nontlm" },
+	{ Opt_sec_ntlmv2, "ntlmv2" },
 	{ Opt_sec_ntlmv2i, "ntlmv2i" },
-	{ Opt_sec_nontlm, "nontlm" },
 	{ Opt_sec_lanman, "lanman" },
 	{ Opt_sec_none, "none" },
 
@@ -1167,7 +1168,7 @@ static int cifs_parse_security_flavors(c
 	case Opt_sec_ntlmi:
 		vol->secFlg |= CIFSSEC_MAY_NTLM | CIFSSEC_MUST_SIGN;
 		break;
-	case Opt_sec_nontlm:
+	case Opt_sec_ntlmv2:
 		vol->secFlg |= CIFSSEC_MAY_NTLMV2;
 		break;
 	case Opt_sec_ntlmv2i:



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

* [ 071/122] cifs: ensure that we always do cifsFileInfo_get under the spinlock
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (69 preceding siblings ...)
  2012-08-07 22:25 ` [ 070/122] cifs: reinstate sec=ntlmv2 mount option Greg Kroah-Hartman
@ 2012-08-07 22:25 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 072/122] spi/pl022: disable port when unused Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:25 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Pavel Shilovsky, Jeff Layton,
	Steve French

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jeff Layton <jlayton@redhat.com>

commit 764a1b1acecedfe204cb2e80d8e2cc7c6df1b0b8 upstream.

The readpages bug is a regression that was introduced in 6993f74a5.
This also fixes a couple of similar bugs in the uncached read and write
codepaths.

Also, prevent this sort of thing in the future by having cifsFileInfo_get
take the spinlock itself, and adding a _locked variant for use in places
that are already holding the lock. The _put code has always done that
so this makes for a less confusing interface.

Reviewed-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/cifs/cifsglob.h |    6 +++---
 fs/cifs/file.c     |   17 ++++++++++++-----
 2 files changed, 15 insertions(+), 8 deletions(-)

--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -657,13 +657,13 @@ struct cifs_io_parms {
  * Take a reference on the file private data. Must be called with
  * cifs_file_list_lock held.
  */
-static inline
-struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file)
+static inline void
+cifsFileInfo_get_locked(struct cifsFileInfo *cifs_file)
 {
 	++cifs_file->count;
-	return cifs_file;
 }
 
+struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file);
 void cifsFileInfo_put(struct cifsFileInfo *cifs_file);
 
 /*
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -284,6 +284,15 @@ cifs_new_fileinfo(__u16 fileHandle, stru
 
 static void cifs_del_lock_waiters(struct cifsLockInfo *lock);
 
+struct cifsFileInfo *
+cifsFileInfo_get(struct cifsFileInfo *cifs_file)
+{
+	spin_lock(&cifs_file_list_lock);
+	cifsFileInfo_get_locked(cifs_file);
+	spin_unlock(&cifs_file_list_lock);
+	return cifs_file;
+}
+
 /*
  * Release a reference on the file private data. This may involve closing
  * the filehandle out on the server. Must be called without holding
@@ -1563,7 +1572,7 @@ struct cifsFileInfo *find_readable_file(
 			if (!open_file->invalidHandle) {
 				/* found a good file */
 				/* lock it so it will not be closed on us */
-				cifsFileInfo_get(open_file);
+				cifsFileInfo_get_locked(open_file);
 				spin_unlock(&cifs_file_list_lock);
 				return open_file;
 			} /* else might as well continue, and look for
@@ -1615,7 +1624,7 @@ refind_writable:
 		if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
 			if (!open_file->invalidHandle) {
 				/* found a good writable file */
-				cifsFileInfo_get(open_file);
+				cifsFileInfo_get_locked(open_file);
 				spin_unlock(&cifs_file_list_lock);
 				return open_file;
 			} else {
@@ -1632,7 +1641,7 @@ refind_writable:
 
 	if (inv_file) {
 		any_available = false;
-		cifsFileInfo_get(inv_file);
+		cifsFileInfo_get_locked(inv_file);
 	}
 
 	spin_unlock(&cifs_file_list_lock);
@@ -3082,8 +3091,6 @@ static int cifs_readpages(struct file *f
 			break;
 		}
 
-		spin_lock(&cifs_file_list_lock);
-		spin_unlock(&cifs_file_list_lock);
 		rdata->cfile = cifsFileInfo_get(open_file);
 		rdata->mapping = mapping;
 		rdata->offset = offset;



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

* [ 072/122] spi/pl022: disable port when unused
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (70 preceding siblings ...)
  2012-08-07 22:25 ` [ 071/122] cifs: ensure that we always do cifsFileInfo_get under the spinlock Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 073/122] qeth: repair crash in qeth_l3_vlan_rx_kill_vid() Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Vinit Shenoy,
	Virupax Sadashivpetimath, Linus Walleij

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>

commit fd316941cfee1fbd12746afea83720fb7823888a upstream.

Commit ffbbdd21329f3e15eeca6df2d4bc11c04d9d91c0
"spi: create a message queueing infrastructure"
Accidentally deleted the logic to disable the port
when unused leading to higher power consumption.
Fix this up.

Cc: Vinit Shenoy <vinit.shenoy@st.com>
Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/spi/spi-pl022.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -489,6 +489,11 @@ static void giveback(struct pl022 *pl022
 	pl022->cur_transfer = NULL;
 	pl022->cur_chip = NULL;
 	spi_finalize_current_message(pl022->master);
+
+	/* disable the SPI/SSP operation */
+	writew((readw(SSP_CR1(pl022->virtbase)) &
+		(~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));
+
 }
 
 /**



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

* [ 073/122] qeth: repair crash in qeth_l3_vlan_rx_kill_vid()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (71 preceding siblings ...)
  2012-08-07 22:26 ` [ 072/122] spi/pl022: disable port when unused Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 074/122] tg3: add device id of Apple Thunderbolt Ethernet device Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Ursula Braun, Frank Blaschka,
	David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Frank Blaschka <frank.blaschka@de.ibm.com>

commit eabfbe6230ee7363681e7a561948d362b87169f0 upstream.

Commit efc73f4b "net: Fix memory leak - vlan_info struct" adds deletion of
VLAN 0 for devices with feature NETIF_F_HW_VLAN_FILTER. For driver
qeth these are the layer 3 devices. Usually there exists no
separate vlan net_device for VLAN 0. Thus the qeth functions
qeth_l3_free_vlan_addresses4() and qeth_l3_free_vlan_addresses6()
require an extra checking if function __vlan_find_dev_deep()
returns with a net_device.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/s390/net/qeth_l3_main.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1760,6 +1760,8 @@ static void qeth_l3_free_vlan_addresses4
 	QETH_CARD_TEXT(card, 4, "frvaddr4");
 
 	netdev = __vlan_find_dev_deep(card->dev, vid);
+	if (!netdev)
+		return;
 	in_dev = in_dev_get(netdev);
 	if (!in_dev)
 		return;
@@ -1788,6 +1790,8 @@ static void qeth_l3_free_vlan_addresses6
 	QETH_CARD_TEXT(card, 4, "frvaddr6");
 
 	netdev = __vlan_find_dev_deep(card->dev, vid);
+	if (!netdev)
+		return;
 	in6_dev = in6_dev_get(netdev);
 	if (!in6_dev)
 		return;



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

* [ 074/122] tg3: add device id of Apple Thunderbolt Ethernet device
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (72 preceding siblings ...)
  2012-08-07 22:26 ` [ 073/122] qeth: repair crash in qeth_l3_vlan_rx_kill_vid() Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 075/122] tg3: Fix Read DMA workaround for 5719 A0 Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Michael Chan, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Greg KH <gregkh@linuxfoundation.org>

commit 02eca3f5f5e458c3a5d7b772bc8042ee2a4ebedf upstream.

The Apple Thunderbolt ethernet device is already listed in the driver,
but not hooked up in the MODULE_DEVICE_TABLE().  This fixes that and
allows it to work properly.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

---
 drivers/net/ethernet/broadcom/tg3.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -298,6 +298,7 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_t
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57795)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)},
+	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)},
 	{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
 	{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
 	{PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},



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

* [ 075/122] tg3: Fix Read DMA workaround for 5719 A0.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (73 preceding siblings ...)
  2012-08-07 22:26 ` [ 074/122] tg3: add device id of Apple Thunderbolt Ethernet device Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 076/122] tg3: Fix race condition in tg3_get_stats64() Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Michael Chan, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Michael Chan <mchan@broadcom.com>

commit 10ce95d6ef36c65df7dcd3b8fcf86913f8b298bd upstream.

The workaround was mis-applied to all 5719 and 5720 chips.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/broadcom/tg3.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -8975,8 +8975,7 @@ static int tg3_reset_hw(struct tg3 *tp,
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
 	    tg3_flag(tp, 57765_PLUS)) {
 		val = tr32(TG3_RDMA_RSRVCTRL_REG);
-		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
-		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
+		if (tp->pci_chip_rev_id == CHIPREV_ID_5719_A0) {
 			val &= ~(TG3_RDMA_RSRVCTRL_TXMRGN_MASK |
 				 TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK |
 				 TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK);



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

* [ 076/122] tg3: Fix race condition in tg3_get_stats64()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (74 preceding siblings ...)
  2012-08-07 22:26 ` [ 075/122] tg3: Fix Read DMA workaround for 5719 A0 Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 077/122] drm/radeon: fix fence related segfault in CS Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Michael Chan, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Michael Chan <mchan@broadcom.com>

commit 0f566b208b41918053b2e67399673aaec02dde5d upstream.

Spinlock should be taken before checking for tp->hw_stats.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/broadcom/tg3.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12282,10 +12282,12 @@ static struct rtnl_link_stats64 *tg3_get
 {
 	struct tg3 *tp = netdev_priv(dev);
 
-	if (!tp->hw_stats)
+	spin_lock_bh(&tp->lock);
+	if (!tp->hw_stats) {
+		spin_unlock_bh(&tp->lock);
 		return &tp->net_stats_prev;
+	}
 
-	spin_lock_bh(&tp->lock);
 	tg3_get_nstats(tp, stats);
 	spin_unlock_bh(&tp->lock);
 



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

* [ 077/122] drm/radeon: fix fence related segfault in CS
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (75 preceding siblings ...)
  2012-08-07 22:26 ` [ 076/122] tg3: Fix race condition in tg3_get_stats64() Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 078/122] drm/radeon: fix bo creation retry path Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Christian König,
	Jerome Glisse, Michel Dänzer, Alex Deucher

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Christian König <deathsimple@vodafone.de>

commit 93bf888c5c730605e3470f5d2381f296eda88d79 upstream.

Don't return success if scheduling the IB fails, otherwise
we end up with an oops in ttm_eu_fence_buffer_objects.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -377,7 +377,7 @@ static int radeon_cs_ib_chunk(struct rad
 	if (r) {
 		DRM_ERROR("Failed to schedule IB !\n");
 	}
-	return 0;
+	return r;
 }
 
 static int radeon_bo_vm_update_pte(struct radeon_cs_parser *parser,



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

* [ 078/122] drm/radeon: fix bo creation retry path
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (76 preceding siblings ...)
  2012-08-07 22:26 ` [ 077/122] drm/radeon: fix fence related segfault in CS Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 079/122] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jerome Glisse, Michel Dänzer,
	Christian König, Dave Airlie

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jerome Glisse <jglisse@redhat.com>

commit d1c7871ddb1f588b8eb35affd9ee1a3d5e11cd0c upstream.

Retry label was at wrong place in function leading to memory
leak.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_devic
 	acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size,
 				       sizeof(struct radeon_bo));
 
-retry:
 	bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
 	if (bo == NULL)
 		return -ENOMEM;
@@ -152,6 +151,8 @@ retry:
 	bo->surface_reg = -1;
 	INIT_LIST_HEAD(&bo->list);
 	INIT_LIST_HEAD(&bo->va);
+
+retry:
 	radeon_ttm_placement_from_domain(bo, domain);
 	/* Kernel allocation are uninterruptible */
 	mutex_lock(&rdev->vram_mutex);



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

* [ 079/122] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (77 preceding siblings ...)
  2012-08-07 22:26 ` [ 078/122] drm/radeon: fix bo creation retry path Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 080/122] drm/radeon: fix non revealent error message Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Michel Dänzer, Alex Deucher,
	Dave Airlie

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Michel Dänzer <michel.daenzer@amd.com>

commit f60ec4c7df043df81e62891ac45383d012afe0da upstream.

This could previously fail if either of the enabled displays was using a
horizontal resolution that is a multiple of 128, and only the leftmost column
of the cursor was (supposed to be) visible at the right edge of that display.

The solution is to move the cursor one pixel to the left in that case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183

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

---
 drivers/gpu/drm/radeon/radeon_cursor.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -262,8 +262,14 @@ int radeon_crtc_cursor_move(struct drm_c
 				if (!(cursor_end & 0x7f))
 					w--;
 			}
-			if (w <= 0)
+			if (w <= 0) {
 				w = 1;
+				cursor_end = x - xorigin + w;
+				if (!(cursor_end & 0x7f)) {
+					x--;
+					WARN_ON_ONCE(x < 0);
+				}
+			}
 		}
 	}
 



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

* [ 080/122] drm/radeon: fix non revealent error message
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (78 preceding siblings ...)
  2012-08-07 22:26 ` [ 079/122] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 081/122] drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2) Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jerome Glisse, Dave Airlie

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jerome Glisse <jglisse@redhat.com>

commit 8d1c702aa0b2c4b22b0742b72a1149d91690674b upstream.

We want to print link status query failed only if it's
an unexepected fail. If we query to see if we need
link training it might be because there is nothing
connected and thus link status query have the right
to fail in that case.

To avoid printing failure when it's expected, move the
failure message to proper place.

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

---
 drivers/gpu/drm/radeon/atombios_dp.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -22,6 +22,7 @@
  *
  * Authors: Dave Airlie
  *          Alex Deucher
+ *          Jerome Glisse
  */
 #include "drmP.h"
 #include "radeon_drm.h"
@@ -654,7 +655,6 @@ static bool radeon_dp_get_link_status(st
 	ret = radeon_dp_aux_native_read(radeon_connector, DP_LANE0_1_STATUS,
 					link_status, DP_LINK_STATUS_SIZE, 100);
 	if (ret <= 0) {
-		DRM_ERROR("displayport link status failed\n");
 		return false;
 	}
 
@@ -833,8 +833,10 @@ static int radeon_dp_link_train_cr(struc
 		else
 			mdelay(dp_info->rd_interval * 4);
 
-		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status))
+		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status)) {
+			DRM_ERROR("displayport link status failed\n");
 			break;
+		}
 
 		if (dp_clock_recovery_ok(dp_info->link_status, dp_info->dp_lane_count)) {
 			clock_recovery = true;
@@ -896,8 +898,10 @@ static int radeon_dp_link_train_ce(struc
 		else
 			mdelay(dp_info->rd_interval * 4);
 
-		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status))
+		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status)) {
+			DRM_ERROR("displayport link status failed\n");
 			break;
+		}
 
 		if (dp_channel_eq_ok(dp_info->link_status, dp_info->dp_lane_count)) {
 			channel_eq = true;



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

* [ 081/122] drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2)
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (79 preceding siblings ...)
  2012-08-07 22:26 ` [ 080/122] drm/radeon: fix non revealent error message Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 082/122] drm/radeon: on hotplug force link training to happen (v2) Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jerome Glisse, Alex Deucher, Dave Airlie

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jerome Glisse <jglisse@redhat.com>

commit 266dcba541a1ef7e5d82d9e67c67fde2910636e8 upstream.

No need to retrain the link for passive adapters.

v2: agd5f
- no passive DP to VGA adapters, update comments
- assign radeon_connector_atom_dig after we are sure
  we have a digital connector as analog connectors
  have different private data.
- get new sink type before checking for retrain.  No
  need to check if it's no longer a DP connection.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/radeon_connectors.c |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -64,14 +64,27 @@ void radeon_connector_hotplug(struct drm
 
 	/* just deal with DP (not eDP) here. */
 	if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
-		int saved_dpms = connector->dpms;
+		struct radeon_connector_atom_dig *dig_connector =
+			radeon_connector->con_priv;
 
-		/* Only turn off the display it it's physically disconnected */
-		if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
-			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-		else if (radeon_dp_needs_link_train(radeon_connector))
-			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
-		connector->dpms = saved_dpms;
+		/* if existing sink type was not DP no need to retrain */
+		if (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT)
+			return;
+
+		/* first get sink type as it may be reset after (un)plug */
+		dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
+		/* don't do anything if sink is not display port, i.e.,
+		 * passive dp->(dvi|hdmi) adaptor
+		 */
+		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
+			int saved_dpms = connector->dpms;
+			/* Only turn off the display if it's physically disconnected */
+			if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
+				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
+			else if (radeon_dp_needs_link_train(radeon_connector))
+				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+			connector->dpms = saved_dpms;
+		}
 	}
 }
 



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

* [ 082/122] drm/radeon: on hotplug force link training to happen (v2)
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (80 preceding siblings ...)
  2012-08-07 22:26 ` [ 081/122] drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2) Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 083/122] drm/radeon: fix dpms on/off on trinity/aruba v2 Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jerome Glisse, Alex Deucher, Dave Airlie

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jerome Glisse <jglisse@redhat.com>

commit ca2ccde5e2f24a792caa4cca919fc5c6f65d1887 upstream.

To have DP behave like VGA/DVI we need to retrain the link
on hotplug. For this to happen we need to force link
training to happen by setting connector dpms to off
before asking it turning it on again.

v2: agd5f
- drop the dp_get_link_status() change in atombios_dp.c
  for now.  We still need the dpms OFF change.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/radeon_connectors.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -79,10 +79,16 @@ void radeon_connector_hotplug(struct drm
 		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
 			int saved_dpms = connector->dpms;
 			/* Only turn off the display if it's physically disconnected */
-			if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
+			if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
 				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-			else if (radeon_dp_needs_link_train(radeon_connector))
+			} else if (radeon_dp_needs_link_train(radeon_connector)) {
+				/* set it to OFF so that drm_helper_connector_dpms()
+				 * won't return immediately since the current state
+				 * is ON at this point.
+				 */
+				connector->dpms = DRM_MODE_DPMS_OFF;
 				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+			}
 			connector->dpms = saved_dpms;
 		}
 	}



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

* [ 083/122] drm/radeon: fix dpms on/off on trinity/aruba v2
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (81 preceding siblings ...)
  2012-08-07 22:26 ` [ 082/122] drm/radeon: on hotplug force link training to happen (v2) Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 084/122] drm/nouveau: init vblank requests list Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jerome Glisse, Alex Deucher, Dave Airlie

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jerome Glisse <jglisse@redhat.com>

commit fcedac670c3da0d17aaa5db1708694971e8024a9 upstream.

The external encoder need to be setup again before enabling the
transmiter. This seems to be only needed on some trinity/aruba
to fix dpms on.

v2: Add comment, only setup again on dce6 ie aruba or newer.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/radeon/atombios_encoders.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1392,10 +1392,18 @@ radeon_atom_encoder_dpms_dig(struct drm_
 	case DRM_MODE_DPMS_ON:
 		/* some early dce3.2 boards have a bug in their transmitter control table */
 		if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730) ||
-		    ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev))
+		    ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
+			if (ASIC_IS_DCE6(rdev)) {
+				/* It seems we need to call ATOM_ENCODER_CMD_SETUP again
+				 * before reenabling encoder on DPMS ON, otherwise we never
+				 * get picture
+				 */
+				atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
+			}
 			atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
-		else
+		} else {
 			atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
+		}
 		if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
 			if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
 				atombios_set_edp_panel_power(connector,



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

* [ 084/122] drm/nouveau: init vblank requests list
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (82 preceding siblings ...)
  2012-08-07 22:26 ` [ 083/122] drm/radeon: fix dpms on/off on trinity/aruba v2 Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 085/122] posix_types.h: Cleanup stale __NFDBITS and related definitions Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Ortwin Glück, Marcin Slusarz,
	Ben Skeggs

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Marcin Slusarz <marcin.slusarz@gmail.com>

commit 715855457e6bc93e148caf8cb3b5dcabbf605b0d upstream.

Fixes kernel panic when vblank interrupt triggers before first sync to
vblank request.

(Besides init, remove some relevant leftovers from vblank rework)

Reported-by: Ortwin Glück <odi@odi.ch>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/nouveau/nouveau_drv.h      |    2 --
 drivers/gpu/drm/nouveau/nouveau_irq.c      |    4 ----
 drivers/gpu/drm/nouveau/nouveau_software.h |    1 +
 3 files changed, 1 insertion(+), 6 deletions(-)

--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -689,8 +689,6 @@ struct drm_nouveau_private {
 	void (*irq_handler[32])(struct drm_device *);
 	bool msi_enabled;
 
-	struct list_head vbl_waiting;
-
 	struct {
 		struct drm_global_reference mem_global_ref;
 		struct ttm_bo_global_ref bo_global_ref;
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -41,12 +41,8 @@
 void
 nouveau_irq_preinstall(struct drm_device *dev)
 {
-	struct drm_nouveau_private *dev_priv = dev->dev_private;
-
 	/* Master disable */
 	nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
-
-	INIT_LIST_HEAD(&dev_priv->vbl_waiting);
 }
 
 int
--- a/drivers/gpu/drm/nouveau/nouveau_software.h
+++ b/drivers/gpu/drm/nouveau/nouveau_software.h
@@ -38,6 +38,7 @@ static inline void
 nouveau_software_context_new(struct nouveau_software_chan *pch)
 {
 	INIT_LIST_HEAD(&pch->flip);
+	INIT_LIST_HEAD(&pch->vblank.list);
 }
 
 static inline void



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

* [ 085/122] posix_types.h: Cleanup stale __NFDBITS and related definitions
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (83 preceding siblings ...)
  2012-08-07 22:26 ` [ 084/122] drm/nouveau: init vblank requests list Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 086/122] dm thin: reduce endio_hook pool size Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Jeff Law, Josh Boyer

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Josh Boyer <jwboyer@redhat.com>

commit 8ded2bbc1845e19c771eb55209aab166ef011243 upstream.

Recently, glibc made a change to suppress sign-conversion warnings in
FD_SET (glibc commit ceb9e56b3d1).  This uncovered an issue with the
kernel's definition of __NFDBITS if applications #include
<linux/types.h> after including <sys/select.h>.  A build failure would
be seen when passing the -Werror=sign-compare and -D_FORTIFY_SOURCE=2
flags to gcc.

It was suggested that the kernel should either match the glibc
definition of __NFDBITS or remove that entirely.  The current in-kernel
uses of __NFDBITS can be replaced with BITS_PER_LONG, and there are no
uses of the related __FDELT and __FDMASK defines.  Given that, we'll
continue the cleanup that was started with commit 8b3d1cda4f5f
("posix_types: Remove fd_set macros") and drop the remaining unused
macros.

Additionally, linux/time.h has similar macros defined that expand to
nothing so we'll remove those at the same time.

Reported-by: Jeff Law <law@redhat.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
[ .. and fix up whitespace as per akpm ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/kspd.c     |    2 +-
 fs/exec.c                   |    2 +-
 fs/select.c                 |   10 +++++-----
 include/linux/posix_types.h |   18 +++---------------
 include/linux/time.h        |    8 --------
 kernel/exit.c               |    2 +-
 security/selinux/hooks.c    |    2 +-
 7 files changed, 12 insertions(+), 32 deletions(-)

--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -323,7 +323,7 @@ static void sp_cleanup(void)
 	fdt = files_fdtable(files);
 	for (;;) {
 		unsigned long set;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		if (i >= fdt->max_fds)
 			break;
 		set = fdt->open_fds[j++];
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1020,7 +1020,7 @@ static void flush_old_files(struct files
 		unsigned long set, i;
 
 		j++;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		fdt = files_fdtable(files);
 		if (i >= fdt->max_fds)
 			break;
--- a/fs/select.c
+++ b/fs/select.c
@@ -345,8 +345,8 @@ static int max_select_fd(unsigned long n
 	struct fdtable *fdt;
 
 	/* handle last in-complete long-word first */
-	set = ~(~0UL << (n & (__NFDBITS-1)));
-	n /= __NFDBITS;
+	set = ~(~0UL << (n & (BITS_PER_LONG-1)));
+	n /= BITS_PER_LONG;
 	fdt = files_fdtable(current->files);
 	open_fds = fdt->open_fds + n;
 	max = 0;
@@ -373,7 +373,7 @@ get_max:
 			max++;
 			set >>= 1;
 		} while (set);
-		max += n * __NFDBITS;
+		max += n * BITS_PER_LONG;
 	}
 
 	return max;
@@ -435,11 +435,11 @@ int do_select(int n, fd_set_bits *fds, s
 			in = *inp++; out = *outp++; ex = *exp++;
 			all_bits = in | out | ex;
 			if (all_bits == 0) {
-				i += __NFDBITS;
+				i += BITS_PER_LONG;
 				continue;
 			}
 
-			for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
+			for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) {
 				int fput_needed;
 				if (i >= n)
 					break;
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -15,26 +15,14 @@
  */
 
 /*
- * Those macros may have been defined in <gnu/types.h>. But we always
- * use the ones here. 
+ * This macro may have been defined in <gnu/types.h>. But we always
+ * use the one here.
  */
-#undef __NFDBITS
-#define __NFDBITS	(8 * sizeof(unsigned long))
-
 #undef __FD_SETSIZE
 #define __FD_SETSIZE	1024
 
-#undef __FDSET_LONGS
-#define __FDSET_LONGS	(__FD_SETSIZE/__NFDBITS)
-
-#undef __FDELT
-#define	__FDELT(d)	((d) / __NFDBITS)
-
-#undef __FDMASK
-#define	__FDMASK(d)	(1UL << ((d) % __NFDBITS))
-
 typedef struct {
-	unsigned long fds_bits [__FDSET_LONGS];
+	unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))];
 } __kernel_fd_set;
 
 /* Type of a signal handler.  */
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -257,14 +257,6 @@ static __always_inline void timespec_add
 
 #endif /* __KERNEL__ */
 
-#define NFDBITS			__NFDBITS
-
-#define FD_SETSIZE		__FD_SETSIZE
-#define FD_SET(fd,fdsetp)	__FD_SET(fd,fdsetp)
-#define FD_CLR(fd,fdsetp)	__FD_CLR(fd,fdsetp)
-#define FD_ISSET(fd,fdsetp)	__FD_ISSET(fd,fdsetp)
-#define FD_ZERO(fdsetp)		__FD_ZERO(fdsetp)
-
 /*
  * Names of the interval timers, and structure
  * defining a timer setting:
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -483,7 +483,7 @@ static void close_files(struct files_str
 	rcu_read_unlock();
 	for (;;) {
 		unsigned long set;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		if (i >= fdt->max_fds)
 			break;
 		set = fdt->open_fds[j++];
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2129,7 +2129,7 @@ static inline void flush_unauthorized_fi
 		int fd;
 
 		j++;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		fdt = files_fdtable(files);
 		if (i >= fdt->max_fds)
 			break;



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

* [ 086/122] dm thin: reduce endio_hook pool size
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (84 preceding siblings ...)
  2012-08-07 22:26 ` [ 085/122] posix_types.h: Cleanup stale __NFDBITS and related definitions Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 087/122] dm thin: fix memory leak in process_prepared_mapping error paths Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Alasdair G Kergon

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Alasdair G Kergon <agk@redhat.com>

commit 7768ed33ccdc02801c4483fc5682dc66ace14aea upstream.

Reduce the slab size used for the dm_thin_endio_hook mempool.

Allocation has been seen to fail on machines with smaller amounts
of memory due to fragmentation.

  lvm: page allocation failure. order:5, mode:0xd0
  device-mapper: table: 253:38: thin-pool: Error creating pool's endio_hook mempool

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-thin.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -19,7 +19,7 @@
 /*
  * Tunable constants
  */
-#define ENDIO_HOOK_POOL_SIZE 10240
+#define ENDIO_HOOK_POOL_SIZE 1024
 #define DEFERRED_SET_SIZE 64
 #define MAPPING_POOL_SIZE 1024
 #define PRISON_CELLS 1024



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

* [ 087/122] dm thin: fix memory leak in process_prepared_mapping error paths
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (85 preceding siblings ...)
  2012-08-07 22:26 ` [ 086/122] dm thin: reduce endio_hook pool size Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 088/122] nfsd4: our filesystems are normally case sensitive Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Joe Thornber, Mike Snitzer,
	Alasdair G Kergon

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Joe Thornber <ejt@redhat.com>

commit 905386f82d08f66726912f303f3e6605248c60a3 upstream.

Fix memory leak in process_prepared_mapping by always freeing
the dm_thin_new_mapping structs from the mapping_pool mempool on
the error paths.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-thin.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -859,7 +859,7 @@ static void process_prepared_mapping(str
 
 	if (m->err) {
 		cell_error(m->cell);
-		return;
+		goto out;
 	}
 
 	/*
@@ -871,7 +871,7 @@ static void process_prepared_mapping(str
 	if (r) {
 		DMERR("dm_thin_insert_block() failed");
 		cell_error(m->cell);
-		return;
+		goto out;
 	}
 
 	/*
@@ -886,6 +886,7 @@ static void process_prepared_mapping(str
 	} else
 		cell_defer(tc, m->cell, m->data_block);
 
+out:
 	list_del(&m->list);
 	mempool_free(m, tc->pool->mapping_pool);
 }



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

* [ 088/122] nfsd4: our filesystems are normally case sensitive
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (86 preceding siblings ...)
  2012-08-07 22:26 ` [ 087/122] dm thin: fix memory leak in process_prepared_mapping error paths Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 089/122] nfsd4: fix cr_principal comparison check in same_creds Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, J. Bruce Fields

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: "J. Bruce Fields" <bfields@redhat.com>

commit 2930d381d22b9c56f40dd4c63a8fa59719ca2c3c upstream.

Actually, xfs and jfs can optionally be case insensitive; we'll handle
that case in later patches.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2259,7 +2259,7 @@ out_acl:
 	if (bmval0 & FATTR4_WORD0_CASE_INSENSITIVE) {
 		if ((buflen -= 4) < 0)
 			goto out_resource;
-		WRITE32(1);
+		WRITE32(0);
 	}
 	if (bmval0 & FATTR4_WORD0_CASE_PRESERVING) {
 		if ((buflen -= 4) < 0)



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

* [ 089/122] nfsd4: fix cr_principal comparison check in same_creds
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (87 preceding siblings ...)
  2012-08-07 22:26 ` [ 088/122] nfsd4: our filesystems are normally case sensitive Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 090/122] nfs: skip commit in releasepage if were freeing memory for fs-related reasons Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Vivek Trivedi, Namjae Jeon,
	J. Bruce Fields

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Vivek Trivedi <vtrivedi018@gmail.com>

commit 5559b50acdcdcad7e362882d3261bf934c9436f6 upstream.

This fixes a wrong check for same cr_principal in same_creds

Introduced by 8fbba96e5b327665265ad02b7f331b68536828bf "nfsd4: stricter
cred comparison for setclientid/exchange_id".

Signed-off-by: Vivek Trivedi <vtrivedi018@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfsd/nfs4state.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1215,7 +1215,7 @@ static bool groups_equal(struct group_in
 	return true;
 }
 
-static int
+static bool
 same_creds(struct svc_cred *cr1, struct svc_cred *cr2)
 {
 	if ((cr1->cr_flavor != cr2->cr_flavor)
@@ -1227,7 +1227,7 @@ same_creds(struct svc_cred *cr1, struct
 		return true;
 	if (!cr1->cr_principal || !cr2->cr_principal)
 		return false;
-	return 0 == strcmp(cr1->cr_principal, cr1->cr_principal);
+	return 0 == strcmp(cr1->cr_principal, cr2->cr_principal);
 }
 
 static void gen_clid(struct nfs4_client *clp)



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

* [ 090/122] nfs: skip commit in releasepage if were freeing memory for fs-related reasons
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (88 preceding siblings ...)
  2012-08-07 22:26 ` [ 089/122] nfsd4: fix cr_principal comparison check in same_creds Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 091/122] NFS: Fix a number of bugs in the idmapper Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jeff Layton, Trond Myklebust

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Jeff Layton <jlayton@redhat.com>

commit 5cf02d09b50b1ee1c2d536c9cf64af5a7d433f56 upstream.

We've had some reports of a deadlock where rpciod ends up with a stack
trace like this:

    PID: 2507   TASK: ffff88103691ab40  CPU: 14  COMMAND: "rpciod/14"
     #0 [ffff8810343bf2f0] schedule at ffffffff814dabd9
     #1 [ffff8810343bf3b8] nfs_wait_bit_killable at ffffffffa038fc04 [nfs]
     #2 [ffff8810343bf3c8] __wait_on_bit at ffffffff814dbc2f
     #3 [ffff8810343bf418] out_of_line_wait_on_bit at ffffffff814dbcd8
     #4 [ffff8810343bf488] nfs_commit_inode at ffffffffa039e0c1 [nfs]
     #5 [ffff8810343bf4f8] nfs_release_page at ffffffffa038bef6 [nfs]
     #6 [ffff8810343bf528] try_to_release_page at ffffffff8110c670
     #7 [ffff8810343bf538] shrink_page_list.clone.0 at ffffffff81126271
     #8 [ffff8810343bf668] shrink_inactive_list at ffffffff81126638
     #9 [ffff8810343bf818] shrink_zone at ffffffff8112788f
    #10 [ffff8810343bf8c8] do_try_to_free_pages at ffffffff81127b1e
    #11 [ffff8810343bf958] try_to_free_pages at ffffffff8112812f
    #12 [ffff8810343bfa08] __alloc_pages_nodemask at ffffffff8111fdad
    #13 [ffff8810343bfb28] kmem_getpages at ffffffff81159942
    #14 [ffff8810343bfb58] fallback_alloc at ffffffff8115a55a
    #15 [ffff8810343bfbd8] ____cache_alloc_node at ffffffff8115a2d9
    #16 [ffff8810343bfc38] kmem_cache_alloc at ffffffff8115b09b
    #17 [ffff8810343bfc78] sk_prot_alloc at ffffffff81411808
    #18 [ffff8810343bfcb8] sk_alloc at ffffffff8141197c
    #19 [ffff8810343bfce8] inet_create at ffffffff81483ba6
    #20 [ffff8810343bfd38] __sock_create at ffffffff8140b4a7
    #21 [ffff8810343bfd98] xs_create_sock at ffffffffa01f649b [sunrpc]
    #22 [ffff8810343bfdd8] xs_tcp_setup_socket at ffffffffa01f6965 [sunrpc]
    #23 [ffff8810343bfe38] worker_thread at ffffffff810887d0
    #24 [ffff8810343bfee8] kthread at ffffffff8108dd96
    #25 [ffff8810343bff48] kernel_thread at ffffffff8100c1ca

rpciod is trying to allocate memory for a new socket to talk to the
server. The VM ends up calling ->releasepage to get more memory, and it
tries to do a blocking commit. That commit can't succeed however without
a connected socket, so we deadlock.

Fix this by setting PF_FSTRANS on the workqueue task prior to doing the
socket allocation, and having nfs_release_page check for that flag when
deciding whether to do a commit call. Also, set PF_FSTRANS
unconditionally in rpc_async_schedule since that function can also do
allocations sometimes.

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

---
 fs/nfs/file.c                   |    7 +++++--
 net/sunrpc/sched.c              |    2 ++
 net/sunrpc/xprtrdma/transport.c |    3 ++-
 net/sunrpc/xprtsock.c           |   10 ++++++++++
 4 files changed, 19 insertions(+), 3 deletions(-)

--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -459,8 +459,11 @@ static int nfs_release_page(struct page
 
 	dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
 
-	/* Only do I/O if gfp is a superset of GFP_KERNEL */
-	if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL) {
+	/* Only do I/O if gfp is a superset of GFP_KERNEL, and we're not
+	 * doing this memory reclaim for a fs-related allocation.
+	 */
+	if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL &&
+	    !(current->flags & PF_FSTRANS)) {
 		int how = FLUSH_SYNC;
 
 		/* Don't let kswapd deadlock waiting for OOM RPC calls */
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -790,7 +790,9 @@ void rpc_execute(struct rpc_task *task)
 
 static void rpc_async_schedule(struct work_struct *work)
 {
+	current->flags |= PF_FSTRANS;
 	__rpc_execute(container_of(work, struct rpc_task, u.tk_work));
+	current->flags &= ~PF_FSTRANS;
 }
 
 /**
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -200,6 +200,7 @@ xprt_rdma_connect_worker(struct work_str
 	int rc = 0;
 
 	if (!xprt->shutdown) {
+		current->flags |= PF_FSTRANS;
 		xprt_clear_connected(xprt);
 
 		dprintk("RPC:       %s: %sconnect\n", __func__,
@@ -212,10 +213,10 @@ xprt_rdma_connect_worker(struct work_str
 
 out:
 	xprt_wake_pending_tasks(xprt, rc);
-
 out_clear:
 	dprintk("RPC:       %s: exit\n", __func__);
 	xprt_clear_connecting(xprt);
+	current->flags &= ~PF_FSTRANS;
 }
 
 /*
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1895,6 +1895,8 @@ static void xs_local_setup_socket(struct
 	if (xprt->shutdown)
 		goto out;
 
+	current->flags |= PF_FSTRANS;
+
 	clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
 	status = __sock_create(xprt->xprt_net, AF_LOCAL,
 					SOCK_STREAM, 0, &sock, 1);
@@ -1928,6 +1930,7 @@ static void xs_local_setup_socket(struct
 out:
 	xprt_clear_connecting(xprt);
 	xprt_wake_pending_tasks(xprt, status);
+	current->flags &= ~PF_FSTRANS;
 }
 
 static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
@@ -1970,6 +1973,8 @@ static void xs_udp_setup_socket(struct w
 	if (xprt->shutdown)
 		goto out;
 
+	current->flags |= PF_FSTRANS;
+
 	/* Start by resetting any existing state */
 	xs_reset_transport(transport);
 	sock = xs_create_sock(xprt, transport,
@@ -1988,6 +1993,7 @@ static void xs_udp_setup_socket(struct w
 out:
 	xprt_clear_connecting(xprt);
 	xprt_wake_pending_tasks(xprt, status);
+	current->flags &= ~PF_FSTRANS;
 }
 
 /*
@@ -2113,6 +2119,8 @@ static void xs_tcp_setup_socket(struct w
 	if (xprt->shutdown)
 		goto out;
 
+	current->flags |= PF_FSTRANS;
+
 	if (!sock) {
 		clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
 		sock = xs_create_sock(xprt, transport,
@@ -2162,6 +2170,7 @@ static void xs_tcp_setup_socket(struct w
 	case -EINPROGRESS:
 	case -EALREADY:
 		xprt_clear_connecting(xprt);
+		current->flags &= ~PF_FSTRANS;
 		return;
 	case -EINVAL:
 		/* Happens, for instance, if the user specified a link
@@ -2174,6 +2183,7 @@ out_eagain:
 out:
 	xprt_clear_connecting(xprt);
 	xprt_wake_pending_tasks(xprt, status);
+	current->flags &= ~PF_FSTRANS;
 }
 
 /**



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

* [ 091/122] NFS: Fix a number of bugs in the idmapper
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (89 preceding siblings ...)
  2012-08-07 22:26 ` [ 090/122] nfs: skip commit in releasepage if were freeing memory for fs-related reasons Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 092/122] nouveau: Fix alignment requirements on src and dst addresses Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, David Howells, Steve Dickson,
	Trond Myklebust

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: David Howells <dhowells@redhat.com>

commit a427b9ec4eda8cd6e641ea24541d30b641fc3140 upstream.

Fix a number of bugs in the NFS idmapper code:

 (1) Only registered key types can be passed to the core keys code, so
     register the legacy idmapper key type.

     This is a requirement because the unregister function cleans up keys
     belonging to that key type so that there aren't dangling pointers to the
     module left behind - including the key->type pointer.

 (2) Rename the legacy key type.  You can't have two key types with the same
     name, and (1) would otherwise require that.

 (3) complete_request_key() must be called in the error path of
     nfs_idmap_legacy_upcall().

 (4) There is one idmap struct for each nfs_client struct.  This means that
     idmap->idmap_key_cons is shared without the use of a lock.  This is a
     problem because key_instantiate_and_link() - as called indirectly by
     idmap_pipe_downcall() - releases anyone waiting for the key to be
     instantiated.

     What happens is that idmap_pipe_downcall() running in the rpc.idmapd
     thread, releases the NFS filesystem in whatever thread that is running in
     to continue.  This may then make another idmapper call, overwriting
     idmap_key_cons before idmap_pipe_downcall() gets the chance to call
     complete_request_key().

     I *think* that reading idmap_key_cons only once, before
     key_instantiate_and_link() is called, and then caching the result in a
     variable is sufficient.

Bug (4) is the cause of:

BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<          (null)>]           (null)
PGD 0
Oops: 0010 [#1] SMP
CPU 1
Modules linked in: ppdev parport_pc lp parport ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack nfs fscache xt_CHECKSUM auth_rpcgss iptable_mangle nfs_acl bridge stp llc lockd be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi snd_hda_codec_realtek snd_usb_audio snd_hda_intel snd_hda_codec snd_seq snd_pcm snd_hwdep snd_usbmidi_lib snd_rawmidi snd_timer uvcvideo videobuf2_core videodev media videobuf2_vmalloc snd_seq_device videobuf2_memops e1000e vhost_net iTCO_wdt joydev coretemp snd soundcore macvtap macvlan i2c_i801 snd_page_alloc tun iTCO_vendor_support microcode kvm_intel kvm sunrpc hid_logitech_dj usb_storage i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
Pid: 1229, comm: rpc.idmapd Not tainted 3.4.2-1.fc16.x86_64 #1 Gateway DX4710-UB801A/G33M05G1
RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
RSP: 0018:ffff8801a3645d40  EFLAGS: 00010246
RAX: ffff880077707e30 RBX: ffff880077707f50 RCX: ffff8801a18ccd80
RDX: 0000000000000006 RSI: ffff8801a3645e75 RDI: ffff880077707f50
RBP: ffff8801a3645d88 R08: ffff8801a430f9c0 R09: ffff8801a3645db0
R10: 000000000000000a R11: 0000000000000246 R12: ffff8801a18ccd80
R13: ffff8801a3645e75 R14: ffff8801a430f9c0 R15: 0000000000000006
FS:  00007fb6fb51a700(0000) GS:ffff8801afc80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000001a49b0000 CR4: 00000000000027e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process rpc.idmapd (pid: 1229, threadinfo ffff8801a3644000, task ffff8801a3bf9710)
Stack:
 ffffffff81260878 ffff8801a3645db0 ffff8801a3645db0 ffff880077707a90
 ffff880077707f50 ffff8801a18ccd80 0000000000000006 ffff8801a3645e75
 ffff8801a430f9c0 ffff8801a3645dd8 ffffffff81260983 ffff8801a3645de8
Call Trace:
 [<ffffffff81260878>] ? __key_instantiate_and_link+0x58/0x100
 [<ffffffff81260983>] key_instantiate_and_link+0x63/0xa0
 [<ffffffffa057062b>] idmap_pipe_downcall+0x1cb/0x1e0 [nfs]
 [<ffffffffa0107f57>] rpc_pipe_write+0x67/0x90 [sunrpc]
 [<ffffffff8117f833>] vfs_write+0xb3/0x180
 [<ffffffff8117fb5a>] sys_write+0x4a/0x90
 [<ffffffff81600329>] system_call_fastpath+0x16/0x1b
Code:  Bad RIP value.
RIP  [<          (null)>]           (null)
 RSP <ffff8801a3645d40>
CR2: 0000000000000000

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-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/idmap.c |   26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -205,12 +205,18 @@ static int nfs_idmap_init_keyring(void)
 	if (ret < 0)
 		goto failed_put_key;
 
+	ret = register_key_type(&key_type_id_resolver_legacy);
+	if (ret < 0)
+		goto failed_reg_legacy;
+
 	set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags);
 	cred->thread_keyring = keyring;
 	cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
 	id_resolver_cache = cred;
 	return 0;
 
+failed_reg_legacy:
+	unregister_key_type(&key_type_id_resolver);
 failed_put_key:
 	key_put(keyring);
 failed_put_cred:
@@ -222,6 +228,7 @@ static void nfs_idmap_quit_keyring(void)
 {
 	key_revoke(id_resolver_cache->thread_keyring);
 	unregister_key_type(&key_type_id_resolver);
+	unregister_key_type(&key_type_id_resolver_legacy);
 	put_cred(id_resolver_cache);
 }
 
@@ -385,7 +392,7 @@ static const struct rpc_pipe_ops idmap_u
 };
 
 static struct key_type key_type_id_resolver_legacy = {
-	.name		= "id_resolver",
+	.name		= "id_legacy",
 	.instantiate	= user_instantiate,
 	.match		= user_match,
 	.revoke		= user_revoke,
@@ -674,6 +681,7 @@ static int nfs_idmap_legacy_upcall(struc
 	if (ret < 0)
 		goto out2;
 
+	BUG_ON(idmap->idmap_key_cons != NULL);
 	idmap->idmap_key_cons = cons;
 
 	ret = rpc_queue_upcall(idmap->idmap_pipe, msg);
@@ -687,8 +695,7 @@ out2:
 out1:
 	kfree(msg);
 out0:
-	key_revoke(cons->key);
-	key_revoke(cons->authkey);
+	complete_request_key(cons, ret);
 	return ret;
 }
 
@@ -722,11 +729,18 @@ idmap_pipe_downcall(struct file *filp, c
 {
 	struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode);
 	struct idmap *idmap = (struct idmap *)rpci->private;
-	struct key_construction *cons = idmap->idmap_key_cons;
+	struct key_construction *cons;
 	struct idmap_msg im;
 	size_t namelen_in;
 	int ret;
 
+	/* If instantiation is successful, anyone waiting for key construction
+	 * will have been woken up and someone else may now have used
+	 * idmap_key_cons - so after this point we may no longer touch it.
+	 */
+	cons = ACCESS_ONCE(idmap->idmap_key_cons);
+	idmap->idmap_key_cons = NULL;
+
 	if (mlen != sizeof(im)) {
 		ret = -ENOSPC;
 		goto out;
@@ -739,7 +753,7 @@ idmap_pipe_downcall(struct file *filp, c
 
 	if (!(im.im_status & IDMAP_STATUS_SUCCESS)) {
 		ret = mlen;
-		complete_request_key(idmap->idmap_key_cons, -ENOKEY);
+		complete_request_key(cons, -ENOKEY);
 		goto out_incomplete;
 	}
 
@@ -756,7 +770,7 @@ idmap_pipe_downcall(struct file *filp, c
 	}
 
 out:
-	complete_request_key(idmap->idmap_key_cons, ret);
+	complete_request_key(cons, ret);
 out_incomplete:
 	return ret;
 }



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

* [ 092/122] nouveau: Fix alignment requirements on src and dst addresses
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (90 preceding siblings ...)
  2012-08-07 22:26 ` [ 091/122] NFS: Fix a number of bugs in the idmapper Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 093/122] ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Maarten Lankhorst

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit ce806a30470bcd846d148bf39d46de3ad7748228 upstream.

Linear copy works by adding the offset to the buffer address,
which may end up not being 16-byte aligned.

Some tests I've written for prime_pcopy show that the engine
allows this correctly, so the restriction on lowest 4 bits of
address can be lifted safely.

The comments added were by envyas, I think because I used
a newer version.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/nouveau/nva3_copy.fuc   |    4 -
 drivers/gpu/drm/nouveau/nva3_copy.fuc.h |   94 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/nouveau/nvc0_copy.fuc.h |   87 ++++++++++++++++++++++++++++-
 3 files changed, 175 insertions(+), 10 deletions(-)

--- a/drivers/gpu/drm/nouveau/nva3_copy.fuc
+++ b/drivers/gpu/drm/nouveau/nva3_copy.fuc
@@ -119,9 +119,9 @@ dispatch_dma:
 // mthd 0x030c-0x0340, various stuff
 .b16 0xc3 14
 .b32 #ctx_src_address_high           ~0x000000ff
-.b32 #ctx_src_address_low            ~0xfffffff0
+.b32 #ctx_src_address_low            ~0xffffffff
 .b32 #ctx_dst_address_high           ~0x000000ff
-.b32 #ctx_dst_address_low            ~0xfffffff0
+.b32 #ctx_dst_address_low            ~0xffffffff
 .b32 #ctx_src_pitch                  ~0x0007ffff
 .b32 #ctx_dst_pitch                  ~0x0007ffff
 .b32 #ctx_xcnt                       ~0x0000ffff
--- a/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
+++ b/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
@@ -1,37 +1,72 @@
-uint32_t nva3_pcopy_data[] = {
+u32 nva3_pcopy_data[] = {
+/* 0x0000: ctx_object */
 	0x00000000,
+/* 0x0004: ctx_dma */
+/* 0x0004: ctx_dma_query */
 	0x00000000,
+/* 0x0008: ctx_dma_src */
 	0x00000000,
+/* 0x000c: ctx_dma_dst */
 	0x00000000,
+/* 0x0010: ctx_query_address_high */
 	0x00000000,
+/* 0x0014: ctx_query_address_low */
 	0x00000000,
+/* 0x0018: ctx_query_counter */
 	0x00000000,
+/* 0x001c: ctx_src_address_high */
 	0x00000000,
+/* 0x0020: ctx_src_address_low */
 	0x00000000,
+/* 0x0024: ctx_src_pitch */
 	0x00000000,
+/* 0x0028: ctx_src_tile_mode */
 	0x00000000,
+/* 0x002c: ctx_src_xsize */
 	0x00000000,
+/* 0x0030: ctx_src_ysize */
 	0x00000000,
+/* 0x0034: ctx_src_zsize */
 	0x00000000,
+/* 0x0038: ctx_src_zoff */
 	0x00000000,
+/* 0x003c: ctx_src_xoff */
 	0x00000000,
+/* 0x0040: ctx_src_yoff */
 	0x00000000,
+/* 0x0044: ctx_src_cpp */
 	0x00000000,
+/* 0x0048: ctx_dst_address_high */
 	0x00000000,
+/* 0x004c: ctx_dst_address_low */
 	0x00000000,
+/* 0x0050: ctx_dst_pitch */
 	0x00000000,
+/* 0x0054: ctx_dst_tile_mode */
 	0x00000000,
+/* 0x0058: ctx_dst_xsize */
 	0x00000000,
+/* 0x005c: ctx_dst_ysize */
 	0x00000000,
+/* 0x0060: ctx_dst_zsize */
 	0x00000000,
+/* 0x0064: ctx_dst_zoff */
 	0x00000000,
+/* 0x0068: ctx_dst_xoff */
 	0x00000000,
+/* 0x006c: ctx_dst_yoff */
 	0x00000000,
+/* 0x0070: ctx_dst_cpp */
 	0x00000000,
+/* 0x0074: ctx_format */
 	0x00000000,
+/* 0x0078: ctx_swz_const0 */
 	0x00000000,
+/* 0x007c: ctx_swz_const1 */
 	0x00000000,
+/* 0x0080: ctx_xcnt */
 	0x00000000,
+/* 0x0084: ctx_ycnt */
 	0x00000000,
 	0x00000000,
 	0x00000000,
@@ -63,6 +98,7 @@ uint32_t nva3_pcopy_data[] = {
 	0x00000000,
 	0x00000000,
 	0x00000000,
+/* 0x0100: dispatch_table */
 	0x00010000,
 	0x00000000,
 	0x00000000,
@@ -73,6 +109,7 @@ uint32_t nva3_pcopy_data[] = {
 	0x00010162,
 	0x00000000,
 	0x00030060,
+/* 0x0128: dispatch_dma */
 	0x00010170,
 	0x00000000,
 	0x00010170,
@@ -118,11 +155,11 @@ uint32_t nva3_pcopy_data[] = {
 	0x0000001c,
 	0xffffff00,
 	0x00000020,
-	0x0000000f,
+	0x00000000,
 	0x00000048,
 	0xffffff00,
 	0x0000004c,
-	0x0000000f,
+	0x00000000,
 	0x00000024,
 	0xfff80000,
 	0x00000050,
@@ -146,7 +183,8 @@ uint32_t nva3_pcopy_data[] = {
 	0x00000800,
 };
 
-uint32_t nva3_pcopy_code[] = {
+u32 nva3_pcopy_code[] = {
+/* 0x0000: main */
 	0x04fe04bd,
 	0x3517f000,
 	0xf10010fe,
@@ -158,23 +196,31 @@ uint32_t nva3_pcopy_code[] = {
 	0x17f11031,
 	0x27f01200,
 	0x0012d003,
+/* 0x002f: spin */
 	0xf40031f4,
 	0x0ef40028,
+/* 0x0035: ih */
 	0x8001cffd,
 	0xf40812c4,
 	0x21f4060b,
+/* 0x0041: ih_no_chsw */
 	0x0412c472,
 	0xf4060bf4,
+/* 0x004a: ih_no_cmd */
 	0x11c4c321,
 	0x4001d00c,
+/* 0x0052: swctx */
 	0x47f101f8,
 	0x4bfe7700,
 	0x0007fe00,
 	0xf00204b9,
 	0x01f40643,
 	0x0604fa09,
+/* 0x006b: swctx_load */
 	0xfa060ef4,
+/* 0x006e: swctx_done */
 	0x03f80504,
+/* 0x0072: chsw */
 	0x27f100f8,
 	0x23cf1400,
 	0x1e3fc800,
@@ -183,18 +229,22 @@ uint32_t nva3_pcopy_code[] = {
 	0x1e3af052,
 	0xf00023d0,
 	0x24d00147,
+/* 0x0093: chsw_no_unload */
 	0xcf00f880,
 	0x3dc84023,
 	0x220bf41e,
 	0xf40131f4,
 	0x57f05221,
 	0x0367f004,
+/* 0x00a8: chsw_load_ctx_dma */
 	0xa07856bc,
 	0xb6018068,
 	0x87d00884,
 	0x0162b600,
+/* 0x00bb: chsw_finish_load */
 	0xf0f018f4,
 	0x23d00237,
+/* 0x00c3: dispatch */
 	0xf100f880,
 	0xcf190037,
 	0x33cf4032,
@@ -202,6 +252,7 @@ uint32_t nva3_pcopy_code[] = {
 	0x1024b607,
 	0x010057f1,
 	0x74bd64bd,
+/* 0x00dc: dispatch_loop */
 	0x58005658,
 	0x50b60157,
 	0x0446b804,
@@ -211,6 +262,7 @@ uint32_t nva3_pcopy_code[] = {
 	0xb60276bb,
 	0x57bb0374,
 	0xdf0ef400,
+/* 0x0100: dispatch_valid_mthd */
 	0xb60246bb,
 	0x45bb0344,
 	0x01459800,
@@ -220,31 +272,41 @@ uint32_t nva3_pcopy_code[] = {
 	0xb0014658,
 	0x1bf40064,
 	0x00538009,
+/* 0x0127: dispatch_cmd */
 	0xf4300ef4,
 	0x55f90132,
 	0xf40c01f4,
+/* 0x0132: dispatch_invalid_bitfield */
 	0x25f0250e,
+/* 0x0135: dispatch_illegal_mthd */
 	0x0125f002,
+/* 0x0138: dispatch_error */
 	0x100047f1,
 	0xd00042d0,
 	0x27f04043,
 	0x0002d040,
+/* 0x0148: hostirq_wait */
 	0xf08002cf,
 	0x24b04024,
 	0xf71bf400,
+/* 0x0154: dispatch_done */
 	0x1d0027f1,
 	0xd00137f0,
 	0x00f80023,
+/* 0x0160: cmd_nop */
+/* 0x0162: cmd_pm_trigger */
 	0x27f100f8,
 	0x34bd2200,
 	0xd00233f0,
 	0x00f80023,
+/* 0x0170: cmd_dma */
 	0x012842b7,
 	0xf00145b6,
 	0x43801e39,
 	0x0040b701,
 	0x0644b606,
 	0xf80043d0,
+/* 0x0189: cmd_exec_set_format */
 	0xf030f400,
 	0xb00001b0,
 	0x01b00101,
@@ -256,20 +318,26 @@ uint32_t nva3_pcopy_code[] = {
 	0x70b63847,
 	0x0232f401,
 	0x94bd84bd,
+/* 0x01b4: ncomp_loop */
 	0xb60f4ac4,
 	0xb4bd0445,
+/* 0x01bc: bpc_loop */
 	0xf404a430,
 	0xa5ff0f18,
 	0x00cbbbc0,
 	0xf40231f4,
+/* 0x01ce: cmp_c0 */
 	0x1bf4220e,
 	0x10c7f00c,
 	0xf400cbbb,
+/* 0x01da: cmp_c1 */
 	0xa430160e,
 	0x0c18f406,
 	0xbb14c7f0,
 	0x0ef400cb,
+/* 0x01e9: cmp_zero */
 	0x80c7f107,
+/* 0x01ed: bpc_next */
 	0x01c83800,
 	0xb60180b6,
 	0xb5b801b0,
@@ -280,6 +348,7 @@ uint32_t nva3_pcopy_code[] = {
 	0x98110680,
 	0x68fd2008,
 	0x0502f400,
+/* 0x0216: dst_xcnt */
 	0x75fd64bd,
 	0x1c078000,
 	0xf10078fd,
@@ -304,6 +373,7 @@ uint32_t nva3_pcopy_code[] = {
 	0x980056d0,
 	0x56d01f06,
 	0x1030f440,
+/* 0x0276: cmd_exec_set_surface_tiled */
 	0x579800f8,
 	0x6879c70a,
 	0xb66478c7,
@@ -311,9 +381,11 @@ uint32_t nva3_pcopy_code[] = {
 	0x0e76b060,
 	0xf0091bf4,
 	0x0ef40477,
+/* 0x0291: xtile64 */
 	0x027cf00f,
 	0xfd1170b6,
 	0x77f00947,
+/* 0x029d: xtileok */
 	0x0f5a9806,
 	0xfd115b98,
 	0xb7f000ab,
@@ -371,6 +443,7 @@ uint32_t nva3_pcopy_code[] = {
 	0x67d00600,
 	0x0060b700,
 	0x0068d004,
+/* 0x0382: cmd_exec_set_surface_linear */
 	0x6cf000f8,
 	0x0260b702,
 	0x0864b602,
@@ -381,13 +454,16 @@ uint32_t nva3_pcopy_code[] = {
 	0xb70067d0,
 	0x98040060,
 	0x67d00957,
+/* 0x03ab: cmd_exec_wait */
 	0xf900f800,
 	0xf110f900,
 	0xb6080007,
+/* 0x03b6: loop */
 	0x01cf0604,
 	0x0114f000,
 	0xfcfa1bf4,
 	0xf800fc10,
+/* 0x03c5: cmd_exec_query */
 	0x0d34c800,
 	0xf5701bf4,
 	0xf103ab21,
@@ -417,6 +493,7 @@ uint32_t nva3_pcopy_code[] = {
 	0x47f10153,
 	0x44b60800,
 	0x0045d006,
+/* 0x0438: query_counter */
 	0x03ab21f5,
 	0x080c47f1,
 	0x980644b6,
@@ -439,11 +516,13 @@ uint32_t nva3_pcopy_code[] = {
 	0x47f10153,
 	0x44b60800,
 	0x0045d006,
+/* 0x0492: cmd_exec */
 	0x21f500f8,
 	0x3fc803ab,
 	0x0e0bf400,
 	0x018921f5,
 	0x020047f1,
+/* 0x04a7: cmd_exec_no_format */
 	0xf11e0ef4,
 	0xb6081067,
 	0x77f00664,
@@ -451,19 +530,24 @@ uint32_t nva3_pcopy_code[] = {
 	0x981c0780,
 	0x67d02007,
 	0x4067d000,
+/* 0x04c2: cmd_exec_init_src_surface */
 	0x32f444bd,
 	0xc854bd02,
 	0x0bf4043f,
 	0x8221f50a,
 	0x0a0ef403,
+/* 0x04d4: src_tiled */
 	0x027621f5,
+/* 0x04db: cmd_exec_init_dst_surface */
 	0xf40749f0,
 	0x57f00231,
 	0x083fc82c,
 	0xf50a0bf4,
 	0xf4038221,
+/* 0x04ee: dst_tiled */
 	0x21f50a0e,
 	0x49f00276,
+/* 0x04f5: cmd_exec_kick */
 	0x0057f108,
 	0x0654b608,
 	0xd0210698,
@@ -473,6 +557,8 @@ uint32_t nva3_pcopy_code[] = {
 	0xc80054d0,
 	0x0bf40c3f,
 	0xc521f507,
+/* 0x0519: cmd_exec_done */
+/* 0x051b: cmd_wrcache_flush */
 	0xf100f803,
 	0xbd220027,
 	0x0133f034,
--- a/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
+++ b/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
@@ -1,34 +1,65 @@
-uint32_t nvc0_pcopy_data[] = {
+u32 nvc0_pcopy_data[] = {
+/* 0x0000: ctx_object */
 	0x00000000,
+/* 0x0004: ctx_query_address_high */
 	0x00000000,
+/* 0x0008: ctx_query_address_low */
 	0x00000000,
+/* 0x000c: ctx_query_counter */
 	0x00000000,
+/* 0x0010: ctx_src_address_high */
 	0x00000000,
+/* 0x0014: ctx_src_address_low */
 	0x00000000,
+/* 0x0018: ctx_src_pitch */
 	0x00000000,
+/* 0x001c: ctx_src_tile_mode */
 	0x00000000,
+/* 0x0020: ctx_src_xsize */
 	0x00000000,
+/* 0x0024: ctx_src_ysize */
 	0x00000000,
+/* 0x0028: ctx_src_zsize */
 	0x00000000,
+/* 0x002c: ctx_src_zoff */
 	0x00000000,
+/* 0x0030: ctx_src_xoff */
 	0x00000000,
+/* 0x0034: ctx_src_yoff */
 	0x00000000,
+/* 0x0038: ctx_src_cpp */
 	0x00000000,
+/* 0x003c: ctx_dst_address_high */
 	0x00000000,
+/* 0x0040: ctx_dst_address_low */
 	0x00000000,
+/* 0x0044: ctx_dst_pitch */
 	0x00000000,
+/* 0x0048: ctx_dst_tile_mode */
 	0x00000000,
+/* 0x004c: ctx_dst_xsize */
 	0x00000000,
+/* 0x0050: ctx_dst_ysize */
 	0x00000000,
+/* 0x0054: ctx_dst_zsize */
 	0x00000000,
+/* 0x0058: ctx_dst_zoff */
 	0x00000000,
+/* 0x005c: ctx_dst_xoff */
 	0x00000000,
+/* 0x0060: ctx_dst_yoff */
 	0x00000000,
+/* 0x0064: ctx_dst_cpp */
 	0x00000000,
+/* 0x0068: ctx_format */
 	0x00000000,
+/* 0x006c: ctx_swz_const0 */
 	0x00000000,
+/* 0x0070: ctx_swz_const1 */
 	0x00000000,
+/* 0x0074: ctx_xcnt */
 	0x00000000,
+/* 0x0078: ctx_ycnt */
 	0x00000000,
 	0x00000000,
 	0x00000000,
@@ -63,6 +94,7 @@ uint32_t nvc0_pcopy_data[] = {
 	0x00000000,
 	0x00000000,
 	0x00000000,
+/* 0x0100: dispatch_table */
 	0x00010000,
 	0x00000000,
 	0x00000000,
@@ -111,11 +143,11 @@ uint32_t nvc0_pcopy_data[] = {
 	0x00000010,
 	0xffffff00,
 	0x00000014,
-	0x0000000f,
+	0x00000000,
 	0x0000003c,
 	0xffffff00,
 	0x00000040,
-	0x0000000f,
+	0x00000000,
 	0x00000018,
 	0xfff80000,
 	0x00000044,
@@ -139,7 +171,8 @@ uint32_t nvc0_pcopy_data[] = {
 	0x00000800,
 };
 
-uint32_t nvc0_pcopy_code[] = {
+u32 nvc0_pcopy_code[] = {
+/* 0x0000: main */
 	0x04fe04bd,
 	0x3517f000,
 	0xf10010fe,
@@ -151,15 +184,20 @@ uint32_t nvc0_pcopy_code[] = {
 	0x17f11031,
 	0x27f01200,
 	0x0012d003,
+/* 0x002f: spin */
 	0xf40031f4,
 	0x0ef40028,
+/* 0x0035: ih */
 	0x8001cffd,
 	0xf40812c4,
 	0x21f4060b,
+/* 0x0041: ih_no_chsw */
 	0x0412c4ca,
 	0xf5070bf4,
+/* 0x004b: ih_no_cmd */
 	0xc4010221,
 	0x01d00c11,
+/* 0x0053: swctx */
 	0xf101f840,
 	0xfe770047,
 	0x47f1004b,
@@ -188,8 +226,11 @@ uint32_t nvc0_pcopy_code[] = {
 	0xf00204b9,
 	0x01f40643,
 	0x0604fa09,
+/* 0x00c3: swctx_load */
 	0xfa060ef4,
+/* 0x00c6: swctx_done */
 	0x03f80504,
+/* 0x00ca: chsw */
 	0x27f100f8,
 	0x23cf1400,
 	0x1e3fc800,
@@ -198,18 +239,22 @@ uint32_t nvc0_pcopy_code[] = {
 	0x1e3af053,
 	0xf00023d0,
 	0x24d00147,
+/* 0x00eb: chsw_no_unload */
 	0xcf00f880,
 	0x3dc84023,
 	0x090bf41e,
 	0xf40131f4,
+/* 0x00fa: chsw_finish_load */
 	0x37f05321,
 	0x8023d002,
+/* 0x0102: dispatch */
 	0x37f100f8,
 	0x32cf1900,
 	0x0033cf40,
 	0x07ff24e4,
 	0xf11024b6,
 	0xbd010057,
+/* 0x011b: dispatch_loop */
 	0x5874bd64,
 	0x57580056,
 	0x0450b601,
@@ -219,6 +264,7 @@ uint32_t nvc0_pcopy_code[] = {
 	0xbb0f08f4,
 	0x74b60276,
 	0x0057bb03,
+/* 0x013f: dispatch_valid_mthd */
 	0xbbdf0ef4,
 	0x44b60246,
 	0x0045bb03,
@@ -229,24 +275,33 @@ uint32_t nvc0_pcopy_code[] = {
 	0x64b00146,
 	0x091bf400,
 	0xf4005380,
+/* 0x0166: dispatch_cmd */
 	0x32f4300e,
 	0xf455f901,
 	0x0ef40c01,
+/* 0x0171: dispatch_invalid_bitfield */
 	0x0225f025,
+/* 0x0174: dispatch_illegal_mthd */
+/* 0x0177: dispatch_error */
 	0xf10125f0,
 	0xd0100047,
 	0x43d00042,
 	0x4027f040,
+/* 0x0187: hostirq_wait */
 	0xcf0002d0,
 	0x24f08002,
 	0x0024b040,
+/* 0x0193: dispatch_done */
 	0xf1f71bf4,
 	0xf01d0027,
 	0x23d00137,
+/* 0x019f: cmd_nop */
 	0xf800f800,
+/* 0x01a1: cmd_pm_trigger */
 	0x0027f100,
 	0xf034bd22,
 	0x23d00233,
+/* 0x01af: cmd_exec_set_format */
 	0xf400f800,
 	0x01b0f030,
 	0x0101b000,
@@ -258,20 +313,26 @@ uint32_t nvc0_pcopy_code[] = {
 	0x3847c701,
 	0xf40170b6,
 	0x84bd0232,
+/* 0x01da: ncomp_loop */
 	0x4ac494bd,
 	0x0445b60f,
+/* 0x01e2: bpc_loop */
 	0xa430b4bd,
 	0x0f18f404,
 	0xbbc0a5ff,
 	0x31f400cb,
 	0x220ef402,
+/* 0x01f4: cmp_c0 */
 	0xf00c1bf4,
 	0xcbbb10c7,
 	0x160ef400,
+/* 0x0200: cmp_c1 */
 	0xf406a430,
 	0xc7f00c18,
 	0x00cbbb14,
+/* 0x020f: cmp_zero */
 	0xf1070ef4,
+/* 0x0213: bpc_next */
 	0x380080c7,
 	0x80b601c8,
 	0x01b0b601,
@@ -283,6 +344,7 @@ uint32_t nvc0_pcopy_code[] = {
 	0x1d08980e,
 	0xf40068fd,
 	0x64bd0502,
+/* 0x023c: dst_xcnt */
 	0x800075fd,
 	0x78fd1907,
 	0x1057f100,
@@ -307,15 +369,18 @@ uint32_t nvc0_pcopy_code[] = {
 	0x1c069800,
 	0xf44056d0,
 	0x00f81030,
+/* 0x029c: cmd_exec_set_surface_tiled */
 	0xc7075798,
 	0x78c76879,
 	0x0380b664,
 	0xb06077c7,
 	0x1bf40e76,
 	0x0477f009,
+/* 0x02b7: xtile64 */
 	0xf00f0ef4,
 	0x70b6027c,
 	0x0947fd11,
+/* 0x02c3: xtileok */
 	0x980677f0,
 	0x5b980c5a,
 	0x00abfd0e,
@@ -374,6 +439,7 @@ uint32_t nvc0_pcopy_code[] = {
 	0xb70067d0,
 	0xd0040060,
 	0x00f80068,
+/* 0x03a8: cmd_exec_set_surface_linear */
 	0xb7026cf0,
 	0xb6020260,
 	0x57980864,
@@ -384,12 +450,15 @@ uint32_t nvc0_pcopy_code[] = {
 	0x0060b700,
 	0x06579804,
 	0xf80067d0,
+/* 0x03d1: cmd_exec_wait */
 	0xf900f900,
 	0x0007f110,
 	0x0604b608,
+/* 0x03dc: loop */
 	0xf00001cf,
 	0x1bf40114,
 	0xfc10fcfa,
+/* 0x03eb: cmd_exec_query */
 	0xc800f800,
 	0x1bf40d34,
 	0xd121f570,
@@ -419,6 +488,7 @@ uint32_t nvc0_pcopy_code[] = {
 	0x0153f026,
 	0x080047f1,
 	0xd00644b6,
+/* 0x045e: query_counter */
 	0x21f50045,
 	0x47f103d1,
 	0x44b6080c,
@@ -442,11 +512,13 @@ uint32_t nvc0_pcopy_code[] = {
 	0x080047f1,
 	0xd00644b6,
 	0x00f80045,
+/* 0x04b8: cmd_exec */
 	0x03d121f5,
 	0xf4003fc8,
 	0x21f50e0b,
 	0x47f101af,
 	0x0ef40200,
+/* 0x04cd: cmd_exec_no_format */
 	0x1067f11e,
 	0x0664b608,
 	0x800177f0,
@@ -454,18 +526,23 @@ uint32_t nvc0_pcopy_code[] = {
 	0x1d079819,
 	0xd00067d0,
 	0x44bd4067,
+/* 0x04e8: cmd_exec_init_src_surface */
 	0xbd0232f4,
 	0x043fc854,
 	0xf50a0bf4,
 	0xf403a821,
+/* 0x04fa: src_tiled */
 	0x21f50a0e,
 	0x49f0029c,
+/* 0x0501: cmd_exec_init_dst_surface */
 	0x0231f407,
 	0xc82c57f0,
 	0x0bf4083f,
 	0xa821f50a,
 	0x0a0ef403,
+/* 0x0514: dst_tiled */
 	0x029c21f5,
+/* 0x051b: cmd_exec_kick */
 	0xf10849f0,
 	0xb6080057,
 	0x06980654,
@@ -475,7 +552,9 @@ uint32_t nvc0_pcopy_code[] = {
 	0x54d00546,
 	0x0c3fc800,
 	0xf5070bf4,
+/* 0x053f: cmd_exec_done */
 	0xf803eb21,
+/* 0x0541: cmd_wrcache_flush */
 	0x0027f100,
 	0xf034bd22,
 	0x23d00133,



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

* [ 093/122] ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (91 preceding siblings ...)
  2012-08-07 22:26 ` [ 092/122] nouveau: Fix alignment requirements on src and dst addresses Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 094/122] ext4: fix overhead calculation used by ext4_statfs() Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Theodore Tso

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit f6fb99cadcd44660c68e13f6eab28333653621e6 upstream.

Make it possible for ext4_count_free to operate on buffers and not
just data in buffer_heads.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/balloc.c |    3 ++-
 fs/ext4/bitmap.c |    8 +++-----
 fs/ext4/ext4.h   |    2 +-
 fs/ext4/ialloc.c |    3 ++-
 4 files changed, 8 insertions(+), 8 deletions(-)

--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -609,7 +609,8 @@ ext4_fsblk_t ext4_count_free_clusters(st
 		if (bitmap_bh == NULL)
 			continue;
 
-		x = ext4_count_free(bitmap_bh, sb->s_blocksize);
+		x = ext4_count_free(bitmap_bh->b_data,
+				    EXT4_BLOCKS_PER_GROUP(sb) / 8);
 		printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
 			i, ext4_free_group_clusters(sb, gdp), x);
 		bitmap_count += x;
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -15,15 +15,13 @@
 
 static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
-unsigned int ext4_count_free(struct buffer_head *map, unsigned int numchars)
+unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
 {
 	unsigned int i, sum = 0;
 
-	if (!map)
-		return 0;
 	for (i = 0; i < numchars; i++)
-		sum += nibblemap[map->b_data[i] & 0xf] +
-			nibblemap[(map->b_data[i] >> 4) & 0xf];
+		sum += nibblemap[bitmap[i] & 0xf] +
+			nibblemap[(bitmap[i] >> 4) & 0xf];
 	return sum;
 }
 
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1852,7 +1852,7 @@ struct mmpd_data {
 # define NORET_AND	noreturn,
 
 /* bitmap.c */
-extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
+extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
 void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
 				struct ext4_group_desc *gdp,
 				struct buffer_head *bh, int sz);
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1054,7 +1054,8 @@ unsigned long ext4_count_free_inodes(str
 		if (!bitmap_bh)
 			continue;
 
-		x = ext4_count_free(bitmap_bh, EXT4_INODES_PER_GROUP(sb) / 8);
+		x = ext4_count_free(bitmap_bh->b_data,
+				    EXT4_INODES_PER_GROUP(sb) / 8);
 		printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n",
 			(unsigned long) i, ext4_free_inodes_count(sb, gdp), x);
 		bitmap_count += x;



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

* [ 094/122] ext4: fix overhead calculation used by ext4_statfs()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (92 preceding siblings ...)
  2012-08-07 22:26 ` [ 093/122] ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 095/122] ext4: fix hole punch failure when depth is greater than 0 Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Theodore Tso

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 952fc18ef9ec707ebdc16c0786ec360295e5ff15 upstream.

Commit f975d6bcc7a introduced bug which caused ext4_statfs() to
miscalculate the number of file system overhead blocks.  This causes
the f_blocks field in the statfs structure to be larger than it should
be.  This would in turn cause the "df" output to show the number of
data blocks in the file system and the number of data blocks used to
be larger than they should be.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/bitmap.c |    4 -
 fs/ext4/ext4.h   |    4 -
 fs/ext4/resize.c |    7 +-
 fs/ext4/super.c  |  174 +++++++++++++++++++++++++++++++++++++++----------------
 4 files changed, 132 insertions(+), 57 deletions(-)

--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -11,8 +11,6 @@
 #include <linux/jbd2.h>
 #include "ext4.h"
 
-#ifdef EXT4FS_DEBUG
-
 static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
 unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
@@ -25,8 +23,6 @@ unsigned int ext4_count_free(char *bitma
 	return sum;
 }
 
-#endif  /*  EXT4FS_DEBUG  */
-
 int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
 				  struct ext4_group_desc *gdp,
 				  struct buffer_head *bh, int sz)
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1161,8 +1161,7 @@ struct ext4_sb_info {
 	unsigned long s_desc_per_block;	/* Number of group descriptors per block */
 	ext4_group_t s_groups_count;	/* Number of groups in the fs */
 	ext4_group_t s_blockfile_groups;/* Groups acceptable for non-extent files */
-	unsigned long s_overhead_last;  /* Last calculated overhead */
-	unsigned long s_blocks_last;    /* Last seen block count */
+	unsigned long s_overhead;  /* # of fs overhead clusters */
 	unsigned int s_cluster_ratio;	/* Number of blocks per cluster */
 	unsigned int s_cluster_bits;	/* log2 of s_cluster_ratio */
 	loff_t s_bitmap_maxbytes;	/* max bytes for bitmap files */
@@ -2037,6 +2036,7 @@ extern int ext4_group_extend(struct supe
 extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count);
 
 /* super.c */
+extern int ext4_calculate_overhead(struct super_block *sb);
 extern int ext4_superblock_csum_verify(struct super_block *sb,
 				       struct ext4_super_block *es);
 extern void ext4_superblock_csum_set(struct super_block *sb,
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1197,7 +1197,7 @@ static void ext4_update_super(struct sup
 	struct ext4_new_group_data *group_data = flex_gd->groups;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
-	int i;
+	int i, ret;
 
 	BUG_ON(flex_gd->count == 0 || group_data == NULL);
 	/*
@@ -1272,6 +1272,11 @@ static void ext4_update_super(struct sup
 			   &sbi->s_flex_groups[flex_group].free_inodes);
 	}
 
+	/*
+	 * Update the fs overhead information
+	 */
+	ext4_calculate_overhead(sb);
+
 	if (test_opt(sb, DEBUG))
 		printk(KERN_DEBUG "EXT4-fs: added group %u:"
 		       "%llu blocks(%llu free %llu reserved)\n", flex_gd->count,
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3085,6 +3085,114 @@ static int set_journal_csum_feature_set(
 	return ret;
 }
 
+/*
+ * Note: calculating the overhead so we can be compatible with
+ * historical BSD practice is quite difficult in the face of
+ * clusters/bigalloc.  This is because multiple metadata blocks from
+ * different block group can end up in the same allocation cluster.
+ * Calculating the exact overhead in the face of clustered allocation
+ * requires either O(all block bitmaps) in memory or O(number of block
+ * groups**2) in time.  We will still calculate the superblock for
+ * older file systems --- and if we come across with a bigalloc file
+ * system with zero in s_overhead_clusters the estimate will be close to
+ * correct especially for very large cluster sizes --- but for newer
+ * file systems, it's better to calculate this figure once at mkfs
+ * time, and store it in the superblock.  If the superblock value is
+ * present (even for non-bigalloc file systems), we will use it.
+ */
+static int count_overhead(struct super_block *sb, ext4_group_t grp,
+			  char *buf)
+{
+	struct ext4_sb_info	*sbi = EXT4_SB(sb);
+	struct ext4_group_desc	*gdp;
+	ext4_fsblk_t		first_block, last_block, b;
+	ext4_group_t		i, ngroups = ext4_get_groups_count(sb);
+	int			s, j, count = 0;
+
+	first_block = le32_to_cpu(sbi->s_es->s_first_data_block) +
+		(grp * EXT4_BLOCKS_PER_GROUP(sb));
+	last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1;
+	for (i = 0; i < ngroups; i++) {
+		gdp = ext4_get_group_desc(sb, i, NULL);
+		b = ext4_block_bitmap(sb, gdp);
+		if (b >= first_block && b <= last_block) {
+			ext4_set_bit(EXT4_B2C(sbi, b - first_block), buf);
+			count++;
+		}
+		b = ext4_inode_bitmap(sb, gdp);
+		if (b >= first_block && b <= last_block) {
+			ext4_set_bit(EXT4_B2C(sbi, b - first_block), buf);
+			count++;
+		}
+		b = ext4_inode_table(sb, gdp);
+		if (b >= first_block && b + sbi->s_itb_per_group <= last_block)
+			for (j = 0; j < sbi->s_itb_per_group; j++, b++) {
+				int c = EXT4_B2C(sbi, b - first_block);
+				ext4_set_bit(c, buf);
+				count++;
+			}
+		if (i != grp)
+			continue;
+		s = 0;
+		if (ext4_bg_has_super(sb, grp)) {
+			ext4_set_bit(s++, buf);
+			count++;
+		}
+		for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) {
+			ext4_set_bit(EXT4_B2C(sbi, s++), buf);
+			count++;
+		}
+	}
+	if (!count)
+		return 0;
+	return EXT4_CLUSTERS_PER_GROUP(sb) -
+		ext4_count_free(buf, EXT4_CLUSTERS_PER_GROUP(sb) / 8);
+}
+
+/*
+ * Compute the overhead and stash it in sbi->s_overhead
+ */
+int ext4_calculate_overhead(struct super_block *sb)
+{
+	struct ext4_sb_info *sbi = EXT4_SB(sb);
+	struct ext4_super_block *es = sbi->s_es;
+	ext4_group_t i, ngroups = ext4_get_groups_count(sb);
+	ext4_fsblk_t overhead = 0;
+	char *buf = (char *) get_zeroed_page(GFP_KERNEL);
+
+	memset(buf, 0, PAGE_SIZE);
+	if (!buf)
+		return -ENOMEM;
+
+	/*
+	 * Compute the overhead (FS structures).  This is constant
+	 * for a given filesystem unless the number of block groups
+	 * changes so we cache the previous value until it does.
+	 */
+
+	/*
+	 * All of the blocks before first_data_block are overhead
+	 */
+	overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block));
+
+	/*
+	 * Add the overhead found in each block group
+	 */
+	for (i = 0; i < ngroups; i++) {
+		int blks;
+
+		blks = count_overhead(sb, i, buf);
+		overhead += blks;
+		if (blks)
+			memset(buf, 0, PAGE_SIZE);
+		cond_resched();
+	}
+	sbi->s_overhead = overhead;
+	smp_wmb();
+	free_page((unsigned long) buf);
+	return 0;
+}
+
 static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 {
 	char *orig_data = kstrdup(data, GFP_KERNEL);
@@ -3735,6 +3843,18 @@ static int ext4_fill_super(struct super_
 
 no_journal:
 	/*
+	 * Get the # of file system overhead blocks from the
+	 * superblock if present.
+	 */
+	if (es->s_overhead_clusters)
+		sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);
+	else {
+		ret = ext4_calculate_overhead(sb);
+		if (ret)
+			goto failed_mount_wq;
+	}
+
+	/*
 	 * The maximum number of concurrent works can be high and
 	 * concurrency isn't really necessary.  Limit it to 1.
 	 */
@@ -4600,67 +4720,21 @@ restore_opts:
 	return err;
 }
 
-/*
- * Note: calculating the overhead so we can be compatible with
- * historical BSD practice is quite difficult in the face of
- * clusters/bigalloc.  This is because multiple metadata blocks from
- * different block group can end up in the same allocation cluster.
- * Calculating the exact overhead in the face of clustered allocation
- * requires either O(all block bitmaps) in memory or O(number of block
- * groups**2) in time.  We will still calculate the superblock for
- * older file systems --- and if we come across with a bigalloc file
- * system with zero in s_overhead_clusters the estimate will be close to
- * correct especially for very large cluster sizes --- but for newer
- * file systems, it's better to calculate this figure once at mkfs
- * time, and store it in the superblock.  If the superblock value is
- * present (even for non-bigalloc file systems), we will use it.
- */
 static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
 	struct super_block *sb = dentry->d_sb;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
-	struct ext4_group_desc *gdp;
+	ext4_fsblk_t overhead = 0;
 	u64 fsid;
 	s64 bfree;
 
-	if (test_opt(sb, MINIX_DF)) {
-		sbi->s_overhead_last = 0;
-	} else if (es->s_overhead_clusters) {
-		sbi->s_overhead_last = le32_to_cpu(es->s_overhead_clusters);
-	} else if (sbi->s_blocks_last != ext4_blocks_count(es)) {
-		ext4_group_t i, ngroups = ext4_get_groups_count(sb);
-		ext4_fsblk_t overhead = 0;
-
-		/*
-		 * Compute the overhead (FS structures).  This is constant
-		 * for a given filesystem unless the number of block groups
-		 * changes so we cache the previous value until it does.
-		 */
-
-		/*
-		 * All of the blocks before first_data_block are
-		 * overhead
-		 */
-		overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block));
-
-		/*
-		 * Add the overhead found in each block group
-		 */
-		for (i = 0; i < ngroups; i++) {
-			gdp = ext4_get_group_desc(sb, i, NULL);
-			overhead += ext4_num_overhead_clusters(sb, i, gdp);
-			cond_resched();
-		}
-		sbi->s_overhead_last = overhead;
-		smp_wmb();
-		sbi->s_blocks_last = ext4_blocks_count(es);
-	}
+	if (!test_opt(sb, MINIX_DF))
+		overhead = sbi->s_overhead;
 
 	buf->f_type = EXT4_SUPER_MAGIC;
 	buf->f_bsize = sb->s_blocksize;
-	buf->f_blocks = (ext4_blocks_count(es) -
-			 EXT4_C2B(sbi, sbi->s_overhead_last));
+	buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, sbi->s_overhead);
 	bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) -
 		percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter);
 	/* prevent underflow in case that few free space is available */



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

* [ 095/122] ext4: fix hole punch failure when depth is greater than 0
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (93 preceding siblings ...)
  2012-08-07 22:26 ` [ 094/122] ext4: fix overhead calculation used by ext4_statfs() Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 096/122] ext4: dont let i_reserved_meta_blocks go negative Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Ashish Sangwan, Namjae Jeon,
	Lukas Czerner

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Ashish Sangwan <ashishsangwan2@gmail.com>

commit 968dee77220768a5f52cf8b21d0bdb73486febef upstream.

Whether to continue removing extents or not is decided by the return
value of function ext4_ext_more_to_rm() which checks 2 conditions:
a) if there are no more indexes to process.
b) if the number of entries are decreased in the header of "depth -1".

In case of hole punch, if the last block to be removed is not part of
the last extent index than this index will not be deleted, hence the
number of valid entries in the extent header of "depth - 1" will
remain as it is and ext4_ext_more_to_rm will return 0 although the
required blocks are not yet removed.

This patch fixes the above mentioned problem as instead of removing
the extents from the end of file, it starts removing the blocks from
the particular extent from which removing blocks is actually required
and continue backward until done.

Signed-off-by: Ashish Sangwan <ashish.sangwan2@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/extents.c |   48 ++++++++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 18 deletions(-)

--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2570,10 +2570,10 @@ static int ext4_ext_remove_space(struct
 {
 	struct super_block *sb = inode->i_sb;
 	int depth = ext_depth(inode);
-	struct ext4_ext_path *path;
+	struct ext4_ext_path *path = NULL;
 	ext4_fsblk_t partial_cluster = 0;
 	handle_t *handle;
-	int i, err;
+	int i = 0, err;
 
 	ext_debug("truncate since %u to %u\n", start, end);
 
@@ -2606,8 +2606,12 @@ again:
 		}
 		depth = ext_depth(inode);
 		ex = path[depth].p_ext;
-		if (!ex)
+		if (!ex) {
+			ext4_ext_drop_refs(path);
+			kfree(path);
+			path = NULL;
 			goto cont;
+		}
 
 		ee_block = le32_to_cpu(ex->ee_block);
 
@@ -2637,8 +2641,6 @@ again:
 			if (err < 0)
 				goto out;
 		}
-		ext4_ext_drop_refs(path);
-		kfree(path);
 	}
 cont:
 
@@ -2647,19 +2649,27 @@ cont:
 	 * after i_size and walking into the tree depth-wise.
 	 */
 	depth = ext_depth(inode);
-	path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), GFP_NOFS);
-	if (path == NULL) {
-		ext4_journal_stop(handle);
-		return -ENOMEM;
-	}
-	path[0].p_depth = depth;
-	path[0].p_hdr = ext_inode_hdr(inode);
-
-	if (ext4_ext_check(inode, path[0].p_hdr, depth)) {
-		err = -EIO;
-		goto out;
+	if (path) {
+		int k = i = depth;
+		while (--k > 0)
+			path[k].p_block =
+				le16_to_cpu(path[k].p_hdr->eh_entries)+1;
+	} else {
+		path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1),
+			       GFP_NOFS);
+		if (path == NULL) {
+			ext4_journal_stop(handle);
+			return -ENOMEM;
+		}
+		path[0].p_depth = depth;
+		path[0].p_hdr = ext_inode_hdr(inode);
+
+		if (ext4_ext_check(inode, path[0].p_hdr, depth)) {
+			err = -EIO;
+			goto out;
+		}
 	}
-	i = err = 0;
+	err = 0;
 
 	while (i >= 0 && err == 0) {
 		if (i == depth) {
@@ -2773,8 +2783,10 @@ cont:
 out:
 	ext4_ext_drop_refs(path);
 	kfree(path);
-	if (err == -EAGAIN)
+	if (err == -EAGAIN) {
+		path = NULL;
 		goto again;
+	}
 	ext4_journal_stop(handle);
 
 	return err;



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

* [ 096/122] ext4: dont let i_reserved_meta_blocks go negative
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (94 preceding siblings ...)
  2012-08-07 22:26 ` [ 095/122] ext4: fix hole punch failure when depth is greater than 0 Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 097/122] ext4: undo ext4_calc_metadata_amount if we fail to claim space Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Brian Foster, Theodore Tso

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Brian Foster <bfoster@redhat.com>

commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.

If we hit a condition where we have allocated metadata blocks that
were not appropriately reserved, we risk underflow of
ei->i_reserved_meta_blocks.  In turn, this can throw
sbi->s_dirtyclusters_counter significantly out of whack and undermine
the nondelalloc fallback logic in ext4_nonda_switch().  Warn if this
occurs and set i_allocated_meta_blocks to avoid this problem.

This condition is reproduced by xfstests 270 against ext2 with
delalloc enabled:

Mar 28 08:58:02 localhost kernel: [  171.526344] EXT4-fs (loop1): delayed block allocation failed for inode 14 at logical offset 64486 with max blocks 64 with error -28
Mar 28 08:58:02 localhost kernel: [  171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost

270 ultimately fails with an inconsistent filesystem and requires an
fsck to repair.  The cause of the error is an underflow in
ext4_da_update_reserve_space() due to an unreserved meta block
allocation.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/inode.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -346,6 +346,15 @@ void ext4_da_update_reserve_space(struct
 		used = ei->i_reserved_data_blocks;
 	}
 
+	if (unlikely(ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) {
+		ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, allocated %d "
+			 "with only %d reserved metadata blocks\n", __func__,
+			 inode->i_ino, ei->i_allocated_meta_blocks,
+			 ei->i_reserved_meta_blocks);
+		WARN_ON(1);
+		ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks;
+	}
+
 	/* Update per-inode reservations */
 	ei->i_reserved_data_blocks -= used;
 	ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;



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

* [ 097/122] ext4: undo ext4_calc_metadata_amount if we fail to claim space
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (95 preceding siblings ...)
  2012-08-07 22:26 ` [ 096/122] ext4: dont let i_reserved_meta_blocks go negative Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 098/122] ext4: use proper csum calculation in ext4_rename Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Brian Foster, Theodore Tso

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 03179fe92318e7934c180d96f12eff2cb36ef7b6 upstream.

The function ext4_calc_metadata_amount() has side effects, although
it's not obvious from its function name.  So if we fail to claim
space, regardless of whether we retry to claim the space again, or
return an error, we need to undo these side effects.

Otherwise we can end up incorrectly calculating the number of metadata
blocks needed for the operation, which was responsible for an xfstests
failure for test #271 when using an ext2 file system with delalloc
enabled.

Reported-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/inode.c |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1180,6 +1180,17 @@ static int ext4_da_reserve_space(struct
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	unsigned int md_needed;
 	int ret;
+	ext4_lblk_t save_last_lblock;
+	int save_len;
+
+	/*
+	 * We will charge metadata quota at writeout time; this saves
+	 * us from metadata over-estimation, though we may go over by
+	 * a small amount in the end.  Here we just reserve for data.
+	 */
+	ret = dquot_reserve_block(inode, EXT4_C2B(sbi, 1));
+	if (ret)
+		return ret;
 
 	/*
 	 * recalculate the amount of metadata blocks to reserve
@@ -1188,32 +1199,31 @@ static int ext4_da_reserve_space(struct
 	 */
 repeat:
 	spin_lock(&ei->i_block_reservation_lock);
+	/*
+	 * ext4_calc_metadata_amount() has side effects, which we have
+	 * to be prepared undo if we fail to claim space.
+	 */
+	save_len = ei->i_da_metadata_calc_len;
+	save_last_lblock = ei->i_da_metadata_calc_last_lblock;
 	md_needed = EXT4_NUM_B2C(sbi,
 				 ext4_calc_metadata_amount(inode, lblock));
 	trace_ext4_da_reserve_space(inode, md_needed);
-	spin_unlock(&ei->i_block_reservation_lock);
 
 	/*
-	 * We will charge metadata quota at writeout time; this saves
-	 * us from metadata over-estimation, though we may go over by
-	 * a small amount in the end.  Here we just reserve for data.
-	 */
-	ret = dquot_reserve_block(inode, EXT4_C2B(sbi, 1));
-	if (ret)
-		return ret;
-	/*
 	 * We do still charge estimated metadata to the sb though;
 	 * we cannot afford to run out of free blocks.
 	 */
 	if (ext4_claim_free_clusters(sbi, md_needed + 1, 0)) {
-		dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
+		ei->i_da_metadata_calc_len = save_len;
+		ei->i_da_metadata_calc_last_lblock = save_last_lblock;
+		spin_unlock(&ei->i_block_reservation_lock);
 		if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
 			yield();
 			goto repeat;
 		}
+		dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
 		return -ENOSPC;
 	}
-	spin_lock(&ei->i_block_reservation_lock);
 	ei->i_reserved_data_blocks++;
 	ei->i_reserved_meta_blocks += md_needed;
 	spin_unlock(&ei->i_block_reservation_lock);



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

* [ 098/122] ext4: use proper csum calculation in ext4_rename
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (96 preceding siblings ...)
  2012-08-07 22:26 ` [ 097/122] ext4: undo ext4_calc_metadata_amount if we fail to claim space Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 099/122] ext4: use s_csum_seed instead of i_csum_seed for xattr block Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tao Ma, Theodore Tso, Darrick J. Wong

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Tao Ma <boyu.mt@taobao.com>

commit ef58f69c3c34f6377f1e21d3533c806dbd980ad0 upstream.

In ext4_rename, when the old name is a dir, we need to
change ".." to its new parent and journal the change, so
with metadata_csum enabled, we have to re-calc the csum.

As the first block of the dir can be either a htree root
or a normal directory block and we have different csum
calculation for these 2 types, we have to choose the right
one in ext4_rename.

btw, it is found by xfstests 013.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/namei.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2918,8 +2918,15 @@ static int ext4_rename(struct inode *old
 		PARENT_INO(dir_bh->b_data, new_dir->i_sb->s_blocksize) =
 						cpu_to_le32(new_dir->i_ino);
 		BUFFER_TRACE(dir_bh, "call ext4_handle_dirty_metadata");
-		retval = ext4_handle_dirty_dirent_node(handle, old_inode,
-						       dir_bh);
+		if (is_dx(old_inode)) {
+			retval = ext4_handle_dirty_dx_node(handle,
+							   old_inode,
+							   dir_bh);
+		} else {
+			retval = ext4_handle_dirty_dirent_node(handle,
+							       old_inode,
+							       dir_bh);
+		}
 		if (retval) {
 			ext4_std_error(old_dir->i_sb, retval);
 			goto end_rename;



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

* [ 099/122] ext4: use s_csum_seed instead of i_csum_seed for xattr block
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (97 preceding siblings ...)
  2012-08-07 22:26 ` [ 098/122] ext4: use proper csum calculation in ext4_rename Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 100/122] net: Fix references to out-of-scope variables in put_cmsg_compat() Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Tao Ma, Theodore Tso, Darrick J. Wong

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Tao Ma <boyu.mt@taobao.com>

commit 41eb70dde42b2360074a559a6f1fc49860a50179 upstream.

In xattr block operation, we use h_refcount to indicate whether the
xattr block is shared among many inodes. And xattr block csum uses
s_csum_seed if it is shared and i_csum_seed if it belongs to
one inode. But this has a problem. So consider the block is shared
first bewteen inode A and B, and B has some xattr update and CoW
the xattr block. When it updates the *old* xattr block(because
of the h_refcount change) and calls ext4_xattr_release_block, we
has no idea that inode A is the real owner of the *old* xattr
block and we can't use the i_csum_seed of inode A either in xattr
block csum calculation. And I don't think we have an easy way to
find inode A.

So this patch just removes the tricky i_csum_seed and we now uses
s_csum_seed every time for the xattr block csum. The corresponding
patch for the e2fsprogs will be sent in another patch.

This is spotted by xfstests 117.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/xattr.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -127,19 +127,16 @@ static __le32 ext4_xattr_block_csum(stru
 				    struct ext4_xattr_header *hdr)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
-	struct ext4_inode_info *ei = EXT4_I(inode);
 	__u32 csum, old;
 
 	old = hdr->h_checksum;
 	hdr->h_checksum = 0;
-	if (le32_to_cpu(hdr->h_refcount) != 1) {
-		block_nr = cpu_to_le64(block_nr);
-		csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&block_nr,
-				   sizeof(block_nr));
-	} else
-		csum = ei->i_csum_seed;
+	block_nr = cpu_to_le64(block_nr);
+	csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&block_nr,
+			   sizeof(block_nr));
 	csum = ext4_chksum(sbi, csum, (__u8 *)hdr,
 			   EXT4_BLOCK_SIZE(inode->i_sb));
+
 	hdr->h_checksum = old;
 	return cpu_to_le32(csum);
 }



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

* [ 100/122] net: Fix references to out-of-scope variables in put_cmsg_compat()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (98 preceding siblings ...)
  2012-08-07 22:26 ` [ 099/122] ext4: use s_csum_seed instead of i_csum_seed for xattr block Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 101/122] r8169: revert "add byte queue limit support" Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jesper Juhl, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Jesper Juhl <jj@chaosbits.net>

[ Upstream commit 818810472b129004c16fc51bf0a570b60776bfb7 ]

In net/compat.c::put_cmsg_compat() we may assign 'data' the address of
either the 'ctv' or 'cts' local variables inside the 'if
(!COMPAT_USE_64BIT_TIME)' branch.

Those variables go out of scope at the end of the 'if' statement, so
when we use 'data' further down in 'copy_to_user(CMSG_COMPAT_DATA(cm),
data, cmlen - sizeof(struct compat_cmsghdr))' there's no telling what
it may be refering to - not good.

Fix the problem by simply giving 'ctv' and 'cts' function scope.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/compat.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/compat.c
+++ b/net/compat.c
@@ -221,6 +221,8 @@ int put_cmsg_compat(struct msghdr *kmsg,
 {
 	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	struct compat_cmsghdr cmhdr;
+	struct compat_timeval ctv;
+	struct compat_timespec cts[3];
 	int cmlen;
 
 	if (cm == NULL || kmsg->msg_controllen < sizeof(*cm)) {
@@ -229,8 +231,6 @@ int put_cmsg_compat(struct msghdr *kmsg,
 	}
 
 	if (!COMPAT_USE_64BIT_TIME) {
-		struct compat_timeval ctv;
-		struct compat_timespec cts[3];
 		if (level == SOL_SOCKET && type == SCM_TIMESTAMP) {
 			struct timeval *tv = (struct timeval *)data;
 			ctv.tv_sec = tv->tv_sec;



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

* [ 101/122] r8169: revert "add byte queue limit support".
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (99 preceding siblings ...)
  2012-08-07 22:26 ` [ 100/122] net: Fix references to out-of-scope variables in put_cmsg_compat() Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 102/122] caif: fix NULL pointer check Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Francois Romieu, Josh Boyer,
	Hayes Wang, David S. Miller

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

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Francois Romieu <romieu@fr.zoreil.com>

[ Upstream commit 17bcb684f08649a2ab6a7dcd8288332e72d208f1 ]

This reverts commit 036dafa28da1e2565a8529de2ae663c37b7a0060.

First it appears in bisection, then reverting it solves the usual
netdev watchdog problem for different people. I don't have a proper
fix yet so get rid of it.

Bisected-and-reported-by: Alex Villacís Lasso <a_villacis@palosanto.com>
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Cc: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/realtek/r8169.c |   27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5380,7 +5380,6 @@ static void rtl8169_tx_clear(struct rtl8
 {
 	rtl8169_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC);
 	tp->cur_tx = tp->dirty_tx = 0;
-	netdev_reset_queue(tp->dev);
 }
 
 static void rtl_reset_work(struct rtl8169_private *tp)
@@ -5535,8 +5534,6 @@ static netdev_tx_t rtl8169_start_xmit(st
 
 	txd->opts2 = cpu_to_le32(opts[1]);
 
-	netdev_sent_queue(dev, skb->len);
-
 	skb_tx_timestamp(skb);
 
 	wmb();
@@ -5633,16 +5630,9 @@ static void rtl8169_pcierr_interrupt(str
 	rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING);
 }
 
-struct rtl_txc {
-	int packets;
-	int bytes;
-};
-
 static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 {
-	struct rtl8169_stats *tx_stats = &tp->tx_stats;
 	unsigned int dirty_tx, tx_left;
-	struct rtl_txc txc = { 0, 0 };
 
 	dirty_tx = tp->dirty_tx;
 	smp_rmb();
@@ -5661,24 +5651,17 @@ static void rtl_tx(struct net_device *de
 		rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb,
 				     tp->TxDescArray + entry);
 		if (status & LastFrag) {
-			struct sk_buff *skb = tx_skb->skb;
-
-			txc.packets++;
-			txc.bytes += skb->len;
-			dev_kfree_skb(skb);
+			u64_stats_update_begin(&tp->tx_stats.syncp);
+			tp->tx_stats.packets++;
+			tp->tx_stats.bytes += tx_skb->skb->len;
+			u64_stats_update_end(&tp->tx_stats.syncp);
+			dev_kfree_skb(tx_skb->skb);
 			tx_skb->skb = NULL;
 		}
 		dirty_tx++;
 		tx_left--;
 	}
 
-	u64_stats_update_begin(&tx_stats->syncp);
-	tx_stats->packets += txc.packets;
-	tx_stats->bytes += txc.bytes;
-	u64_stats_update_end(&tx_stats->syncp);
-
-	netdev_completed_queue(dev, txc.packets, txc.bytes);
-
 	if (tp->dirty_tx != dirty_tx) {
 		tp->dirty_tx = dirty_tx;
 		/* Sync with rtl8169_start_xmit:



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

* [ 102/122] caif: fix NULL pointer check
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (100 preceding siblings ...)
  2012-08-07 22:26 ` [ 101/122] r8169: revert "add byte queue limit support" Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 103/122] wanmain: comparing array with NULL Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, rucsoftsec, Alan Cox, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Alan Cox <alan@linux.intel.com>

[ Upstream commit c66b9b7d365444b433307ebb18734757cb668a02 ]

Reported-by: <rucsoftsec@gmail.com>
Resolves-bug: http://bugzilla.kernel.org/show_bug?44441
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/caif/caif_serial.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -325,6 +325,9 @@ static int ldisc_open(struct tty_struct
 
 	sprintf(name, "cf%s", tty->name);
 	dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
+	if (!dev)
+		return -ENOMEM;
+
 	ser = netdev_priv(dev);
 	ser->tty = tty_kref_get(tty);
 	ser->dev = dev;



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

* [ 103/122] wanmain: comparing array with NULL
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (101 preceding siblings ...)
  2012-08-07 22:26 ` [ 102/122] caif: fix NULL pointer check Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 104/122] tcp: Add TCP_USER_TIMEOUT negative value check Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Alan Cox, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Alan Cox <alan@linux.intel.com>

[ Upstream commit 8b72ff6484fe303e01498b58621810a114f3cf09 ]

gcc really should warn about these !

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/wanrouter/wanmain.c |   53 +++++++++++++++++++++---------------------------
 1 file changed, 24 insertions(+), 29 deletions(-)

--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -602,36 +602,31 @@ static int wanrouter_device_new_if(struc
 		 * successfully, add it to the interface list.
 		 */
 
-		if (dev->name == NULL) {
-			err = -EINVAL;
-		} else {
-
-			#ifdef WANDEBUG
-			printk(KERN_INFO "%s: registering interface %s...\n",
-				wanrouter_modname, dev->name);
-			#endif
-
-			err = register_netdev(dev);
-			if (!err) {
-				struct net_device *slave = NULL;
-				unsigned long smp_flags=0;
-
-				lock_adapter_irq(&wandev->lock, &smp_flags);
-
-				if (wandev->dev == NULL) {
-					wandev->dev = dev;
-				} else {
-					for (slave=wandev->dev;
-					     DEV_TO_SLAVE(slave);
-					     slave = DEV_TO_SLAVE(slave))
-						DEV_TO_SLAVE(slave) = dev;
-				}
-				++wandev->ndev;
-
-				unlock_adapter_irq(&wandev->lock, &smp_flags);
-				err = 0;	/* done !!! */
-				goto out;
+#ifdef WANDEBUG
+		printk(KERN_INFO "%s: registering interface %s...\n",
+		       wanrouter_modname, dev->name);
+#endif
+
+		err = register_netdev(dev);
+		if (!err) {
+			struct net_device *slave = NULL;
+			unsigned long smp_flags=0;
+
+			lock_adapter_irq(&wandev->lock, &smp_flags);
+
+			if (wandev->dev == NULL) {
+				wandev->dev = dev;
+			} else {
+				for (slave=wandev->dev;
+				     DEV_TO_SLAVE(slave);
+				     slave = DEV_TO_SLAVE(slave))
+					DEV_TO_SLAVE(slave) = dev;
 			}
+			++wandev->ndev;
+
+			unlock_adapter_irq(&wandev->lock, &smp_flags);
+			err = 0;	/* done !!! */
+			goto out;
 		}
 		if (wandev->del_if)
 			wandev->del_if(wandev, dev);



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

* [ 104/122] tcp: Add TCP_USER_TIMEOUT negative value check
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (102 preceding siblings ...)
  2012-08-07 22:26 ` [ 103/122] wanmain: comparing array with NULL Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 105/122] USB: kaweth.c: use GFP_ATOMIC under spin_lock Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Hangbin Liu, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Hangbin Liu <liuhangbin@gmail.com>

[ Upstream commit 42493570100b91ef663c4c6f0c0fdab238f9d3c2 ]

TCP_USER_TIMEOUT is a TCP level socket option that takes an unsigned int. But
patch "tcp: Add TCP_USER_TIMEOUT socket option"(dca43c75) didn't check the negative
values. If a user assign -1 to it, the socket will set successfully and wait
for 4294967295 miliseconds. This patch add a negative value check to avoid
this issue.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2625,7 +2625,10 @@ static int do_tcp_setsockopt(struct sock
 		/* Cap the max timeout in ms TCP will retry/retrans
 		 * before giving up and aborting (ETIMEDOUT) a connection.
 		 */
-		icsk->icsk_user_timeout = msecs_to_jiffies(val);
+		if (val < 0)
+			err = -EINVAL;
+		else
+			icsk->icsk_user_timeout = msecs_to_jiffies(val);
 		break;
 	default:
 		err = -ENOPROTOOPT;



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

* [ 105/122] USB: kaweth.c: use GFP_ATOMIC under spin_lock
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (103 preceding siblings ...)
  2012-08-07 22:26 ` [ 104/122] tcp: Add TCP_USER_TIMEOUT negative value check Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 106/122] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Dan Carpenter, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


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

[ Upstream commit e4c7f259c5be99dcfc3d98f913590663b0305bf8 ]

The problem is that we call this with a spin lock held.  The call tree
is:
	kaweth_start_xmit() holds kaweth->device_lock.
	-> kaweth_async_set_rx_mode()
	   -> kaweth_control()
	      -> kaweth_internal_control_msg()

The kaweth_internal_control_msg() function is only called from
kaweth_control() which used GFP_ATOMIC for its allocations.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/usb/kaweth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1314,7 +1314,7 @@ static int kaweth_internal_control_msg(s
         int retv;
         int length = 0; /* shut up GCC */
 
-        urb = usb_alloc_urb(0, GFP_NOIO);
+	urb = usb_alloc_urb(0, GFP_ATOMIC);
         if (!urb)
                 return -ENOMEM;
 



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

* [ 106/122] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (104 preceding siblings ...)
  2012-08-07 22:26 ` [ 105/122] USB: kaweth.c: use GFP_ATOMIC under spin_lock Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 107/122] tcp: perform DMA to userspace only if there is a task waiting for it Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Max Matveev, Jiri Benc, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Jiri Benc <jbenc@redhat.com>

[ Upstream commit b1beb681cba5358f62e6187340660ade226a5fcc ]

When device flags are set using rtnetlink, IFF_PROMISC and IFF_ALLMULTI
flags are handled specially. Function dev_change_flags sets IFF_PROMISC and
IFF_ALLMULTI bits in dev->gflags according to the passed value but
do_setlink passes a result of rtnl_dev_combine_flags which takes those bits
from dev->flags.

This can be easily trigerred by doing:

tcpdump -i eth0 &
ip l s up eth0

ip sets IFF_UP flag in ifi_flags and ifi_change, which is combined with
IFF_PROMISC by rtnl_dev_combine_flags, causing __dev_change_flags to set
IFF_PROMISC in gflags.

Reported-by: Max Matveev <makc@redhat.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/rtnetlink.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -674,6 +674,12 @@ static void set_operstate(struct net_dev
 	}
 }
 
+static unsigned int rtnl_dev_get_flags(const struct net_device *dev)
+{
+	return (dev->flags & ~(IFF_PROMISC | IFF_ALLMULTI)) |
+	       (dev->gflags & (IFF_PROMISC | IFF_ALLMULTI));
+}
+
 static unsigned int rtnl_dev_combine_flags(const struct net_device *dev,
 					   const struct ifinfomsg *ifm)
 {
@@ -682,7 +688,7 @@ static unsigned int rtnl_dev_combine_fla
 	/* bugwards compatibility: ifi_change == 0 is treated as ~0 */
 	if (ifm->ifi_change)
 		flags = (flags & ifm->ifi_change) |
-			(dev->flags & ~ifm->ifi_change);
+			(rtnl_dev_get_flags(dev) & ~ifm->ifi_change);
 
 	return flags;
 }



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

* [ 107/122] tcp: perform DMA to userspace only if there is a task waiting for it
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (105 preceding siblings ...)
  2012-08-07 22:26 ` [ 106/122] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 108/122] net/tun: fix ioctl() based info leaks Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Jiri Kosina, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Jiri Kosina <jkosina@suse.cz>

[ Upstream commit 59ea33a68a9083ac98515e4861c00e71efdc49a1 ]

Back in 2006, commit 1a2449a87b ("[I/OAT]: TCP recv offload to I/OAT")
added support for receive offloading to IOAT dma engine if available.

The code in tcp_rcv_established() tries to perform early DMA copy if
applicable. It however does so without checking whether the userspace
task is actually expecting the data in the buffer.

This is not a problem under normal circumstances, but there is a corner
case where this doesn't work -- and that's when MSG_TRUNC flag to
recvmsg() is used.

If the IOAT dma engine is not used, the code properly checks whether
there is a valid ucopy.task and the socket is owned by userspace, but
misses the check in the dmaengine case.

This problem can be observed in real trivially -- for example 'tbench' is a
good reproducer, as it makes a heavy use of MSG_TRUNC. On systems utilizing
IOAT, you will soon find tbench waiting indefinitely in sk_wait_data(), as they
have been already early-copied in tcp_rcv_established() using dma engine.

This patch introduces the same check we are performing in the simple
iovec copy case to the IOAT case as well. It fixes the indefinite
recvmsg(MSG_TRUNC) hangs.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp_input.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5602,7 +5602,9 @@ int tcp_rcv_established(struct sock *sk,
 			if (tp->copied_seq == tp->rcv_nxt &&
 			    len - tcp_header_len <= tp->ucopy.len) {
 #ifdef CONFIG_NET_DMA
-				if (tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
+				if (tp->ucopy.task == current &&
+				    sock_owned_by_user(sk) &&
+				    tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
 					copied_early = 1;
 					eaten = 1;
 				}



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

* [ 108/122] net/tun: fix ioctl() based info leaks
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (106 preceding siblings ...)
  2012-08-07 22:26 ` [ 107/122] tcp: perform DMA to userspace only if there is a task waiting for it Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 109/122] USB: echi-dbgp: increase the controller wait time to come out of halt Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Mathias Krause, David S. Miller

From: Greg KH <gregkh@linuxfoundation.org>

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

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


From: Mathias Krause <minipli@googlemail.com>

[ Upstream commits a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc
  and 8bbb181308bc348e02bfdbebdedd4e4ec9d452ce ]

The tun module leaks up to 36 bytes of memory by not fully initializing
a structure located on the stack that gets copied to user memory by the
TUNGETIFF and SIOCGIFHWADDR ioctl()s.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/tun.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1255,10 +1255,12 @@ static long __tun_chr_ioctl(struct file
 	int vnet_hdr_sz;
 	int ret;
 
-	if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
+	if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) {
 		if (copy_from_user(&ifr, argp, ifreq_len))
 			return -EFAULT;
-
+	} else {
+		memset(&ifr, 0, sizeof(ifr));
+	}
 	if (cmd == TUNGETFEATURES) {
 		/* Currently this just means: "what IFF flags are valid?".
 		 * This is needed because we never checked for invalid flags on



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

* [ 109/122] USB: echi-dbgp: increase the controller wait time to come out of halt.
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (107 preceding siblings ...)
  2012-08-07 22:26 ` [ 108/122] net/tun: fix ioctl() based info leaks Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 110/122] ALSA: snd-usb: fix clock source validity index Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Colin Ian King, Jason Wessel

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Colin Ian King <colin.king@canonical.com>

commit f96a4216e85050c0a9d41a41ecb0ae9d8e39b509 upstream.

The default 10 microsecond delay for the controller to come out of
halt in dbgp_ehci_startup is too short, so increase it to 1 millisecond.

This is based on emperical testing on various USB debug ports on
modern machines such as a Lenovo X220i and an Ivybridge development
platform that needed to wait ~450-950 microseconds.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/early/ehci-dbgp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -450,7 +450,7 @@ static int dbgp_ehci_startup(void)
 	writel(FLAG_CF, &ehci_regs->configured_flag);
 
 	/* Wait until the controller is no longer halted */
-	loop = 10;
+	loop = 1000;
 	do {
 		status = readl(&ehci_regs->status);
 		if (!(status & STS_HALT))



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

* [ 110/122] ALSA: snd-usb: fix clock source validity index
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (108 preceding siblings ...)
  2012-08-07 22:26 ` [ 109/122] USB: echi-dbgp: increase the controller wait time to come out of halt Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 111/122] ALSA: mpu401: Fix missing initialization of irq field Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Daniel Mack, Andreas Koch, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Daniel Mack <zonque@gmail.com>

commit aff252a848ce21b431ba822de3dab9c4c94571cb upstream.

uac_clock_source_is_valid() uses the control selector value to access
the bmControls bitmap of the clock source unit. This is wrong, as
control selector values start from 1, while the bitmap uses all
available bits.

In other words, "Clock Validity Control" is stored in D3..2, not D5..4
of the clock selector unit's bmControls.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Andreas Koch <andreas@akdesigninc.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/usb/clock.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -111,7 +111,8 @@ static bool uac_clock_source_is_valid(st
 		return 0;
 
 	/* If a clock source can't tell us whether it's valid, we assume it is */
-	if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
+	if (!uac2_control_is_readable(cs_desc->bmControls,
+				      UAC2_CS_CONTROL_CLOCK_VALID - 1))
 		return 1;
 
 	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,



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

* [ 111/122] ALSA: mpu401: Fix missing initialization of irq field
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (109 preceding siblings ...)
  2012-08-07 22:26 ` [ 110/122] ALSA: snd-usb: fix clock source validity index Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 112/122] ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Takashi Iwai <tiwai@suse.de>

commit bc733d495267a23ef8660220d696c6e549ce30b3 upstream.

The irq field of struct snd_mpu401 is supposed to be initialized to -1.
Since it's set to zero as of now, a probing error before the irq
installation results in a kernel warning "Trying to free already-free
IRQ 0".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44821
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/drivers/mpu401/mpu401_uart.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -554,6 +554,7 @@ int snd_mpu401_uart_new(struct snd_card
 	spin_lock_init(&mpu->output_lock);
 	spin_lock_init(&mpu->timer_lock);
 	mpu->hardware = hardware;
+	mpu->irq = -1;
 	if (! (info_flags & MPU401_INFO_INTEGRATED)) {
 		int res_size = hardware == MPU401_HW_PC98II ? 4 : 2;
 		mpu->res = request_region(port, res_size, "MPU401 UART");



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

* [ 112/122] ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (110 preceding siblings ...)
  2012-08-07 22:26 ` [ 111/122] ALSA: mpu401: Fix missing initialization of irq field Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 113/122] ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210 Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 6162552b0de6ba80937c3dd53e084967851cd199 upstream.

We've got a bug report about the silent output from the headphone on a
mobo with VT2021, and spotted out that this was because of the wrong
D3 state on the DAC for the headphone output.  The bug is triggered by
the incomplete check for this DAC in set_widgets_power_state_vt1718S().
It checks only the connectivity of the primary output (0x27) but
doesn't consider the path from the headphone pin (0x28).

Now this patch fixes the problem by checking both pins for DAC 0x0b.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_via.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -3226,7 +3226,7 @@ static void set_widgets_power_state_vt17
 {
 	struct via_spec *spec = codec->spec;
 	int imux_is_smixer;
-	unsigned int parm;
+	unsigned int parm, parm2;
 	/* MUX6 (1eh) = stereo mixer */
 	imux_is_smixer =
 	snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
@@ -3249,7 +3249,7 @@ static void set_widgets_power_state_vt17
 	parm = AC_PWRST_D3;
 	set_pin_power_state(codec, 0x27, &parm);
 	update_power_state(codec, 0x1a, parm);
-	update_power_state(codec, 0xb, parm);
+	parm2 = parm; /* for pin 0x0b */
 
 	/* PW2 (26h), AOW2 (ah) */
 	parm = AC_PWRST_D3;
@@ -3264,6 +3264,9 @@ static void set_widgets_power_state_vt17
 	if (!spec->hp_independent_mode) /* check for redirected HP */
 		set_pin_power_state(codec, 0x28, &parm);
 	update_power_state(codec, 0x8, parm);
+	if (!spec->hp_independent_mode && parm2 != AC_PWRST_D3)
+		parm = parm2;
+	update_power_state(codec, 0xb, parm);
 	/* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
 	update_power_state(codec, 0x21, imux_is_smixer ? AC_PWRST_D0 : parm);
 



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

* [ 113/122] ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (111 preceding siblings ...)
  2012-08-07 22:26 ` [ 112/122] ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 114/122] ALSA: hda - Fix polarity of mute LED on " Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Takashi Iwai <tiwai@suse.de>

commit a3e199732b8e2b272e82cc1ccc49c35239ed6c5a upstream.

BIOS on HP Mini 210 doesn't provide the proper "HP_Mute_LED" DMI
string, thus the driver doesn't initialize the GPIO, too.  In the
earlier kernel, the driver falls back to GPIO1, but since 3.3 we've
stopped this due to other wrongly advertised machines.

For fixing this particular case, add a new model type to specify the
default polarity explicitly so that the fallback to GPIO1 is handled.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=772923

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_sigmatel.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -101,6 +101,7 @@ enum {
 	STAC_92HD83XXX_HP_cNB11_INTQUAD,
 	STAC_HP_DV7_4000,
 	STAC_HP_ZEPHYR,
+	STAC_92HD83XXX_HP_LED,
 	STAC_92HD83XXX_MODELS
 };
 
@@ -1675,6 +1676,7 @@ static const char * const stac92hd83xxx_
 	[STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad",
 	[STAC_HP_DV7_4000] = "hp-dv7-4000",
 	[STAC_HP_ZEPHYR] = "hp-zephyr",
+	[STAC_92HD83XXX_HP_LED] = "hp-led",
 };
 
 static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
@@ -1729,6 +1731,8 @@ static const struct snd_pci_quirk stac92
 			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
 			  "HP", STAC_HP_ZEPHYR),
+	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
+			  "HP Mini", STAC_92HD83XXX_HP_LED),
 	{} /* terminator */
 };
 
@@ -5507,6 +5511,7 @@ static void stac92hd8x_fill_auto_spec(st
 static int patch_stac92hd83xxx(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec;
+	int default_polarity = -1; /* no default cfg */
 	int err;
 
 	spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -5555,9 +5560,12 @@ again:
 	case STAC_HP_ZEPHYR:
 		spec->init = stac92hd83xxx_hp_zephyr_init;
 		break;
+	case STAC_92HD83XXX_HP_LED:
+		default_polarity = 1;
+		break;
 	}
 
-	if (find_mute_led_cfg(codec, -1/*no default cfg*/))
+	if (find_mute_led_cfg(codec, default_polarity))
 		snd_printd("mute LED gpio %d polarity %d\n",
 				spec->gpio_led,
 				spec->gpio_led_polarity);



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

* [ 114/122] ALSA: hda - Fix polarity of mute LED on HP Mini 210
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (112 preceding siblings ...)
  2012-08-07 22:26 ` [ 113/122] ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210 Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 115/122] ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Takashi Iwai <tiwai@suse.de>

commit ff8a1e274cbc11da6b57849f925b895a212b56c9 upstream.

The commit a3e199732b made the LED working again on HP Mini 210 but
with a wrong polarity.  This patch fixes the polarity for this
machine, and also introduce a new model string "hp-inv-led".

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=772923

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_sigmatel.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -102,6 +102,7 @@ enum {
 	STAC_HP_DV7_4000,
 	STAC_HP_ZEPHYR,
 	STAC_92HD83XXX_HP_LED,
+	STAC_92HD83XXX_HP_INV_LED,
 	STAC_92HD83XXX_MODELS
 };
 
@@ -1677,6 +1678,7 @@ static const char * const stac92hd83xxx_
 	[STAC_HP_DV7_4000] = "hp-dv7-4000",
 	[STAC_HP_ZEPHYR] = "hp-zephyr",
 	[STAC_92HD83XXX_HP_LED] = "hp-led",
+	[STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led",
 };
 
 static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
@@ -5561,6 +5563,9 @@ again:
 		spec->init = stac92hd83xxx_hp_zephyr_init;
 		break;
 	case STAC_92HD83XXX_HP_LED:
+		default_polarity = 0;
+		break;
+	case STAC_92HD83XXX_HP_INV_LED:
 		default_polarity = 1;
 		break;
 	}



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

* [ 115/122] ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (113 preceding siblings ...)
  2012-08-07 22:26 ` [ 114/122] ALSA: hda - Fix polarity of mute LED on " Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 116/122] ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 1f43f6c1bc8d740e75b4177eb29110858bb5fea2 upstream.

The IDT codecs initializes the GPIO setup for mute LEDs via
snd_hda_sync_vmaster_hook().  This works in most cases except for the
very first call, which is called before PCM and control creations.
Thus before Master switch is set manually via alsactl, the mute LED
may show the wrong state, depending on the polarity.

Now it's fixed by calling the LED-status update function manually when
no vmaster is set yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_sigmatel.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4420,7 +4420,12 @@ static int stac92xx_init(struct hda_code
 	snd_hda_jack_report_sync(codec);
 
 	/* sync mute LED */
-	snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+	if (spec->gpio_led) {
+		if (spec->vmaster_mute.hook)
+			snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+		else /* the very first init call doesn't have vmaster yet */
+			stac92xx_update_led_status(codec, false);
+	}
 
 	/* sync the power-map */
 	if (spec->num_pwrs)



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

* [ 116/122] ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (114 preceding siblings ...)
  2012-08-07 22:26 ` [ 115/122] ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 117/122] ASoC: wm8962: Allow VMID time to fully ramp Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Takashi Iwai

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 707fba3fa76a4c8855552f5d4c1a12430c09bce8 upstream.

Lenovo Thinkpad T530 with ALC269VC codec has a dock port but BIOS
doesn't set up the pins properly.  Enable the pins as well as on
Thinkpad X230 Tablet.

Reported-and-tested-by: Mario <anyc@hadiko.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6000,6 +6000,7 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
+	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_QUANTA_MUTE),
 	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K),



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

* [ 117/122] ASoC: wm8962: Allow VMID time to fully ramp
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (115 preceding siblings ...)
  2012-08-07 22:26 ` [ 116/122] ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 118/122] ASoC: wm8994: Ensure there are enough BCLKs for four channels Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Mark Brown

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 9d40e5582c9c4cfb6977ba2a0ca9c2ed82c56f21 upstream.

Required for reliable power up from cold.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/codecs/wm8962.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2501,6 +2501,9 @@ static int wm8962_set_bias_level(struct
 		/* VMID 2*250k */
 		snd_soc_update_bits(codec, WM8962_PWR_MGMT_1,
 				    WM8962_VMID_SEL_MASK, 0x100);
+
+		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
+			msleep(100);
 		break;
 
 	case SND_SOC_BIAS_OFF:



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

* [ 118/122] ASoC: wm8994: Ensure there are enough BCLKs for four channels
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (116 preceding siblings ...)
  2012-08-07 22:26 ` [ 117/122] ASoC: wm8962: Allow VMID time to fully ramp Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 119/122] m68k: Make sys_atomic_cmpxchg_32 work on classic m68k Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Greg KH, torvalds, akpm, alan, Mark Brown

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit b8edf3e5522735c8ce78b81845f7a1a2d4a08626 upstream.

Otherwise if someone tries to use all four channels on AIF1 with the
device in master mode we won't be able to clock out all the data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/codecs/wm8994.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -2649,7 +2649,7 @@ static int wm8994_hw_params(struct snd_p
 		return -EINVAL;
 	}
 
-	bclk_rate = params_rate(params) * 2;
+	bclk_rate = params_rate(params) * 4;
 	switch (params_format(params)) {
 	case SNDRV_PCM_FORMAT_S16_LE:
 		bclk_rate *= 16;



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

* [ 119/122] m68k: Make sys_atomic_cmpxchg_32 work on classic m68k
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (117 preceding siblings ...)
  2012-08-07 22:26 ` [ 118/122] ASoC: wm8994: Ensure there are enough BCLKs for four channels Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 120/122] futex: Test for pi_mutex on fault in futex_wait_requeue_pi() Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Andreas Schwab, Thorsten Glaser,
	Geert Uytterhoeven

From: Greg KH <gregkh@linuxfoundation.org>

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

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

From: Andreas Schwab <schwab@linux-m68k.org>

commit 9e2760d18b3cf179534bbc27692c84879c61b97c upstream.

User space access must always go through uaccess accessors, since on
classic m68k user space and kernel space are completely separate.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Tested-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/m68k/kernel/sys_m68k.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newv
 			goto bad_access;
 		}
 
-		mem_value = *mem;
+		/*
+		 * No need to check for EFAULT; we know that the page is
+		 * present and writable.
+		 */
+		__get_user(mem_value, mem);
 		if (mem_value == oldval)
-			*mem = newval;
+			__put_user(newval, mem);
 
 		pte_unmap_unlock(pte, ptl);
 		up_read(&mm->mmap_sem);



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

* [ 120/122] futex: Test for pi_mutex on fault in futex_wait_requeue_pi()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (118 preceding siblings ...)
  2012-08-07 22:26 ` [ 119/122] m68k: Make sys_atomic_cmpxchg_32 work on classic m68k Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 121/122] futex: Fix bug in WARN_ON for NULL q.pi_state Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 122/122] futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi() Greg Kroah-Hartman
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Darren Hart, Dave Jones,
	Dan Carpenter, Thomas Gleixner

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit b6070a8d9853eda010a549fa9a09eb8d7269b929 upstream.

If fixup_pi_state_owner() faults, pi_mutex may be NULL. Test
for pi_mutex != NULL before testing the owner against current
and possibly unlocking it.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Link: http://lkml.kernel.org/r/dc59890338fc413606f04e5c5b131530734dae3d.1342809673.git.dvhart@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/futex.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2370,7 +2370,7 @@ static int futex_wait_requeue_pi(u32 __u
 	 * fault, unlock the rt_mutex and return the fault to userspace.
 	 */
 	if (ret == -EFAULT) {
-		if (rt_mutex_owner(pi_mutex) == current)
+		if (pi_mutex && rt_mutex_owner(pi_mutex) == current)
 			rt_mutex_unlock(pi_mutex);
 	} else if (ret == -EINTR) {
 		/*



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

* [ 121/122] futex: Fix bug in WARN_ON for NULL q.pi_state
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (119 preceding siblings ...)
  2012-08-07 22:26 ` [ 120/122] futex: Test for pi_mutex on fault in futex_wait_requeue_pi() Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  2012-08-07 22:26 ` [ 122/122] futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi() Greg Kroah-Hartman
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Darren Hart, Dave Jones, Thomas Gleixner

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit f27071cb7fe3e1d37a9dbe6c0dfc5395cd40fa43 upstream.

The WARN_ON in futex_wait_requeue_pi() for a NULL q.pi_state was testing
the address (&q.pi_state) of the pointer instead of the value
(q.pi_state) of the pointer. Correct it accordingly.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Cc: Dave Jones <davej@redhat.com>
Link: http://lkml.kernel.org/r/1c85d97f6e5f79ec389a4ead3e367363c74bd09a.1342809673.git.dvhart@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/futex.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2343,7 +2343,7 @@ static int futex_wait_requeue_pi(u32 __u
 		 * signal.  futex_unlock_pi() will not destroy the lock_ptr nor
 		 * the pi_state.
 		 */
-		WARN_ON(!&q.pi_state);
+		WARN_ON(!q.pi_state);
 		pi_mutex = &q.pi_state->pi_mutex;
 		ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1);
 		debug_rt_mutex_free_waiter(&rt_waiter);



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

* [ 122/122] futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi()
  2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
                   ` (120 preceding siblings ...)
  2012-08-07 22:26 ` [ 121/122] futex: Fix bug in WARN_ON for NULL q.pi_state Greg Kroah-Hartman
@ 2012-08-07 22:26 ` Greg Kroah-Hartman
  121 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-07 22:26 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Greg KH, torvalds, akpm, alan, Darren Hart, Dave Jones, Thomas Gleixner

From: Greg KH <gregkh@linuxfoundation.org>

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

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

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

commit 6f7b0a2a5c0fb03be7c25bd1745baa50582348ef upstream.

If uaddr == uaddr2, then we have broken the rule of only requeueing
from a non-pi futex to a pi futex with this call. If we attempt this,
as the trinity test suite manages to do, we miss early wakeups as
q.key is equal to key2 (because they are the same uaddr). We will then
attempt to dereference the pi_mutex (which would exist had the futex_q
been properly requeued to a pi futex) and trigger a NULL pointer
dereference.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Cc: Dave Jones <davej@redhat.com>
Link: http://lkml.kernel.org/r/ad82bfe7f7d130247fbe2b5b4275654807774227.1342809673.git.dvhart@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/futex.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2231,11 +2231,11 @@ int handle_early_requeue_pi_wakeup(struc
  * @uaddr2:	the pi futex we will take prior to returning to user-space
  *
  * The caller will wait on uaddr and will be requeued by futex_requeue() to
- * uaddr2 which must be PI aware.  Normal wakeup will wake on uaddr2 and
- * complete the acquisition of the rt_mutex prior to returning to userspace.
- * This ensures the rt_mutex maintains an owner when it has waiters; without
- * one, the pi logic wouldn't know which task to boost/deboost, if there was a
- * need to.
+ * uaddr2 which must be PI aware and unique from uaddr.  Normal wakeup will wake
+ * on uaddr2 and complete the acquisition of the rt_mutex prior to returning to
+ * userspace.  This ensures the rt_mutex maintains an owner when it has waiters;
+ * without one, the pi logic would not know which task to boost/deboost, if
+ * there was a need to.
  *
  * We call schedule in futex_wait_queue_me() when we enqueue and return there
  * via the following:
@@ -2272,6 +2272,9 @@ static int futex_wait_requeue_pi(u32 __u
 	struct futex_q q = futex_q_init;
 	int res, ret;
 
+	if (uaddr == uaddr2)
+		return -EINVAL;
+
 	if (!bitset)
 		return -EINVAL;
 



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

* Re: [ 010/122] smack: off by one error
  2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
@ 2012-08-07 22:53   ` Casey Schaufler
  2012-08-08  0:11   ` Casey Schaufler
  1 sibling, 0 replies; 127+ messages in thread
From: Casey Schaufler @ 2012-08-07 22:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, torvalds, akpm, alan, Alan Cox,
	James Morris, Casey Schaufler

On 8/7/2012 3:24 PM, Greg Kroah-Hartman wrote:
> From: Greg KH <gregkh@linuxfoundation.org>
>
> 3.5-stable review patch.  If anyone has any objections, please let me know.

No objection here.

>
> ------------------
>
> From: Alan Cox <alan@linux.intel.com>
>
> commit 3b9fc37280c521b086943f9aedda767f5bf3b2d3 upstream.
>
> Consider the input case of a rule that consists entirely of non space
> symbols followed by a \0. Say 64 + \0
>
> In this case strlen(data) = 64
> kzalloc of subject and object are 64 byte objects
> sscanfdata, "%s %s %s", subject, ...)
>
> will put 65 bytes into subject.
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
> Signed-off-by: James Morris <james.l.morris@oracle.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
>  security/smack/smackfs.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -325,11 +325,11 @@ static int smk_parse_long_rule(const cha
>  	int datalen;
>  	int rc = -1;
>  
> -	/*
> -	 * This is probably inefficient, but safe.
> -	 */
> +	/* This is inefficient */
>  	datalen = strlen(data);
> -	subject = kzalloc(datalen, GFP_KERNEL);
> +
> +	/* Our first element can be 64 + \0 with no spaces */
> +	subject = kzalloc(datalen + 1, GFP_KERNEL);
>  	if (subject == NULL)
>  		return -1;
>  	object = kzalloc(datalen, GFP_KERNEL);
>
>
>


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

* Re: [ 010/122] smack: off by one error
  2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
  2012-08-07 22:53   ` Casey Schaufler
@ 2012-08-08  0:11   ` Casey Schaufler
  1 sibling, 0 replies; 127+ messages in thread
From: Casey Schaufler @ 2012-08-08  0:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, torvalds, akpm, alan, Alan Cox,
	James Morris, Casey Schaufler

On 8/7/2012 3:24 PM, Greg Kroah-Hartman wrote:
> From: Greg KH <gregkh@linuxfoundation.org>
>
> 3.5-stable review patch.  If anyone has any objections, please let me know.

No objection here.

>
> ------------------
>
> From: Alan Cox <alan@linux.intel.com>
>
> commit 3b9fc37280c521b086943f9aedda767f5bf3b2d3 upstream.
>
> Consider the input case of a rule that consists entirely of non space
> symbols followed by a \0. Say 64 + \0
>
> In this case strlen(data) = 64
> kzalloc of subject and object are 64 byte objects
> sscanfdata, "%s %s %s", subject, ...)
>
> will put 65 bytes into subject.
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
> Signed-off-by: James Morris <james.l.morris@oracle.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
>  security/smack/smackfs.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -325,11 +325,11 @@ static int smk_parse_long_rule(const cha
>  	int datalen;
>  	int rc = -1;
>  
> -	/*
> -	 * This is probably inefficient, but safe.
> -	 */
> +	/* This is inefficient */
>  	datalen = strlen(data);
> -	subject = kzalloc(datalen, GFP_KERNEL);
> +
> +	/* Our first element can be 64 + \0 with no spaces */
> +	subject = kzalloc(datalen + 1, GFP_KERNEL);
>  	if (subject == NULL)
>  		return -1;
>  	object = kzalloc(datalen, GFP_KERNEL);
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>


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

* Re: [ 040/122] batman-adv: fix skb->data assignment
  2012-08-07 22:25 ` [ 040/122] batman-adv: fix skb->data assignment Greg Kroah-Hartman
@ 2012-08-09  3:13   ` Ben Hutchings
  2012-08-09 15:17     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 127+ messages in thread
From: Ben Hutchings @ 2012-08-09  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, stable, torvalds, akpm, alan, Antonio Quartulli,
	Sven Eckelmann

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

On Tue, 2012-08-07 at 15:25 -0700, Greg Kroah-Hartman wrote:
> From: Greg KH <gregkh@linuxfoundation.org>
> 
> 3.5-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Antonio Quartulli <ordex@autistici.org>
> 
> commit d2b6cc8e460494251442a877fcbc150faa175b4f upstream.
[...]

This is a duplicate of commit 2c995ff892313009e336ecc8ec3411022f5b1c39
which is already in 3.5.  Please drop it.

Ben.

-- 
Ben Hutchings
Make three consecutive correct guesses and you will be considered an expert.

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

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

* Re: [ 040/122] batman-adv: fix skb->data assignment
  2012-08-09  3:13   ` Ben Hutchings
@ 2012-08-09 15:17     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 127+ messages in thread
From: Greg Kroah-Hartman @ 2012-08-09 15:17 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, torvalds, akpm, alan, Antonio Quartulli,
	Sven Eckelmann

On Thu, Aug 09, 2012 at 04:13:28AM +0100, Ben Hutchings wrote:
> On Tue, 2012-08-07 at 15:25 -0700, Greg Kroah-Hartman wrote:
> > From: Greg KH <gregkh@linuxfoundation.org>
> > 
> > 3.5-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Antonio Quartulli <ordex@autistici.org>
> > 
> > commit d2b6cc8e460494251442a877fcbc150faa175b4f upstream.
> [...]
> 
> This is a duplicate of commit 2c995ff892313009e336ecc8ec3411022f5b1c39
> which is already in 3.5.  Please drop it.

Thanks for noticing this, now dropped.

greg k-h

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

end of thread, other threads:[~2012-08-09 15:17 UTC | newest]

Thread overview: 127+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
2012-08-07 22:24 ` [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE Greg Kroah-Hartman
2012-08-07 22:24 ` [ 002/122] iscsi-target: Drop bogus struct file usage for iSCSI/SCTP Greg Kroah-Hartman
2012-08-07 22:24 ` [ 003/122] mmc: sdhci-pci: CaFe has broken card detection Greg Kroah-Hartman
2012-08-07 22:24 ` [ 004/122] mmc: sdhci: fix incorrect command used in tuning Greg Kroah-Hartman
2012-08-07 22:24 ` [ 005/122] powerpc/ftrace: Fix assembly trampoline register usage Greg Kroah-Hartman
2012-08-07 22:24 ` [ 006/122] powerpc: Add "memory" attribute for mfmsr() Greg Kroah-Hartman
2012-08-07 22:24 ` [ 007/122] powerpc/eeh: Check handle_eeh_events() return value Greg Kroah-Hartman
2012-08-07 22:24 ` [ 008/122] be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC Greg Kroah-Hartman
2012-08-07 22:24 ` [ 009/122] powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS Greg Kroah-Hartman
2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
2012-08-07 22:53   ` Casey Schaufler
2012-08-08  0:11   ` Casey Schaufler
2012-08-07 22:24 ` [ 011/122] SCSI: libsas: continue revalidation Greg Kroah-Hartman
2012-08-07 22:25 ` [ 012/122] SCSI: libsas: fix sas_discover_devices return code handling Greg Kroah-Hartman
2012-08-07 22:25 ` [ 013/122] SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations) Greg Kroah-Hartman
2012-08-07 22:25 ` [ 014/122] SCSI: fix hot unplug vs async scan race Greg Kroah-Hartman
2012-08-07 22:25 ` [ 015/122] SCSI: Fix device removal NULL pointer dereference Greg Kroah-Hartman
2012-08-07 22:25 ` [ 016/122] SCSI: Avoid dangling pointer in scsi_requeue_command() Greg Kroah-Hartman
2012-08-07 22:25 ` [ 017/122] rt2800usb: 2001:3c17 is an RT3370 device Greg Kroah-Hartman
2012-08-07 22:25 ` [ 018/122] ARM: dt: tegra trimslice: enable USB2 port Greg Kroah-Hartman
2012-08-07 22:25 ` [ 019/122] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one Greg Kroah-Hartman
2012-08-07 22:25 ` [ 020/122] ARM: dt: tegra trimslice: add vbus-gpio property Greg Kroah-Hartman
2012-08-07 22:25 ` [ 021/122] ASoC: dapm: Fix locking during codec shutdown Greg Kroah-Hartman
2012-08-07 22:25 ` [ 022/122] ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements Greg Kroah-Hartman
2012-08-07 22:25 ` [ 023/122] ASoC: wm8962: Redo early init of the part on resume Greg Kroah-Hartman
2012-08-07 22:25 ` [ 024/122] ALSA: hda - Add support for Realtek ALC282 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 025/122] ALSA: hda - Turn on PIN_OUT from hdmi playback prepare Greg Kroah-Hartman
2012-08-07 22:25 ` [ 026/122] ALSA: hda - Dont power up when not powered down Greg Kroah-Hartman
2012-08-07 22:25 ` [ 027/122] HID: hid-multitouch: fix input mode feature command Greg Kroah-Hartman
2012-08-07 22:25 ` [ 028/122] usbdevfs: Correct amount of data copied to user in processcompl_compat Greg Kroah-Hartman
2012-08-07 22:25 ` [ 029/122] usb: gadget: Fix g_ether interface link status Greg Kroah-Hartman
2012-08-07 22:25 ` [ 030/122] USB: option: add ZTE MF821D Greg Kroah-Hartman
2012-08-07 22:25 ` [ 031/122] Revert "usb/uas: make sure data urb is gone if we receive status before that" Greg Kroah-Hartman
2012-08-07 22:25 ` [ 032/122] USB: Disable LPM while the device is unconfigured Greg Kroah-Hartman
2012-08-07 22:25 ` [ 033/122] USB: Fix LPM disable/enable during device reset Greg Kroah-Hartman
2012-08-07 22:25 ` [ 034/122] USB: Remove unused LPM variable Greg Kroah-Hartman
2012-08-07 22:25 ` [ 035/122] USB: Fix LPM disable count mismatch on driver unbind Greg Kroah-Hartman
2012-08-07 22:25 ` [ 036/122] ALSA: hda - add dock support for Thinkpad X230 Tablet Greg Kroah-Hartman
2012-08-07 22:25 ` [ 037/122] x86, microcode: Sanitize per-cpu microcode reloading interface Greg Kroah-Hartman
2012-08-07 22:25 ` [ 038/122] x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults Greg Kroah-Hartman
2012-08-07 22:25 ` [ 039/122] locks: fix checking of fcntl_setlease argument Greg Kroah-Hartman
2012-08-07 22:25 ` [ 040/122] batman-adv: fix skb->data assignment Greg Kroah-Hartman
2012-08-09  3:13   ` Ben Hutchings
2012-08-09 15:17     ` Greg Kroah-Hartman
2012-08-07 22:25 ` [ 041/122] ftrace: Disable function tracing during suspend/resume and hibernation, again Greg Kroah-Hartman
2012-08-07 22:25 ` [ 042/122] PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock Greg Kroah-Hartman
2012-08-07 22:25 ` [ 043/122] PM / Sleep: call early resume handlers when suspend_noirq fails Greg Kroah-Hartman
2012-08-07 22:25 ` [ 044/122] TPM: chip disabled state erronously being reported as error Greg Kroah-Hartman
2012-08-07 22:25 ` [ 045/122] tun: fix a crash bug and a memory leak Greg Kroah-Hartman
2012-08-07 22:25 ` [ 046/122] mac80211: fix crash with single-queue drivers Greg Kroah-Hartman
2012-08-07 22:25 ` [ 047/122] b43: fix crash with OpenFWWF Greg Kroah-Hartman
2012-08-07 22:25 ` [ 048/122] mac80211: fix read outside array bounds Greg Kroah-Hartman
2012-08-07 22:25 ` [ 049/122] mac80211: fail authentication when AP denied authentication Greg Kroah-Hartman
2012-08-07 22:25 ` [ 050/122] iwlwifi: Check BSS ctx active before call mac80211 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 051/122] iwlwifi: fix debug print in iwl_sta_calc_ht_flags Greg Kroah-Hartman
2012-08-07 22:25 ` [ 052/122] atl1c: fix issue of io access mode for AR8152 v2.1 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 053/122] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads Greg Kroah-Hartman
2012-08-07 22:25 ` [ 054/122] rtlwifi: rtl8192de: Fix phy-based version calculation Greg Kroah-Hartman
2012-08-07 22:25 ` [ 055/122] mwifiex: correction in mcs index check Greg Kroah-Hartman
2012-08-07 22:25 ` [ 056/122] s390/idle: fix sequence handling vs cpu hotplug Greg Kroah-Hartman
2012-08-07 22:25 ` [ 057/122] s390/mm: downgrade page table after fork of a 31 bit process Greg Kroah-Hartman
2012-08-07 22:25 ` [ 058/122] s390/mm: fix fault handling for page table walk case Greg Kroah-Hartman
2012-08-07 22:25 ` [ 059/122] cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode Greg Kroah-Hartman
2012-08-07 22:25 ` [ 060/122] iommu/amd: Add missing spin_lock initialization Greg Kroah-Hartman
2012-08-07 22:25 ` [ 061/122] iommu/amd: Fix hotplug with iommu=pt Greg Kroah-Hartman
2012-08-07 22:25 ` [ 062/122] udf: Improve table length check to avoid possible overflow Greg Kroah-Hartman
2012-08-07 22:25 ` [ 063/122] stable: update references to older 2.6 versions for 3.x Greg Kroah-Hartman
2012-08-07 22:25 ` [ 064/122] staging: zsmalloc: Finish conversion to a separate module Greg Kroah-Hartman
2012-08-07 22:25 ` [ 065/122] workqueue: perform cpu down operations from low priority cpu_notifier() Greg Kroah-Hartman
2012-08-07 22:25 ` [ 066/122] ACPI, APEI: Fixup common access width firmware bug Greg Kroah-Hartman
2012-08-07 22:25 ` [ 067/122] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check Greg Kroah-Hartman
2012-08-07 22:25 ` [ 068/122] kmsg - properly print over-long continuation lines Greg Kroah-Hartman
2012-08-07 22:25 ` [ 069/122] Btrfs: call the ordered free operation without any locks held Greg Kroah-Hartman
2012-08-07 22:25 ` [ 070/122] cifs: reinstate sec=ntlmv2 mount option Greg Kroah-Hartman
2012-08-07 22:25 ` [ 071/122] cifs: ensure that we always do cifsFileInfo_get under the spinlock Greg Kroah-Hartman
2012-08-07 22:26 ` [ 072/122] spi/pl022: disable port when unused Greg Kroah-Hartman
2012-08-07 22:26 ` [ 073/122] qeth: repair crash in qeth_l3_vlan_rx_kill_vid() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 074/122] tg3: add device id of Apple Thunderbolt Ethernet device Greg Kroah-Hartman
2012-08-07 22:26 ` [ 075/122] tg3: Fix Read DMA workaround for 5719 A0 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 076/122] tg3: Fix race condition in tg3_get_stats64() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 077/122] drm/radeon: fix fence related segfault in CS Greg Kroah-Hartman
2012-08-07 22:26 ` [ 078/122] drm/radeon: fix bo creation retry path Greg Kroah-Hartman
2012-08-07 22:26 ` [ 079/122] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns Greg Kroah-Hartman
2012-08-07 22:26 ` [ 080/122] drm/radeon: fix non revealent error message Greg Kroah-Hartman
2012-08-07 22:26 ` [ 081/122] drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2) Greg Kroah-Hartman
2012-08-07 22:26 ` [ 082/122] drm/radeon: on hotplug force link training to happen (v2) Greg Kroah-Hartman
2012-08-07 22:26 ` [ 083/122] drm/radeon: fix dpms on/off on trinity/aruba v2 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 084/122] drm/nouveau: init vblank requests list Greg Kroah-Hartman
2012-08-07 22:26 ` [ 085/122] posix_types.h: Cleanup stale __NFDBITS and related definitions Greg Kroah-Hartman
2012-08-07 22:26 ` [ 086/122] dm thin: reduce endio_hook pool size Greg Kroah-Hartman
2012-08-07 22:26 ` [ 087/122] dm thin: fix memory leak in process_prepared_mapping error paths Greg Kroah-Hartman
2012-08-07 22:26 ` [ 088/122] nfsd4: our filesystems are normally case sensitive Greg Kroah-Hartman
2012-08-07 22:26 ` [ 089/122] nfsd4: fix cr_principal comparison check in same_creds Greg Kroah-Hartman
2012-08-07 22:26 ` [ 090/122] nfs: skip commit in releasepage if were freeing memory for fs-related reasons Greg Kroah-Hartman
2012-08-07 22:26 ` [ 091/122] NFS: Fix a number of bugs in the idmapper Greg Kroah-Hartman
2012-08-07 22:26 ` [ 092/122] nouveau: Fix alignment requirements on src and dst addresses Greg Kroah-Hartman
2012-08-07 22:26 ` [ 093/122] ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr Greg Kroah-Hartman
2012-08-07 22:26 ` [ 094/122] ext4: fix overhead calculation used by ext4_statfs() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 095/122] ext4: fix hole punch failure when depth is greater than 0 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 096/122] ext4: dont let i_reserved_meta_blocks go negative Greg Kroah-Hartman
2012-08-07 22:26 ` [ 097/122] ext4: undo ext4_calc_metadata_amount if we fail to claim space Greg Kroah-Hartman
2012-08-07 22:26 ` [ 098/122] ext4: use proper csum calculation in ext4_rename Greg Kroah-Hartman
2012-08-07 22:26 ` [ 099/122] ext4: use s_csum_seed instead of i_csum_seed for xattr block Greg Kroah-Hartman
2012-08-07 22:26 ` [ 100/122] net: Fix references to out-of-scope variables in put_cmsg_compat() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 101/122] r8169: revert "add byte queue limit support" Greg Kroah-Hartman
2012-08-07 22:26 ` [ 102/122] caif: fix NULL pointer check Greg Kroah-Hartman
2012-08-07 22:26 ` [ 103/122] wanmain: comparing array with NULL Greg Kroah-Hartman
2012-08-07 22:26 ` [ 104/122] tcp: Add TCP_USER_TIMEOUT negative value check Greg Kroah-Hartman
2012-08-07 22:26 ` [ 105/122] USB: kaweth.c: use GFP_ATOMIC under spin_lock Greg Kroah-Hartman
2012-08-07 22:26 ` [ 106/122] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling Greg Kroah-Hartman
2012-08-07 22:26 ` [ 107/122] tcp: perform DMA to userspace only if there is a task waiting for it Greg Kroah-Hartman
2012-08-07 22:26 ` [ 108/122] net/tun: fix ioctl() based info leaks Greg Kroah-Hartman
2012-08-07 22:26 ` [ 109/122] USB: echi-dbgp: increase the controller wait time to come out of halt Greg Kroah-Hartman
2012-08-07 22:26 ` [ 110/122] ALSA: snd-usb: fix clock source validity index Greg Kroah-Hartman
2012-08-07 22:26 ` [ 111/122] ALSA: mpu401: Fix missing initialization of irq field Greg Kroah-Hartman
2012-08-07 22:26 ` [ 112/122] ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs Greg Kroah-Hartman
2012-08-07 22:26 ` [ 113/122] ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 114/122] ALSA: hda - Fix polarity of mute LED on " Greg Kroah-Hartman
2012-08-07 22:26 ` [ 115/122] ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs Greg Kroah-Hartman
2012-08-07 22:26 ` [ 116/122] ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC Greg Kroah-Hartman
2012-08-07 22:26 ` [ 117/122] ASoC: wm8962: Allow VMID time to fully ramp Greg Kroah-Hartman
2012-08-07 22:26 ` [ 118/122] ASoC: wm8994: Ensure there are enough BCLKs for four channels Greg Kroah-Hartman
2012-08-07 22:26 ` [ 119/122] m68k: Make sys_atomic_cmpxchg_32 work on classic m68k Greg Kroah-Hartman
2012-08-07 22:26 ` [ 120/122] futex: Test for pi_mutex on fault in futex_wait_requeue_pi() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 121/122] futex: Fix bug in WARN_ON for NULL q.pi_state Greg Kroah-Hartman
2012-08-07 22:26 ` [ 122/122] futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi() Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.