All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.12 001/175] xfs: ensure buffer types are set correctly
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 002/175] xfs: inode unlink does not set AGI buffer type Jiri Slaby
                   ` (175 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Chinner, Dave Chinner, Jiri Slaby

From: Dave Chinner <dchinner@redhat.com>

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

===============

commit 0d612fb570b71ea2e49554a770cff4c489018b2c upstream.

Jan Kara reported that log recovery was finding buffers with invalid
types in them. This should not happen, and indicates a bug in the
logging of buffers. To catch this, add asserts to the buffer
formatting code to ensure that the buffer type is in range when the
transaction is committed.

We don't set a type on buffers being marked stale - they are not
going to get replayed, the format item exists only for recovery to
be able to prevent replay of the buffer, so the type does not
matter. Hence that needs special casing here.

Reported-by: Jan Kara <jack@suse.cz>
Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_buf_item.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index f1d85cfc0a54..a0726e475380 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -319,6 +319,10 @@ xfs_buf_item_format(
 	ASSERT(atomic_read(&bip->bli_refcount) > 0);
 	ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
 	       (bip->bli_flags & XFS_BLI_STALE));
+	ASSERT((bip->bli_flags & XFS_BLI_STALE) ||
+	       (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF
+	        && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF));
+
 
 	/*
 	 * If it is an inode buffer, transfer the in-memory state to the
-- 
2.3.0


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

* [PATCH 3.12 002/175] xfs: inode unlink does not set AGI buffer type
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 001/175] xfs: ensure buffer types are set correctly Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 003/175] xfs: set superblock buffer type correctly Jiri Slaby
                   ` (174 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Chinner, Dave Chinner, Jiri Slaby

From: Dave Chinner <dchinner@redhat.com>

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

===============

commit f19b872b086711bb4b22c3a0f52f16aa920bcc61 upstream.

This leads to log recovery throwing errors like:

XFS (md0): Mounting V5 Filesystem
XFS (md0): Starting recovery (logdev: internal)
XFS (md0): Unknown buffer type 0!
XFS (md0): _xfs_buf_ioapply: no ops on block 0xaea8802/0x1
ffff8800ffc53800: 58 41 47 49 .....

Which is the AGI buffer magic number.

Ensure that we set the type appropriately in both unlink list
addition and removal.

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 7a460d8ad06e..e3606f26f82d 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1916,6 +1916,7 @@ xfs_iunlink(
 	agi->agi_unlinked[bucket_index] = cpu_to_be32(agino);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		(sizeof(xfs_agino_t) * bucket_index);
+	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 	return 0;
@@ -2007,6 +2008,7 @@ xfs_iunlink_remove(
 		agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
 		offset = offsetof(xfs_agi_t, agi_unlinked) +
 			(sizeof(xfs_agino_t) * bucket_index);
+		xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 		xfs_trans_log_buf(tp, agibp, offset,
 				  (offset + sizeof(xfs_agino_t) - 1));
 	} else {
-- 
2.3.0


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

* [PATCH 3.12 003/175] xfs: set superblock buffer type correctly
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 001/175] xfs: ensure buffer types are set correctly Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 002/175] xfs: inode unlink does not set AGI buffer type Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 004/175] fsnotify: fix handling of renames in audit Jiri Slaby
                   ` (173 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Chinner, Dave Chinner, Jiri Slaby

From: Dave Chinner <dchinner@redhat.com>

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

===============

commit 3443a3bca54588f43286b725d8648d33a38c86f1 upstream.

When the superblock is modified in a transaction, the commonly
modified fields are not actually copied to the superblock buffer to
avoid the buffer lock becoming a serialisation point. However, there
are some other operations that modify the superblock fields within
the transaction that don't directly log to the superblock but rely
on the changes to be applied during the transaction commit (to
minimise the buffer lock hold time).

When we do this, we fail to mark the buffer log item as being a
superblock buffer and that can lead to the buffer not being marked
with the corect type in the log and hence causing recovery issues.
Fix it by setting the type correctly, similar to xfs_mod_sb()...

Tested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_trans.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 5411e01ab452..b4152a18a99f 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -485,6 +485,7 @@ xfs_trans_apply_sb_deltas(
 		whole = 1;
 	}
 
+	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF);
 	if (whole)
 		/*
 		 * Log the whole thing, the fields are noncontiguous.
-- 
2.3.0


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

* [PATCH 3.12 004/175] fsnotify: fix handling of renames in audit
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 003/175] xfs: set superblock buffer type correctly Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 005/175] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Jiri Slaby
                   ` (172 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jan Kara, Paul Moore, Eric Paris, Andrew Morton,
	Linus Torvalds, Jiri Slaby

From: Jan Kara <jack@suse.cz>

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

===============

commit 6ee8e25fc3e916193bce4ebb43d5439e1e2144ab upstream.

Commit e9fd702a58c4 ("audit: convert audit watches to use fsnotify
instead of inotify") broke handling of renames in audit.  Audit code
wants to update inode number of an inode corresponding to watched name
in a directory.  When something gets renamed into a directory to a
watched name, inotify previously passed moved inode to audit code
however new fsnotify code passes directory inode where the change
happened.  That confuses audit and it starts watching parent directory
instead of a file in a directory.

This can be observed for example by doing:

  cd /tmp
  touch foo bar
  auditctl -w /tmp/foo
  touch foo
  mv bar foo
  touch foo

In audit log we see events like:

  type=CONFIG_CHANGE msg=audit(1423563584.155:90): auid=1000 ses=2 op="updated rules" path="/tmp/foo" key=(null) list=4 res=1
  ...
  type=PATH msg=audit(1423563584.155:91): item=2 name="bar" inode=1046884 dev=08:0 2 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE
  type=PATH msg=audit(1423563584.155:91): item=3 name="foo" inode=1046842 dev=08:0 2 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=DELETE
  type=PATH msg=audit(1423563584.155:91): item=4 name="foo" inode=1046884 dev=08:0 2 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=CREATE
  ...

and that's it - we see event for the first touch after creating the
audit rule, we see events for rename but we don't see any event for the
last touch.  However we start seeing events for unrelated stuff
happening in /tmp.

Fix the problem by passing moved inode as data in the FS_MOVED_FROM and
FS_MOVED_TO events instead of the directory where the change happens.
This doesn't introduce any new problems because noone besides
audit_watch.c cares about the passed value:

  fs/notify/fanotify/fanotify.c cares only about FSNOTIFY_EVENT_PATH events.
  fs/notify/dnotify/dnotify.c doesn't care about passed 'data' value at all.
  fs/notify/inotify/inotify_fsnotify.c uses 'data' only for FSNOTIFY_EVENT_PATH.
  kernel/audit_tree.c doesn't care about passed 'data' at all.
  kernel/audit_watch.c expects moved inode as 'data'.

Fixes: e9fd702a58c49db ("audit: convert audit watches to use fsnotify instead of inotify")
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/fsnotify.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 1c804b057fb1..7ee1774edee5 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -101,8 +101,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
 		new_dir_mask |= FS_ISDIR;
 	}
 
-	fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
-	fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
+	fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,
+		 fs_cookie);
+	fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
+		 fs_cookie);
 
 	if (target)
 		fsnotify_link_count(target);
-- 
2.3.0


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

* [PATCH 3.12 005/175] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 004/175] fsnotify: fix handling of renames in audit Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 006/175] iwlwifi: mvm: validate tid and sta_id in ba_notif Jiri Slaby
                   ` (171 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Emmanuel Grumbach, Jiri Slaby

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

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

===============

commit cd8f438405032ac8ff88bd8f2eca5e0c0063b14b upstream.

The base address of the scheduler in the device's memory
(SRAM) comes from two different sources. The periphery
register and the alive notification from the firmware.
We have a check in iwl_pcie_tx_start that ensures that
they are the same.
When we resume from WoWLAN, the firmware may have crashed
for whatever reason. In that case, the whole device may be
reset which means that the periphery register will hold a
meaningless value. When we come to compare
trans_pcie->scd_base_addr (which really holds the value we
had when we loaded the WoWLAN firmware upon suspend) and
the current value of the register, we don't see a match
unsurprisingly.
Trick the check to avoid a loud yet harmless WARN.
Note that when the WoWLAN has crashed, we will see that
in iwl_trans_pcie_d3_resume which will let the op_mode
know. Once the op_mode is informed that the WowLAN firmware
has crashed, it can't do much besides resetting the whole
device.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/iwlwifi/pcie/tx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 1424335163b9..911a15074ffb 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -729,7 +729,12 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans)
 	iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG,
 			   trans_pcie->kw.dma >> 4);
 
-	iwl_pcie_tx_start(trans, trans_pcie->scd_base_addr);
+	/*
+	 * Send 0 as the scd_base_addr since the device may have be reset
+	 * while we were in WoWLAN in which case SCD_SRAM_BASE_ADDR will
+	 * contain garbage.
+	 */
+	iwl_pcie_tx_start(trans, 0);
 }
 
 /*
-- 
2.3.0


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

* [PATCH 3.12 006/175] iwlwifi: mvm: validate tid and sta_id in ba_notif
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 005/175] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 007/175] iwlwifi: mvm: always use mac color zero Jiri Slaby
                   ` (170 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Eyal Shapira, Eyal Shapira, Emmanuel Grumbach, Jiri Slaby

From: Eyal Shapira <eyal@wizery.com>

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

===============

commit 2cee4762c528a9bd2cdff793197bf591a2196c11 upstream.

These are coming from the FW and are used to access arrays.
Bad values can cause an out of bounds access so discard
such ba_notifs and warn.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index f41add9c8093..c95b4aac1317 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -832,6 +832,11 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
 	sta_id = ba_notif->sta_id;
 	tid = ba_notif->tid;
 
+	if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT ||
+		      tid >= IWL_MAX_TID_COUNT,
+		      "sta_id %d tid %d", sta_id, tid))
+		return 0;
+
 	rcu_read_lock();
 
 	sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
-- 
2.3.0


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

* [PATCH 3.12 007/175] iwlwifi: mvm: always use mac color zero
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 006/175] iwlwifi: mvm: validate tid and sta_id in ba_notif Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 008/175] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Jiri Slaby
                   ` (169 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Luciano Coelho, Emmanuel Grumbach, Jiri Slaby

From: Luciano Coelho <luciano.coelho@intel.com>

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

===============

commit 5523d11cc46393a1e61b7ef4a0b2d4e7ed9521e4 upstream.

We don't really need to use different mac colors when adding mac
contexts, because they're not used anywhere.  In fact, the firmware
doesn't accept 255 as a valid color, so we get into a SYSASSERT 0x3401
when we reach that.

Remove the color increment to use always zero and avoid reaching 255.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 5f6fd44e72f1..c34b011769b7 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -379,9 +379,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
 	mvmvif->uploaded = false;
 	mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
 
-	/* does this make sense at all? */
-	mvmvif->color++;
-
 	spin_lock_bh(&mvm->time_event_lock);
 	iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data);
 	spin_unlock_bh(&mvm->time_event_lock);
-- 
2.3.0


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

* [PATCH 3.12 008/175] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 007/175] iwlwifi: mvm: always use mac color zero Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 009/175] PCI: Generate uppercase hex for modalias var in uevent Jiri Slaby
                   ` (168 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Seth Forshee, Jiri Kosina, Jiri Slaby

From: Seth Forshee <seth.forshee@canonical.com>

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

===============

commit 6d00f37e49d95e640a3937a4a1ae07dbe92a10cb upstream.

d1c7e29e8d27 (HID: i2c-hid: prevent buffer overflow in early IRQ)
changed hid_get_input() to read ihid->bufsize bytes, which can be
more than wMaxInputLength. This is the case with the Dell XPS 13
9343, and it is causing events to be missed. In some cases the
missed events are releases, which can cause the cursor to jump or
freeze, among other problems. Limit the number of bytes read to
min(wMaxInputLength, ihid->bufsize) to prevent such problems.

Fixes: d1c7e29e8d27 "HID: i2c-hid: prevent buffer overflow in early IRQ"
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/i2c-hid/i2c-hid.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index e29d8a0feb5f..f62c65ec117e 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -356,7 +356,10 @@ static int i2c_hid_hwreset(struct i2c_client *client)
 static void i2c_hid_get_input(struct i2c_hid *ihid)
 {
 	int ret, ret_size;
-	int size = ihid->bufsize;
+	int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
+
+	if (size > ihid->bufsize)
+		size = ihid->bufsize;
 
 	ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
 	if (ret != size) {
-- 
2.3.0


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

* [PATCH 3.12 009/175] PCI: Generate uppercase hex for modalias var in uevent
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 008/175] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 010/175] PCI: Fix infinite loop with ROM image of size 0 Jiri Slaby
                   ` (167 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ricardo Ribalda Delgado, Bjorn Helgaas, Jiri Slaby

From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>

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

===============

commit 145b3fe579db66fbe999a2bc3fd5b63dffe9636d upstream.

Some implementations of modprobe fail to load the driver for a PCI device
automatically because the "interface" part of the modalias from the kernel
is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI
r3.0, Appendix D.  Most interface types defined in the spec do not use
alpha characters, so they won't be affected.  For example, 00h, 01h, 10h,
20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we
already do for the Vendor ID, Device ID, Class, etc.

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface
class") fixed only half of the problem.  Some udev implementations rely on
the uevent file and not the modalias file.

Fixes: d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")
Fixes: 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class")
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 53dc57127ca3..150170bb53e6 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1306,7 +1306,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
+	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X",
 			   pdev->vendor, pdev->device,
 			   pdev->subsystem_vendor, pdev->subsystem_device,
 			   (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
-- 
2.3.0


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

* [PATCH 3.12 010/175] PCI: Fix infinite loop with ROM image of size 0
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 009/175] PCI: Generate uppercase hex for modalias var in uevent Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 011/175] cpufreq: speedstep-smi: enable interrupts when waiting Jiri Slaby
                   ` (166 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michel Dänzer, Bjorn Helgaas, Jiri Slaby

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

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

===============

commit 16b036af31e1456cb69243a5a0c9ef801ecd1f17 upstream.

If the image size would ever read as 0, pci_get_rom_size() could keep
processing the same image over and over again.  Exit the loop if we ever
read a length of zero.

This fixes a soft lockup on boot when the radeon driver calls
pci_get_rom_size() on an AMD Radeon R7 250X PCIe discrete graphics card.

[bhelgaas: changelog, reference]
Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386973
Reported-by: Federico <federicotg@gmail.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/rom.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index c5d0a08a8747..d6d499782fb4 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -69,6 +69,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 {
 	void __iomem *image;
 	int last_image;
+	unsigned length;
 
 	image = rom;
 	do {
@@ -91,9 +92,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 		if (readb(pds + 3) != 'R')
 			break;
 		last_image = readb(pds + 21) & 0x80;
-		/* this length is reliable */
-		image += readw(pds + 16) * 512;
-	} while (!last_image);
+		length = readw(pds + 16);
+		image += length * 512;
+	} while (length && !last_image);
 
 	/* never return a size larger than the PCI resource window */
 	/* there are known ROMs that get the size wrong */
-- 
2.3.0


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

* [PATCH 3.12 011/175] cpufreq: speedstep-smi: enable interrupts when waiting
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 010/175] PCI: Fix infinite loop with ROM image of size 0 Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 012/175] cpufreq: s3c: remove incorrect __init annotations Jiri Slaby
                   ` (165 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mikulas Patocka, Rafael J. Wysocki, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

===============

commit d4d4eda23794c701442e55129dd4f8f2fefd5e4d upstream.

On Dell Latitude C600 laptop with Pentium 3 850MHz processor, the
speedstep-smi driver sometimes loads and sometimes doesn't load with
"change to state X failed" message.

The hardware sometimes refuses to change frequency and in this case, we
need to retry later. I found out that we need to enable interrupts while
waiting. When we enable interrupts, the hardware blockage that prevents
frequency transition resolves and the transition is possible. With
disabled interrupts, the blockage doesn't resolve (no matter how long do
we wait). The exact reasons for this hardware behavior are unknown.

This patch enables interrupts in the function speedstep_set_state that can
be called with disabled interrupts. However, this function is called with
disabled interrupts only from speedstep_get_freqs, so it shouldn't cause
any problem.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/cpufreq/speedstep-lib.c |  3 +++
 drivers/cpufreq/speedstep-smi.c | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
index 7047821a7f8a..4ab7a2156672 100644
--- a/drivers/cpufreq/speedstep-lib.c
+++ b/drivers/cpufreq/speedstep-lib.c
@@ -400,6 +400,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor,
 
 	pr_debug("previous speed is %u\n", prev_speed);
 
+	preempt_disable();
 	local_irq_save(flags);
 
 	/* switch to low state */
@@ -464,6 +465,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor,
 
 out:
 	local_irq_restore(flags);
+	preempt_enable();
+
 	return ret;
 }
 EXPORT_SYMBOL_GPL(speedstep_get_freqs);
diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c
index abfba4f731eb..1f6c4adc85d1 100644
--- a/drivers/cpufreq/speedstep-smi.c
+++ b/drivers/cpufreq/speedstep-smi.c
@@ -188,6 +188,7 @@ static void speedstep_set_state(unsigned int state)
 		return;
 
 	/* Disable IRQs */
+	preempt_disable();
 	local_irq_save(flags);
 
 	command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
@@ -198,9 +199,19 @@ static void speedstep_set_state(unsigned int state)
 
 	do {
 		if (retry) {
+			/*
+			 * We need to enable interrupts, otherwise the blockage
+			 * won't resolve.
+			 *
+			 * We disable preemption so that other processes don't
+			 * run. If other processes were running, they could
+			 * submit more DMA requests, making the blockage worse.
+			 */
 			pr_debug("retry %u, previous result %u, waiting...\n",
 					retry, result);
+			local_irq_enable();
 			mdelay(retry * 50);
+			local_irq_disable();
 		}
 		retry++;
 		__asm__ __volatile__(
@@ -217,6 +228,7 @@ static void speedstep_set_state(unsigned int state)
 
 	/* enable IRQs */
 	local_irq_restore(flags);
+	preempt_enable();
 
 	if (new_state == state)
 		pr_debug("change to %u MHz succeeded after %u tries "
-- 
2.3.0


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

* [PATCH 3.12 012/175] cpufreq: s3c: remove incorrect __init annotations
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 011/175] cpufreq: speedstep-smi: enable interrupts when waiting Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 013/175] xen/manage: Fix USB interaction issues when resuming Jiri Slaby
                   ` (164 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Arnd Bergmann, Rafael J. Wysocki, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

===============

commit 61882b63171736571e1139ab5aa929e3bb336016 upstream.

The two functions s3c2416_cpufreq_driver_init and s3c_cpufreq_register
are marked init but are called from a context that might be run after
the __init sections are discarded, as the compiler points out:

WARNING: vmlinux.o(.data+0x1ad9dc): Section mismatch in reference from the variable s3c2416_cpufreq_driver to the function .init.text:s3c2416_cpufreq_driver_init()
WARNING: drivers/built-in.o(.text+0x35b5dc): Section mismatch in reference from the function s3c2410a_cpufreq_add() to the function .init.text:s3c_cpufreq_register()

This removes the __init markings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/cpufreq/s3c2416-cpufreq.c | 4 ++--
 drivers/cpufreq/s3c24xx-cpufreq.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
index 22dcb81ef9d0..e62fb3ffba8a 100644
--- a/drivers/cpufreq/s3c2416-cpufreq.c
+++ b/drivers/cpufreq/s3c2416-cpufreq.c
@@ -295,7 +295,7 @@ out:
 }
 
 #ifdef CONFIG_ARM_S3C2416_CPUFREQ_VCORESCALE
-static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
+static void s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
 {
 	int count, v, i, found;
 	struct cpufreq_frequency_table *freq;
@@ -367,7 +367,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
 	.notifier_call = s3c2416_cpufreq_reboot_notifier_evt,
 };
 
-static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
+static int s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
 {
 	struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
 	struct cpufreq_frequency_table *freq;
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c
index b0f343fcb7ee..83b63f2fa51f 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq.c
@@ -483,7 +483,7 @@ static struct cpufreq_driver s3c24xx_driver = {
 };
 
 
-int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info)
+int s3c_cpufreq_register(struct s3c_cpufreq_info *info)
 {
 	if (!info || !info->name) {
 		printk(KERN_ERR "%s: failed to pass valid information\n",
-- 
2.3.0


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

* [PATCH 3.12 013/175] xen/manage: Fix USB interaction issues when resuming
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 012/175] cpufreq: s3c: remove incorrect __init annotations Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 014/175] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Jiri Slaby
                   ` (163 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ross Lagerwall, David Vrabel, Jiri Slaby

From: Ross Lagerwall <ross.lagerwall@citrix.com>

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

===============

commit 72978b2fe2f2cdf9f319c6c6dcdbe92b38de2be2 upstream.

Commit 61a734d305e1 ("xen/manage: Always freeze/thaw processes when
suspend/resuming") ensured that userspace processes were always frozen
before suspending to reduce interaction issues when resuming devices.
However, freeze_processes() does not freeze kernel threads.  Freeze
kernel threads as well to prevent deadlocks with the khubd thread when
resuming devices.

This is what native suspend and resume does.

Example deadlock:
[ 7279.648010]  [<ffffffff81446bde>] ? xen_poll_irq_timeout+0x3e/0x50
[ 7279.648010]  [<ffffffff81448d60>] xen_poll_irq+0x10/0x20
[ 7279.648010]  [<ffffffff81011723>] xen_lock_spinning+0xb3/0x120
[ 7279.648010]  [<ffffffff810115d1>] __raw_callee_save_xen_lock_spinning+0x11/0x20
[ 7279.648010]  [<ffffffff815620b6>] ? usb_control_msg+0xe6/0x120
[ 7279.648010]  [<ffffffff81747e50>] ? _raw_spin_lock_irq+0x50/0x60
[ 7279.648010]  [<ffffffff8174522c>] wait_for_completion+0xac/0x160
[ 7279.648010]  [<ffffffff8109c520>] ? try_to_wake_up+0x2c0/0x2c0
[ 7279.648010]  [<ffffffff814b60f2>] dpm_wait+0x32/0x40
[ 7279.648010]  [<ffffffff814b6eb0>] device_resume+0x90/0x210
[ 7279.648010]  [<ffffffff814b7d71>] dpm_resume+0x121/0x250
[ 7279.648010]  [<ffffffff8144c570>] ? xenbus_dev_request_and_reply+0xc0/0xc0
[ 7279.648010]  [<ffffffff814b80d5>] dpm_resume_end+0x15/0x30
[ 7279.648010]  [<ffffffff81449fba>] do_suspend+0x10a/0x200
[ 7279.648010]  [<ffffffff8144a2f0>] ? xen_pre_suspend+0x20/0x20
[ 7279.648010]  [<ffffffff8144a1d0>] shutdown_handler+0x120/0x150
[ 7279.648010]  [<ffffffff8144c60f>] xenwatch_thread+0x9f/0x160
[ 7279.648010]  [<ffffffff810ac510>] ? finish_wait+0x80/0x80
[ 7279.648010]  [<ffffffff8108d189>] kthread+0xc9/0xe0
[ 7279.648010]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80
[ 7279.648010]  [<ffffffff8175087c>] ret_from_fork+0x7c/0xb0
[ 7279.648010]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80

[ 7441.216287] INFO: task khubd:89 blocked for more than 120 seconds.
[ 7441.219457]       Tainted: G            X 3.13.11-ckt12.kz #1
[ 7441.222176] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 7441.225827] khubd           D ffff88003f433440     0    89      2 0x00000000
[ 7441.229258]  ffff88003ceb9b98 0000000000000046 ffff88003ce83000 0000000000013440
[ 7441.232959]  ffff88003ceb9fd8 0000000000013440 ffff88003cd13000 ffff88003ce83000
[ 7441.236658]  0000000000000286 ffff88003d3e0000 ffff88003ceb9bd0 00000001001aa01e
[ 7441.240415] Call Trace:
[ 7441.241614]  [<ffffffff817442f9>] schedule+0x29/0x70
[ 7441.243930]  [<ffffffff81743406>] schedule_timeout+0x166/0x2c0
[ 7441.246681]  [<ffffffff81075b80>] ? call_timer_fn+0x110/0x110
[ 7441.249339]  [<ffffffff8174357e>] schedule_timeout_uninterruptible+0x1e/0x20
[ 7441.252644]  [<ffffffff81077710>] msleep+0x20/0x30
[ 7441.254812]  [<ffffffff81555f00>] hub_port_reset+0xf0/0x580
[ 7441.257400]  [<ffffffff81558465>] hub_port_init+0x75/0xb40
[ 7441.259981]  [<ffffffff814bb3c9>] ? update_autosuspend+0x39/0x60
[ 7441.262817]  [<ffffffff814bb4f0>] ? pm_runtime_set_autosuspend_delay+0x50/0xa0
[ 7441.266212]  [<ffffffff8155a64a>] hub_thread+0x71a/0x1750
[ 7441.268728]  [<ffffffff810ac510>] ? finish_wait+0x80/0x80
[ 7441.271272]  [<ffffffff81559f30>] ? usb_port_resume+0x670/0x670
[ 7441.274067]  [<ffffffff8108d189>] kthread+0xc9/0xe0
[ 7441.276305]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80
[ 7441.279131]  [<ffffffff8175087c>] ret_from_fork+0x7c/0xb0
[ 7441.281659]  [<ffffffff8108d0c0>] ? flush_kthread_worker+0x80/0x80

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/xen/manage.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 602913d7ae03..edfd797db341 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -113,10 +113,16 @@ static void do_suspend(void)
 
 	err = freeze_processes();
 	if (err) {
-		pr_err("%s: freeze failed %d\n", __func__, err);
+		pr_err("%s: freeze processes failed %d\n", __func__, err);
 		goto out;
 	}
 
+	err = freeze_kernel_threads();
+	if (err) {
+		pr_err("%s: freeze kernel threads failed %d\n", __func__, err);
+		goto out_thaw;
+	}
+
 	err = dpm_suspend_start(PMSG_FREEZE);
 	if (err) {
 		pr_err("%s: dpm_suspend_start %d\n", __func__, err);
-- 
2.3.0


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

* [PATCH 3.12 014/175] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 013/175] xen/manage: Fix USB interaction issues when resuming Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 015/175] ALSA: off by one bug in snd_riptide_joystick_probe() Jiri Slaby
                   ` (162 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Malcolm Priestley, Mauro Carvalho Chehab, Jiri Slaby

From: Malcolm Priestley <tvboxspy@gmail.com>

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

===============

commit 15e1ce33182d1d5dbd8efe8d382b9352dc857527 upstream.

A quirk of some older firmwares that report endpoint pipe type as PIPE_BULK
but the endpoint otheriwse functions as interrupt.

Check if usb_endpoint_type is USB_ENDPOINT_XFER_BULK and set as usb_rcvbulkpipe.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index f674dc024d06..d2a4e6d40bf0 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -350,6 +350,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
 {
 	struct dvb_usb_device *d = adap_to_d(adap);
 	struct lme2510_state *lme_int = adap_to_priv(adap);
+	struct usb_host_endpoint *ep;
 
 	lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC);
 
@@ -371,6 +372,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
 				adap,
 				8);
 
+	/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */
+	ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);
+
+	if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK)
+		lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa),
+
 	lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
 	usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC);
-- 
2.3.0


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

* [PATCH 3.12 015/175] ALSA: off by one bug in snd_riptide_joystick_probe()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 014/175] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 016/175] ALSA: hdspm - Constrain periods to 2 on older cards Jiri Slaby
                   ` (161 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dan Carpenter, Takashi Iwai, Jiri Slaby

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

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

===============

commit e4940626defdf6c92da1052ad3f12741c1a28c90 upstream.

The problem here is that we check:

	if (dev >= SNDRV_CARDS)

Then we increment "dev".

       if (!joystick_port[dev++])

Then we use it as an offset into a array with SNDRV_CARDS elements.

	if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {

This has 3 effects:
1) If you use the module option to specify the joystick port then it has
   to be shifted one space over.
2) The wrong error message will be printed on failure if you have over
   32 cards.
3) Static checkers will correctly complain that are off by one.

Fixes: db1005ec6ff8 ('ALSA: riptide - Fix joystick resource handling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/riptide/riptide.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 56cc891e395e..d99c8d341e50 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -2032,32 +2032,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id)
 {
 	static int dev;
 	struct gameport *gameport;
+	int ret;
 
 	if (dev >= SNDRV_CARDS)
 		return -ENODEV;
+
 	if (!enable[dev]) {
-		dev++;
-		return -ENOENT;
+		ret = -ENOENT;
+		goto inc_dev;
 	}
 
-	if (!joystick_port[dev++])
-		return 0;
+	if (!joystick_port[dev]) {
+		ret = 0;
+		goto inc_dev;
+	}
 
 	gameport = gameport_allocate_port();
-	if (!gameport)
-		return -ENOMEM;
+	if (!gameport) {
+		ret = -ENOMEM;
+		goto inc_dev;
+	}
 	if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {
 		snd_printk(KERN_WARNING
 			   "Riptide: cannot grab gameport 0x%x\n",
 			   joystick_port[dev]);
 		gameport_free_port(gameport);
-		return -EBUSY;
+		ret = -EBUSY;
+		goto inc_dev;
 	}
 
 	gameport->io = joystick_port[dev];
 	gameport_register_port(gameport);
 	pci_set_drvdata(pci, gameport);
-	return 0;
+
+	ret = 0;
+inc_dev:
+	dev++;
+	return ret;
 }
 
 static void snd_riptide_joystick_remove(struct pci_dev *pci)
-- 
2.3.0


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

* [PATCH 3.12 016/175] ALSA: hdspm - Constrain periods to 2 on older cards
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 015/175] ALSA: off by one bug in snd_riptide_joystick_probe() Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 017/175] power_supply: 88pm860x: Fix leaked power supply on probe fail Jiri Slaby
                   ` (160 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Adrian Knoth, Takashi Iwai, Jiri Slaby

From: Adrian Knoth <adi@drcomp.erfurt.thur.de>

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

===============

commit f0153c3d948c1764f6c920a0675d86fc1d75813e upstream.

RME RayDAT and AIO use a fixed buffer size of 16384 samples. With period
sizes of 32-4096, this translates to 4-512 periods.

The older RME cards have a variable buffer size but require exactly two
periods.

This patch enforces nperiods=2 on those cards.

Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/rme9652/hdspm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 3cde55b753e2..9585e316a5c6 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6107,6 +6107,9 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream)
 		snd_pcm_hw_constraint_minmax(runtime,
 					     SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 					     64, 8192);
+		snd_pcm_hw_constraint_minmax(runtime,
+					     SNDRV_PCM_HW_PARAM_PERIODS,
+					     2, 2);
 		break;
 	}
 
@@ -6181,6 +6184,9 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream)
 		snd_pcm_hw_constraint_minmax(runtime,
 					     SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
 					     64, 8192);
+		snd_pcm_hw_constraint_minmax(runtime,
+					     SNDRV_PCM_HW_PARAM_PERIODS,
+					     2, 2);
 		break;
 	}
 
-- 
2.3.0


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

* [PATCH 3.12 017/175] power_supply: 88pm860x: Fix leaked power supply on probe fail
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 016/175] ALSA: hdspm - Constrain periods to 2 on older cards Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 018/175] power: bq24190: Fix ignored supplicants Jiri Slaby
                   ` (159 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Krzysztof Kozlowski, Sebastian Reichel, Jiri Slaby

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

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

===============

commit 24727b45b484e8937dcde53fa8d1aa70ac30ec0c upstream.

Driver forgot to unregister power supply if request_threaded_irq()
failed in probe(). In such case the memory associated with power supply
leaked.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: a830d28b48bf ("power_supply: Enable battery-charger for 88pm860x")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/power/88pm860x_charger.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index de029bbc1cc1..5ccca8743ce6 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -711,6 +711,7 @@ static int pm860x_charger_probe(struct platform_device *pdev)
 	return 0;
 
 out_irq:
+	power_supply_unregister(&info->usb);
 	while (--i >= 0)
 		free_irq(info->irq[i], info);
 out:
-- 
2.3.0


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

* [PATCH 3.12 018/175] power: bq24190: Fix ignored supplicants
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 017/175] power_supply: 88pm860x: Fix leaked power supply on probe fail Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 019/175] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Jiri Slaby
                   ` (158 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Krzysztof Kozlowski, Sebastian Reichel, Jiri Slaby

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

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

===============

commit 478913fdbdfd4a781d91c993eb86838620fe7421 upstream.

The driver mismatched 'num_supplicants' with 'num_supplies' of
power_supply structure.

It provided list of supplicants (power_supply.supplied_to) but did
not set the number of supplicants. Instead it set the num_supplies which
is used when iterating over number of supplies (power_supply.supplied_from).

As a result the list of supplicants was ignored by core because its size
was 0.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: d7bf353fd0aa ("bq24190_charger: Add support for TI BQ24190 Battery Charger")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/power/bq24190_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c
index ad3ff8fbfbbb..e4c95e1a6733 100644
--- a/drivers/power/bq24190_charger.c
+++ b/drivers/power/bq24190_charger.c
@@ -929,7 +929,7 @@ static void bq24190_charger_init(struct power_supply *charger)
 	charger->properties = bq24190_charger_properties;
 	charger->num_properties = ARRAY_SIZE(bq24190_charger_properties);
 	charger->supplied_to = bq24190_charger_supplied_to;
-	charger->num_supplies = ARRAY_SIZE(bq24190_charger_supplied_to);
+	charger->num_supplicants = ARRAY_SIZE(bq24190_charger_supplied_to);
 	charger->get_property = bq24190_charger_get_property;
 	charger->set_property = bq24190_charger_set_property;
 	charger->property_is_writeable = bq24190_charger_property_is_writeable;
-- 
2.3.0


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

* [PATCH 3.12 019/175] megaraid_sas: disable interrupt_mask before enabling hardware interrupts
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 018/175] power: bq24190: Fix ignored supplicants Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 020/175] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Jiri Slaby
                   ` (157 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Sumit.Saxena, Sumit Saxena, Chaitra Basappa,
	Christoph Hellwig, Jiri Slaby

From: "Sumit.Saxena@avagotech.com" <Sumit.Saxena@avagotech.com>

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

===============

commit c2ced1719a1b903350955a511e1666e6d05a7f5b upstream.

Update driver "mask_interrupts" before enable/disable hardware interrupt
in order to avoid missing interrupts because of "mask_interrupts" still
set to 1 and hardware interrupts are enabled.

Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index f6555921fd7a..a1f04e3b2a8f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -92,6 +92,8 @@ megasas_enable_intr_fusion(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
 	regs = instance->reg_set;
+
+	instance->mask_interrupts = 0;
 	/* For Thunderbolt/Invader also clear intr on enable */
 	writel(~0, &regs->outbound_intr_status);
 	readl(&regs->outbound_intr_status);
@@ -100,7 +102,6 @@ megasas_enable_intr_fusion(struct megasas_instance *instance)
 
 	/* Dummy readl to force pci flush */
 	readl(&regs->outbound_intr_mask);
-	instance->mask_interrupts = 0;
 }
 
 /**
-- 
2.3.0


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

* [PATCH 3.12 020/175] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 019/175] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 021/175] nfs: don't call blocking operations while !TASK_RUNNING Jiri Slaby
                   ` (156 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jisheng Zhang, Ulf Hansson, Jiri Slaby

From: Jisheng Zhang <jszhang@marvell.com>

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

===============

commit 14460dbaf7a5a0488963fdb8232ad5c8a8cca7b7 upstream.

Current code checks "clk_delay_cycles > 0" to know whether the optional
"mrvl,clk_delay_cycles" is set or not. But of_property_read_u32() doesn't
touch clk_delay_cycles if the property is not set. And type of
clk_delay_cycles is u32, so we may always set pdata->clk_delay_cycles as a
random value.

This patch fix this problem by check the return value of of_property_read_u32()
to know whether the optional clk-delay-cycles is set or not.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mmc/host/sdhci-pxav3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 793dacd3b841..561c6b4907a1 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -201,8 +201,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev)
 	if (!pdata)
 		return NULL;
 
-	of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles);
-	if (clk_delay_cycles > 0)
+	if (!of_property_read_u32(np, "mrvl,clk-delay-cycles",
+				  &clk_delay_cycles))
 		pdata->clk_delay_cycles = clk_delay_cycles;
 
 	return pdata;
-- 
2.3.0


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

* [PATCH 3.12 021/175] nfs: don't call blocking operations while !TASK_RUNNING
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 020/175] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Jiri Slaby
@ 2015-03-17  8:39 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 022/175] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Jiri Slaby
                   ` (155 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:39 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jeff Layton, Trond Myklebust, Jiri Slaby

From: Jeff Layton <jlayton@primarydata.com>

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

===============

commit 6ffa30d3f734d4f6b478081dfc09592021028f90 upstream.

Bruce reported seeing this warning pop when mounting using v4.1:

     ------------[ cut here ]------------
     WARNING: CPU: 1 PID: 1121 at kernel/sched/core.c:7300 __might_sleep+0xbd/0xd0()
    do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffff810ff58f>] prepare_to_wait+0x2f/0x90
    Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace sunrpc fscache ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_pcm snd_timer ppdev joydev snd virtio_console virtio_balloon pcspkr serio_raw parport_pc parport pvpanic floppy soundcore i2c_piix4 virtio_blk virtio_net qxl drm_kms_helper ttm drm virtio_pci virtio_ring ata_generic virtio pata_acpi
    CPU: 1 PID: 1121 Comm: nfsv4.1-svc Not tainted 3.19.0-rc4+ #25
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140709_153950- 04/01/2014
     0000000000000000 000000004e5e3f73 ffff8800b998fb48 ffffffff8186ac78
     0000000000000000 ffff8800b998fba0 ffff8800b998fb88 ffffffff810ac9da
     ffff8800b998fb68 ffffffff81c923e7 00000000000004d9 0000000000000000
    Call Trace:
     [<ffffffff8186ac78>] dump_stack+0x4c/0x65
     [<ffffffff810ac9da>] warn_slowpath_common+0x8a/0xc0
     [<ffffffff810aca65>] warn_slowpath_fmt+0x55/0x70
     [<ffffffff810ff58f>] ? prepare_to_wait+0x2f/0x90
     [<ffffffff810ff58f>] ? prepare_to_wait+0x2f/0x90
     [<ffffffff810dd2ad>] __might_sleep+0xbd/0xd0
     [<ffffffff8124c973>] kmem_cache_alloc_trace+0x243/0x430
     [<ffffffff810d941e>] ? groups_alloc+0x3e/0x130
     [<ffffffff810d941e>] groups_alloc+0x3e/0x130
     [<ffffffffa0301b1e>] svcauth_unix_accept+0x16e/0x290 [sunrpc]
     [<ffffffffa0300571>] svc_authenticate+0xe1/0xf0 [sunrpc]
     [<ffffffffa02fc564>] svc_process_common+0x244/0x6a0 [sunrpc]
     [<ffffffffa02fd044>] bc_svc_process+0x1c4/0x260 [sunrpc]
     [<ffffffffa03d5478>] nfs41_callback_svc+0x128/0x1f0 [nfsv4]
     [<ffffffff810ff970>] ? wait_woken+0xc0/0xc0
     [<ffffffffa03d5350>] ? nfs4_callback_svc+0x60/0x60 [nfsv4]
     [<ffffffff810d45bf>] kthread+0x11f/0x140
     [<ffffffff810ea815>] ? local_clock+0x15/0x30
     [<ffffffff810d44a0>] ? kthread_create_on_node+0x250/0x250
     [<ffffffff81874bfc>] ret_from_fork+0x7c/0xb0
     [<ffffffff810d44a0>] ? kthread_create_on_node+0x250/0x250
    ---[ end trace 675220a11e30f4f2 ]---

nfs41_callback_svc does most of its work while in TASK_INTERRUPTIBLE,
which is just wrong. Fix that by finishing the wait immediately if we've
found that the list has something on it.

Also, we don't expect this kthread to accept signals, so we should be
using a TASK_UNINTERRUPTIBLE sleep instead. That however, opens us up
hung task warnings from the watchdog, so have the schedule_timeout
wake up every 60s if there's no callback activity.

Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/callback.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 67cd73213168..f4cac2b06ac3 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -128,22 +128,24 @@ nfs41_callback_svc(void *vrqstp)
 		if (try_to_freeze())
 			continue;
 
-		prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
+		prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE);
 		spin_lock_bh(&serv->sv_cb_lock);
 		if (!list_empty(&serv->sv_cb_list)) {
 			req = list_first_entry(&serv->sv_cb_list,
 					struct rpc_rqst, rq_bc_list);
 			list_del(&req->rq_bc_list);
 			spin_unlock_bh(&serv->sv_cb_lock);
+			finish_wait(&serv->sv_cb_waitq, &wq);
 			dprintk("Invoking bc_svc_process()\n");
 			error = bc_svc_process(serv, req, rqstp);
 			dprintk("bc_svc_process() returned w/ error code= %d\n",
 				error);
 		} else {
 			spin_unlock_bh(&serv->sv_cb_lock);
-			schedule();
+			/* schedule_timeout to game the hung task watchdog */
+			schedule_timeout(60 * HZ);
+			finish_wait(&serv->sv_cb_waitq, &wq);
 		}
-		finish_wait(&serv->sv_cb_waitq, &wq);
 	}
 	return 0;
 }
-- 
2.3.0


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

* [PATCH 3.12 022/175] MIPS: KVM: Deliver guest interrupts after local_irq_disable()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2015-03-17  8:39 ` [PATCH 3.12 021/175] nfs: don't call blocking operations while !TASK_RUNNING Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 023/175] mm/hugetlb: pmd_huge() returns true for non-present hugepage Jiri Slaby
                   ` (154 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, James Hogan, Paolo Bonzini, Gleb Natapov, kvm,
	Ralf Baechle, linux-mips, Sanjay Lal, Jiri Slaby

From: James Hogan <james.hogan@imgtec.com>

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

===============

commit 044f0f03eca0110e1835b2ea038a484b93950328 upstream.

When about to run the guest, deliver guest interrupts after disabling
host interrupts. This should prevent an hrtimer interrupt from being
handled after delivering guest interrupts, and therefore not delivering
the guest timer interrupt until after the next guest exit.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: Sanjay Lal <sanjayl@kymasys.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kvm/kvm_mips.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 3f3e5b2b2f38..016f163b42da 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -417,11 +417,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 		vcpu->mmio_needed = 0;
 	}
 
+	local_irq_disable();
 	/* Check if we have any exceptions/interrupts pending */
 	kvm_mips_deliver_interrupts(vcpu,
 				    kvm_read_c0_guest_cause(vcpu->arch.cop0));
 
-	local_irq_disable();
 	kvm_guest_enter();
 
 	r = __kvm_mips_vcpu_run(run, vcpu);
-- 
2.3.0


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

* [PATCH 3.12 023/175] mm/hugetlb: pmd_huge() returns true for non-present hugepage
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 022/175] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 024/175] tracing: Fix unmapping loop in tracing_mark_write Jiri Slaby
                   ` (153 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, Hugh Dickins, James Hogan,
	David Rientjes, Mel Gorman, Johannes Weiner, Michal Hocko,
	Rik van Riel, Andrea Arcangeli, Luiz Capitulino,
	Nishanth Aravamudan, Lee Schermerhorn, Steve Capper,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

===============

commit cbef8478bee55775ac312a574aad48af7bb9cf9f upstream.

Migrating hugepages and hwpoisoned hugepages are considered as non-present
hugepages, and they are referenced via migration entries and hwpoison
entries in their page table slots.

This behavior causes race condition because pmd_huge() doesn't tell
non-huge pages from migrating/hwpoisoned hugepages.  follow_page_mask() is
one example where the kernel would call follow_page_pte() for such
hugepage while this function is supposed to handle only normal pages.

To avoid this, this patch makes pmd_huge() return true when pmd_none() is
true *and* pmd_present() is false.  We don't have to worry about mixing up
non-present pmd entry with normal pmd (pointing to leaf level pte entry)
because pmd_present() is true in normal pmd.

The same race condition could happen in (x86-specific) gup_pmd_range(),
where this patch simply adds pmd_present() check instead of pmd_huge().
This is because gup_pmd_range() is fast path.  If we have non-present
hugepage in this function, we will go into gup_huge_pmd(), then return 0
at flag mask check, and finally fall back to the slow path.

Fixes: 290408d4a2 ("hugetlb: hugepage migration core")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/gup.c         | 2 +-
 arch/x86/mm/hugetlbpage.c | 8 +++++++-
 mm/hugetlb.c              | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 0596e8e0cc19..5bb7b365c519 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -172,7 +172,7 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
 		 */
 		if (pmd_none(pmd) || pmd_trans_splitting(pmd))
 			return 0;
-		if (unlikely(pmd_large(pmd))) {
+		if (unlikely(pmd_large(pmd) || !pmd_present(pmd))) {
 			/*
 			 * NUMA hinting faults need to be handled in the GUP
 			 * slowpath for accounting purposes and so that they
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index fa029fb2afae..e473dbe45c0f 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -66,9 +66,15 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
 	return ERR_PTR(-EINVAL);
 }
 
+/*
+ * pmd_huge() returns 1 if @pmd is hugetlb related entry, that is normal
+ * hugetlb entry or non-present (migration or hwpoisoned) hugetlb entry.
+ * Otherwise, returns 0.
+ */
 int pmd_huge(pmd_t pmd)
 {
-	return !!(pmd_val(pmd) & _PAGE_PSE);
+	return !pmd_none(pmd) &&
+		(pmd_val(pmd) & (_PAGE_PRESENT|_PAGE_PSE)) != _PAGE_PRESENT;
 }
 
 int pud_huge(pud_t pud)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c33d8a65298c..0b46aedef779 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3466,6 +3466,8 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 {
 	struct page *page;
 
+	if (!pmd_present(*pmd))
+		return NULL;
 	page = pte_page(*(pte_t *)pmd);
 	if (page)
 		page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
-- 
2.3.0


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

* [PATCH 3.12 024/175] tracing: Fix unmapping loop in tracing_mark_write
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 023/175] mm/hugetlb: pmd_huge() returns true for non-present hugepage Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 025/175] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Jiri Slaby
                   ` (152 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vikram Mulukutla, Steven Rostedt, Jiri Slaby

From: Vikram Mulukutla <markivx@codeaurora.org>

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

===============

commit 7215853e985a4bef1a6c14e00e89dfec84f1e457 upstream.

Commit 6edb2a8a385f0cdef51dae37ff23e74d76d8a6ce introduced
an array map_pages that contains the addresses returned by
kmap_atomic. However, when unmapping those pages, map_pages[0]
is unmapped before map_pages[1], breaking the nesting requirement
as specified in the documentation for kmap_atomic/kunmap_atomic.

This was caught by the highmem debug code present in kunmap_atomic.
Fix the loop to do the unmapping properly.

Link: http://lkml.kernel.org/r/1418871056-6614-1-git-send-email-markivx@codeaurora.org

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Reported-by: Lime Yang <limey@codeaurora.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 691a8ea6f472..1b51436db225 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4599,7 +4599,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 	*fpos += written;
 
  out_unlock:
-	for (i = 0; i < nr_pages; i++){
+	for (i = nr_pages - 1; i >= 0; i--) {
 		kunmap_atomic(map_page[i]);
 		put_page(pages[i]);
 	}
-- 
2.3.0


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

* [PATCH 3.12 025/175] ARM: 8284/1: sa1100: clear RCSR_SMR on resume
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 024/175] tracing: Fix unmapping loop in tracing_mark_write Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 026/175] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Jiri Slaby
                   ` (151 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dmitry Eremin-Solenikov, Russell King, Jiri Slaby

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

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

===============

commit e461894dc2ce7778ccde1c3483c9b15a85a7fc5f upstream.

StrongARM core uses RCSR SMR bit to tell to bootloader that it was reset
by entering the sleep mode. After we have resumed, there is little point
in having that bit enabled. Moreover, if this bit is set before reboot,
the bootloader can become confused. Thus clear the SMR bit on resume
just before clearing the scratchpad (resume address) register.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-sa1100/pm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 6645d1e31f14..34853d5dfda2 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -81,6 +81,7 @@ static int sa11x0_pm_enter(suspend_state_t state)
 	/*
 	 * Ensure not to come back here if it wasn't intended
 	 */
+	RCSR = RCSR_SMR;
 	PSPR = 0;
 
 	/*
-- 
2.3.0


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

* [PATCH 3.12 026/175] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 025/175] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 027/175] ARM: dts: am335x-bone*: usb0 is hardwired for peripheral Jiri Slaby
                   ` (150 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lokesh Vutla, Paul Walmsley, Jiri Slaby

From: Lokesh Vutla <lokeshvutla@ti.com>

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

===============

commit 1c7e36bfc3e2fb2df5e2d1989a4b6fb9055a0f9b upstream.

With commit '7dedd34: ARM: OMAP2+: hwmod: Fix a crash in _setup_reset()
with DEBUG_LL' we moved from parsing cmdline to identify uart used
for earlycon to using the requsite hwmod CONFIG_DEBUG_OMAPxUARTy FLAGS.

On DRA7 UART3 hwmod doesn't have this flag enabled, and atleast on
BeagleBoard-X15, where we use UART3 for console, boot fails with
DEBUG_LL enabled. Enable DEBUG_OMAP4UART3_FLAGS for UART3 hwmod.

For using DEBUG_LL, enable CONFIG_DEBUG_OMAP4UART3 in menuconfig.

Fixes: 90020c7b2c5e ("ARM: OMAP: DRA7: hwmod: Create initial DRA7XX SoC data")
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 18f333c440db..3d41b06a9926 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1669,7 +1669,7 @@ static struct omap_hwmod dra7xx_uart3_hwmod = {
 	.class		= &dra7xx_uart_hwmod_class,
 	.clkdm_name	= "l4per_clkdm",
 	.main_clk	= "uart3_gfclk_mux",
-	.flags		= HWMOD_SWSUP_SIDLE_ACT,
+	.flags		= HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP4UART3_FLAGS,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_offs = DRA7XX_CM_L4PER_UART3_CLKCTRL_OFFSET,
-- 
2.3.0


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

* [PATCH 3.12 027/175] ARM: dts: am335x-bone*: usb0 is hardwired for peripheral
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 026/175] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 028/175] tpm_tis: verify interrupt during init Jiri Slaby
                   ` (149 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Robert Nelson, Tony Lindgren, Jiri Slaby

From: Robert Nelson <robertcnelson@gmail.com>

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

===============

commit 67fd14b3eca63b14429350e9eadc5fab709a8821 upstream.

Fixes: http://bugs.elinux.org/issues/127

the bb.org community was seeing random reboots before this change.

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/boot/dts/am335x-bone-common.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index e6e952e32117..b9d31187d0de 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -134,6 +134,7 @@
 
 			usb@47401000 {
 				status = "okay";
+				dr_mode = "peripheral";
 			};
 
 			usb@47401800 {
-- 
2.3.0


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

* [PATCH 3.12 028/175] tpm_tis: verify interrupt during init
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 027/175] ARM: dts: am335x-bone*: usb0 is hardwired for peripheral Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 029/175] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Jiri Slaby
                   ` (148 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Scot Doyle, Peter Huewe, Jiri Slaby

From: Scot Doyle <lkml14@scotdoyle.com>

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

===============

commit 448e9c55c12d6bd4fa90a7e31d802e045666d7c8 upstream.

Some machines, such as the Acer C720 and Toshiba CB35, have TPMs that do
not send IRQs while also having an ACPI TPM entry indicating that they
will be sent. These machines freeze on resume while the tpm_tis module
waits for an IRQ, eventually timing out.

When in interrupt mode, the tpm_tis module should receive an IRQ during
module init. Fall back to polling mode if none is received when expected.

Signed-off-by: Scot Doyle <lkml14@scotdoyle.com>
Tested-by: Michael Mullin <masmullin@gmail.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
[phuewe: minor checkpatch fixed]
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/tpm/tpm_tis.c | 76 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 62 insertions(+), 14 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index e7b1a0ae4300..7f8598387702 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -75,6 +75,10 @@ enum tis_defaults {
 #define	TPM_DID_VID(l)			(0x0F00 | ((l) << 12))
 #define	TPM_RID(l)			(0x0F04 | ((l) << 12))
 
+struct priv_data {
+	bool irq_tested;
+};
+
 static LIST_HEAD(tis_chips);
 static DEFINE_MUTEX(tis_lock);
 
@@ -338,12 +342,27 @@ out_err:
 	return rc;
 }
 
+static void disable_interrupts(struct tpm_chip *chip)
+{
+	u32 intmask;
+
+	intmask =
+	    ioread32(chip->vendor.iobase +
+		     TPM_INT_ENABLE(chip->vendor.locality));
+	intmask &= ~TPM_GLOBAL_INT_ENABLE;
+	iowrite32(intmask,
+		  chip->vendor.iobase +
+		  TPM_INT_ENABLE(chip->vendor.locality));
+	free_irq(chip->vendor.irq, chip);
+	chip->vendor.irq = 0;
+}
+
 /*
  * If interrupts are used (signaled by an irq set in the vendor structure)
  * tpm.c can skip polling for the data to be available as the interrupt is
  * waited for here
  */
-static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
+static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
 {
 	int rc;
 	u32 ordinal;
@@ -373,6 +392,30 @@ out_err:
 	return rc;
 }
 
+static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
+{
+	int rc, irq;
+	struct priv_data *priv = chip->vendor.priv;
+
+	if (!chip->vendor.irq || priv->irq_tested)
+		return tpm_tis_send_main(chip, buf, len);
+
+	/* Verify receipt of the expected IRQ */
+	irq = chip->vendor.irq;
+	chip->vendor.irq = 0;
+	rc = tpm_tis_send_main(chip, buf, len);
+	chip->vendor.irq = irq;
+	if (!priv->irq_tested)
+		msleep(1);
+	if (!priv->irq_tested) {
+		disable_interrupts(chip);
+		dev_err(chip->dev,
+			FW_BUG "TPM interrupt not working, polling instead\n");
+	}
+	priv->irq_tested = true;
+	return rc;
+}
+
 struct tis_vendor_timeout_override {
 	u32 did_vid;
 	unsigned long timeout_us[4];
@@ -546,6 +589,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
 	if (interrupt == 0)
 		return IRQ_NONE;
 
+	((struct priv_data *)chip->vendor.priv)->irq_tested = true;
 	if (interrupt & TPM_INTF_DATA_AVAIL_INT)
 		wake_up_interruptible(&chip->vendor.read_queue);
 	if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT)
@@ -575,9 +619,14 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 	u32 vendor, intfcaps, intmask;
 	int rc, i, irq_s, irq_e, probe;
 	struct tpm_chip *chip;
+	struct priv_data *priv;
 
+	priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL);
+	if (priv == NULL)
+		return -ENOMEM;
 	if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
 		return -ENODEV;
+	chip->vendor.priv = priv;
 
 	chip->vendor.iobase = ioremap(start, len);
 	if (!chip->vendor.iobase) {
@@ -646,19 +695,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 	if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
 		dev_dbg(dev, "\tData Avail Int Support\n");
 
-	/* get the timeouts before testing for irqs */
-	if (tpm_get_timeouts(chip)) {
-		dev_err(dev, "Could not get TPM timeouts and durations\n");
-		rc = -ENODEV;
-		goto out_err;
-	}
-
-	if (tpm_do_selftest(chip)) {
-		dev_err(dev, "TPM self test failed\n");
-		rc = -ENODEV;
-		goto out_err;
-	}
-
 	/* INTERRUPT Setup */
 	init_waitqueue_head(&chip->vendor.read_queue);
 	init_waitqueue_head(&chip->vendor.int_queue);
@@ -760,6 +796,18 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 		}
 	}
 
+	if (tpm_get_timeouts(chip)) {
+		dev_err(dev, "Could not get TPM timeouts and durations\n");
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	if (tpm_do_selftest(chip)) {
+		dev_err(dev, "TPM self test failed\n");
+		rc = -ENODEV;
+		goto out_err;
+	}
+
 	INIT_LIST_HEAD(&chip->vendor.list);
 	mutex_lock(&tis_lock);
 	list_add(&chip->vendor.list, &tis_chips);
-- 
2.3.0


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

* [PATCH 3.12 029/175] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 028/175] tpm_tis: verify interrupt during init Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 030/175] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Jiri Slaby
                   ` (147 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Howells, Peter Huewe, Jiri Slaby

From: David Howells <dhowells@redhat.com>

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

===============

commit 398a1e71dc827b994b7f2f56c7c2186fea7f8d75 upstream.

Add newly registered TPMs to the tail of the list, not the beginning, so that
things that are specifying TPM_ANY_NUM don't find that the device they're
using has inadvertently changed.  Adding a second device would break IMA, for
instance.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/tpm/tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 48138b311460..23c71e7a875f 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1583,7 +1583,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
 
 	/* Make chip available */
 	spin_lock(&driver_lock);
-	list_add_rcu(&chip->list, &tpm_chip_list);
+	list_add_tail_rcu(&chip->list, &tpm_chip_list);
 	spin_unlock(&driver_lock);
 
 	return chip;
-- 
2.3.0


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

* [PATCH 3.12 030/175] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 029/175] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 031/175] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Jiri Slaby
                   ` (146 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hon Ching (Vicky) Lo, Peter Huewe, Jiri Slaby

From: "Hon Ching (Vicky) Lo" <honclo@linux.vnet.ibm.com>

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

===============

commit 84eb186bc37c0900b53077ca21cf6dd15823a232 upstream.

There was an oops in tpm_ibmvtpm_get_desired_dma, which caused
kernel panic during boot when vTPM is enabled in Power partition
configured in AMS mode.

vio_bus_probe calls vio_cmo_bus_probe which calls
tpm_ibmvtpm_get_desired_dma to get the size needed for DMA allocation.
The problem is, vio_cmo_bus_probe is called before calling probe, which
for vtpm is tpm_ibmvtpm_probe and it's this function that initializes
and sets up vtpm's CRQ and gets required data values.  Therefore,
since this has not yet been done, NULL is returned in attempt to get
the size for DMA allocation.

We added a NULL check.  In addition, a default buffer size will
be set when NULL is returned.

Signed-off-by: Hon Ching (Vicky) Lo <honclo@linux.vnet.ibm.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 56b07c35a13e..010d814dd9f5 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -307,6 +307,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev)
 static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev)
 {
 	struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev);
+
+	/* ibmvtpm initializes at probe time, so the data we are
+	* asking for may not be set yet. Estimate that 4K required
+	* for TCE-mapped buffer in addition to CRQ.
+	*/
+	if (!ibmvtpm)
+		return CRQ_RES_BUF_SIZE + PAGE_SIZE;
+
 	return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size;
 }
 
-- 
2.3.0


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

* [PATCH 3.12 031/175] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 030/175] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 032/175] Added Little Endian support to vtpm module Jiri Slaby
                   ` (145 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Christophe Ricard, Christophe Ricard, Peter Huewe,
	Jiri Slaby

From: Christophe Ricard <christophe.ricard@gmail.com>

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

===============

commit 1ba3b0b6f218072afe8372d12f1b6bf26a26008e upstream.

When sending data in tpm_stm_i2c_send, each loop iteration send buf.
Send buf + i instead as the goal of this for loop is to send a number
of byte from buf that fit in burstcnt. Once those byte are sent, we are
supposed to send the next ones.

The driver was working because the burstcount value returns always the maximum size for a TPM
command or response. (0x800 for a command and 0x400 for a response).

Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/tpm/tpm_i2c_stm_st33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 06af39ca901e..3f9edcd33f65 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
 		if (burstcnt < 0)
 			return burstcnt;
 		size = min_t(int, len - i - 1, burstcnt);
-		ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size);
+		ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size);
 		if (ret < 0)
 			goto out_err;
 
-- 
2.3.0


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

* [PATCH 3.12 032/175] Added Little Endian support to vtpm module
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 031/175] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 033/175] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Jiri Slaby
                   ` (144 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, honclo, Hon Ching(Vicky) Lo, Joy Latten,
	Peter Huewe, Jiri Slaby

From: honclo <honclo@imap.linux.ibm.com>

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

===============

commit eb71f8a5e33fa1066fb92f0111ab366a341e1f6c upstream.

The tpm_ibmvtpm module is affected by an unaligned access problem.
ibmvtpm_crq_get_version failed with rc=-4 during boot when vTPM is
enabled in Power partition, which supports both little endian and
big endian modes.

We added little endian support to fix this problem:
1) added cpu_to_be64 calls to ensure BE data is sent from an LE OS.
2) added be16_to_cpu and be32_to_cpu calls to make sure data received
   is in LE format on a LE OS.

Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
Signed-off-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
[phuewe: manually applied the patch :( ]
Reviewed-by: Ashley Lai <ashley@ahsleylai.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/tpm/tpm_ibmvtpm.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 010d814dd9f5..538856f3e68a 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -148,7 +148,8 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
 	crq.len = (u16)count;
 	crq.data = ibmvtpm->rtce_dma_handle;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]),
+			      cpu_to_be64(word[1]));
 	if (rc != H_SUCCESS) {
 		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
 		rc = 0;
@@ -186,7 +187,8 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm)
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]),
+			      cpu_to_be64(buf[1]));
 	if (rc != H_SUCCESS)
 		dev_err(ibmvtpm->dev,
 			"ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc);
@@ -212,7 +214,8 @@ static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm)
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_GET_VERSION;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]),
+			      cpu_to_be64(buf[1]));
 	if (rc != H_SUCCESS)
 		dev_err(ibmvtpm->dev,
 			"ibmvtpm_crq_get_version failed rc=%d\n", rc);
@@ -335,7 +338,8 @@ static int tpm_ibmvtpm_suspend(struct device *dev)
 	crq.valid = (u8)IBMVTPM_VALID_CMD;
 	crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND;
 
-	rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]);
+	rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]),
+			      cpu_to_be64(buf[1]));
 	if (rc != H_SUCCESS)
 		dev_err(ibmvtpm->dev,
 			"tpm_ibmvtpm_suspend failed rc=%d\n", rc);
@@ -519,11 +523,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
 	case IBMVTPM_VALID_CMD:
 		switch (crq->msg) {
 		case VTPM_GET_RTCE_BUFFER_SIZE_RES:
-			if (crq->len <= 0) {
+			if (be16_to_cpu(crq->len) <= 0) {
 				dev_err(ibmvtpm->dev, "Invalid rtce size\n");
 				return;
 			}
-			ibmvtpm->rtce_size = crq->len;
+			ibmvtpm->rtce_size = be16_to_cpu(crq->len);
 			ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size,
 						    GFP_KERNEL);
 			if (!ibmvtpm->rtce_buf) {
@@ -544,11 +548,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
 
 			return;
 		case VTPM_GET_VERSION_RES:
-			ibmvtpm->vtpm_version = crq->data;
+			ibmvtpm->vtpm_version = be32_to_cpu(crq->data);
 			return;
 		case VTPM_TPM_COMMAND_RES:
 			/* len of the data in rtce buffer */
-			ibmvtpm->res_len = crq->len;
+			ibmvtpm->res_len = be16_to_cpu(crq->len);
 			wake_up_interruptible(&ibmvtpm->wq);
 			return;
 		default:
-- 
2.3.0


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

* [PATCH 3.12 033/175] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 032/175] Added Little Endian support to vtpm module Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 034/175] iscsi-target: Drop problematic active_ts_list usage Jiri Slaby
                   ` (143 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Trond Myklebust, Jiri Slaby

From: Trond Myklebust <trond.myklebust@primarydata.com>

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

===============

commit d8ba1f971497c19cf80da1ea5391a46a5f9fbd41 upstream.

If the call to decode_rc_list() fails due to a memory allocation error,
then we need to truncate the array size to ensure that we only call
kfree() on those pointer that were allocated.

Reported-by: David Ramos <daramos@stanford.edu>
Fixes: 4aece6a19cf7f ("nfs41: cb_sequence xdr implementation")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/callback_xdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index f4ccfe6521ec..02f8d09e119f 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,
 
 		for (i = 0; i < args->csa_nrclists; i++) {
 			status = decode_rc_list(xdr, &args->csa_rclists[i]);
-			if (status)
+			if (status) {
+				args->csa_nrclists = i;
 				goto out_free;
+			}
 		}
 	}
 	status = 0;
-- 
2.3.0


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

* [PATCH 3.12 034/175] iscsi-target: Drop problematic active_ts_list usage
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 033/175] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 035/175] cfq-iosched: handle failure of cfq group allocation Jiri Slaby
                   ` (142 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicholas Bellinger, Jiri Slaby

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

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

===============

commit 3fd7b60f2c7418239d586e359e0c6d8503e10646 upstream.

This patch drops legacy active_ts_list usage within iscsi_target_tq.c
code.  It was originally used to track the active thread sets during
iscsi-target shutdown, and is no longer used by modern upstream code.

Two people have reported list corruption using traditional iscsi-target
and iser-target with the following backtrace, that appears to be related
to iscsi_thread_set->ts_list being used across both active_ts_list and
inactive_ts_list.

[   60.782534] ------------[ cut here ]------------
[   60.782543] WARNING: CPU: 0 PID: 9430 at lib/list_debug.c:53 __list_del_entry+0x63/0xd0()
[   60.782545] list_del corruption, ffff88045b00d180->next is LIST_POISON1 (dead000000100100)
[   60.782546] Modules linked in: ib_srpt tcm_qla2xxx qla2xxx tcm_loop tcm_fc ...
[   60.782597] CPU: 0 PID: 9430 Comm: iscsi_ttx Tainted: GF 3.12.19+ #2
[   60.782598] Hardware name: Supermicro X9DRX+-F/X9DRX+-F, BIOS 3.00 07/09/2013
[   60.782599]  0000000000000035 ffff88044de31d08 ffffffff81553ae7 0000000000000035
[   60.782602]  ffff88044de31d58 ffff88044de31d48 ffffffff8104d1cc 0000000000000002
[   60.782605]  ffff88045b00d180 ffff88045b00d0c0 ffff88045b00d0c0 ffff88044de31e58
[   60.782607] Call Trace:
[   60.782611]  [<ffffffff81553ae7>] dump_stack+0x49/0x62
[   60.782615]  [<ffffffff8104d1cc>] warn_slowpath_common+0x8c/0xc0
[   60.782618]  [<ffffffff8104d2b6>] warn_slowpath_fmt+0x46/0x50
[   60.782620]  [<ffffffff81280933>] __list_del_entry+0x63/0xd0
[   60.782622]  [<ffffffff812809b1>] list_del+0x11/0x40
[   60.782630]  [<ffffffffa06e7cf9>] iscsi_del_ts_from_active_list+0x29/0x50 [iscsi_target_mod]
[   60.782635]  [<ffffffffa06e87b1>] iscsi_tx_thread_pre_handler+0xa1/0x180 [iscsi_target_mod]
[   60.782642]  [<ffffffffa06fb9ae>] iscsi_target_tx_thread+0x4e/0x220 [iscsi_target_mod]
[   60.782647]  [<ffffffffa06fb960>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
[   60.782652]  [<ffffffffa06fb960>] ? iscsit_handle_snack+0x190/0x190 [iscsi_target_mod]
[   60.782655]  [<ffffffff8106f99e>] kthread+0xce/0xe0
[   60.782657]  [<ffffffff8106f8d0>] ? kthread_freezable_should_stop+0x70/0x70
[   60.782660]  [<ffffffff8156026c>] ret_from_fork+0x7c/0xb0
[   60.782662]  [<ffffffff8106f8d0>] ? kthread_freezable_should_stop+0x70/0x70
[   60.782663] ---[ end trace 9662f4a661d33965 ]---

Since this code is no longer used, go ahead and drop the problematic usage
all-together.

Reported-by: Gavin Guo <gavin.guo@canonical.com>
Reported-by: Moussa Ba <moussaba@micron.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/iscsi/iscsi_target_tq.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c
index 601e9cc61e98..bb2890e79ca0 100644
--- a/drivers/target/iscsi/iscsi_target_tq.c
+++ b/drivers/target/iscsi/iscsi_target_tq.c
@@ -24,36 +24,22 @@
 #include "iscsi_target_tq.h"
 #include "iscsi_target.h"
 
-static LIST_HEAD(active_ts_list);
 static LIST_HEAD(inactive_ts_list);
-static DEFINE_SPINLOCK(active_ts_lock);
 static DEFINE_SPINLOCK(inactive_ts_lock);
 static DEFINE_SPINLOCK(ts_bitmap_lock);
 
-static void iscsi_add_ts_to_active_list(struct iscsi_thread_set *ts)
-{
-	spin_lock(&active_ts_lock);
-	list_add_tail(&ts->ts_list, &active_ts_list);
-	iscsit_global->active_ts++;
-	spin_unlock(&active_ts_lock);
-}
-
 static void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts)
 {
+	if (!list_empty(&ts->ts_list)) {
+		WARN_ON(1);
+		return;
+	}
 	spin_lock(&inactive_ts_lock);
 	list_add_tail(&ts->ts_list, &inactive_ts_list);
 	iscsit_global->inactive_ts++;
 	spin_unlock(&inactive_ts_lock);
 }
 
-static void iscsi_del_ts_from_active_list(struct iscsi_thread_set *ts)
-{
-	spin_lock(&active_ts_lock);
-	list_del(&ts->ts_list);
-	iscsit_global->active_ts--;
-	spin_unlock(&active_ts_lock);
-}
-
 static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
 {
 	struct iscsi_thread_set *ts;
@@ -66,7 +52,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
 
 	ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list);
 
-	list_del(&ts->ts_list);
+	list_del_init(&ts->ts_list);
 	iscsit_global->inactive_ts--;
 	spin_unlock(&inactive_ts_lock);
 
@@ -204,8 +190,6 @@ static void iscsi_deallocate_extra_thread_sets(void)
 
 void iscsi_activate_thread_set(struct iscsi_conn *conn, struct iscsi_thread_set *ts)
 {
-	iscsi_add_ts_to_active_list(ts);
-
 	spin_lock_bh(&ts->ts_state_lock);
 	conn->thread_set = ts;
 	ts->conn = conn;
@@ -397,7 +381,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts)
 
 	if (ts->delay_inactive && (--ts->thread_count == 0)) {
 		spin_unlock_bh(&ts->ts_state_lock);
-		iscsi_del_ts_from_active_list(ts);
 
 		if (!iscsit_global->in_shutdown)
 			iscsi_deallocate_extra_thread_sets();
@@ -452,7 +435,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts)
 
 	if (ts->delay_inactive && (--ts->thread_count == 0)) {
 		spin_unlock_bh(&ts->ts_state_lock);
-		iscsi_del_ts_from_active_list(ts);
 
 		if (!iscsit_global->in_shutdown)
 			iscsi_deallocate_extra_thread_sets();
-- 
2.3.0


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

* [PATCH 3.12 035/175] cfq-iosched: handle failure of cfq group allocation
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 034/175] iscsi-target: Drop problematic active_ts_list usage Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 036/175] cfq-iosched: fix incorrect filing of rt async cfqq Jiri Slaby
                   ` (141 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Konstantin Khlebnikov, Jens Axboe, Jiri Slaby

From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

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

===============

commit 69abaffec7d47a083739b79e3066cb3730eba72e upstream.

Cfq_lookup_create_cfqg() allocates struct blkcg_gq using GFP_ATOMIC.
In cfq_find_alloc_queue() possible allocation failure is not handled.
As a result kernel oopses on NULL pointer dereference when
cfq_link_cfqq_cfqg() calls cfqg_get() for NULL pointer.

Bug was introduced in v3.5 in commit cd1604fab4f9 ("blkcg: factor
out blkio_group creation"). Prior to that commit cfq group lookup
had returned pointer to root group as fallback.

This patch handles this error using existing fallback oom_cfqq.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Fixes: cd1604fab4f9 ("blkcg: factor out blkio_group creation")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/cfq-iosched.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 06c2bab69756..396bff25226b 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3575,6 +3575,11 @@ retry:
 
 	blkcg = bio_blkcg(bio);
 	cfqg = cfq_lookup_create_cfqg(cfqd, blkcg);
+	if (!cfqg) {
+		cfqq = &cfqd->oom_cfqq;
+		goto out;
+	}
+
 	cfqq = cic_to_cfqq(cic, is_sync);
 
 	/*
@@ -3611,7 +3616,7 @@ retry:
 		} else
 			cfqq = &cfqd->oom_cfqq;
 	}
-
+out:
 	if (new_cfqq)
 		kmem_cache_free(cfq_pool, new_cfqq);
 
-- 
2.3.0


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

* [PATCH 3.12 036/175] cfq-iosched: fix incorrect filing of rt async cfqq
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 035/175] cfq-iosched: handle failure of cfq group allocation Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 037/175] axonram: Fix bug in direct_access Jiri Slaby
                   ` (140 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jeff Moyer, Jens Axboe, Jiri Slaby

From: Jeff Moyer <jmoyer@redhat.com>

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

===============

commit c6ce194325cef342313e3d27620411ce90a89c50 upstream.

Hi,

If you can manage to submit an async write as the first async I/O from
the context of a process with realtime scheduling priority, then a
cfq_queue is allocated, but filed into the wrong async_cfqq bucket.  It
ends up in the best effort array, but actually has realtime I/O
scheduling priority set in cfqq->ioprio.

The reason is that cfq_get_queue assumes the default scheduling class and
priority when there is no information present (i.e. when the async cfqq
is created):

static struct cfq_queue *
cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
	      struct bio *bio, gfp_t gfp_mask)
{
	const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
	const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);

cic->ioprio starts out as 0, which is "invalid".  So, class of 0
(IOPRIO_CLASS_NONE) is passed to cfq_async_queue_prio like so:

		async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio);

static struct cfq_queue **
cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio)
{
        switch (ioprio_class) {
        case IOPRIO_CLASS_RT:
                return &cfqd->async_cfqq[0][ioprio];
        case IOPRIO_CLASS_NONE:
                ioprio = IOPRIO_NORM;
                /* fall through */
        case IOPRIO_CLASS_BE:
                return &cfqd->async_cfqq[1][ioprio];
        case IOPRIO_CLASS_IDLE:
                return &cfqd->async_idle_cfqq;
        default:
                BUG();
        }
}

Here, instead of returning a class mapped from the process' scheduling
priority, we get back the bucket associated with IOPRIO_CLASS_BE.

Now, there is no queue allocated there yet, so we create it:

		cfqq = cfq_find_alloc_queue(cfqd, is_sync, cic, bio, gfp_mask);

That function ends up doing this:

			cfq_init_cfqq(cfqd, cfqq, current->pid, is_sync);
			cfq_init_prio_data(cfqq, cic);

cfq_init_cfqq marks the priority as having changed.  Then, cfq_init_prio
data does this:

	ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
	switch (ioprio_class) {
	default:
		printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class);
	case IOPRIO_CLASS_NONE:
		/*
		 * no prio set, inherit CPU scheduling settings
		 */
		cfqq->ioprio = task_nice_ioprio(tsk);
		cfqq->ioprio_class = task_nice_ioclass(tsk);
		break;

So we basically have two code paths that treat IOPRIO_CLASS_NONE
differently, which results in an RT async cfqq filed into a best effort
bucket.

Attached is a patch which fixes the problem.  I'm not sure how to make
it cleaner.  Suggestions would be welcome.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Tested-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/cfq-iosched.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 396bff25226b..b19c9f391761 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3646,12 +3646,17 @@ static struct cfq_queue *
 cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
 	      struct bio *bio, gfp_t gfp_mask)
 {
-	const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
-	const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
+	int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio);
+	int ioprio = IOPRIO_PRIO_DATA(cic->ioprio);
 	struct cfq_queue **async_cfqq = NULL;
 	struct cfq_queue *cfqq = NULL;
 
 	if (!is_sync) {
+		if (!ioprio_valid(cic->ioprio)) {
+			struct task_struct *tsk = current;
+			ioprio = task_nice_ioprio(tsk);
+			ioprio_class = task_nice_ioclass(tsk);
+		}
 		async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio);
 		cfqq = *async_cfqq;
 	}
-- 
2.3.0


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

* [PATCH 3.12 037/175] axonram: Fix bug in direct_access
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 036/175] cfq-iosched: fix incorrect filing of rt async cfqq Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 038/175] tty: Prevent untrappable signals from malicious program Jiri Slaby
                   ` (139 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Matthew Wilcox, Jens Axboe, Jiri Slaby

From: Matthew Wilcox <matthew.r.wilcox@intel.com>

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

===============

commit 91117a20245b59f70b563523edbf998a62fc6383 upstream.

The 'pfn' returned by axonram was completely bogus, and has been since
2008.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/sysdev/axonram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 1c16141c031c..1fea24944ff4 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -155,7 +155,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector,
 	}
 
 	*kaddr = (void *)(bank->ph_addr + offset);
-	*pfn = virt_to_phys(kaddr) >> PAGE_SHIFT;
+	*pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT;
 
 	return 0;
 }
-- 
2.3.0


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

* [PATCH 3.12 038/175] tty: Prevent untrappable signals from malicious program
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 037/175] axonram: Fix bug in direct_access Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 039/175] tty/serial: at91: fix error handling in atmel_serial_probe() Jiri Slaby
                   ` (138 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Peter Hurley, Theodore Ts'o, Howard Chu,
	One Thousand Gnomes, Jiri Slaby

From: Peter Hurley <peter@hurleysoftware.com>

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

===============

commit 37480a05685ed5b8e1b9bf5e5c53b5810258b149 upstream.

Commit 26df6d13406d1a5 ("tty: Add EXTPROC support for LINEMODE")
allows a process which has opened a pty master to send _any_ signal
to the process group of the pty slave. Although potentially
exploitable by a malicious program running a setuid program on
a pty slave, it's unknown if this exploit currently exists.

Limit to signals actually used.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Howard Chu <hyc@symas.com>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/pty.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 25c9bc783722..e49616eeb1cc 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -209,6 +209,9 @@ static int pty_signal(struct tty_struct *tty, int sig)
 	unsigned long flags;
 	struct pid *pgrp;
 
+	if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP)
+		return -EINVAL;
+
 	if (tty->link) {
 		spin_lock_irqsave(&tty->link->ctrl_lock, flags);
 		pgrp = get_pid(tty->link->pgrp);
-- 
2.3.0


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

* [PATCH 3.12 039/175] tty/serial: at91: fix error handling in atmel_serial_probe()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 038/175] tty: Prevent untrappable signals from malicious program Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 040/175] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Jiri Slaby
                   ` (137 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Cyrille Pitchen, Jiri Slaby

From: Cyrille Pitchen <cyrille.pitchen@atmel.com>

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

===============

commit 6fbb9bdf0f3fbe23aeff806489791aa876adaffb upstream.

-EDEFER error wasn't handle properly by atmel_serial_probe().
As an example, when atmel_serial_probe() is called for the first time, we pass
the test_and_set_bit() test to check whether the port has already been
initalized. Then we call atmel_init_port(), which may return -EDEFER, possibly
returned before by clk_get(). Consequently atmel_serial_probe() used to return
this error code WITHOUT clearing the port bit in the "atmel_ports_in_use" mask.
When atmel_serial_probe() was called for the second time, it used to fail on
the test_and_set_bit() function then returning -EBUSY.

When atmel_serial_probe() fails, this patch make it clear the port bit in the
"atmel_ports_in_use" mask, if needed, before returning the error code.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/atmel_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 3b301a7ec662..ebdc00f184a1 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2375,7 +2375,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
 
 	ret = atmel_init_port(port, pdev);
 	if (ret)
-		goto err;
+		goto err_clear_bit;
 
 	if (!atmel_use_pdc_rx(&port->uart)) {
 		ret = -ENOMEM;
@@ -2424,6 +2424,8 @@ err_alloc_ring:
 		clk_put(port->clk);
 		port->clk = NULL;
 	}
+err_clear_bit:
+	clear_bit(port->uart.line, atmel_ports_in_use);
 err:
 	return ret;
 }
-- 
2.3.0


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

* [PATCH 3.12 040/175] USB: cp210x: add ID for RUGGEDCOM USB Serial Console
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 039/175] tty/serial: at91: fix error handling in atmel_serial_probe() Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 041/175] USB: fix use-after-free bug in usb_hcd_unlink_urb() Jiri Slaby
                   ` (136 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lennart Sorensen, Johan Hovold, Jiri Slaby

From: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>

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

===============

commit a6f0331236fa75afba14bbcf6668d42cebb55c43 upstream.

Added the USB serial console device ID for Siemens Ruggedcom devices
which have a USB port for their serial console.

Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index b5fa609def53..af5ccd292f27 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -56,6 +56,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */
 	{ USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
 	{ USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
+	{ USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */
 	{ USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
 	{ USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
 	{ USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
-- 
2.3.0


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

* [PATCH 3.12 041/175] USB: fix use-after-free bug in usb_hcd_unlink_urb()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 040/175] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 042/175] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Jiri Slaby
                   ` (135 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alan Stern, Greg Kroah-Hartman, Jiri Slaby

From: Alan Stern <stern@rowland.harvard.edu>

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

===============

commit c99197902da284b4b723451c1471c45b18537cde upstream.

The usb_hcd_unlink_urb() routine in hcd.c contains two possible
use-after-free errors.  The dev_dbg() statement at the end of the
routine dereferences urb and urb->dev even though both structures may
have been deallocated.

This patch fixes the problem by storing urb->dev in a local variable
(avoiding the dereference of urb) and moving the dev_dbg() up before
the usb_put_dev() call.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/hcd.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 830063cb4343..d32755e0c3b1 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1618,6 +1618,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)
 int usb_hcd_unlink_urb (struct urb *urb, int status)
 {
 	struct usb_hcd		*hcd;
+	struct usb_device	*udev = urb->dev;
 	int			retval = -EIDRM;
 	unsigned long		flags;
 
@@ -1629,20 +1630,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
 	spin_lock_irqsave(&hcd_urb_unlink_lock, flags);
 	if (atomic_read(&urb->use_count) > 0) {
 		retval = 0;
-		usb_get_dev(urb->dev);
+		usb_get_dev(udev);
 	}
 	spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags);
 	if (retval == 0) {
 		hcd = bus_to_hcd(urb->dev->bus);
 		retval = unlink1(hcd, urb, status);
-		usb_put_dev(urb->dev);
+		if (retval == 0)
+			retval = -EINPROGRESS;
+		else if (retval != -EIDRM && retval != -EBUSY)
+			dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n",
+					urb, retval);
+		usb_put_dev(udev);
 	}
-
-	if (retval == 0)
-		retval = -EINPROGRESS;
-	else if (retval != -EIDRM && retval != -EBUSY)
-		dev_dbg(&urb->dev->dev, "hcd_unlink_urb %p fail %d\n",
-				urb, retval);
 	return retval;
 }
 
-- 
2.3.0


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

* [PATCH 3.12 042/175] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (40 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 041/175] USB: fix use-after-free bug in usb_hcd_unlink_urb() Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 043/175] vt: provide notifications on selection changes Jiri Slaby
                   ` (134 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sebastian Andrzej Siewior, Jiri Slaby

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

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

===============

commit 5efd2ea8c9f4f12916ffc8ba636792ce052f6911 upstream.

the following error pops up during "testusb -a -t 10"
| musb-hdrc musb-hdrc.1.auto: dma_pool_free buffer-128,	f134e000/be842000 (bad dma)
hcd_buffer_create() creates a few buffers, the smallest has 32 bytes of
size. ARCH_KMALLOC_MINALIGN is set to 64 bytes. This combo results in
hcd_buffer_alloc() returning memory which is 32 bytes aligned and it
might by identified by buffer_offset() as another buffer. This means the
buffer which is on a 32 byte boundary will not get freed, instead it
tries to free another buffer with the error message.

This patch fixes the issue by creating the smallest DMA buffer with the
size of ARCH_KMALLOC_MINALIGN (or 32 in case ARCH_KMALLOC_MINALIGN is
smaller). This might be 32, 64 or even 128 bytes. The next three pools
will have the size 128, 512 and 2048.
In case the smallest pool is 128 bytes then we have only three pools
instead of four (and zero the first entry in the array).
The last pool size is always 2048 bytes which is the assumed PAGE_SIZE /
2 of 4096. I doubt it makes sense to continue using PAGE_SIZE / 2 where
we would end up with 8KiB buffer in case we have 16KiB pages.
Instead I think it makes sense to have a common size(s) and extend them
if there is need to.
There is a BUILD_BUG_ON() now in case someone has a minalign of more than
128 bytes.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/buffer.c | 26 +++++++++++++++++---------
 drivers/usb/core/usb.c    |  1 +
 include/linux/usb/hcd.h   |  1 +
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 23559746be92..4596f7e34d20 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -22,17 +22,25 @@
  */
 
 /* FIXME tune these based on pool statistics ... */
-static const size_t	pool_max[HCD_BUFFER_POOLS] = {
-	/* platforms without dma-friendly caches might need to
-	 * prevent cacheline sharing...
-	 */
-	32,
-	128,
-	512,
-	PAGE_SIZE / 2
-	/* bigger --> allocate pages */
+static size_t pool_max[HCD_BUFFER_POOLS] = {
+	32, 128, 512, 2048,
 };
 
+void __init usb_init_pool_max(void)
+{
+	/*
+	 * The pool_max values must never be smaller than
+	 * ARCH_KMALLOC_MINALIGN.
+	 */
+	if (ARCH_KMALLOC_MINALIGN <= 32)
+		;			/* Original value is okay */
+	else if (ARCH_KMALLOC_MINALIGN <= 64)
+		pool_max[0] = 64;
+	else if (ARCH_KMALLOC_MINALIGN <= 128)
+		pool_max[0] = 0;	/* Don't use this pool */
+	else
+		BUILD_BUG();		/* We don't allow this */
+}
 
 /* SETUP primitives */
 
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 0a6ee2e70b25..eea7a1214a9a 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1050,6 +1050,7 @@ static int __init usb_init(void)
 		pr_info("%s: USB support disabled\n", usbcore_name);
 		return 0;
 	}
+	usb_init_pool_max();
 
 	retval = usb_debugfs_init();
 	if (retval)
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 75efc45eaa2f..d8ee9fd7ca4e 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -434,6 +434,7 @@ extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
 #endif /* CONFIG_PCI */
 
 /* pci-ish (pdev null is ok) buffer alloc/mapping support */
+void usb_init_pool_max(void);
 int hcd_buffer_create(struct usb_hcd *hcd);
 void hcd_buffer_destroy(struct usb_hcd *hcd);
 
-- 
2.3.0


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

* [PATCH 3.12 043/175] vt: provide notifications on selection changes
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (41 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 042/175] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 044/175] ARM: pxa: add regulator_has_full_constraints to corgi board file Jiri Slaby
                   ` (133 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Nicolas Pitre, Nicolas Pitre, Dave Mielke, Jiri Slaby

From: Nicolas Pitre <nicolas.pitre@linaro.org>

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

===============

commit 19e3ae6b4f07a87822c1c9e7ed99d31860e701af upstream.

The vcs device's poll/fasync support relies on the vt notifier to signal
changes to the screen content.  Notifier invocations were missing for
changes that comes through the selection interface though.  Fix that.

Tested with BRLTTY 5.2.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Cc: Dave Mielke <dave@mielke.cc>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/vt/vt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 239eae55600a..e341fd52a80d 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -498,6 +498,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed)
 #endif
 	if (DO_UPDATE(vc))
 		do_update_region(vc, (unsigned long) p, count);
+	notify_update(vc);
 }
 
 /* used by selection: complement pointer position */
@@ -514,6 +515,7 @@ void complement_pos(struct vc_data *vc, int offset)
 		scr_writew(old, screenpos(vc, old_offset, 1));
 		if (DO_UPDATE(vc))
 			vc->vc_sw->con_putc(vc, old, oldy, oldx);
+		notify_update(vc);
 	}
 
 	old_offset = offset;
@@ -531,8 +533,8 @@ void complement_pos(struct vc_data *vc, int offset)
 			oldy = (offset >> 1) / vc->vc_cols;
 			vc->vc_sw->con_putc(vc, new, oldy, oldx);
 		}
+		notify_update(vc);
 	}
-
 }
 
 static void insert_char(struct vc_data *vc, unsigned int nr)
-- 
2.3.0


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

* [PATCH 3.12 044/175] ARM: pxa: add regulator_has_full_constraints to corgi board file
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (42 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 043/175] vt: provide notifications on selection changes Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 045/175] ARM: pxa: add regulator_has_full_constraints to poodle " Jiri Slaby
                   ` (132 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dmitry Eremin-Solenikov, Robert Jarzmik, Jiri Slaby

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

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

===============

commit 271e80176aae4e5b481f4bb92df9768c6075bbca upstream.

Add regulator_has_full_constraints() call to corgi board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on corgi if
regulators are enabled:

ads7846 spi1.0: unable to get regulator: -517
spi spi1.0: Driver ads7846 requests probe deferral
wm8731 0-001b: Failed to get supply 'AVDD': -517
wm8731 0-001b: Failed to request supplies: -517
wm8731 0-001b: ASoC: failed to probe component -517
corgi-audio corgi-audio: ASoC: failed to instantiate card -517

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-pxa/corgi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index f162f1b77cd2..82fd9dd17ed1 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -26,6 +26,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/io.h>
+#include <linux/regulator/machine.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/corgi_lcd.h>
@@ -711,6 +712,8 @@ static void __init corgi_init(void)
 		sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
+
+	regulator_has_full_constraints();
 }
 
 static void __init fixup_corgi(struct tag *tags, char **cmdline,
-- 
2.3.0


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

* [PATCH 3.12 045/175] ARM: pxa: add regulator_has_full_constraints to poodle board file
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (43 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 044/175] ARM: pxa: add regulator_has_full_constraints to corgi board file Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 046/175] kdb: fix incorrect counts in KDB summary command output Jiri Slaby
                   ` (131 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dmitry Eremin-Solenikov, Robert Jarzmik, Jiri Slaby

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

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

===============

commit 9bc78f32c2e430aebf6def965b316aa95e37a20c upstream.

Add regulator_has_full_constraints() call to poodle board file to let
regulator core know that we do not have any additional regulators left.
This lets it substitute unprovided regulators with dummy ones.

This fixes the following warnings that can be seen on poodle if
regulators are enabled:

ads7846 spi1.0: unable to get regulator: -517
spi spi1.0: Driver ads7846 requests probe deferral
wm8731 0-001b: Failed to get supply 'AVDD': -517
wm8731 0-001b: Failed to request supplies: -517
wm8731 0-001b: ASoC: failed to probe component -517

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-pxa/poodle.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index aedf053a1de5..b4fff2998b8a 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -25,6 +25,7 @@
 #include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
+#include <linux/regulator/machine.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/pxa2xx_spi.h>
@@ -454,6 +455,7 @@ static void __init poodle_init(void)
 	pxa_set_i2c_info(NULL);
 	i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices));
 	poodle_init_spi();
+	regulator_has_full_constraints();
 }
 
 static void __init fixup_poodle(struct tag *tags, char **cmdline,
-- 
2.3.0


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

* [PATCH 3.12 046/175] kdb: fix incorrect counts in KDB summary command output
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (44 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 045/175] ARM: pxa: add regulator_has_full_constraints to poodle " Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 047/175] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Jiri Slaby
                   ` (130 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jay Lan, Jason Wessel, Jiri Slaby

From: Jay Lan <jlan@sgi.com>

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

===============

commit 146755923262037fc4c54abc28c04b1103f3cc51 upstream.

The output of KDB 'summary' command should report MemTotal, MemFree
and Buffers output in kB. Current codes report in unit of pages.

A define of K(x) as
is defined in the code, but not used.

This patch would apply the define to convert the values to kB.
Please include me on Cc on replies. I do not subscribe to linux-kernel.

Signed-off-by: Jay Lan <jlan@sgi.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/debug/kdb/kdb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 00eb8f7fbf41..545241de23bf 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -2532,7 +2532,7 @@ static int kdb_summary(int argc, const char **argv)
 #define K(x) ((x) << (PAGE_SHIFT - 10))
 	kdb_printf("\nMemTotal:       %8lu kB\nMemFree:        %8lu kB\n"
 		   "Buffers:        %8lu kB\n",
-		   val.totalram, val.freeram, val.bufferram);
+		   K(val.totalram), K(val.freeram), K(val.bufferram));
 	return 0;
 }
 
-- 
2.3.0


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

* [PATCH 3.12 047/175] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (45 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 046/175] kdb: fix incorrect counts in KDB summary command output Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 048/175] KVM: MIPS: Don't leak FPU/DSP to guest Jiri Slaby
                   ` (129 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexey Brodkin, Vineet Gupta, Jiri Slaby

From: Alexey Brodkin <abrodkin@synopsys.com>

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

===============

commit 06f34e1c28f3608b0ce5b310e41102d3fe7b65a1 upstream.

We used to calculate page address differently in 2 cases:

1. In virt_to_page(x) we do
 --->8---
 mem_map + (x - CONFIG_LINUX_LINK_BASE) >> PAGE_SHIFT
 --->8---

2. In in pte_page(x) we do
 --->8---
 mem_map + (pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT
 --->8---

That leads to problems in case PAGE_OFFSET != CONFIG_LINUX_LINK_BASE -
different pages will be selected depending on where and how we calculate
page address.

In particular in the STAR 9000853582 when gdb attempted to read memory
of another process it got improper page in get_user_pages() because this
is exactly one of the places where we search for a page by pte_page().

The fix is trivial - we need to calculate page address similarly in both
cases.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arc/include/asm/pgtable.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 6b0b7f7ef783..7670f33b9ce2 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -259,7 +259,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_clear(xp)			do { pmd_val(*(xp)) = 0; } while (0)
 
 #define pte_page(x) (mem_map + \
-		(unsigned long)(((pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT)))
+		(unsigned long)(((pte_val(x) - CONFIG_LINUX_LINK_BASE) >> \
+				PAGE_SHIFT)))
 
 #define mk_pte(page, pgprot)						\
 ({									\
-- 
2.3.0


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

* [PATCH 3.12 048/175] KVM: MIPS: Don't leak FPU/DSP to guest
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (46 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 047/175] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 049/175] Bluetooth: Add support for Acer [0489:e078] Jiri Slaby
                   ` (128 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, James Hogan, Paolo Bonzini, Ralf Baechle,
	Sanjay Lal, Gleb Natapov, kvm, linux-mips, Jiri Slaby

From: James Hogan <james.hogan@imgtec.com>

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

===============

[ Upstream commit f798217dfd038af981a18bbe4bc57027a08bb182 ]

The FPU and DSP are enabled via the CP0 Status CU1 and MX bits by
kvm_mips_set_c0_status() on a guest exit, presumably in case there is
active state that needs saving if pre-emption occurs. However neither of
these bits are cleared again when returning to the guest.

This effectively gives the guest access to the FPU/DSP hardware after
the first guest exit even though it is not aware of its presence,
allowing FP instructions in guest user code to intermittently actually
execute instead of trapping into the guest OS for emulation. It will
then read & manipulate the hardware FP registers which technically
belong to the user process (e.g. QEMU), or are stale from another user
process. It can also crash the guest OS by causing an FP exception, for
which a guest exception handler won't have been registered.

First lets save and disable the FPU (and MSA) state with lose_fpu(1)
before entering the guest. This simplifies the problem, especially for
when guest FPU/MSA support is added in the future, and prevents FR=1 FPU
state being live when the FR bit gets cleared for the guest, which
according to the architecture causes the contents of the FPU and vector
registers to become UNPREDICTABLE.

We can then safely remove the enabling of the FPU in
kvm_mips_set_c0_status(), since there should never be any active FPU or
MSA state to save at pre-emption, which should plug the FPU leak.

DSP state is always live rather than being lazily restored, so for that
it is simpler to just clear the MX bit again when re-entering the guest.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Sanjay Lal <sanjayl@kymasys.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # v3.10+: 044f0f03eca0: MIPS: KVM: Deliver guest interrupts
Cc: <stable@vger.kernel.org> # v3.10+: 3ce465e04bfd: MIPS: Export FP functions used by lose_fpu(1) for KVM
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kvm/kvm_locore.S | 2 +-
 arch/mips/kvm/kvm_mips.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S
index bbace092ad0a..03a2db58b22d 100644
--- a/arch/mips/kvm/kvm_locore.S
+++ b/arch/mips/kvm/kvm_locore.S
@@ -428,7 +428,7 @@ __kvm_mips_return_to_guest:
 	/* Setup status register for running guest in UM */
 	.set	at
 	or	v1, v1, (ST0_EXL | KSU_USER | ST0_IE)
-	and	v1, v1, ~ST0_CU0
+	and	v1, v1, ~(ST0_CU0 | ST0_MX)
 	.set	noat
 	mtc0	v1, CP0_STATUS
 	ehb
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 016f163b42da..2cb24788a8a6 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -15,6 +15,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
+#include <asm/fpu.h>
 #include <asm/page.h>
 #include <asm/cacheflush.h>
 #include <asm/mmu_context.h>
@@ -417,6 +418,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 		vcpu->mmio_needed = 0;
 	}
 
+	lose_fpu(1);
+
 	local_irq_disable();
 	/* Check if we have any exceptions/interrupts pending */
 	kvm_mips_deliver_interrupts(vcpu,
@@ -1021,9 +1024,6 @@ void kvm_mips_set_c0_status(void)
 {
 	uint32_t status = read_c0_status();
 
-	if (cpu_has_fpu)
-		status |= (ST0_CU1);
-
 	if (cpu_has_dsp)
 		status |= (ST0_MX);
 
-- 
2.3.0


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

* [PATCH 3.12 049/175] Bluetooth: Add support for Acer [0489:e078]
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (47 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 048/175] KVM: MIPS: Don't leak FPU/DSP to guest Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 050/175] libceph: assert both regular and lingering lists in __remove_osd() Jiri Slaby
                   ` (127 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Anantha Krishnan, Marcel Holtmann, Jiri Slaby

From: Anantha Krishnan <ananthk@codeaurora.org>

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

===============

commit 4b552bc9edfdc947862af225a0e2521edb5d37a0 upstream.

Add support for the QCA6174 chip.

    T:  Bus=06 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=12  MxCh= 0
    D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0489 ProdID=e078 Rev=00.01
    C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Signed-off-by: Anantha Krishnan <ananthk@codeaurora.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index fa6a79009724..9e925bf9ac57 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -79,6 +79,7 @@ static struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x0489, 0xe057) },
 	{ USB_DEVICE(0x0489, 0xe056) },
 	{ USB_DEVICE(0x0489, 0xe05f) },
+	{ USB_DEVICE(0x0489, 0xe078) },
 	{ USB_DEVICE(0x04c5, 0x1330) },
 	{ USB_DEVICE(0x04CA, 0x3004) },
 	{ USB_DEVICE(0x04CA, 0x3005) },
@@ -130,6 +131,7 @@ static struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 64f19159515f..faa9a387f9a5 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -156,6 +156,7 @@ static struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
-- 
2.3.0


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

* [PATCH 3.12 050/175] libceph: assert both regular and lingering lists in __remove_osd()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (48 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 049/175] Bluetooth: Add support for Acer [0489:e078] Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 051/175] libceph: change from BUG to WARN for __remove_osd() asserts Jiri Slaby
                   ` (126 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ilya Dryomov, Jiri Slaby

From: Ilya Dryomov <ilya.dryomov@inktank.com>

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

===============

commit 7c6e6fc53e7335570ed82f77656cedce1502744e upstream.

It is important that both regular and lingering requests lists are
empty when the OSD is removed.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ceph/osd_client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index e6b2db68b4fa..4e24b7338582 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -976,6 +976,8 @@ static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 {
 	dout("__remove_osd %p\n", osd);
 	BUG_ON(!list_empty(&osd->o_requests));
+	BUG_ON(!list_empty(&osd->o_linger_requests));
+
 	rb_erase(&osd->o_node, &osdc->osds);
 	list_del_init(&osd->o_osd_lru);
 	ceph_con_close(&osd->o_con);
-- 
2.3.0


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

* [PATCH 3.12 051/175] libceph: change from BUG to WARN for __remove_osd() asserts
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (49 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 050/175] libceph: assert both regular and lingering lists in __remove_osd() Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 052/175] libceph: fix double __remove_osd() problem Jiri Slaby
                   ` (125 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ilya Dryomov, Jiri Slaby

From: Ilya Dryomov <idryomov@redhat.com>

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

===============

commit cc9f1f518cec079289d11d732efa490306b1ddad upstream.

No reason to use BUG_ON for osd request list assertions.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ceph/osd_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 4e24b7338582..ba3330e9665d 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -975,8 +975,8 @@ static void put_osd(struct ceph_osd *osd)
 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 {
 	dout("__remove_osd %p\n", osd);
-	BUG_ON(!list_empty(&osd->o_requests));
-	BUG_ON(!list_empty(&osd->o_linger_requests));
+	WARN_ON(!list_empty(&osd->o_requests));
+	WARN_ON(!list_empty(&osd->o_linger_requests));
 
 	rb_erase(&osd->o_node, &osdc->osds);
 	list_del_init(&osd->o_osd_lru);
-- 
2.3.0


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

* [PATCH 3.12 052/175] libceph: fix double __remove_osd() problem
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (50 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 051/175] libceph: change from BUG to WARN for __remove_osd() asserts Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 053/175] KVM: x86: update masterclock values on TSC writes Jiri Slaby
                   ` (124 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ilya Dryomov, Sage Weil, Jiri Slaby

From: Ilya Dryomov <idryomov@gmail.com>

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

===============

commit 7eb71e0351fbb1b242ae70abb7bb17107fe2f792 upstream.

It turns out it's possible to get __remove_osd() called twice on the
same OSD.  That doesn't sit well with rb_erase() - depending on the
shape of the tree we can get a NULL dereference, a soft lockup or
a random crash at some point in the future as we end up touching freed
memory.  One scenario that I was able to reproduce is as follows:

            <osd3 is idle, on the osd lru list>
<con reset - osd3>
con_fault_finish()
  osd_reset()
                              <osdmap - osd3 down>
                              ceph_osdc_handle_map()
                                <takes map_sem>
                                kick_requests()
                                  <takes request_mutex>
                                  reset_changed_osds()
                                    __reset_osd()
                                      __remove_osd()
                                  <releases request_mutex>
                                <releases map_sem>
    <takes map_sem>
    <takes request_mutex>
    __kick_osd_requests()
      __reset_osd()
        __remove_osd() <-- !!!

A case can be made that osd refcounting is imperfect and reworking it
would be a proper resolution, but for now Sage and I decided to fix
this by adding a safe guard around __remove_osd().

Fixes: http://tracker.ceph.com/issues/8087

Cc: Sage Weil <sage@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ceph/osd_client.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index ba3330e9665d..aab733629265 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -974,14 +974,24 @@ static void put_osd(struct ceph_osd *osd)
  */
 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 {
-	dout("__remove_osd %p\n", osd);
+	dout("%s %p osd%d\n", __func__, osd, osd->o_osd);
 	WARN_ON(!list_empty(&osd->o_requests));
 	WARN_ON(!list_empty(&osd->o_linger_requests));
 
-	rb_erase(&osd->o_node, &osdc->osds);
 	list_del_init(&osd->o_osd_lru);
-	ceph_con_close(&osd->o_con);
-	put_osd(osd);
+	rb_erase(&osd->o_node, &osdc->osds);
+	RB_CLEAR_NODE(&osd->o_node);
+}
+
+static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
+{
+	dout("%s %p osd%d\n", __func__, osd, osd->o_osd);
+
+	if (!RB_EMPTY_NODE(&osd->o_node)) {
+		ceph_con_close(&osd->o_con);
+		__remove_osd(osdc, osd);
+		put_osd(osd);
+	}
 }
 
 static void remove_all_osds(struct ceph_osd_client *osdc)
@@ -991,7 +1001,7 @@ static void remove_all_osds(struct ceph_osd_client *osdc)
 	while (!RB_EMPTY_ROOT(&osdc->osds)) {
 		struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds),
 						struct ceph_osd, o_node);
-		__remove_osd(osdc, osd);
+		remove_osd(osdc, osd);
 	}
 	mutex_unlock(&osdc->request_mutex);
 }
@@ -1021,7 +1031,7 @@ static void remove_old_osds(struct ceph_osd_client *osdc)
 	list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) {
 		if (time_before(jiffies, osd->lru_ttl))
 			break;
-		__remove_osd(osdc, osd);
+		remove_osd(osdc, osd);
 	}
 	mutex_unlock(&osdc->request_mutex);
 }
@@ -1036,8 +1046,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
 	dout("__reset_osd %p osd%d\n", osd, osd->o_osd);
 	if (list_empty(&osd->o_requests) &&
 	    list_empty(&osd->o_linger_requests)) {
-		__remove_osd(osdc, osd);
-
+		remove_osd(osdc, osd);
 		return -ENODEV;
 	}
 
@@ -1619,6 +1628,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc)
 {
 	struct rb_node *p, *n;
 
+	dout("%s %p\n", __func__, osdc);
 	for (p = rb_first(&osdc->osds); p; p = n) {
 		struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node);
 
-- 
2.3.0


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

* [PATCH 3.12 053/175] KVM: x86: update masterclock values on TSC writes
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (51 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 052/175] libceph: fix double __remove_osd() problem Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 054/175] hx4700: regulator: declare full constraints Jiri Slaby
                   ` (123 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Marcelo Tosatti, Paolo Bonzini, Jiri Slaby

From: Marcelo Tosatti <mtosatti@redhat.com>

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

===============

commit 7f187922ddf6b67f2999a76dcb71663097b75497 upstream.

When the guest writes to the TSC, the masterclock TSC copy must be
updated as well along with the TSC_OFFSET update, otherwise a negative
tsc_timestamp is calculated at kvm_guest_time_update.

Once "if (!vcpus_matched && ka->use_master_clock)" is simplified to
"if (ka->use_master_clock)", the corresponding "if (!ka->use_master_clock)"
becomes redundant, so remove the do_request boolean and collapse
everything into a single condition.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kvm/x86.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fabb62bad47c..d3691ab6d6a0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1171,21 +1171,22 @@ void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_X86_64
 	bool vcpus_matched;
-	bool do_request = false;
 	struct kvm_arch *ka = &vcpu->kvm->arch;
 	struct pvclock_gtod_data *gtod = &pvclock_gtod_data;
 
 	vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 ==
 			 atomic_read(&vcpu->kvm->online_vcpus));
 
-	if (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC)
-		if (!ka->use_master_clock)
-			do_request = 1;
-
-	if (!vcpus_matched && ka->use_master_clock)
-			do_request = 1;
-
-	if (do_request)
+	/*
+	 * Once the masterclock is enabled, always perform request in
+	 * order to update it.
+	 *
+	 * In order to enable masterclock, the host clocksource must be TSC
+	 * and the vcpus need to have matched TSCs.  When that happens,
+	 * perform request to enable masterclock.
+	 */
+	if (ka->use_master_clock ||
+	    (gtod->clock.vclock_mode == VCLOCK_TSC && vcpus_matched))
 		kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
 
 	trace_kvm_track_tsc(vcpu->vcpu_id, ka->nr_vcpus_matched_tsc,
-- 
2.3.0


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

* [PATCH 3.12 054/175] hx4700: regulator: declare full constraints
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (52 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 053/175] KVM: x86: update masterclock values on TSC writes Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 055/175] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Jiri Slaby
                   ` (122 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Martin Vajnar, Robert Jarzmik, Jiri Slaby

From: Martin Vajnar <martin.vajnar@gmail.com>

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

===============

commit a52d209336f8fc7483a8c7f4a8a7d2a8e1692a6c upstream.

Since the removal of CONFIG_REGULATOR_DUMMY option, the touchscreen stopped
working. This patch enables the "replacement" for REGULATOR_DUMMY and
allows the touchscreen to work even though there is no regulator for "vcc".

Signed-off-by: Martin Vajnar <martin.vajnar@gmail.com>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-pxa/hx4700.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 133109ec7332..a07accfb3aec 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -891,6 +891,8 @@ static void __init hx4700_init(void)
 	mdelay(10);
 	gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1);
 	mdelay(10);
+
+	regulator_has_full_constraints();
 }
 
 MACHINE_START(H4700, "HP iPAQ HX4700")
-- 
2.3.0


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

* [PATCH 3.12 055/175] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (53 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 054/175] hx4700: regulator: declare full constraints Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 056/175] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Jiri Slaby
                   ` (121 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Catalin Marinas, Jiri Slaby

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

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

===============

commit 9d42d48a342aee208c1154696196497fdc556bbf upstream.

The native (64-bit) sigval_t union contains sival_int (32-bit) and
sival_ptr (64-bit). When a compat application invokes a syscall that
takes a sigval_t value (as part of a larger structure, e.g.
compat_sys_mq_notify, compat_sys_timer_create), the compat_sigval_t
union is converted to the native sigval_t with sival_int overlapping
with either the least or the most significant half of sival_ptr,
depending on endianness. When the corresponding signal is delivered to a
compat application, on big endian the current (compat_uptr_t)sival_ptr
cast always returns 0 since sival_int corresponds to the top part of
sival_ptr. This patch fixes copy_siginfo_to_user32() so that sival_int
is copied to the compat_siginfo_t structure.

Reported-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Tested-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/signal32.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index e393174fe859..3d478102b1c0 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -179,8 +179,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 	case __SI_TIMER:
 		 err |= __put_user(from->si_tid, &to->si_tid);
 		 err |= __put_user(from->si_overrun, &to->si_overrun);
-		 err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr,
-				   &to->si_ptr);
+		 err |= __put_user(from->si_int, &to->si_int);
 		break;
 	case __SI_POLL:
 		err |= __put_user(from->si_band, &to->si_band);
@@ -209,7 +208,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 	case __SI_MESGQ: /* But this is */
 		err |= __put_user(from->si_pid, &to->si_pid);
 		err |= __put_user(from->si_uid, &to->si_uid);
-		err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr);
+		err |= __put_user(from->si_int, &to->si_int);
 		break;
 	default: /* this is just in case for now ... */
 		err |= __put_user(from->si_pid, &to->si_pid);
-- 
2.3.0


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

* [PATCH 3.12 056/175] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (54 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 055/175] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 057/175] gpio: tps65912: fix wrong container_of arguments Jiri Slaby
                   ` (120 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans Holmberg, Linus Walleij, Jiri Slaby

From: Hans Holmberg <hans.holmberg@intel.com>

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

===============

commit 9cf75e9e4ddd587ac12e88e8751c358b7b27e95f upstream.

The change:

7b8792bbdffdff3abda704f89c6a45ea97afdc62
gpiolib: of: Correct error handling in of_get_named_gpiod_flags

assumed that only one gpio-chip is registred per of-node.
Some drivers register more than one chip per of-node, so
adjust the matching function of_gpiochip_find_and_xlate to
not stop looking for chips if a node-match is found and
the translation fails.

Fixes: 7b8792bbdffd ("gpiolib: of: Correct error handling in of_get_named_gpiod_flags")
Signed-off-by: Hans Holmberg <hans.holmberg@intel.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Tyler Hall <tylerwhall@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpio/gpiolib-of.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 63e7fad69ced..836af49da901 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -44,12 +44,13 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)
 
 	ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags);
 	if (ret < 0) {
-		/* We've found the gpio chip, but the translation failed.
-		 * Return true to stop looking and return the translation
-		 * error via out_gpio
+		/* We've found a gpio chip, but the translation failed.
+		 * Store translation error in out_gpio.
+		 * Return false to keep looking, as more than one gpio chip
+		 * could be registered per of-node.
 		 */
 		gg_data->out_gpio = ERR_PTR(ret);
-		return true;
+		return false;
 	 }
 
 	gg_data->out_gpio = ret + gc->base;
-- 
2.3.0


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

* [PATCH 3.12 057/175] gpio: tps65912: fix wrong container_of arguments
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (55 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 056/175] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 058/175] xfs: Fix quota type in quota structures when reusing quota file Jiri Slaby
                   ` (119 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicolas Saenz Julienne, Linus Walleij, Jiri Slaby

From: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>

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

===============

commit 2f97c20e5f7c3582c7310f65a04465bfb0fd0e85 upstream.

The gpio_chip operations receive a pointer the gpio_chip struct which is
contained in the driver's private struct, yet the container_of call in those
functions point to the mfd struct defined in include/linux/mfd/tps65912.h.

Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpio/gpio-tps65912.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c
index 276a4229b032..a1c47b4bc6d4 100644
--- a/drivers/gpio/gpio-tps65912.c
+++ b/drivers/gpio/gpio-tps65912.c
@@ -26,9 +26,12 @@ struct tps65912_gpio_data {
 	struct gpio_chip gpio_chip;
 };
 
+#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip)
+
 static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 	int val;
 
 	val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset);
@@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
 static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
 			      int value)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 
 	if (value)
 		tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
@@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
 static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
 				int value)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 
 	/* Set the initial value */
 	tps65912_gpio_set(gc, offset, value);
@@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
 
 static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset)
 {
-	struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
+	struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
+	struct tps65912 *tps65912 = tps65912_gpio->tps65912;
 
 	return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
 								GPIO_CFG_MASK);
-- 
2.3.0


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

* [PATCH 3.12 058/175] xfs: Fix quota type in quota structures when reusing quota file
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (56 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 057/175] gpio: tps65912: fix wrong container_of arguments Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 059/175] metag: Fix KSTK_EIP() and KSTK_ESP() macros Jiri Slaby
                   ` (118 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jan Kara, Dave Chinner, Jiri Slaby

From: Jan Kara <jack@suse.cz>

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

===============

commit dfcc70a8c868fe03276fa59864149708fb41930b upstream.

For filesystems without separate project quota inode field in the
superblock we just reuse project quota file for group quotas (and vice
versa) if project quota file is allocated and we need group quota file.
When we reuse the file, quota structures on disk suddenly have wrong
type stored in d_flags though. Nobody really cares about this (although
structure type reported to userspace was wrong as well) except
that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
->set_dqblk() to use bytes as space units) assertion in
xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
was testing without XFS_DEBUG so I didn't notice when submitting the
above commit).

Fix the problem by properly resetting ddq->d_flags when running quotacheck
for a quota file.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_qm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 794aa2fb9c69..3868c0aaa724 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1125,6 +1125,11 @@ xfs_qm_reset_dqcounts(
 		 */
 		(void) xfs_qm_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
 				      "xfs_quotacheck");
+		/*
+		 * Reset type in case we are reusing group quota file for
+		 * project quotas or vice versa
+		 */
+		ddq->d_flags = type;
 		ddq->d_bcount = 0;
 		ddq->d_icount = 0;
 		ddq->d_rtbcount = 0;
-- 
2.3.0


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

* [PATCH 3.12 059/175] metag: Fix KSTK_EIP() and KSTK_ESP() macros
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (57 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 058/175] xfs: Fix quota type in quota structures when reusing quota file Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 060/175] md/raid5: Fix livelock when array is both resyncing and degraded Jiri Slaby
                   ` (117 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, James Hogan, linux-metag, Jiri Slaby

From: James Hogan <james.hogan@imgtec.com>

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

===============

commit c2996cb29bfb73927a79dc96e598a718e843f01a upstream.

The KSTK_EIP() and KSTK_ESP() macros should return the user program
counter (PC) and stack pointer (A0StP) of the given task. These are used
to determine which VMA corresponds to the user stack in
/proc/<pid>/maps, and for the user PC & A0StP in /proc/<pid>/stat.

However for Meta the PC & A0StP from the task's kernel context are used,
resulting in broken output. For example in following /proc/<pid>/maps
output, the 3afff000-3b021000 VMA should be described as the stack:

  # cat /proc/self/maps
  ...
  100b0000-100b1000 rwxp 00000000 00:00 0          [heap]
  3afff000-3b021000 rwxp 00000000 00:00 0

And in the following /proc/<pid>/stat output, the PC is in kernel code
(1074234964 = 0x40078654) and the A0StP is in the kernel heap
(1335981392 = 0x4fa17550):

  # cat /proc/self/stat
  51 (cat) R ... 1335981392 1074234964 ...

Fix the definitions of KSTK_EIP() and KSTK_ESP() to use
task_pt_regs(tsk)->ctx rather than (tsk)->thread.kernel_context. This
gets the registers from the user context stored after the thread info at
the base of the kernel stack, which is from the last entry into the
kernel from userland, regardless of where in the kernel the task may
have been interrupted, which results in the following more correct
/proc/<pid>/maps output:

  # cat /proc/self/maps
  ...
  0800b000-08070000 r-xp 00000000 00:02 207        /lib/libuClibc-0.9.34-git.so
  ...
  100b0000-100b1000 rwxp 00000000 00:00 0          [heap]
  3afff000-3b021000 rwxp 00000000 00:00 0          [stack]

And /proc/<pid>/stat now correctly reports the PC in libuClibc
(134320308 = 0x80190b4) and the A0StP in the [stack] region (989864576 =
0x3b002280):

  # cat /proc/self/stat
  51 (cat) R ... 989864576 134320308 ...

Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Reported-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/metag/include/asm/processor.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h
index 3be8581af495..ba857382ba65 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -149,8 +149,8 @@ extern void exit_thread(void);
 
 unsigned long get_wchan(struct task_struct *p);
 
-#define	KSTK_EIP(tsk)	((tsk)->thread.kernel_context->CurrPC)
-#define	KSTK_ESP(tsk)	((tsk)->thread.kernel_context->AX[0].U0)
+#define	KSTK_EIP(tsk)	(task_pt_regs(tsk)->ctx.CurrPC)
+#define	KSTK_ESP(tsk)	(task_pt_regs(tsk)->ctx.AX[0].U0)
 
 #define user_stack_pointer(regs)        ((regs)->ctx.AX[0].U0)
 
-- 
2.3.0


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

* [PATCH 3.12 060/175] md/raid5: Fix livelock when array is both resyncing and degraded.
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (58 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 059/175] metag: Fix KSTK_EIP() and KSTK_ESP() macros Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 061/175] md/raid1: fix read balance when a drive is write-mostly Jiri Slaby
                   ` (116 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, NeilBrown, Jiri Slaby

From: NeilBrown <neilb@suse.de>

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

===============

commit 26ac107378c4742978216be1005b7291b799c7b2 upstream.

Commit a7854487cd7128a30a7f4f5259de9f67d5efb95f:
  md: When RAID5 is dirty, force reconstruct-write instead of read-modify-write.

Causes an RCW cycle to be forced even when the array is degraded.
A degraded array cannot support RCW as that requires reading all data
blocks, and one may be missing.

Forcing an RCW when it is not possible causes a live-lock and the code
spins, repeatedly deciding to do something that cannot succeed.

So change the condition to only force RCW on non-degraded arrays.

Reported-by: Manibalan P <pmanibalan@amiindia.co.in>
Bisected-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Fixes: a7854487cd7128a30a7f4f5259de9f67d5efb95f
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/raid5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7b54c3bf9f8f..09c18062bbc2 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2964,7 +2964,8 @@ static void handle_stripe_dirtying(struct r5conf *conf,
 	 * generate correct data from the parity.
 	 */
 	if (conf->max_degraded == 2 ||
-	    (recovery_cp < MaxSector && sh->sector >= recovery_cp)) {
+	    (recovery_cp < MaxSector && sh->sector >= recovery_cp &&
+	     s->failed == 0)) {
 		/* Calculate the real rcw later - for now make it
 		 * look like rcw is cheaper
 		 */
-- 
2.3.0


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

* [PATCH 3.12 061/175] md/raid1: fix read balance when a drive is write-mostly.
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (59 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 060/175] md/raid5: Fix livelock when array is both resyncing and degraded Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 062/175] EDAC, amd64_edac: Prevent OOPS with >16 memory controllers Jiri Slaby
                   ` (115 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Tomáš Hodek, NeilBrown, Jiri Slaby

From: Tomáš Hodek <tomas.hodek@volny.cz>

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

===============

commit d1901ef099c38afd11add4cfb3312c02ef21ec4a upstream.

When a drive is marked write-mostly it should only be the
target of reads if there is no other option.

This behaviour was broken by

commit 9dedf60313fa4dddfd5b9b226a0ef12a512bf9dc
    md/raid1: read balance chooses idlest disk for SSD

which causes a write-mostly device to be *preferred* is some cases.

Restore correct behaviour by checking and setting
best_dist_disk and best_pending_disk rather than best_disk.

We only need to test one of these as they are both changed
from -1 or >=0 at the same time.

As we leave min_pending and best_dist unchanged, any non-write-mostly
device will appear better than the write-mostly device.

Reported-by: Tomáš Hodek <tomas.hodek@volny.cz>
Reported-by: Dark Penguin <darkpenguin@yandex.ru>
Signed-off-by: NeilBrown <neilb@suse.de>
Link: http://marc.info/?l=linux-raid&m=135982797322422
Fixes: 9dedf60313fa4dddfd5b9b226a0ef12a512bf9dc
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/raid1.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 6564eebbdf0e..633b6e1e7d4d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -557,7 +557,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
 		if (test_bit(WriteMostly, &rdev->flags)) {
 			/* Don't balance among write-mostly, just
 			 * use the first as a last resort */
-			if (best_disk < 0) {
+			if (best_dist_disk < 0) {
 				if (is_badblock(rdev, this_sector, sectors,
 						&first_bad, &bad_sectors)) {
 					if (first_bad < this_sector)
@@ -566,7 +566,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
 					best_good_sectors = first_bad - this_sector;
 				} else
 					best_good_sectors = sectors;
-				best_disk = disk;
+				best_dist_disk = disk;
+				best_pending_disk = disk;
 			}
 			continue;
 		}
-- 
2.3.0


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

* [PATCH 3.12 062/175] EDAC, amd64_edac: Prevent OOPS with >16 memory controllers
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (60 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 061/175] md/raid1: fix read balance when a drive is write-mostly Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 063/175] jffs2: fix handling of corrupted summary length Jiri Slaby
                   ` (114 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Daniel J Blueman, Borislav Petkov, Jiri Slaby

From: Daniel J Blueman <daniel@numascale.com>

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

===============

commit 0c510cc83bdbaac8406f4f7caef34f4da0ba35ea upstream.

When DRAM errors occur on memory controllers after EDAC_MAX_MCS (16),
the kernel fatally dereferences unallocated structures, see splat below;
this occurs on at least NumaConnect systems.

Fix by checking if a memory controller info structure was found.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000320
IP: [<ffffffff819f714f>] decode_bus_error+0x2f/0x2b0
PGD 2f8b5a3067 PUD 2f8b5a2067 PMD 0
Oops: 0000 [#2] SMP
Modules linked in:
CPU: 224 PID: 11930 Comm: stream_c.exe.gn Tainted: G   D    3.19.0 #1
Hardware name: Supermicro H8QGL/H8QGL, BIOS 3.5b    01/28/2015
task: ffff8807dbfb8c00 ti: ffff8807dd16c000 task.ti: ffff8807dd16c000
RIP: 0010:[<ffffffff819f714f>] [<ffffffff819f714f>] decode_bus_error+0x2f/0x2b0
RSP: 0000:ffff8907dfc03c48 EFLAGS: 00010297
RAX: 0000000000000001 RBX: 9c67400010080a13 RCX: 0000000000001dc6
RDX: 000000001dc61dc6 RSI: ffff8907dfc03df0 RDI: 000000000000001c
RBP: ffff8907dfc03ce8 R08: 0000000000000000 R09: 0000000000000022
R10: ffff891fffa30380 R11: 00000000001cfc90 R12: 0000000000000008
R13: 0000000000000000 R14: 000000000000001c R15: 00009c6740001000
FS: 00007fa97ee18700(0000) GS:ffff8907dfc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000320 CR3: 0000003f889b8000 CR4: 00000000000407e0
Stack:
 0000000000000000 ffff8907dfc03df0 0000000000000008 9c67400010080a13
 000000000000001c 00009c6740001000 ffff8907dfc03c88 ffffffff810e4f9a
 ffff8907dfc03ce8 ffffffff81b375b9 0000000000000000 0000000000000010
Call Trace:
 <IRQ>
 ? vprintk_default
 ? printk
 amd_decode_mce
 notifier_call_chain
 atomic_notifier_call_chain
 mce_log
 machine_check_poll
 mce_timer_fn
 ? mce_cpu_restart
 call_timer_fn.isra.29
 run_timer_softirq
 __do_softirq
 irq_exit
 smp_apic_timer_interrupt
 apic_timer_interrupt
 <EOI>
 ? down_read_trylock
 __do_page_fault
 ? __schedule
 do_page_fault
 page_fault

Signed-off-by: Daniel J Blueman <daniel@numascale.com>
Link: http://lkml.kernel.org/r/1424144078-24589-1-git-send-email-daniel@numascale.com
[ Boris: massage commit message ]
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz> [backport to 3.12]
---
 drivers/edac/amd64_edac.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index d43a6202a5c5..10162af430c5 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2043,7 +2043,13 @@ static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci,
 
 void amd64_decode_bus_error(int node_id, struct mce *m)
 {
-	__amd64_decode_bus_error(mcis[node_id], m);
+	struct mem_ctl_info *mci;
+
+	mci = edac_mc_find(node_id);
+	if (!mci)
+		return;
+
+	__amd64_decode_bus_error(mci, m);
 }
 
 /*
-- 
2.3.0


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

* [PATCH 3.12 063/175] jffs2: fix handling of corrupted summary length
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (61 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 062/175] EDAC, amd64_edac: Prevent OOPS with >16 memory controllers Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 064/175] btrfs: set proper message level for skinny metadata Jiri Slaby
                   ` (113 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Chen Jie, Andrew Morton, David Woodhouse, Jiri Slaby

From: Chen Jie <chenjie6@huawei.com>

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

===============

commit 164c24063a3eadee11b46575c5482b2f1417be49 upstream.

sm->offset maybe wrong but magic maybe right, the offset do not have CRC.

Badness at c00c7580 [verbose debug info unavailable]
NIP: c00c7580 LR: c00c718c CTR: 00000014
REGS: df07bb40 TRAP: 0700   Not tainted  (2.6.34.13-WR4.3.0.0_standard)
MSR: 00029000 <EE,ME,CE>  CR: 22084f84  XER: 00000000
TASK = df84d6e0[908] 'mount' THREAD: df07a000
GPR00: 00000001 df07bbf0 df84d6e0 00000000 00000001 00000000 df07bb58 00000041
GPR08: 00000041 c0638860 00000000 00000010 22084f88 100636c8 df814ff8 00000000
GPR16: df84d6e0 dfa558cc c05adb90 00000048 c0452d30 00000000 000240d0 000040d0
GPR24: 00000014 c05ae734 c05be2e0 00000000 00000001 00000000 00000000 c05ae730
NIP [c00c7580] __alloc_pages_nodemask+0x4d0/0x638
LR [c00c718c] __alloc_pages_nodemask+0xdc/0x638
Call Trace:
[df07bbf0] [c00c718c] __alloc_pages_nodemask+0xdc/0x638 (unreliable)
[df07bc90] [c00c7708] __get_free_pages+0x20/0x48
[df07bca0] [c00f4a40] __kmalloc+0x15c/0x1ec
[df07bcd0] [c01fc880] jffs2_scan_medium+0xa58/0x14d0
[df07bd70] [c01ff38c] jffs2_do_mount_fs+0x1f4/0x6b4
[df07bdb0] [c020144c] jffs2_do_fill_super+0xa8/0x260
[df07bdd0] [c020230c] jffs2_fill_super+0x104/0x184
[df07be00] [c0335814] get_sb_mtd_aux+0x9c/0xec
[df07be20] [c033596c] get_sb_mtd+0x84/0x1e8
[df07be60] [c0201ed0] jffs2_get_sb+0x1c/0x2c
[df07be70] [c0103898] vfs_kern_mount+0x78/0x1e8
[df07bea0] [c0103a58] do_kern_mount+0x40/0x100
[df07bec0] [c011fe90] do_mount+0x240/0x890
[df07bf10] [c0120570] sys_mount+0x90/0xd8
[df07bf40] [c00110d8] ret_from_syscall+0x0/0x4

=== Exception: c01 at 0xff61a34
    LR = 0x100135f0
Instruction dump:
38800005 38600000 48010f41 4bfffe1c 4bfc2d15 4bfffe8c 72e90200 4082fc28
3d20c064 39298860 8809000d 68000001 <0f000000> 2f800000 419efc0c 38000001
mount: mounting /dev/mtdblock3 on /common failed: Input/output error

Signed-off-by: Chen Jie <chenjie6@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/jffs2/scan.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 7654e87b0428..9ad5ba4b299b 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -510,6 +510,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 				sumlen = c->sector_size - je32_to_cpu(sm->offset);
 				sumptr = buf + buf_size - sumlen;
 
+				/* sm->offset maybe wrong but MAGIC maybe right */
+				if (sumlen > c->sector_size)
+					goto full_scan;
+
 				/* Now, make sure the summary itself is available */
 				if (sumlen > buf_size) {
 					/* Need to kmalloc for this. */
@@ -544,6 +548,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
 		}
 	}
 
+full_scan:
 	buf_ofs = jeb->offset;
 
 	if (!buf_size) {
-- 
2.3.0


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

* [PATCH 3.12 064/175] btrfs: set proper message level for skinny metadata
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (62 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 063/175] jffs2: fix handling of corrupted summary length Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 065/175] blk-throttle: check stats_cpu before reading it from sysfs Jiri Slaby
                   ` (112 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Sterba, Chris Mason, Jiri Slaby

From: David Sterba <dsterba@suse.cz>

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

===============

commit 5efa0490cc94aee06cd8d282683e22a8ce0a0026 upstream.

This has been confusing people for too long, the message is really just
informative.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/btrfs/disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f46ad53626be..3ec1cb0808c3 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2432,7 +2432,7 @@ int open_ctree(struct super_block *sb,
 		features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
 
 	if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
-		printk(KERN_ERR "btrfs: has skinny extents\n");
+		printk(KERN_INFO "btrfs: has skinny extents\n");
 
 	/*
 	 * flag our filesystem as having big metadata blocks if
-- 
2.3.0


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

* [PATCH 3.12 065/175] blk-throttle: check stats_cpu before reading it from sysfs
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (63 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 064/175] btrfs: set proper message level for skinny metadata Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 066/175] x86, mm/ASLR: Fix stack randomization on 64-bit systems Jiri Slaby
                   ` (111 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Thadeu Lima de Souza Cascardo, Jens Axboe, Jiri Slaby

From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>

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

===============

commit 045c47ca306acf30c740c285a77a4b4bda6be7c5 upstream.

When reading blkio.throttle.io_serviced in a recently created blkio
cgroup, it's possible to race against the creation of a throttle policy,
which delays the allocation of stats_cpu.

Like other functions in the throttle code, just checking for a NULL
stats_cpu prevents the following oops caused by that race.

[ 1117.285199] Unable to handle kernel paging request for data at address 0x7fb4d0020
[ 1117.285252] Faulting instruction address: 0xc0000000003efa2c
[ 1137.733921] Oops: Kernel access of bad area, sig: 11 [#1]
[ 1137.733945] SMP NR_CPUS=2048 NUMA PowerNV
[ 1137.734025] Modules linked in: bridge stp llc kvm_hv kvm binfmt_misc autofs4
[ 1137.734102] CPU: 3 PID: 5302 Comm: blkcgroup Not tainted 3.19.0 #5
[ 1137.734132] task: c000000f1d188b00 ti: c000000f1d210000 task.ti: c000000f1d210000
[ 1137.734167] NIP: c0000000003efa2c LR: c0000000003ef9f0 CTR: c0000000003ef980
[ 1137.734202] REGS: c000000f1d213500 TRAP: 0300   Not tainted  (3.19.0)
[ 1137.734230] MSR: 9000000000009032 <SF,HV,EE,ME,IR,DR,RI>  CR: 42008884  XER: 20000000
[ 1137.734325] CFAR: 0000000000008458 DAR: 00000007fb4d0020 DSISR: 40000000 SOFTE: 0
GPR00: c0000000003ed3a0 c000000f1d213780 c000000000c59538 0000000000000000
GPR04: 0000000000000800 0000000000000000 0000000000000000 0000000000000000
GPR08: ffffffffffffffff 00000007fb4d0020 00000007fb4d0000 c000000000780808
GPR12: 0000000022000888 c00000000fdc0d80 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 000001003e120200 c000000f1d5b0cc0 0000000000000200 0000000000000000
GPR24: 0000000000000001 c000000000c269e0 0000000000000020 c000000f1d5b0c80
GPR28: c000000000ca3a08 c000000000ca3dec c000000f1c667e00 c000000f1d213850
[ 1137.734886] NIP [c0000000003efa2c] .tg_prfill_cpu_rwstat+0xac/0x180
[ 1137.734915] LR [c0000000003ef9f0] .tg_prfill_cpu_rwstat+0x70/0x180
[ 1137.734943] Call Trace:
[ 1137.734952] [c000000f1d213780] [d000000005560520] 0xd000000005560520 (unreliable)
[ 1137.734996] [c000000f1d2138a0] [c0000000003ed3a0] .blkcg_print_blkgs+0xe0/0x1a0
[ 1137.735039] [c000000f1d213960] [c0000000003efb50] .tg_print_cpu_rwstat+0x50/0x70
[ 1137.735082] [c000000f1d2139e0] [c000000000104b48] .cgroup_seqfile_show+0x58/0x150
[ 1137.735125] [c000000f1d213a70] [c0000000002749dc] .kernfs_seq_show+0x3c/0x50
[ 1137.735161] [c000000f1d213ae0] [c000000000218630] .seq_read+0xe0/0x510
[ 1137.735197] [c000000f1d213bd0] [c000000000275b04] .kernfs_fop_read+0x164/0x200
[ 1137.735240] [c000000f1d213c80] [c0000000001eb8e0] .__vfs_read+0x30/0x80
[ 1137.735276] [c000000f1d213cf0] [c0000000001eb9c4] .vfs_read+0x94/0x1b0
[ 1137.735312] [c000000f1d213d90] [c0000000001ebb38] .SyS_read+0x58/0x100
[ 1137.735349] [c000000f1d213e30] [c000000000009218] syscall_exit+0x0/0x98
[ 1137.735383] Instruction dump:
[ 1137.735405] 7c6307b4 7f891800 409d00b8 60000000 60420000 3d420004 392a63b0 786a1f24
[ 1137.735471] 7d49502a e93e01c8 7d495214 7d2ad214 <7cead02a> e9090008 e9490010 e9290018

And here is one code that allows to easily reproduce this, although this
has first been found by running docker.

void run(pid_t pid)
{
	int n;
	int status;
	int fd;
	char *buffer;
	buffer = memalign(BUFFER_ALIGN, BUFFER_SIZE);
	n = snprintf(buffer, BUFFER_SIZE, "%d\n", pid);
	fd = open(CGPATH "/test/tasks", O_WRONLY);
	write(fd, buffer, n);
	close(fd);
	if (fork() > 0) {
		fd = open("/dev/sda", O_RDONLY | O_DIRECT);
		read(fd, buffer, 512);
		close(fd);
		wait(&status);
	} else {
		fd = open(CGPATH "/test/blkio.throttle.io_serviced", O_RDONLY);
		n = read(fd, buffer, BUFFER_SIZE);
		close(fd);
	}
	free(buffer);
	exit(0);
}

void test(void)
{
	int status;
	mkdir(CGPATH "/test", 0666);
	if (fork() > 0)
		wait(&status);
	else
		run(getpid());
	rmdir(CGPATH "/test");
}

int main(int argc, char **argv)
{
	int i;
	for (i = 0; i < NR_TESTS; i++)
		test();
	return 0;
}

Reported-by: Ricardo Marin Matinata <rmm@br.ibm.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/blk-throttle.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 8331aba9426f..ca3794e17755 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1282,6 +1282,9 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf,
 	struct blkg_rwstat rwstat = { }, tmp;
 	int i, cpu;
 
+	if (tg->stats_cpu == NULL)
+		return 0;
+
 	for_each_possible_cpu(cpu) {
 		struct tg_stats_cpu *sc = per_cpu_ptr(tg->stats_cpu, cpu);
 
-- 
2.3.0


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

* [PATCH 3.12 066/175] x86, mm/ASLR: Fix stack randomization on 64-bit systems
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (64 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 065/175] blk-throttle: check stats_cpu before reading it from sysfs Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 067/175] ath6kl: fix struct hif_scatter_req list handling Jiri Slaby
                   ` (110 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Hector Marco-Gisbert, Ismael Ripoll, Kees Cook,
	Linus Torvalds, Andrew Morton, Al Viro, Borislav Petkov,
	Jiri Slaby

From: Hector Marco-Gisbert <hecmargi@upv.es>

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

===============

commit 4e7c22d447bb6d7e37bfe39ff658486ae78e8d77 upstream.

The issue is that the stack for processes is not properly randomized on
64 bit architectures due to an integer overflow.

The affected function is randomize_stack_top() in file
"fs/binfmt_elf.c":

  static unsigned long randomize_stack_top(unsigned long stack_top)
  {
           unsigned int random_variable = 0;

           if ((current->flags & PF_RANDOMIZE) &&
                   !(current->personality & ADDR_NO_RANDOMIZE)) {
                   random_variable = get_random_int() & STACK_RND_MASK;
                   random_variable <<= PAGE_SHIFT;
           }
           return PAGE_ALIGN(stack_top) + random_variable;
           return PAGE_ALIGN(stack_top) - random_variable;
  }

Note that, it declares the "random_variable" variable as "unsigned int".
Since the result of the shifting operation between STACK_RND_MASK (which
is 0x3fffff on x86_64, 22 bits) and PAGE_SHIFT (which is 12 on x86_64):

	  random_variable <<= PAGE_SHIFT;

then the two leftmost bits are dropped when storing the result in the
"random_variable". This variable shall be at least 34 bits long to hold
the (22+12) result.

These two dropped bits have an impact on the entropy of process stack.
Concretely, the total stack entropy is reduced by four: from 2^28 to
2^30 (One fourth of expected entropy).

This patch restores back the entropy by correcting the types involved
in the operations in the functions randomize_stack_top() and
stack_maxrandom_size().

The successful fix can be tested with:

  $ for i in `seq 1 10`; do cat /proc/self/maps | grep stack; done
  7ffeda566000-7ffeda587000 rw-p 00000000 00:00 0                          [stack]
  7fff5a332000-7fff5a353000 rw-p 00000000 00:00 0                          [stack]
  7ffcdb7a1000-7ffcdb7c2000 rw-p 00000000 00:00 0                          [stack]
  7ffd5e2c4000-7ffd5e2e5000 rw-p 00000000 00:00 0                          [stack]
  ...

Once corrected, the leading bytes should be between 7ffc and 7fff,
rather than always being 7fff.

Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Signed-off-by: Ismael Ripoll <iripoll@upv.es>
[ Rebased, fixed 80 char bugs, cleaned up commit message, added test example and CVE ]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Fixes: CVE-2015-1593
Link: http://lkml.kernel.org/r/20150214173350.GA18393@www.outflux.net
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/mmap.c | 6 +++---
 fs/binfmt_elf.c    | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 25e7e1372bb2..3601ff284b92 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -35,12 +35,12 @@ struct __read_mostly va_alignment va_align = {
 	.flags = -1,
 };
 
-static unsigned int stack_maxrandom_size(void)
+static unsigned long stack_maxrandom_size(void)
 {
-	unsigned int max = 0;
+	unsigned long max = 0;
 	if ((current->flags & PF_RANDOMIZE) &&
 		!(current->personality & ADDR_NO_RANDOMIZE)) {
-		max = ((-1U) & STACK_RND_MASK) << PAGE_SHIFT;
+		max = ((-1UL) & STACK_RND_MASK) << PAGE_SHIFT;
 	}
 
 	return max;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 4c94a79991bb..c757a131bb4a 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -552,11 +552,12 @@ out:
 
 static unsigned long randomize_stack_top(unsigned long stack_top)
 {
-	unsigned int random_variable = 0;
+	unsigned long random_variable = 0;
 
 	if ((current->flags & PF_RANDOMIZE) &&
 		!(current->personality & ADDR_NO_RANDOMIZE)) {
-		random_variable = get_random_int() & STACK_RND_MASK;
+		random_variable = (unsigned long) get_random_int();
+		random_variable &= STACK_RND_MASK;
 		random_variable <<= PAGE_SHIFT;
 	}
 #ifdef CONFIG_STACK_GROWSUP
-- 
2.3.0


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

* [PATCH 3.12 067/175] ath6kl: fix struct hif_scatter_req list handling
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (65 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 066/175] x86, mm/ASLR: Fix stack randomization on 64-bit systems Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 068/175] staging: comedi: cb_pcidas64: fix incorrect AI range code handling Jiri Slaby
                   ` (109 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Kalle Valo, Jiri Slaby

From: Kalle Valo <kvalo@qca.qualcomm.com>

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

===============

commit 31b9cc9a873dcab161999622314f98a75d838975 upstream.

Jason noticed that with Yocto GCC 4.8.1 ath6kl crashes with this iperf command:

iperf -c $TARGET_IP -i 5 -t 50 -w 1M

The crash was:

Unable to handle kernel paging request at virtual address 1a480000
pgd = 80004000
[1a480000] *pgd=00000000
Internal error: Oops: 805 [#1] SMP ARM
Modules linked in: ath6kl_sdio ath6kl_core [last unloaded: ath6kl_core]
CPU: 0 PID: 1953 Comm: kworker/u4:0 Not tainted 3.10.9-1.0.0_alpha+dbf364b #1
Workqueue: ath6kl ath6kl_sdio_write_async_work [ath6kl_sdio]
task: dcc9a680 ti: dc9ae000 task.ti: dc9ae000
PC is at v7_dma_clean_range+0x20/0x38
LR is at dma_cache_maint_page+0x50/0x54
pc : [<8001a6f8>]    lr : [<800170fc>]    psr: 20000093
sp : dc9afcf8  ip : 8001a748  fp : 00000004
r10: 00000000  r9 : 00000001  r8 : 00000000
r7 : 00000001  r6 : 00000000  r5 : 80cb7000  r4 : 03f9a480
r3 : 0000001f  r2 : 00000020  r1 : 1a480000  r0 : 1a480000
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c53c7d  Table: 6cc5004a  DAC: 00000015
Process kworker/u4:0 (pid: 1953, stack limit = 0xdc9ae238)
Stack: (0xdc9afcf8 to 0xdc9b0000)
fce0:                                                       80c9b29c 00000000
fd00: 00000000 80017134 8001a748 dc302ac0 00000000 00000000 dc454a00 80c12ed8
fd20: dc115410 80017238 00000000 dc454a10 00000001 80017588 00000001 00000000
fd40: 00000000 dc302ac0 dc9afe38 dc9afe68 00000004 80c12ed8 00000000 dc454a00
fd60: 00000004 80436f88 00000000 00000000 00000600 0000ffff 0000000c 80c113c4
fd80: 80c9b29c 00000001 00000004 dc115470 60000013 dc302ac0 dc46e000 dc302800
fda0: dc9afe10 dc302b78 60000013 dc302ac0 dc46e000 00000035 dc46e5b0 80438c90
fdc0: dc9afe10 dc302800 dc302800 dc9afe68 dc9afe38 80424cb4 00000005 dc9afe10
fde0: dc9afe20 80424de8 dc9afe10 dc302800 dc46e910 80424e90 dc473c00 dc454f00
fe00: 000001b5 7f619d64 dcc7c830 00000000 00000000 dc9afe38 dc9afe68 00000000
fe20: 00000000 00000000 dc9afe28 dc9afe28 80424d80 00000000 00000035 9cac0034
fe40: 00000000 00000000 00000000 00000000 000001b5 00000000 00000000 00000000
fe60: dc9afe68 dc9afe10 3b9aca00 00000000 00000080 00000034 00000000 00000100
fe80: 00000000 00000000 dc9afe10 00000004 dc454a00 00000000 dc46e010 dc46e96c
fea0: dc46e000 dc46e964 00200200 00100100 dc46e910 7f619ec0 00000600 80c0e770
fec0: dc15a900 dcc7c838 00000000 dc46e954 8042d434 dcc44680 dc46e954 dc004400
fee0: dc454500 00000000 00000000 dc9ae038 dc004400 8003c450 dcc44680 dc004414
ff00: dc46e954 dc454500 00000001 dcc44680 dc004414 dcc44698 dc9ae000 dc9ae030
ff20: 00000001 dc9ae000 dc004400 8003d158 8003d020 00000000 00000000 80c53941
ff40: dc9aff64 dcb71ea0 00000000 dcc44680 8003d020 00000000 00000000 00000000
ff60: 00000000 80042480 00000000 00000000 000000f8 dcc44680 00000000 00000000
ff80: dc9aff80 dc9aff80 00000000 00000000 dc9aff90 dc9aff90 dc9affac dcb71ea0
ffa0: 800423cc 00000000 00000000 8000e018 00000000 00000000 00000000 00000000
ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<8001a6f8>] (v7_dma_clean_range+0x20/0x38) from [<800170fc>] (dma_cache_maint_page+0x50/0x54)
[<800170fc>] (dma_cache_maint_page+0x50/0x54) from [<80017134>] (__dma_page_cpu_to_dev+0x34/0x9c)
[<80017134>] (__dma_page_cpu_to_dev+0x34/0x9c) from [<80017238>] (arm_dma_map_page+0x64/0x68)
[<80017238>] (arm_dma_map_page+0x64/0x68) from [<80017588>] (arm_dma_map_sg+0x7c/0xf4)
[<80017588>] (arm_dma_map_sg+0x7c/0xf4) from [<80436f88>] (sdhci_send_command+0x894/0xe00)
[<80436f88>] (sdhci_send_command+0x894/0xe00) from [<80438c90>] (sdhci_request+0xc0/0x1ec)
[<80438c90>] (sdhci_request+0xc0/0x1ec) from [<80424cb4>] (mmc_start_request+0xb8/0xd4)
[<80424cb4>] (mmc_start_request+0xb8/0xd4) from [<80424de8>] (__mmc_start_req+0x60/0x84)
[<80424de8>] (__mmc_start_req+0x60/0x84) from [<80424e90>] (mmc_wait_for_req+0x10/0x20)
[<80424e90>] (mmc_wait_for_req+0x10/0x20) from [<7f619d64>] (ath6kl_sdio_scat_rw.isra.10+0x1dc/0x240 [ath6kl_sdio])
[<7f619d64>] (ath6kl_sdio_scat_rw.isra.10+0x1dc/0x240 [ath6kl_sdio]) from [<7f619ec0>] (ath6kl_sdio_write_async_work+0x5c/0x104 [ath6kl_sdio])
[<7f619ec0>] (ath6kl_sdio_write_async_work+0x5c/0x104 [ath6kl_sdio]) from [<8003c450>] (process_one_work+0x10c/0x370)
[<8003c450>] (process_one_work+0x10c/0x370) from [<8003d158>] (worker_thread+0x138/0x3fc)
[<8003d158>] (worker_thread+0x138/0x3fc) from [<80042480>] (kthread+0xb4/0xb8)
[<80042480>] (kthread+0xb4/0xb8) from [<8000e018>] (ret_from_fork+0x14/0x3c)
Code: e1a02312 e2423001 e1c00003 f57ff04f (ee070f3a)
---[ end trace 0c038f0b8e0b67a3 ]---
Kernel panic - not syncing: Fatal exception

Jason's analysis:

  "The GCC 4.8.1 compiler will not do the for-loop till scat_entries, instead,
   it only run one round loop. This may be caused by that the GCC 4.8.1 thought
   that the scat_list only have one item and then no need to do full iteration,
   but this is simply wrong by looking at the assebly code. This will cause the sg
   buffer not get set when scat_entries > 1 and thus lead to kernel panic.

   Note: This issue not observed with GCC 4.7.2, only found on the GCC 4.8.1)"

Fix this by using the normal [0] style for defining unknown number of list
entries following the struct. This also fixes corruption with scat_q_depth, which
was mistankely added to the end of struct and overwritten if there were more
than item in the scat list.

Reported-by: Jason Liu <r64343@freescale.com>
Tested-by: Jason Liu <r64343@freescale.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/ath/ath6kl/hif.h  | 4 ++--
 drivers/net/wireless/ath/ath6kl/sdio.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/hif.h b/drivers/net/wireless/ath/ath6kl/hif.h
index 61f6b21fb0ae..dc6bd8cd9b83 100644
--- a/drivers/net/wireless/ath/ath6kl/hif.h
+++ b/drivers/net/wireless/ath/ath6kl/hif.h
@@ -197,9 +197,9 @@ struct hif_scatter_req {
 	/* bounce buffer for upper layers to copy to/from */
 	u8 *virt_dma_buf;
 
-	struct hif_scatter_item scat_list[1];
-
 	u32 scat_q_depth;
+
+	struct hif_scatter_item scat_list[0];
 };
 
 struct ath6kl_irq_proc_registers {
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 7126bdd4236c..6bf15a331714 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -348,7 +348,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio,
 	int i, scat_req_sz, scat_list_sz, size;
 	u8 *virt_buf;
 
-	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+	scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item);
 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
 
 	if (!virt_scat)
-- 
2.3.0


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

* [PATCH 3.12 068/175] staging: comedi: cb_pcidas64: fix incorrect AI range code handling
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (66 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 067/175] ath6kl: fix struct hif_scatter_req list handling Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 069/175] USB: EHCI: adjust error return code Jiri Slaby
                   ` (108 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ian Abbott, Greg Kroah-Hartman, Jiri Slaby

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

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

===============

commit be8e89087ec2d2c8a1ad1e3db64bf4efdfc3c298 upstream.

The hardware range code values and list of valid ranges for the AI
subdevice is incorrect for several supported boards.  The hardware range
code values for all boards except PCI-DAS4020/12 is determined by
calling `ai_range_bits_6xxx()` based on the maximum voltage of the range
and whether it is bipolar or unipolar, however it only returns the
correct hardware range code for the PCI-DAS60xx boards.  For
PCI-DAS6402/16 (and /12) it returns the wrong code for the unipolar
ranges.  For PCI-DAS64/Mx/16 it returns the wrong code for all the
ranges and the comedi range table is incorrect.

Change `ai_range_bits_6xxx()` to use a look-up table pointed to by new
member `ai_range_codes` of `struct pcidas64_board` to map the comedi
range table indices to the hardware range codes.  Use a new comedi range
table for the PCI-DAS64/Mx/16 boards (and the commented out variants).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 122 ++++++++++++++++-----------
 1 file changed, 75 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 388dbd7a5d27..21e5bc541417 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -451,6 +451,29 @@ static const struct comedi_lrange ai_ranges_64xx = {
 	 }
 };
 
+static const uint8_t ai_range_code_64xx[8] = {
+	0x0, 0x1, 0x2, 0x3,	/* bipolar 10, 5, 2,5, 1.25 */
+	0x8, 0x9, 0xa, 0xb	/* unipolar 10, 5, 2.5, 1.25 */
+};
+
+/* analog input ranges for 64-Mx boards */
+static const struct comedi_lrange ai_ranges_64_mx = {
+	7, {
+		BIP_RANGE(5),
+		BIP_RANGE(2.5),
+		BIP_RANGE(1.25),
+		BIP_RANGE(0.625),
+		UNI_RANGE(5),
+		UNI_RANGE(2.5),
+		UNI_RANGE(1.25)
+	}
+};
+
+static const uint8_t ai_range_code_64_mx[7] = {
+	0x0, 0x1, 0x2, 0x3,	/* bipolar 5, 2.5, 1.25, 0.625 */
+	0x9, 0xa, 0xb		/* unipolar 5, 2.5, 1.25 */
+};
+
 /* analog input ranges for 60xx boards */
 static const struct comedi_lrange ai_ranges_60xx = {
 	4,
@@ -462,6 +485,10 @@ static const struct comedi_lrange ai_ranges_60xx = {
 	 }
 };
 
+static const uint8_t ai_range_code_60xx[4] = {
+	0x0, 0x1, 0x4, 0x7	/* bipolar 10, 5, 0.5, 0.05 */
+};
+
 /* analog input ranges for 6030, etc boards */
 static const struct comedi_lrange ai_ranges_6030 = {
 	14,
@@ -483,6 +510,11 @@ static const struct comedi_lrange ai_ranges_6030 = {
 	 }
 };
 
+static const uint8_t ai_range_code_6030[14] = {
+	0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */
+	0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf  /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */
+};
+
 /* analog input ranges for 6052, etc boards */
 static const struct comedi_lrange ai_ranges_6052 = {
 	15,
@@ -505,6 +537,11 @@ static const struct comedi_lrange ai_ranges_6052 = {
 	 }
 };
 
+static const uint8_t ai_range_code_6052[15] = {
+	0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7,	/* bipolar 10 ... 0.05 */
+	0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf	/* unipolar 10 ... 0.1 */
+};
+
 /* analog input ranges for 4020 board */
 static const struct comedi_lrange ai_ranges_4020 = {
 	2,
@@ -612,6 +649,7 @@ struct pcidas64_board {
 	int ai_bits;		/*  analog input resolution */
 	int ai_speed;		/*  fastest conversion period in ns */
 	const struct comedi_lrange *ai_range_table;
+	const uint8_t *ai_range_code;
 	int ao_nchan;		/*  number of analog out channels */
 	int ao_bits;		/*  analog output resolution */
 	int ao_scan_speed;	/*  analog output scan speed */
@@ -670,6 +708,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
 		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_code	= ai_range_code_64xx,
 		.ao_range_table	= &ao_ranges_64xx,
 		.ao_range_code	= ao_range_code_64xx,
 		.ai_fifo	= &ai_fifo_64xx,
@@ -685,6 +724,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
 		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_code	= ai_range_code_64xx,
 		.ao_range_table	= &ao_ranges_64xx,
 		.ao_range_code	= ao_range_code_64xx,
 		.ai_fifo	= &ai_fifo_64xx,
@@ -699,7 +739,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_bits	= 16,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ao_range_table	= &ao_ranges_64xx,
 		.ao_range_code	= ao_range_code_64xx,
 		.ai_fifo	= &ai_fifo_64xx,
@@ -714,7 +755,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_bits	= 16,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ao_range_table	= &ao_ranges_64xx,
 		.ao_range_code	= ao_range_code_64xx,
 		.ai_fifo	= &ai_fifo_64xx,
@@ -729,7 +771,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_bits	= 16,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ao_range_table	= &ao_ranges_64xx,
 		.ao_range_code	= ao_range_code_64xx,
 		.ai_fifo	= &ai_fifo_64xx,
@@ -744,6 +787,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_bits	= 16,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ao_range_table	= &range_bipolar10,
 		.ao_range_code	= ao_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -759,6 +803,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 100000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ao_range_table	= &range_bipolar10,
 		.ao_range_code	= ao_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -773,6 +818,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 100000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ao_range_table	= &range_bipolar10,
 		.ao_range_code	= ao_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -788,6 +834,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 100000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ao_range_table	= &range_bipolar10,
 		.ao_range_code	= ao_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -803,6 +850,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6030,
+		.ai_range_code	= ai_range_code_6030,
 		.ao_range_table	= &ao_ranges_6030,
 		.ao_range_code	= ao_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -818,6 +866,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6030,
+		.ai_range_code	= ai_range_code_6030,
 		.ao_range_table	= &ao_ranges_6030,
 		.ao_range_code	= ao_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -831,6 +880,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 0,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6030,
+		.ai_range_code	= ai_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
 		.has_8255	= 0,
 	},
@@ -842,6 +892,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 0,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6030,
+		.ai_range_code	= ai_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
 		.has_8255	= 0,
 	},
@@ -854,6 +905,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 0,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
 		.has_8255	= 0,
 	},
@@ -867,6 +919,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 100000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ao_range_table	= &range_bipolar10,
 		.ao_range_code	= ao_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -882,6 +935,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 100000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_60xx,
+		.ai_range_code	= ai_range_code_60xx,
 		.ao_range_table	= &range_bipolar10,
 		.ao_range_code	= ao_range_code_60xx,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -897,6 +951,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 1000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6052,
+		.ai_range_code	= ai_range_code_6052,
 		.ao_range_table	= &ao_ranges_6030,
 		.ao_range_code	= ao_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -912,6 +967,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 3333,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6052,
+		.ai_range_code	= ai_range_code_6052,
 		.ao_range_table	= &ao_ranges_6030,
 		.ao_range_code	= ao_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -927,6 +983,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 1000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6052,
+		.ai_range_code	= ai_range_code_6052,
 		.ao_range_table	= &ao_ranges_6030,
 		.ao_range_code	= ao_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -942,6 +999,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 1000,
 		.layout		= LAYOUT_60XX,
 		.ai_range_table	= &ai_ranges_6052,
+		.ai_range_code	= ai_range_code_6052,
 		.ao_range_table	= &ao_ranges_6030,
 		.ao_range_code	= ao_range_code_6030,
 		.ai_fifo	= &ai_fifo_60xx,
@@ -976,6 +1034,7 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
 		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_code	= ai_range_code_64xx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -987,7 +1046,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 0,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -999,7 +1059,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 0,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -1011,7 +1072,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 0,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -1023,7 +1085,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 2,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -1035,7 +1098,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 2,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -1047,7 +1111,8 @@ static const struct pcidas64_board pcidas64_boards[] = {
 		.ao_nchan	= 2,
 		.ao_scan_speed	= 10000,
 		.layout		= LAYOUT_64XX,
-		.ai_range_table	= &ai_ranges_64xx,
+		.ai_range_table	= &ai_ranges_64_mx,
+		.ai_range_code	= ai_range_code_64_mx,
 		.ai_fifo	= ai_fifo_64xx,
 		.has_8255	= 1,
 	},
@@ -1144,45 +1209,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev,
 				       unsigned int range_index)
 {
 	const struct pcidas64_board *thisboard = comedi_board(dev);
-	const struct comedi_krange *range =
-		&thisboard->ai_range_table->range[range_index];
-	unsigned int bits = 0;
 
-	switch (range->max) {
-	case 10000000:
-		bits = 0x000;
-		break;
-	case 5000000:
-		bits = 0x100;
-		break;
-	case 2000000:
-	case 2500000:
-		bits = 0x200;
-		break;
-	case 1000000:
-	case 1250000:
-		bits = 0x300;
-		break;
-	case 500000:
-		bits = 0x400;
-		break;
-	case 200000:
-	case 250000:
-		bits = 0x500;
-		break;
-	case 100000:
-		bits = 0x600;
-		break;
-	case 50000:
-		bits = 0x700;
-		break;
-	default:
-		comedi_error(dev, "bug! in ai_range_bits_6xxx");
-		break;
-	}
-	if (range->min == 0)
-		bits += 0x900;
-	return bits;
+	return thisboard->ai_range_code[range_index] << 8;
 }
 
 static unsigned int hw_revision(const struct comedi_device *dev,
-- 
2.3.0


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

* [PATCH 3.12 069/175] USB: EHCI: adjust error return code
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (67 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 068/175] staging: comedi: cb_pcidas64: fix incorrect AI range code handling Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 070/175] MIPS: Export FP functions used by lose_fpu(1) for KVM Jiri Slaby
                   ` (107 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alan Stern, Greg Kroah-Hartman, Jiri Slaby

From: Alan Stern <stern@rowland.harvard.edu>

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

===============

commit c401e7b4a808d50ab53ef45cb8d0b99b238bf2c9 upstream.

The USB stack uses error code -ENOSPC to indicate that the periodic
schedule is too full, with insufficient bandwidth to accommodate a new
allocation.  It uses -EFBIG to indicate that an isochronous transfer
could not be linked into the schedule because it would exceed the
number of isochronous packets the host controller driver can handle
(generally because the new transfer would extend too far into the
future).

ehci-hcd uses the wrong error code at one point.  This patch fixes it,
along with a misleading comment and debugging message.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/ehci-sched.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 8ecf164f0318..a70e4579623c 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1409,12 +1409,12 @@ iso_stream_schedule (
 		next = (next - base) & (mod - 1);
 		start = (stream->next_uframe - base) & (mod - 1);
 
-		/* Is the schedule already full? */
+		/* Is the schedule about to wrap around? */
 		if (unlikely(start < period)) {
-			ehci_dbg(ehci, "iso sched full %p (%u-%u < %u mod %u)\n",
+			ehci_dbg(ehci, "request %p would overflow (%u-%u < %u mod %u)\n",
 					urb, stream->next_uframe, base,
 					period, mod);
-			status = -ENOSPC;
+			status = -EFBIG;
 			goto fail;
 		}
 
-- 
2.3.0


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

* [PATCH 3.12 070/175] MIPS: Export FP functions used by lose_fpu(1) for KVM
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (68 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 069/175] USB: EHCI: adjust error return code Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 071/175] ipvs: add missing ip_vs_pe_put in sync code Jiri Slaby
                   ` (106 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, James Hogan, Paolo Bonzini, Ralf Baechle,
	Paul Burton, Gleb Natapov, kvm, linux-mips, Jiri Slaby

From: James Hogan <james.hogan@imgtec.com>

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

===============

commit 3ce465e04bfd8de9956d515d6e9587faac3375dc upstream.

Export the _save_fp asm function used by the lose_fpu(1) macro to GPL
modules so that KVM can make use of it when it is built as a module.

This fixes the following build error when CONFIG_KVM=m due to commit
f798217dfd03 ("KVM: MIPS: Don't leak FPU/DSP to guest"):

ERROR: "_save_fp" [arch/mips/kvm/kvm.ko] undefined!

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Fixes: f798217dfd03 (KVM: MIPS: Don't leak FPU/DSP to guest)
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9260/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
[james.hogan@imgtec.com: Only export when CPU_R4K_FPU=y prior to v3.16,
 so as not to break the Octeon build which excludes FPU support. KVM
 depends on MIPS32r2 anyway.]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kernel/mips_ksyms.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 6e58e97fcd39..cedeb5686eb5 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -14,6 +14,7 @@
 #include <linux/mm.h>
 #include <asm/uaccess.h>
 #include <asm/ftrace.h>
+#include <asm/fpu.h>
 
 extern void *__bzero(void *__s, size_t __count);
 extern long __strncpy_from_user_nocheck_asm(char *__to,
@@ -26,6 +27,13 @@ extern long __strnlen_user_nocheck_asm(const char *s);
 extern long __strnlen_user_asm(const char *s);
 
 /*
+ * Core architecture code
+ */
+#ifdef CONFIG_CPU_R4K_FPU
+EXPORT_SYMBOL_GPL(_save_fp);
+#endif
+
+/*
  * String functions
  */
 EXPORT_SYMBOL(memset);
-- 
2.3.0


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

* [PATCH 3.12 071/175] ipvs: add missing ip_vs_pe_put in sync code
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (69 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 070/175] MIPS: Export FP functions used by lose_fpu(1) for KVM Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 072/175] ipvs: rerouting to local clients is not needed anymore Jiri Slaby
                   ` (105 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Julian Anastasov, Simon Horman, Jiri Slaby

From: Julian Anastasov <ja@ssi.bg>

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

===============

[ upstream commit 528c943f3bb919aef75ab2fff4f00176f09a4019 ]

ip_vs_conn_fill_param_sync() gets in param.pe a module
reference for persistence engine from __ip_vs_pe_getbyname()
but forgets to put it. Problem occurs in backup for
sync protocol v1 (2.6.39).

Also, pe_data usually comes in sync messages for
connection templates and ip_vs_conn_new() copies
the pointer only in this case. Make sure pe_data
is not leaked if it comes unexpectedly for normal
connections. Leak can happen only if bogus messages
are sent to backup server.

Fixes: fe5e7a1efb66 ("IPVS: Backup, Adding Version 1 receive capability")
Cc: <stable@vger.kernel.org> # 3.10.x
Cc: <stable@vger.kernel.org> # 3.12.x
Cc: <stable@vger.kernel.org> # 3.14.x
Cc: <stable@vger.kernel.org> # 3.18.x
Cc: <stable@vger.kernel.org> # 3.19.x
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/netfilter/ipvs/ip_vs_sync.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index f4484719f3e6..6d91d760a896 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -891,6 +891,8 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param,
 			IP_VS_DBG(2, "BACKUP, add new conn. failed\n");
 			return;
 		}
+		if (!(flags & IP_VS_CONN_F_TEMPLATE))
+			kfree(param->pe_data);
 	}
 
 	if (opt)
@@ -1164,6 +1166,7 @@ static inline int ip_vs_proc_sync_conn(struct net *net, __u8 *p, __u8 *msg_end)
 				(opt_flags & IPVS_OPT_F_SEQ_DATA ? &opt : NULL)
 				);
 #endif
+	ip_vs_pe_put(param.pe);
 	return 0;
 	/* Error exit */
 out:
-- 
2.3.0


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

* [PATCH 3.12 072/175] ipvs: rerouting to local clients is not needed anymore
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (70 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 071/175] ipvs: add missing ip_vs_pe_put in sync code Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 073/175] netfilter: xt_socket: fix a stack corruption bug Jiri Slaby
                   ` (104 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Julian Anastasov, Simon Horman, Jiri Slaby

From: Julian Anastasov <ja@ssi.bg>

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

===============

[ upstream commit 579eb62ac35845686a7c4286c0a820b4eb1f96aa ]

commit f5a41847acc5 ("ipvs: move ip_route_me_harder for ICMP")
from 2.6.37 introduced ip_route_me_harder() call for responses to
local clients, so that we can provide valid rt_src after SNAT.
It was used by TCP to provide valid daddr for ip_send_reply().
After commit 0a5ebb8000c5 ("ipv4: Pass explicit daddr arg to
ip_send_reply()." from 3.0 this rerouting is not needed anymore
and should be avoided, especially in LOCAL_IN.

Fixes 3.12.33 crash in xfrm reported by Florian Wiessner:
"3.12.33 - BUG xfrm_selector_match+0x25/0x2f6"

Cc: <stable@vger.kernel.org> # 3.10.x
Cc: <stable@vger.kernel.org> # 3.12.x
Cc: <stable@vger.kernel.org> # 3.14.x
Cc: <stable@vger.kernel.org> # 3.18.x
Reported-by: Smart Weblications GmbH - Florian Wiessner <f.wiessner@smart-weblications.de>
Tested-by: Smart Weblications GmbH - Florian Wiessner <f.wiessner@smart-weblications.de>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/netfilter/ipvs/ip_vs_core.c | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index f7a758fae8e5..d1d6b82d2250 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -658,16 +658,24 @@ static inline int ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
 	return err;
 }
 
-static int ip_vs_route_me_harder(int af, struct sk_buff *skb)
+static int ip_vs_route_me_harder(int af, struct sk_buff *skb,
+				 unsigned int hooknum)
 {
+	if (!sysctl_snat_reroute(skb))
+		return 0;
+	/* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */
+	if (NF_INET_LOCAL_IN == hooknum)
+		return 0;
 #ifdef CONFIG_IP_VS_IPV6
 	if (af == AF_INET6) {
-		if (sysctl_snat_reroute(skb) && ip6_route_me_harder(skb) != 0)
+		struct dst_entry *dst = skb_dst(skb);
+
+		if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) &&
+		    ip6_route_me_harder(skb) != 0)
 			return 1;
 	} else
 #endif
-		if ((sysctl_snat_reroute(skb) ||
-		     skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
+		if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
 		    ip_route_me_harder(skb, RTN_LOCAL) != 0)
 			return 1;
 
@@ -790,7 +798,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
 				union nf_inet_addr *snet,
 				__u8 protocol, struct ip_vs_conn *cp,
 				struct ip_vs_protocol *pp,
-				unsigned int offset, unsigned int ihl)
+				unsigned int offset, unsigned int ihl,
+				unsigned int hooknum)
 {
 	unsigned int verdict = NF_DROP;
 
@@ -820,7 +829,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
 #endif
 		ip_vs_nat_icmp(skb, pp, cp, 1);
 
-	if (ip_vs_route_me_harder(af, skb))
+	if (ip_vs_route_me_harder(af, skb, hooknum))
 		goto out;
 
 	/* do the statistics and put it back */
@@ -915,7 +924,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related,
 
 	snet.ip = iph->saddr;
 	return handle_response_icmp(AF_INET, skb, &snet, cih->protocol, cp,
-				    pp, ciph.len, ihl);
+				    pp, ciph.len, ihl, hooknum);
 }
 
 #ifdef CONFIG_IP_VS_IPV6
@@ -980,7 +989,8 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related,
 	snet.in6 = ciph.saddr.in6;
 	writable = ciph.len;
 	return handle_response_icmp(AF_INET6, skb, &snet, ciph.protocol, cp,
-				    pp, writable, sizeof(struct ipv6hdr));
+				    pp, writable, sizeof(struct ipv6hdr),
+				    hooknum);
 }
 #endif
 
@@ -1039,7 +1049,8 @@ static inline bool is_new_conn(const struct sk_buff *skb,
  */
 static unsigned int
 handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
-		struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
+		struct ip_vs_conn *cp, struct ip_vs_iphdr *iph,
+		unsigned int hooknum)
 {
 	struct ip_vs_protocol *pp = pd->pp;
 
@@ -1077,7 +1088,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
 	 * if it came from this machine itself.  So re-compute
 	 * the routing information.
 	 */
-	if (ip_vs_route_me_harder(af, skb))
+	if (ip_vs_route_me_harder(af, skb, hooknum))
 		goto drop;
 
 	IP_VS_DBG_PKT(10, af, pp, skb, 0, "After SNAT");
@@ -1180,7 +1191,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af)
 	cp = pp->conn_out_get(af, skb, &iph, 0);
 
 	if (likely(cp))
-		return handle_response(af, skb, pd, cp, &iph);
+		return handle_response(af, skb, pd, cp, &iph, hooknum);
 	if (sysctl_nat_icmp_send(net) &&
 	    (pp->protocol == IPPROTO_TCP ||
 	     pp->protocol == IPPROTO_UDP ||
-- 
2.3.0


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

* [PATCH 3.12 073/175] netfilter: xt_socket: fix a stack corruption bug
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (71 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 072/175] ipvs: rerouting to local clients is not needed anymore Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 074/175] pktgen: fix UDP checksum computation Jiri Slaby
                   ` (103 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric Dumazet, Pablo Neira Ayuso, Jiri Slaby

From: Eric Dumazet <edumazet@google.com>

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

===============

[ upstream commit 78296c97ca1fd3b104f12e1f1fbc06c46635990b ]

As soon as extract_icmp6_fields() returns, its local storage (automatic
variables) is deallocated and can be overwritten.

Lets add an additional parameter to make sure storage is valid long
enough.

While we are at it, adds some const qualifiers.

Cc: <stable@vger.kernel.org> # 3.12.x
Cc: <stable@vger.kernel.org> # 3.14.x
Cc: <stable@vger.kernel.org> # 3.18.x
Cc: <stable@vger.kernel.org> # 3.19.x
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: b64c9256a9b76 ("tproxy: added IPv6 support to the socket match")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/netfilter/xt_socket.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c
index 06df2b9110f5..fcea773971ca 100644
--- a/net/netfilter/xt_socket.c
+++ b/net/netfilter/xt_socket.c
@@ -252,12 +252,13 @@ static int
 extract_icmp6_fields(const struct sk_buff *skb,
 		     unsigned int outside_hdrlen,
 		     int *protocol,
-		     struct in6_addr **raddr,
-		     struct in6_addr **laddr,
+		     const struct in6_addr **raddr,
+		     const struct in6_addr **laddr,
 		     __be16 *rport,
-		     __be16 *lport)
+		     __be16 *lport,
+		     struct ipv6hdr *ipv6_var)
 {
-	struct ipv6hdr *inside_iph, _inside_iph;
+	const struct ipv6hdr *inside_iph;
 	struct icmp6hdr *icmph, _icmph;
 	__be16 *ports, _ports[2];
 	u8 inside_nexthdr;
@@ -272,12 +273,14 @@ extract_icmp6_fields(const struct sk_buff *skb,
 	if (icmph->icmp6_type & ICMPV6_INFOMSG_MASK)
 		return 1;
 
-	inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), sizeof(_inside_iph), &_inside_iph);
+	inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph),
+					sizeof(*ipv6_var), ipv6_var);
 	if (inside_iph == NULL)
 		return 1;
 	inside_nexthdr = inside_iph->nexthdr;
 
-	inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph),
+	inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) +
+					      sizeof(*ipv6_var),
 					 &inside_nexthdr, &inside_fragoff);
 	if (inside_hdrlen < 0)
 		return 1; /* hjm: Packet has no/incomplete transport layer headers. */
@@ -324,10 +327,10 @@ xt_socket_get_sock_v6(struct net *net, const u8 protocol,
 static bool
 socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par)
 {
-	struct ipv6hdr *iph = ipv6_hdr(skb);
+	struct ipv6hdr ipv6_var, *iph = ipv6_hdr(skb);
 	struct udphdr _hdr, *hp = NULL;
 	struct sock *sk = skb->sk;
-	struct in6_addr *daddr = NULL, *saddr = NULL;
+	const struct in6_addr *daddr = NULL, *saddr = NULL;
 	__be16 uninitialized_var(dport), uninitialized_var(sport);
 	int thoff = 0, uninitialized_var(tproto);
 	const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo;
@@ -351,7 +354,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par)
 
 	} else if (tproto == IPPROTO_ICMPV6) {
 		if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr,
-					 &sport, &dport))
+					 &sport, &dport, &ipv6_var))
 			return false;
 	} else {
 		return false;
-- 
2.3.0


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

* [PATCH 3.12 074/175] pktgen: fix UDP checksum computation
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (72 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 073/175] netfilter: xt_socket: fix a stack corruption bug Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 075/175] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Jiri Slaby
                   ` (102 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sabrina Dubroca, David S. Miller, Jiri Slaby

From: Sabrina Dubroca <sd@queasysnail.net>

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

===============

[ Upstream commit 7744b5f3693cc06695cb9d6667671c790282730f ]

This patch fixes two issues in UDP checksum computation in pktgen.

First, the pseudo-header uses the source and destination IP
addresses. Currently, the ports are used for IPv4.

Second, the UDP checksum covers both header and data.  So we need to
generate the data earlier (move pktgen_finalize_skb up), and compute
the checksum for UDP header + data.

Fixes: c26bf4a51308c ("pktgen: Add UDPCSUM flag to support UDP checksums")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/core/pktgen.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index a797fff7f222..a104ba3c5768 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2771,25 +2771,25 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
 	skb->dev = odev;
 	skb->pkt_type = PACKET_HOST;
 
+	pktgen_finalize_skb(pkt_dev, skb, datalen);
+
 	if (!(pkt_dev->flags & F_UDPCSUM)) {
 		skb->ip_summed = CHECKSUM_NONE;
 	} else if (odev->features & NETIF_F_V4_CSUM) {
 		skb->ip_summed = CHECKSUM_PARTIAL;
 		skb->csum = 0;
-		udp4_hwcsum(skb, udph->source, udph->dest);
+		udp4_hwcsum(skb, iph->saddr, iph->daddr);
 	} else {
-		__wsum csum = udp_csum(skb);
+		__wsum csum = skb_checksum(skb, skb_transport_offset(skb), datalen + 8, 0);
 
 		/* add protocol-dependent pseudo-header */
-		udph->check = csum_tcpudp_magic(udph->source, udph->dest,
+		udph->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
 						datalen + 8, IPPROTO_UDP, csum);
 
 		if (udph->check == 0)
 			udph->check = CSUM_MANGLED_0;
 	}
 
-	pktgen_finalize_skb(pkt_dev, skb, datalen);
-
 #ifdef CONFIG_XFRM
 	if (!process_ipsec(pkt_dev, skb, protocol))
 		return NULL;
@@ -2905,6 +2905,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 	skb->dev = odev;
 	skb->pkt_type = PACKET_HOST;
 
+	pktgen_finalize_skb(pkt_dev, skb, datalen);
+
 	if (!(pkt_dev->flags & F_UDPCSUM)) {
 		skb->ip_summed = CHECKSUM_NONE;
 	} else if (odev->features & NETIF_F_V6_CSUM) {
@@ -2913,7 +2915,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 		skb->csum_offset = offsetof(struct udphdr, check);
 		udph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, 0);
 	} else {
-		__wsum csum = udp_csum(skb);
+		__wsum csum = skb_checksum(skb, skb_transport_offset(skb), udplen, 0);
 
 		/* add protocol-dependent pseudo-header */
 		udph->check = csum_ipv6_magic(&iph->saddr, &iph->daddr, udplen, IPPROTO_UDP, csum);
@@ -2922,8 +2924,6 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
 			udph->check = CSUM_MANGLED_0;
 	}
 
-	pktgen_finalize_skb(pkt_dev, skb, datalen);
-
 	return skb;
 }
 
-- 
2.3.0


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

* [PATCH 3.12 075/175] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (73 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 074/175] pktgen: fix UDP checksum computation Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 076/175] ipv6: fix ipv6_cow_metrics for non DST_HOST case Jiri Slaby
                   ` (101 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Daniel Borkmann, Mitch Williams, Jeff Kirsher,
	David S. Miller, Jiri Slaby

From: Daniel Borkmann <daniel@iogearbox.net>

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

===============

[ Upstream commit 364d5716a7adb91b731a35765d369602d68d2881 ]

ifla_vf_policy[] is wrong in advertising its individual member types as
NLA_BINARY since .type = NLA_BINARY in combination with .len declares the
len member as *max* attribute length [0, len].

The issue is that when do_setvfinfo() is being called to set up a VF
through ndo handler, we could set corrupted data if the attribute length
is less than the size of the related structure itself.

The intent is exactly the opposite, namely to make sure to pass at least
data of minimum size of len.

Fixes: ebc08a6f47ee ("rtnetlink: Add VF config code to rtnetlink")
Cc: Mitch Williams <mitch.a.williams@intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/core/rtnetlink.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5874dfbb8d90..d211eddb9a02 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1202,14 +1202,10 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = {
 };
 
 static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
-	[IFLA_VF_MAC]		= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_mac) },
-	[IFLA_VF_VLAN]		= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_vlan) },
-	[IFLA_VF_TX_RATE]	= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_tx_rate) },
-	[IFLA_VF_SPOOFCHK]	= { .type = NLA_BINARY,
-				    .len = sizeof(struct ifla_vf_spoofchk) },
+	[IFLA_VF_MAC]		= { .len = sizeof(struct ifla_vf_mac) },
+	[IFLA_VF_VLAN]		= { .len = sizeof(struct ifla_vf_vlan) },
+	[IFLA_VF_TX_RATE]	= { .len = sizeof(struct ifla_vf_tx_rate) },
+	[IFLA_VF_SPOOFCHK]	= { .len = sizeof(struct ifla_vf_spoofchk) },
 };
 
 static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = {
-- 
2.3.0


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

* [PATCH 3.12 076/175] ipv6: fix ipv6_cow_metrics for non DST_HOST case
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (74 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 075/175] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 077/175] rtnetlink: call ->dellink on failure when ->newlink exists Jiri Slaby
                   ` (100 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Martin KaFai Lau, David S. Miller, Jiri Slaby

From: Martin KaFai Lau <kafai@fb.com>

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

===============

[ Upstream commit 3b4711757d7903ab6fa88a9e7ab8901b8227da60 ]

ipv6_cow_metrics() currently assumes only DST_HOST routes require
dynamic metrics allocation from inetpeer.  The assumption breaks
when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
is called after the route is created.

This patch creates the metrics array (by calling dst_cow_metrics_generic) in
ipv6_cow_metrics().

Test:
radvd.conf:
interface qemubr0
{
	AdvLinkMTU 1300;
	AdvCurHopLimit 30;

	prefix fd00:face:face:face::/64
	{
		AdvOnLink on;
		AdvAutonomous on;
		AdvRouterAddr off;
	};
};

Before:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0  proto kernel  metric 256  expires 27sec
fe80::/64 dev eth0  proto kernel  metric 256
default via fe80::74df:d0ff:fe23:8ef2 dev eth0  proto ra  metric 1024  expires 27sec

After:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0  proto kernel  metric 256  expires 27sec mtu 1300
fe80::/64 dev eth0  proto kernel  metric 256  mtu 1300
default via fe80::74df:d0ff:fe23:8ef2 dev eth0  proto ra  metric 1024  expires 27sec mtu 1300 hoplimit 30

Fixes: 8e2ec639173f325 (ipv6: don't use inetpeer to store metrics for routes.)
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1d0c5d66d637..0464f9a9d2dc 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -110,7 +110,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
 	u32 *p = NULL;
 
 	if (!(rt->dst.flags & DST_HOST))
-		return NULL;
+		return dst_cow_metrics_generic(dst, old);
 
 	peer = rt6_get_peer_create(rt);
 	if (peer) {
-- 
2.3.0


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

* [PATCH 3.12 077/175] rtnetlink: call ->dellink on failure when ->newlink exists
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (75 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 076/175] ipv6: fix ipv6_cow_metrics for non DST_HOST case Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 078/175] gen_stats.c: Duplicate xstats buffer for later use Jiri Slaby
                   ` (99 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, WANG Cong, David S. Miller, Jiri Slaby

From: WANG Cong <xiyou.wangcong@gmail.com>

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

===============

[ Upstream commit 7afb8886a05be68e376655539a064ec672de8a8e ]

Ignacy reported that when eth0 is down and add a vlan device
on top of it like:

  ip link add link eth0 name eth0.1 up type vlan id 1

We will get a refcount leak:

  unregister_netdevice: waiting for eth0.1 to become free. Usage count = 2

The problem is when rtnl_configure_link() fails in rtnl_newlink(),
we simply call unregister_device(), but for stacked device like vlan,
we almost do nothing when we unregister the upper device, more work
is done when we unregister the lower device, so call its ->dellink().

Reported-by: Ignacy Gawedzki <ignacy.gawedzki@green-communications.fr>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/core/rtnetlink.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d211eddb9a02..76cc27f3f991 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1924,8 +1924,16 @@ replay:
 		}
 
 		err = rtnl_configure_link(dev, ifm);
-		if (err < 0)
-			unregister_netdevice(dev);
+		if (err < 0) {
+			if (ops->newlink) {
+				LIST_HEAD(list_kill);
+
+				ops->dellink(dev, &list_kill);
+				unregister_netdevice_many(&list_kill);
+			} else {
+				unregister_netdevice(dev);
+			}
+		}
 out:
 		put_net(dest_net);
 		return err;
-- 
2.3.0


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

* [PATCH 3.12 078/175] gen_stats.c: Duplicate xstats buffer for later use
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (76 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 077/175] rtnetlink: call ->dellink on failure when ->newlink exists Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 079/175] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Jiri Slaby
                   ` (98 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Ignacy Gawędzki, Cong Wang, David S. Miller,
	Jiri Slaby

From: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>

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

===============

[ Upstream commit 1c4cff0cf55011792125b6041bc4e9713e46240f ]

The gnet_stats_copy_app() function gets called, more often than not, with its
second argument a pointer to an automatic variable in the caller's stack.
Therefore, to avoid copying garbage afterwards when calling
gnet_stats_finish_copy(), this data is better copied to a dynamically allocated
memory that gets freed after use.

[xiyou.wangcong@gmail.com: remove a useless kfree()]

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/core/gen_stats.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 9d3d9e78397b..372ac662adf9 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size)
 	return 0;
 
 nla_put_failure:
+	kfree(d->xstats);
+	d->xstats = NULL;
+	d->xstats_len = 0;
 	spin_unlock_bh(d->lock);
 	return -1;
 }
@@ -217,7 +220,9 @@ int
 gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
 {
 	if (d->compat_xstats) {
-		d->xstats = st;
+		d->xstats = kmemdup(st, len, GFP_ATOMIC);
+		if (!d->xstats)
+			goto err_out;
 		d->xstats_len = len;
 	}
 
@@ -225,6 +230,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
 		return gnet_stats_copy(d, TCA_STATS_APP, st, len);
 
 	return 0;
+
+err_out:
+	d->xstats_len = 0;
+	spin_unlock_bh(d->lock);
+	return -1;
 }
 EXPORT_SYMBOL(gnet_stats_copy_app);
 
@@ -257,6 +267,9 @@ gnet_stats_finish_copy(struct gnet_dump *d)
 			return -1;
 	}
 
+	kfree(d->xstats);
+	d->xstats = NULL;
+	d->xstats_len = 0;
 	spin_unlock_bh(d->lock);
 	return 0;
 }
-- 
2.3.0


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

* [PATCH 3.12 079/175] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (77 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 078/175] gen_stats.c: Duplicate xstats buffer for later use Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 080/175] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Jiri Slaby
                   ` (97 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexander Drozdov, David S. Miller, Jiri Slaby

From: Alexander Drozdov <al.drozdov@gmail.com>

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

===============

[ Upstream commit fba04a9e0c869498889b6445fd06cbe7da9bb834 ]

skb_copy_bits() returns zero on success and negative value on error,
so it is needed to invert the condition in ip_check_defrag().

Fixes: 1bf3751ec90c ("ipv4: ip_check_defrag must not modify skb before unsharing")
Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/ip_fragment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b66910aaef4d..5fff3d466e90 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -683,7 +683,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
 	if (skb->protocol != htons(ETH_P_IP))
 		return skb;
 
-	if (!skb_copy_bits(skb, 0, &iph, sizeof(iph)))
+	if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0)
 		return skb;
 
 	if (iph.ihl < 5 || iph.version != 4)
-- 
2.3.0


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

* [PATCH 3.12 080/175] ipv4: ip_check_defrag should not assume that skb_network_offset is zero
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (78 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 079/175] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:40 ` [PATCH 3.12 081/175] net: phy: Fix verification of EEE support in phy_init_eee Jiri Slaby
                   ` (96 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexander Drozdov, David S. Miller, Jiri Slaby

From: Alexander Drozdov <al.drozdov@gmail.com>

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

===============

[ Upstream commit 3e32e733d1bbb3f227259dc782ef01d5706bdae0 ]

ip_check_defrag() may be used by af_packet to defragment outgoing packets.
skb_network_offset() of af_packet's outgoing packets is not zero.

Signed-off-by: Alexander Drozdov <al.drozdov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/ip_fragment.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 5fff3d466e90..4c1884fed548 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -678,27 +678,30 @@ EXPORT_SYMBOL(ip_defrag);
 struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
 {
 	struct iphdr iph;
+	int netoff;
 	u32 len;
 
 	if (skb->protocol != htons(ETH_P_IP))
 		return skb;
 
-	if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0)
+	netoff = skb_network_offset(skb);
+
+	if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0)
 		return skb;
 
 	if (iph.ihl < 5 || iph.version != 4)
 		return skb;
 
 	len = ntohs(iph.tot_len);
-	if (skb->len < len || len < (iph.ihl * 4))
+	if (skb->len < netoff + len || len < (iph.ihl * 4))
 		return skb;
 
 	if (ip_is_fragment(&iph)) {
 		skb = skb_share_check(skb, GFP_ATOMIC);
 		if (skb) {
-			if (!pskb_may_pull(skb, iph.ihl*4))
+			if (!pskb_may_pull(skb, netoff + iph.ihl * 4))
 				return skb;
-			if (pskb_trim_rcsum(skb, len))
+			if (pskb_trim_rcsum(skb, netoff + len))
 				return skb;
 			memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
 			if (ip_defrag(skb, user))
-- 
2.3.0


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

* [PATCH 3.12 081/175] net: phy: Fix verification of EEE support in phy_init_eee
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (79 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 080/175] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Jiri Slaby
@ 2015-03-17  8:40 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 082/175] ematch: Fix auto-loading of ematch modules Jiri Slaby
                   ` (95 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:40 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Guenter Roeck, Giuseppe Cavallaro, David S. Miller,
	Jiri Slaby

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

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

===============

[ Upstream commit 54da5a8be3c1e924c35480eb44c6e9b275f6444e ]

phy_init_eee uses phy_find_setting(phydev->speed, phydev->duplex)
to find a valid entry in the settings array for the given speed
and duplex value. For full duplex 1000baseT, this will return
the first matching entry, which is the entry for 1000baseKX_Full.

If the phy eee does not support 1000baseKX_Full, this entry will not
match, causing phy_init_eee to fail for no good reason.

Fixes: 9a9c56cb34e6 ("net: phy: fix a bug when verify the EEE support")
Fixes: 3e7077067e80c ("phy: Expand phy speed/duplex settings array")
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/phy/phy.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 36c6994436b7..0bc73f2c24ba 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -203,6 +203,25 @@ static inline int phy_find_valid(int idx, u32 features)
 }
 
 /**
+ * phy_check_valid - check if there is a valid PHY setting which matches
+ *		     speed, duplex, and feature mask
+ * @speed: speed to match
+ * @duplex: duplex to match
+ * @features: A mask of the valid settings
+ *
+ * Description: Returns true if there is a valid setting, false otherwise.
+ */
+static inline bool phy_check_valid(int speed, int duplex, u32 features)
+{
+	unsigned int idx;
+
+	idx = phy_find_valid(phy_find_setting(speed, duplex), features);
+
+	return settings[idx].speed == speed && settings[idx].duplex == duplex &&
+		(settings[idx].setting & features);
+}
+
+/**
  * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex
  * @phydev: the target phy_device struct
  *
@@ -1018,7 +1037,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 	    (phydev->interface == PHY_INTERFACE_MODE_RGMII))) {
 		int eee_lp, eee_cap, eee_adv;
 		u32 lp, cap, adv;
-		int idx, status;
+		int status;
 
 		/* Read phy status to properly get the right settings */
 		status = phy_read_status(phydev);
@@ -1050,8 +1069,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 
 		adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
 		lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
-		idx = phy_find_setting(phydev->speed, phydev->duplex);
-		if (!(lp & adv & settings[idx].setting))
+		if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv))
 			goto eee_exit;
 
 		if (clk_stop_enable) {
-- 
2.3.0


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

* [PATCH 3.12 082/175] ematch: Fix auto-loading of ematch modules.
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (80 preceding siblings ...)
  2015-03-17  8:40 ` [PATCH 3.12 081/175] net: phy: Fix verification of EEE support in phy_init_eee Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 083/175] net: reject creation of netdev names with colons Jiri Slaby
                   ` (94 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ignacy Gawędzki, David S. Miller, Jiri Slaby

From: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>

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

===============

[ Upstream commit 34eea79e2664b314cab6a30fc582fdfa7a1bb1df ]

In tcf_em_validate(), after calling request_module() to load the
kind-specific module, set em->ops to NULL before returning -EAGAIN, so
that module_put() is not called again by tcf_em_tree_destroy().

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Acked-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sched/ematch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index 3a633debb6df..a2abc449ce8f 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
 				 * to replay the request.
 				 */
 				module_put(em->ops->owner);
+				em->ops = NULL;
 				err = -EAGAIN;
 			}
 #endif
-- 
2.3.0


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

* [PATCH 3.12 083/175] net: reject creation of netdev names with colons
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (81 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 082/175] ematch: Fix auto-loading of ematch modules Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 084/175] team: fix possible null pointer dereference in team_handle_frame Jiri Slaby
                   ` (93 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Matthew Thode, David S. Miller, Jiri Slaby

From: Matthew Thode <mthode@mthode.org>

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

===============

[ Upstream commit a4176a9391868bfa87705bcd2e3b49e9b9dd2996 ]

colons are used as a separator in netdev device lookup in dev_ioctl.c

Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME

Signed-off-by: Matthew Thode <mthode@mthode.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 249ab7d67254..3ca487e14080 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -935,7 +935,7 @@ bool dev_valid_name(const char *name)
 		return false;
 
 	while (*name) {
-		if (*name == '/' || isspace(*name))
+		if (*name == '/' || *name == ':' || isspace(*name))
 			return false;
 		name++;
 	}
-- 
2.3.0


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

* [PATCH 3.12 084/175] team: fix possible null pointer dereference in team_handle_frame
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (82 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 083/175] net: reject creation of netdev names with colons Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 085/175] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Jiri Slaby
                   ` (92 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jiri Pirko, David S. Miller, Jiri Slaby

From: Jiri Pirko <jiri@resnulli.us>

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

===============

[ Upstream commit 57e595631904c827cfa1a0f7bbd7cc9a49da5745 ]

Currently following race is possible in team:

CPU0                                        CPU1
                                            team_port_del
                                              team_upper_dev_unlink
                                                priv_flags &= ~IFF_TEAM_PORT
team_handle_frame
  team_port_get_rcu
    team_port_exists
      priv_flags & IFF_TEAM_PORT == 0
    return NULL (instead of port got
                 from rx_handler_data)
                                              netdev_rx_handler_unregister

The thing is that the flag is removed before rx_handler is unregistered.
If team_handle_frame is called in between, team_port_exists returns 0
and team_port_get_rcu will return NULL.
So do not check the flag here. It is guaranteed by netdev_rx_handler_unregister
that team_handle_frame will always see valid rx_handler_data pointer.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/team/team.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 258f65ba733f..b99f9198c916 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -42,9 +42,7 @@
 
 static struct team_port *team_port_get_rcu(const struct net_device *dev)
 {
-	struct team_port *port = rcu_dereference(dev->rx_handler_data);
-
-	return team_port_exists(dev) ? port : NULL;
+	return rcu_dereference(dev->rx_handler_data);
 }
 
 static struct team_port *team_port_get_rtnl(const struct net_device *dev)
-- 
2.3.0


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

* [PATCH 3.12 085/175] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (83 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 084/175] team: fix possible null pointer dereference in team_handle_frame Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 086/175] macvtap: make sure neighbour code can push ethernet header Jiri Slaby
                   ` (91 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Catalin Marinas, Andy Lutomirski, David S. Miller,
	Jiri Slaby

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

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

===============

[ Upstream commit d720d8cec563ce4e4fa44a613d4f2dcb1caf2998 ]

With commit a7526eb5d06b (net: Unbreak compat_sys_{send,recv}msg), the
MSG_CMSG_COMPAT flag is blocked at the compat syscall entry points,
changing the kernel compat behaviour from the one before the commit it
was trying to fix (1be374a0518a, net: Block MSG_CMSG_COMPAT in
send(m)msg and recv(m)msg).

On 32-bit kernels (!CONFIG_COMPAT), MSG_CMSG_COMPAT is 0 and the native
32-bit sys_sendmsg() allows flag 0x80000000 to be set (it is ignored by
the kernel). However, on a 64-bit kernel, the compat ABI is different
with commit a7526eb5d06b.

This patch changes the compat_sys_{send,recv}msg behaviour to the one
prior to commit 1be374a0518a.

The problem was found running 32-bit LTP (sendmsg01) binary on an arm64
kernel. Arguably, LTP should not pass 0xffffffff as flags to sendmsg()
but the general rule is not to break user ABI (even when the user
behaviour is not entirely sane).

Fixes: a7526eb5d06b (net: Unbreak compat_sys_{send,recv}msg)
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/compat.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/net/compat.c b/net/compat.c
index cbc1a2a26587..275af79c131b 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -738,24 +738,18 @@ static unsigned char nas[21] = {
 
 asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
 {
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
 	return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
 asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
 				    unsigned int vlen, unsigned int flags)
 {
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
 	return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
 			      flags | MSG_CMSG_COMPAT);
 }
 
 asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
 {
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
 	return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
@@ -778,9 +772,6 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
 	int datagrams;
 	struct timespec ktspec;
 
-	if (flags & MSG_CMSG_COMPAT)
-		return -EINVAL;
-
 	if (timeout == NULL)
 		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
 				      flags | MSG_CMSG_COMPAT, NULL);
-- 
2.3.0


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

* [PATCH 3.12 086/175] macvtap: make sure neighbour code can push ethernet header
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (84 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 085/175] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 087/175] usb: plusb: Add support for National Instruments host-to-host cable Jiri Slaby
                   ` (90 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric Dumazet, David S. Miller, Jiri Slaby

From: Eric Dumazet <edumazet@google.com>

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

===============

[ Upstream commit 2f1d8b9e8afa5a833d96afcd23abcb8cdf8d83ab ]

Brian reported crashes using IPv6 traffic with macvtap/veth combo.

I tracked the crashes in neigh_hh_output()

-> memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);

Neighbour code assumes headroom to push Ethernet header is
at least 16 bytes.

It appears macvtap has only 14 bytes available on arches
where NET_IP_ALIGN is 0 (like x86)

Effect is a corruption of 2 bytes right before skb->head,
and possible crashes if accessing non existing memory.

This fix should also increase IPv4 performance, as paranoid code
in ip_finish_output2() wont have to call skb_realloc_headroom()

Reported-by: Brian Rak <brak@vultr.com>
Tested-by: Brian Rak <brak@vultr.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/macvtap.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 89d21fc47a16..393873fb792e 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -635,12 +635,15 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
 	return 0;
 }
 
+/* Neighbour code has some assumptions on HH_DATA_MOD alignment */
+#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN)
+
 /* Get packet from user space buffer */
 static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
 				const struct iovec *iv, unsigned long total_len,
 				size_t count, int noblock)
 {
-	int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN);
+	int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE);
 	struct sk_buff *skb;
 	struct macvlan_dev *vlan;
 	unsigned long len = total_len;
@@ -699,7 +702,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
 			linear = vnet_hdr.hdr_len;
 	}
 
-	skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen,
+	skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen,
 				linear, noblock, &err);
 	if (!skb)
 		goto err;
-- 
2.3.0


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

* [PATCH 3.12 087/175] usb: plusb: Add support for National Instruments host-to-host cable
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (85 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 086/175] macvtap: make sure neighbour code can push ethernet header Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 088/175] udp: only allow UFO for packets from SOCK_DGRAM sockets Jiri Slaby
                   ` (89 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ben Shelton, David S. Miller, Jiri Slaby

From: Ben Shelton <ben.shelton@ni.com>

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

===============

[ Upstream commit 42c972a1f390e3bc51ca1e434b7e28764992067f ]

The National Instruments USB Host-to-Host Cable is based on the Prolific
PL-25A1 chipset.  Add its VID/PID so the plusb driver will recognize it.

Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/usb/plusb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 0fcc8e65a068..74323e9d9004 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -136,6 +136,11 @@ static const struct usb_device_id	products [] = {
 }, {
 	USB_DEVICE(0x050d, 0x258a),     /* Belkin F5U258/F5U279 (PL-25A1) */
 	.driver_info =  (unsigned long) &prolific_info,
+}, {
+	USB_DEVICE(0x3923, 0x7825),     /* National Instruments USB
+					 * Host-to-Host Cable
+					 */
+	.driver_info =  (unsigned long) &prolific_info,
 },
 
 	{ },		// END
-- 
2.3.0


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

* [PATCH 3.12 088/175] udp: only allow UFO for packets from SOCK_DGRAM sockets
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (86 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 087/175] usb: plusb: Add support for National Instruments host-to-host cable Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 089/175] net: ping: Return EAFNOSUPPORT when appropriate Jiri Slaby
                   ` (88 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michal Kubeček, David S. Miller, Jiri Slaby

From: Michal Kubeček <mkubecek@suse.cz>

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

===============

[ Upstream commit acf8dd0a9d0b9e4cdb597c2f74802f79c699e802 ]

If an over-MTU UDP datagram is sent through a SOCK_RAW socket to a
UFO-capable device, ip_ufo_append_data() sets skb->ip_summed to
CHECKSUM_PARTIAL unconditionally as all GSO code assumes transport layer
checksum is to be computed on segmentation. However, in this case,
skb->csum_start and skb->csum_offset are never set as raw socket
transmit path bypasses udp_send_skb() where they are usually set. As a
result, driver may access invalid memory when trying to calculate the
checksum and store the result (as observed in virtio_net driver).

Moreover, the very idea of modifying the userspace provided UDP header
is IMHO against raw socket semantics (I wasn't able to find a document
clearly stating this or the opposite, though). And while allowing
CHECKSUM_NONE in the UFO case would be more efficient, it would be a bit
too intrusive change just to handle a corner case like this. Therefore
disallowing UFO for packets from SOCK_DGRAM seems to be the best option.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/ip_output.c  | 3 ++-
 net/ipv6/ip6_output.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 52e82e1709e6..b4cdc79a7fc8 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -842,7 +842,8 @@ static int __ip_append_data(struct sock *sk,
 	cork->length += length;
 	if (((length > mtu) || (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
-	    (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) {
+	    (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
+	    (sk->sk_type == SOCK_DGRAM)) {
 		err = ip_ufo_append_data(sk, queue, getfrag, from, length,
 					 hh_len, fragheaderlen, transhdrlen,
 					 maxfraglen, flags);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 602533d9cb97..855957271830 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1266,7 +1266,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
 	if (((length > mtu) ||
 	     (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
-	    (rt->dst.dev->features & NETIF_F_UFO)) {
+	    (rt->dst.dev->features & NETIF_F_UFO) &&
+	    (sk->sk_type == SOCK_DGRAM)) {
 		err = ip6_ufo_append_data(sk, getfrag, from, length,
 					  hh_len, fragheaderlen,
 					  transhdrlen, mtu, flags, rt);
-- 
2.3.0


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

* [PATCH 3.12 089/175] net: ping: Return EAFNOSUPPORT when appropriate.
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (87 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 088/175] udp: only allow UFO for packets from SOCK_DGRAM sockets Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 090/175] team: don't traverse port list using rcu in team_set_mac_address Jiri Slaby
                   ` (87 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lorenzo Colitti, David S. Miller, Jiri Slaby

From: Lorenzo Colitti <lorenzo@google.com>

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

===============

[ Upstream commit 9145736d4862145684009d6a72a6e61324a9439e ]

1. For an IPv4 ping socket, ping_check_bind_addr does not check
   the family of the socket address that's passed in. Instead,
   make it behave like inet_bind, which enforces either that the
   address family is AF_INET, or that the family is AF_UNSPEC and
   the address is 0.0.0.0.
2. For an IPv6 ping socket, ping_check_bind_addr returns EINVAL
   if the socket family is not AF_INET6. Return EAFNOSUPPORT
   instead, for consistency with inet6_bind.
3. Make ping_v4_sendmsg and ping_v6_sendmsg return EAFNOSUPPORT
   instead of EINVAL if an incorrect socket address structure is
   passed in.
4. Make IPv6 ping sockets be IPv6-only. The code does not support
   IPv4, and it cannot easily be made to support IPv4 because
   the protocol numbers for ICMP and ICMPv6 are different. This
   makes connect(::ffff:192.0.2.1) fail with EAFNOSUPPORT instead
   of making the socket unusable.

Among other things, this fixes an oops that can be triggered by:

    int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
    struct sockaddr_in6 sin6 = {
        .sin6_family = AF_INET6,
        .sin6_addr = in6addr_any,
    };
    bind(s, (struct sockaddr *) &sin6, sizeof(sin6));

Change-Id: If06ca86d9f1e4593c0d6df174caca3487c57a241
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/ping.c | 14 +++++++++++++-
 net/ipv6/ping.c |  5 +++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 81c92f61d77c..a9f8e66f6dad 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -256,6 +256,10 @@ int ping_init_sock(struct sock *sk)
 	kgid_t low, high;
 	int ret = 0;
 
+#if IS_ENABLED(CONFIG_IPV6)
+	if (sk->sk_family == AF_INET6)
+		inet6_sk(sk)->ipv6only = 1;
+#endif
 	inet_get_ping_group_range_net(net, &low, &high);
 	if (gid_lte(low, group) && gid_lte(group, high))
 		return 0;
@@ -302,6 +306,11 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk,
 		if (addr_len < sizeof(*addr))
 			return -EINVAL;
 
+		if (addr->sin_family != AF_INET &&
+		    !(addr->sin_family == AF_UNSPEC &&
+		      addr->sin_addr.s_addr == htonl(INADDR_ANY)))
+			return -EAFNOSUPPORT;
+
 		pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n",
 			 sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port));
 
@@ -326,6 +335,9 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk,
 		if (addr_len < sizeof(*addr))
 			return -EINVAL;
 
+		if (addr->sin6_family != AF_INET6)
+			return -EAFNOSUPPORT;
+
 		pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n",
 			 sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port));
 
@@ -708,7 +720,7 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 		if (msg->msg_namelen < sizeof(*usin))
 			return -EINVAL;
 		if (usin->sin_family != AF_INET)
-			return -EINVAL;
+			return -EAFNOSUPPORT;
 		daddr = usin->sin_addr.s_addr;
 		/* no remote port */
 	} else {
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 6acab0bce9d8..f414af6cda43 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -104,9 +104,10 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 
 	if (msg->msg_name) {
 		struct sockaddr_in6 *u = (struct sockaddr_in6 *) msg->msg_name;
-		if (msg->msg_namelen < sizeof(struct sockaddr_in6) ||
-		    u->sin6_family != AF_INET6) {
+		if (msg->msg_namelen < sizeof(*u))
 			return -EINVAL;
+		if (u->sin6_family != AF_INET6) {
+			return -EAFNOSUPPORT;
 		}
 		if (sk->sk_bound_dev_if &&
 		    sk->sk_bound_dev_if != u->sin6_scope_id) {
-- 
2.3.0


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

* [PATCH 3.12 090/175] team: don't traverse port list using rcu in team_set_mac_address
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (88 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 089/175] net: ping: Return EAFNOSUPPORT when appropriate Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 091/175] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Jiri Slaby
                   ` (86 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jiri Pirko, David S. Miller, Jiri Slaby

From: Jiri Pirko <jiri@resnulli.us>

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

===============

[ Upstream commit 9215f437b85da339a7dfe3db6e288637406f88b2 ]

Currently the list is traversed using rcu variant. That is not correct
since dev_set_mac_address can be called which eventually calls
rtmsg_ifinfo_build_skb and there, skb allocation can sleep. So fix this
by remove the rcu usage here.

Fixes: 3d249d4ca7 "net: introduce ethernet teaming device"
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/team/team.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index b99f9198c916..020581ddfdd3 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1716,11 +1716,11 @@ static int team_set_mac_address(struct net_device *dev, void *p)
 	if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-	rcu_read_lock();
-	list_for_each_entry_rcu(port, &team->port_list, list)
+	mutex_lock(&team->lock);
+	list_for_each_entry(port, &team->port_list, list)
 		if (team->ops.port_change_dev_addr)
 			team->ops.port_change_dev_addr(team, port);
-	rcu_read_unlock();
+	mutex_unlock(&team->lock);
 	return 0;
 }
 
-- 
2.3.0


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

* [PATCH 3.12 091/175] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (89 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 090/175] team: don't traverse port list using rcu in team_set_mac_address Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 092/175] mm/hugetlb: add migration entry check in __unmap_hugepage_range Jiri Slaby
                   ` (85 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, Hugh Dickins, James Hogan,
	David Rientjes, Mel Gorman, Johannes Weiner, Michal Hocko,
	Rik van Riel, Andrea Arcangeli, Luiz Capitulino,
	Nishanth Aravamudan, Lee Schermerhorn, Steve Capper,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

===============

commit a8bda28d87c38c6aa93de28ba5d30cc18e865a11 upstream.

There is a race condition between hugepage migration and
change_protection(), where hugetlb_change_protection() doesn't care about
migration entries and wrongly overwrites them.  That causes unexpected
results like kernel crash.  HWPoison entries also can cause the same
problem.

This patch adds is_hugetlb_entry_(migration|hwpoisoned) check in this
function to do proper actions.

Fixes: 290408d4a2 ("hugetlb: hugepage migration core")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/hugetlb.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 0b46aedef779..723e63aefb64 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3175,7 +3175,24 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
 			pages++;
 			continue;
 		}
-		if (!huge_pte_none(huge_ptep_get(ptep))) {
+		pte = huge_ptep_get(ptep);
+		if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+			continue;
+		}
+		if (unlikely(is_hugetlb_entry_migration(pte))) {
+			swp_entry_t entry = pte_to_swp_entry(pte);
+
+			if (is_write_migration_entry(entry)) {
+				pte_t newpte;
+
+				make_migration_entry_read(&entry);
+				newpte = swp_entry_to_pte(entry);
+				set_huge_pte_at(mm, address, ptep, newpte);
+				pages++;
+			}
+			continue;
+		}
+		if (!huge_pte_none(pte)) {
 			pte = huge_ptep_get_and_clear(mm, address, ptep);
 			pte = pte_mkhuge(huge_pte_modify(pte, newprot));
 			pte = arch_make_huge_pte(pte, vma, NULL, 0);
-- 
2.3.0


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

* [PATCH 3.12 092/175] mm/hugetlb: add migration entry check in __unmap_hugepage_range
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (90 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 091/175] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 093/175] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Jiri Slaby
                   ` (84 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, Hugh Dickins, James Hogan,
	David Rientjes, Mel Gorman, Johannes Weiner, Michal Hocko,
	Rik van Riel, Andrea Arcangeli, Luiz Capitulino,
	Nishanth Aravamudan, Lee Schermerhorn, Steve Capper,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

===============

commit 9fbc1f635fd0bd28cb32550211bf095753ac637a upstream.

If __unmap_hugepage_range() tries to unmap the address range over which
hugepage migration is on the way, we get the wrong page because pte_page()
doesn't work for migration entries.  This patch simply clears the pte for
migration entries as we do for hwpoison entries.

Fixes: 290408d4a2 ("hugetlb: hugepage migration core")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/hugetlb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 723e63aefb64..33193ab3dbd3 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2517,9 +2517,10 @@ again:
 			continue;
 
 		/*
-		 * HWPoisoned hugepage is already unmapped and dropped reference
+		 * Migrating hugepage or HWPoisoned hugepage is already
+		 * unmapped and its refcount is dropped, so just clear pte here.
 		 */
-		if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) {
+		if (unlikely(!pte_present(pte))) {
 			huge_pte_clear(mm, address, ptep);
 			continue;
 		}
-- 
2.3.0


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

* [PATCH 3.12 093/175] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (91 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 092/175] mm/hugetlb: add migration entry check in __unmap_hugepage_range Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 094/175] mm/nommu.c: " Jiri Slaby
                   ` (83 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Roman Gushchin, Andrew Shewmaker, Rik van Riel,
	Konstantin Khlebnikov, Andrew Morton, Linus Torvalds, Jiri Slaby

From: Roman Gushchin <klamm@yandex-team.ru>

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

===============

commit 5703b087dc8eaf47bfb399d6cf512d471beff405 upstream.

I noticed, that "allowed" can easily overflow by falling below 0,
because (total_vm / 32) can be larger than "allowed".  The problem
occurs in OVERCOMMIT_NONE mode.

In this case, a huge allocation can success and overcommit the system
(despite OVERCOMMIT_NONE mode).  All subsequent allocations will fall
(system-wide), so system become unusable.

The problem was masked out by commit c9b1d0981fcc
("mm: limit growth of 3% hardcoded other user reserve"),
but it's easy to reproduce it on older kernels:
1) set overcommit_memory sysctl to 2
2) mmap() large file multiple times (with VM_SHARED flag)
3) try to malloc() large amount of memory

It also can be reproduced on newer kernels, but miss-configured
sysctl_user_reserve_kbytes is required.

Fix this issue by switching to signed arithmetic here.

[akpm@linux-foundation.org: use min_t]
Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>
Cc: Andrew Shewmaker <agshew@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/mmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 441602d7259a..c3ed083cfb59 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(vm_memory_committed);
  */
 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 {
-	unsigned long free, allowed, reserve;
+	long free, allowed, reserve;
 
 	vm_acct_memory(pages);
 
@@ -194,7 +194,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 	 */
 	if (mm) {
 		reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10);
-		allowed -= min(mm->total_vm / 32, reserve);
+		allowed -= min_t(long, mm->total_vm / 32, reserve);
 	}
 
 	if (percpu_counter_read_positive(&vm_committed_as) < allowed)
-- 
2.3.0


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

* [PATCH 3.12 094/175] mm/nommu.c: fix arithmetic overflow in __vm_enough_memory()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (92 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 093/175] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 095/175] mm/compaction: fix wrong order check in compact_finished() Jiri Slaby
                   ` (82 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Roman Gushchin, Andrew Shewmaker, Rik van Riel,
	Konstantin Khlebnikov, Andrew Morton, Linus Torvalds, Jiri Slaby

From: Roman Gushchin <klamm@yandex-team.ru>

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

===============

commit 8138a67a5557ffea3a21dfd6f037842d4e748513 upstream.

I noticed that "allowed" can easily overflow by falling below 0, because
(total_vm / 32) can be larger than "allowed".  The problem occurs in
OVERCOMMIT_NONE mode.

In this case, a huge allocation can success and overcommit the system
(despite OVERCOMMIT_NONE mode).  All subsequent allocations will fall
(system-wide), so system become unusable.

The problem was masked out by commit c9b1d0981fcc
("mm: limit growth of 3% hardcoded other user reserve"),
but it's easy to reproduce it on older kernels:
1) set overcommit_memory sysctl to 2
2) mmap() large file multiple times (with VM_SHARED flag)
3) try to malloc() large amount of memory

It also can be reproduced on newer kernels, but miss-configured
sysctl_user_reserve_kbytes is required.

Fix this issue by switching to signed arithmetic here.

Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>
Cc: Andrew Shewmaker <agshew@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/nommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index 1221d2b66e97..97d19be38233 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1904,7 +1904,7 @@ EXPORT_SYMBOL(unmap_mapping_range);
  */
 int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 {
-	unsigned long free, allowed, reserve;
+	long free, allowed, reserve;
 
 	vm_acct_memory(pages);
 
@@ -1969,7 +1969,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 	 */
 	if (mm) {
 		reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10);
-		allowed -= min(mm->total_vm / 32, reserve);
+		allowed -= min_t(long, mm->total_vm / 32, reserve);
 	}
 
 	if (percpu_counter_read_positive(&vm_committed_as) < allowed)
-- 
2.3.0


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

* [PATCH 3.12 095/175] mm/compaction: fix wrong order check in compact_finished()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (93 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 094/175] mm/nommu.c: " Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 096/175] mm/memory.c: actually remap enough memory Jiri Slaby
                   ` (81 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Joonsoo Kim, Mel Gorman, David Rientjes,
	Rik van Riel, Andrew Morton, Linus Torvalds, Jiri Slaby

From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

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

===============

commit 372549c2a3778fd3df445819811c944ad54609ca upstream.

What we want to check here is whether there is highorder freepage in buddy
list of other migratetype in order to steal it without fragmentation.
But, current code just checks cc->order which means allocation request
order.  So, this is wrong.

Without this fix, non-movable synchronous compaction below pageblock order
would not stopped until compaction is complete, because migratetype of
most pageblocks are movable and high order freepage made by compaction is
usually on movable type buddy list.

There is some report related to this bug. See below link.

  http://www.spinics.net/lists/linux-mm/msg81666.html

Although the issued system still has load spike comes from compaction,
this makes that system completely stable and responsive according to his
report.

stress-highalloc test in mmtests with non movable order 7 allocation
doesn't show any notable difference in allocation success rate, but, it
shows more compaction success rate.

Compaction success rate (Compaction success * 100 / Compaction stalls, %)
18.47 : 28.94

Fixes: 1fb3f8ca0e92 ("mm: compaction: capture a suitable high-order page immediately when it is made available")
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/compaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index adb6d0560e96..ddcdbe0e42d9 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -935,7 +935,7 @@ static int compact_finished(struct zone *zone,
 			return COMPACT_PARTIAL;
 
 		/* Job done if allocation would set block type */
-		if (cc->order >= pageblock_order && area->nr_free)
+		if (order >= pageblock_order && area->nr_free)
 			return COMPACT_PARTIAL;
 	}
 
-- 
2.3.0


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

* [PATCH 3.12 096/175] mm/memory.c: actually remap enough memory
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (94 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 095/175] mm/compaction: fix wrong order check in compact_finished() Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 097/175] drm/radeon: only enable kv/kb dpm interrupts once v3 Jiri Slaby
                   ` (80 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Grazvydas Ignotas, Rik van Riel, Andrew Morton,
	Linus Torvalds, Jiri Slaby

From: Grazvydas Ignotas <notasas@gmail.com>

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

===============

commit 9cb12d7b4ccaa976f97ce0c5fd0f1b6a83bc2a75 upstream.

For whatever reason, generic_access_phys() only remaps one page, but
actually allows to access arbitrary size.  It's quite easy to trigger
large reads, like printing out large structure with gdb, which leads to a
crash.  Fix it by remapping correct size.

Fixes: 28b2ee20c7cb ("access_process_vm device memory infrastructure")
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index db2916f5f378..cf05415c25a6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4079,7 +4079,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
 	if (follow_phys(vma, addr, write, &prot, &phys_addr))
 		return -EINVAL;
 
-	maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot);
+	maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
 	if (write)
 		memcpy_toio(maddr + offset, buf, len);
 	else
-- 
2.3.0


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

* [PATCH 3.12 097/175] drm/radeon: only enable kv/kb dpm interrupts once v3
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (95 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 096/175] mm/memory.c: actually remap enough memory Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 098/175] drm/radeon: workaround for CP HW bug on CIK Jiri Slaby
                   ` (79 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Deucher, Christian König, Jiri Slaby

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

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

===============

commit 410af8d7285a0b96314845c75c39fd612b755688 upstream.

Enable at init and disable on fini. Workaround for hardware problems.

v2 (chk): extend commit message
v3: add new function

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com> (v2)
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/cik.c    | 21 ---------------------
 drivers/gpu/drm/radeon/kv_dpm.c | 17 +++++++++++++++--
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index cdc7f408bd18..76bf1f29d7cb 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -6092,7 +6092,6 @@ int cik_irq_set(struct radeon_device *rdev)
 	u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6;
 	u32 grbm_int_cntl = 0;
 	u32 dma_cntl, dma_cntl1;
-	u32 thermal_int;
 
 	if (!rdev->irq.installed) {
 		WARN(1, "Can't enable IRQ/MSI because no handler is installed\n");
@@ -6129,13 +6128,6 @@ int cik_irq_set(struct radeon_device *rdev)
 	cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE;
 	cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE;
 
-	if (rdev->flags & RADEON_IS_IGP)
-		thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL) &
-			~(THERM_INTH_MASK | THERM_INTL_MASK);
-	else
-		thermal_int = RREG32_SMC(CG_THERMAL_INT) &
-			~(THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW);
-
 	/* enable CP interrupts on all rings */
 	if (atomic_read(&rdev->irq.ring_int[RADEON_RING_TYPE_GFX_INDEX])) {
 		DRM_DEBUG("cik_irq_set: sw int gfx\n");
@@ -6293,14 +6285,6 @@ int cik_irq_set(struct radeon_device *rdev)
 		hpd6 |= DC_HPDx_INT_EN;
 	}
 
-	if (rdev->irq.dpm_thermal) {
-		DRM_DEBUG("dpm thermal\n");
-		if (rdev->flags & RADEON_IS_IGP)
-			thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK;
-		else
-			thermal_int |= THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW;
-	}
-
 	WREG32(CP_INT_CNTL_RING0, cp_int_cntl);
 
 	WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, dma_cntl);
@@ -6354,11 +6338,6 @@ int cik_irq_set(struct radeon_device *rdev)
 	WREG32(DC_HPD5_INT_CONTROL, hpd5);
 	WREG32(DC_HPD6_INT_CONTROL, hpd6);
 
-	if (rdev->flags & RADEON_IS_IGP)
-		WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int);
-	else
-		WREG32_SMC(CG_THERMAL_INT, thermal_int);
-
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index b41905573cd2..47a7a34d3b0c 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -1121,6 +1121,19 @@ void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable)
 	}
 }
 
+static void kv_enable_thermal_int(struct radeon_device *rdev, bool enable)
+{
+	u32 thermal_int;
+
+	thermal_int = RREG32_SMC(CG_THERMAL_INT_CTRL);
+	if (enable)
+		thermal_int |= THERM_INTH_MASK | THERM_INTL_MASK;
+	else
+		thermal_int &= ~(THERM_INTH_MASK | THERM_INTL_MASK);
+	WREG32_SMC(CG_THERMAL_INT_CTRL, thermal_int);
+
+}
+
 int kv_dpm_enable(struct radeon_device *rdev)
 {
 	struct kv_power_info *pi = kv_get_pi(rdev);
@@ -1222,8 +1235,7 @@ int kv_dpm_enable(struct radeon_device *rdev)
 			DRM_ERROR("kv_set_thermal_temperature_range failed\n");
 			return ret;
 		}
-		rdev->irq.dpm_thermal = true;
-		radeon_irq_set(rdev);
+		kv_enable_thermal_int(rdev, true);
 	}
 
 	ret = kv_smc_bapm_enable(rdev, false);
@@ -1269,6 +1281,7 @@ void kv_dpm_disable(struct radeon_device *rdev)
 	kv_stop_dpm(rdev);
 	kv_enable_ulv(rdev, false);
 	kv_reset_am(rdev);
+	kv_enable_thermal_int(rdev, false);
 
 	kv_update_current_ps(rdev, rdev->pm.dpm.boot_ps);
 }
-- 
2.3.0


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

* [PATCH 3.12 098/175] drm/radeon: workaround for CP HW bug on CIK
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (96 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 097/175] drm/radeon: only enable kv/kb dpm interrupts once v3 Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 099/175] target: Fix PR_APTPL_BUF_LEN buffer size limitation Jiri Slaby
                   ` (78 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Christian König, Alex Deucher, Jiri Slaby

From: Christian König <christian.koenig@amd.com>

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

===============

commit a9c73a0e022c33954835e66fec3cd744af90ec98 upstream.

Emit the EOP twice to avoid cache flushing problems.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/cik.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 76bf1f29d7cb..6e2e4a859047 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -3027,7 +3027,21 @@ void cik_fence_gfx_ring_emit(struct radeon_device *rdev,
 	struct radeon_ring *ring = &rdev->ring[fence->ring];
 	u64 addr = rdev->fence_drv[fence->ring].gpu_addr;
 
-	/* EVENT_WRITE_EOP - flush caches, send int */
+	/* Workaround for cache flush problems. First send a dummy EOP
+	 * event down the pipe with seq one below.
+	 */
+	radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4));
+	radeon_ring_write(ring, (EOP_TCL1_ACTION_EN |
+				 EOP_TC_ACTION_EN |
+				 EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) |
+				 EVENT_INDEX(5)));
+	radeon_ring_write(ring, addr & 0xfffffffc);
+	radeon_ring_write(ring, (upper_32_bits(addr) & 0xffff) |
+				DATA_SEL(1) | INT_SEL(0));
+	radeon_ring_write(ring, fence->seq - 1);
+	radeon_ring_write(ring, 0);
+
+	/* Then send the real EOP event down the pipe. */
 	radeon_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4));
 	radeon_ring_write(ring, (EOP_TCL1_ACTION_EN |
 				 EOP_TC_ACTION_EN |
-- 
2.3.0


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

* [PATCH 3.12 099/175] target: Fix PR_APTPL_BUF_LEN buffer size limitation
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (97 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 098/175] drm/radeon: workaround for CP HW bug on CIK Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 100/175] target: Add missing WRITE_SAME end-of-device sanity check Jiri Slaby
                   ` (77 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicholas Bellinger, Jiri Slaby

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

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

===============

commit f161d4b44d7cc1dc66b53365215227db356378b1 upstream.

This patch addresses the original PR_APTPL_BUF_LEN = 8k limitiation
for write-out of PR APTPL metadata that Martin has recently been
running into.

It changes core_scsi3_update_and_write_aptpl() to use vzalloc'ed
memory instead of kzalloc, and increases the default hardcoded
length to 256k.

It also adds logic in core_scsi3_update_and_write_aptpl() to double
the original length upon core_scsi3_update_aptpl_buf() failure, and
retries until the vzalloc'ed buffer is large enough to accommodate
the outgoing APTPL metadata.

Reported-by: Martin Svec <martin.svec@zoner.cz>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/target_core_pr.c   | 25 +++++++++++++------------
 include/target/target_core_base.h |  2 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index a1e1ecdab86c..36c507c1b4fd 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1877,8 +1877,8 @@ static int core_scsi3_update_aptpl_buf(
 		}
 
 		if ((len + strlen(tmp) >= pr_aptpl_buf_len)) {
-			pr_err("Unable to update renaming"
-				" APTPL metadata\n");
+			pr_err("Unable to update renaming APTPL metadata,"
+			       " reallocating larger buffer\n");
 			ret = -EMSGSIZE;
 			goto out;
 		}
@@ -1895,8 +1895,8 @@ static int core_scsi3_update_aptpl_buf(
 			lun->lun_sep->sep_rtpi, lun->unpacked_lun, reg_count);
 
 		if ((len + strlen(tmp) >= pr_aptpl_buf_len)) {
-			pr_err("Unable to update renaming"
-				" APTPL metadata\n");
+			pr_err("Unable to update renaming APTPL metadata,"
+			       " reallocating larger buffer\n");
 			ret = -EMSGSIZE;
 			goto out;
 		}
@@ -1959,7 +1959,7 @@ static int __core_scsi3_write_aptpl_to_file(
 static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, bool aptpl)
 {
 	unsigned char *buf;
-	int rc;
+	int rc, len = PR_APTPL_BUF_LEN;
 
 	if (!aptpl) {
 		char *null_buf = "No Registrations or Reservations\n";
@@ -1973,25 +1973,26 @@ static sense_reason_t core_scsi3_update_and_write_aptpl(struct se_device *dev, b
 
 		return 0;
 	}
-
-	buf = kzalloc(PR_APTPL_BUF_LEN, GFP_KERNEL);
+retry:
+	buf = vzalloc(len);
 	if (!buf)
 		return TCM_OUT_OF_RESOURCES;
 
-	rc = core_scsi3_update_aptpl_buf(dev, buf, PR_APTPL_BUF_LEN);
+	rc = core_scsi3_update_aptpl_buf(dev, buf, len);
 	if (rc < 0) {
-		kfree(buf);
-		return TCM_OUT_OF_RESOURCES;
+		vfree(buf);
+		len *= 2;
+		goto retry;
 	}
 
 	rc = __core_scsi3_write_aptpl_to_file(dev, buf);
 	if (rc != 0) {
 		pr_err("SPC-3 PR: Could not update APTPL\n");
-		kfree(buf);
+		vfree(buf);
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 	}
 	dev->t10_pr.pr_aptpl_active = 1;
-	kfree(buf);
+	vfree(buf);
 	pr_debug("SPC-3 PR: Set APTPL Bit Activated\n");
 	return 0;
 }
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 23bfd1028457..38647a3441c9 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -378,7 +378,7 @@ struct t10_reservation {
 	/* Activate Persistence across Target Power Loss enabled
 	 * for SCSI device */
 	int pr_aptpl_active;
-#define PR_APTPL_BUF_LEN			8192
+#define PR_APTPL_BUF_LEN			262144
 	u32 pr_generation;
 	spinlock_t registration_lock;
 	spinlock_t aptpl_reg_lock;
-- 
2.3.0


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

* [PATCH 3.12 100/175] target: Add missing WRITE_SAME end-of-device sanity check
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (98 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 099/175] target: Fix PR_APTPL_BUF_LEN buffer size limitation Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 101/175] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Jiri Slaby
                   ` (76 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Nicholas Bellinger, Martin Petersen,
	Christoph Hellwig, Jiri Slaby

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

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

===============

commit 8e575c50a171f2579e367a7f778f86477dfdaf49 upstream.

This patch adds a check to sbc_setup_write_same() to verify
the incoming WRITE_SAME LBA + number of blocks does not exceed
past the end-of-device.

Also check for potential LBA wrap-around as well.

Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/target_core_sbc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index d83aea80d83c..42efb40ac596 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -250,6 +250,8 @@ static inline unsigned long long transport_lba_64_ext(unsigned char *cdb)
 static sense_reason_t
 sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *ops)
 {
+	struct se_device *dev = cmd->se_dev;
+	sector_t end_lba = dev->transport->get_blocks(dev) + 1;
 	unsigned int sectors = sbc_get_write_same_sectors(cmd);
 
 	if ((flags[0] & 0x04) || (flags[0] & 0x02)) {
@@ -263,6 +265,16 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
 			sectors, cmd->se_dev->dev_attrib.max_write_same_len);
 		return TCM_INVALID_CDB_FIELD;
 	}
+	/*
+	 * Sanity check for LBA wrap and request past end of device.
+	 */
+	if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) ||
+	    ((cmd->t_task_lba + sectors) > end_lba)) {
+		pr_err("WRITE_SAME exceeds last lba %llu (lba %llu, sectors %u)\n",
+		       (unsigned long long)end_lba, cmd->t_task_lba, sectors);
+		return TCM_ADDRESS_OUT_OF_RANGE;
+	}
+
 	/* We always have ANC_SUP == 0 so setting ANCHOR is always an error */
 	if (flags[0] & 0x10) {
 		pr_warn("WRITE SAME with ANCHOR not supported\n");
-- 
2.3.0


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

* [PATCH 3.12 101/175] target: Check for LBA + sectors wrap-around in sbc_parse_cdb
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (99 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 100/175] target: Add missing WRITE_SAME end-of-device sanity check Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 102/175] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization Jiri Slaby
                   ` (75 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Nicholas Bellinger, Martin Petersen,
	Christoph Hellwig, Jiri Slaby

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

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

===============

commit aa179935edea9a64dec4b757090c8106a3907ffa upstream.

This patch adds a check to sbc_parse_cdb() in order to detect when
an LBA + sector vs. end-of-device calculation wraps when the LBA is
sufficently large enough (eg: 0xFFFFFFFFFFFFFFFF).

Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/target_core_sbc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 42efb40ac596..63d56cda2b96 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -842,7 +842,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
 		unsigned long long end_lba;
 
 		end_lba = dev->transport->get_blocks(dev) + 1;
-		if (cmd->t_task_lba + sectors > end_lba) {
+		if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) ||
+		    ((cmd->t_task_lba + sectors) > end_lba)) {
 			pr_err("cmd exceeds last lba %llu "
 				"(lba %llu, sectors %u)\n",
 				end_lba, cmd->t_task_lba, sectors);
-- 
2.3.0


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

* [PATCH 3.12 102/175] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (100 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 101/175] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 103/175] iio: imu: adis16400: Fix sign extension Jiri Slaby
                   ` (74 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Andy Lutomirski, Borislav Petkov, Denys Vlasenko,
	H. Peter Anvin, Linus Torvalds, Oleg Nesterov, Thomas Gleixner,
	Ingo Molnar, Jiri Slaby

From: Andy Lutomirski <luto@amacapital.net>

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

===============

commit 956421fbb74c3a6261903f3836c0740187cf038b upstream.

'ret_from_fork' checks TIF_IA32 to determine whether 'pt_regs' and
the related state make sense for 'ret_from_sys_call'.  This is
entirely the wrong check.  TS_COMPAT would make a little more
sense, but there's really no point in keeping this optimization
at all.

This fixes a return to the wrong user CS if we came from int
0x80 in a 64-bit task.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/4710be56d76ef994ddf59087aad98c000fbab9a4.1424989793.git.luto@amacapital.net
[ Backported from tip:x86/asm. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/entry_64.S | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e96560628571..7b22af265d12 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -542,11 +542,14 @@ ENTRY(ret_from_fork)
 	testl $3, CS-ARGOFFSET(%rsp)		# from kernel_thread?
 	jz   1f
 
-	testl $_TIF_IA32, TI_flags(%rcx)	# 32-bit compat task needs IRET
-	jnz  int_ret_from_sys_call
-
-	RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET
-	jmp ret_from_sys_call			# go to the SYSRET fastpath
+	/*
+	 * By the time we get here, we have no idea whether our pt_regs,
+	 * ti flags, and ti status came from the 64-bit SYSCALL fast path,
+	 * the slow path, or one of the ia32entry paths.
+	 * Use int_ret_from_sys_call to return, since it can safely handle
+	 * all of the above.
+	 */
+	jmp  int_ret_from_sys_call
 
 1:
 	subq $REST_SKIP, %rsp	# leave space for volatiles
-- 
2.3.0


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

* [PATCH 3.12 103/175] iio: imu: adis16400: Fix sign extension
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (101 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 102/175] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 104/175] iio: ad5686: fix optional reference voltage declaration Jiri Slaby
                   ` (73 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Rasmus Villemoes, Jonathan Cameron, Jiri Slaby

From: Rasmus Villemoes <linux@rasmusvillemoes.dk>

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

===============

commit 19e353f2b344ad86cea6ebbc0002e5f903480a90 upstream.

The intention is obviously to sign-extend a 12 bit quantity. But
because of C's promotion rules, the assignment is equivalent to "val16
&= 0xfff;". Use the proper API for this.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/iio/imu/adis16400_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
index 7c582f7ae34e..70753bf23a86 100644
--- a/drivers/iio/imu/adis16400_core.c
+++ b/drivers/iio/imu/adis16400_core.c
@@ -26,6 +26,7 @@
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/debugfs.h>
+#include <linux/bitops.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -447,7 +448,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
 		mutex_unlock(&indio_dev->mlock);
 		if (ret)
 			return ret;
-		val16 = ((val16 & 0xFFF) << 4) >> 4;
+		val16 = sign_extend32(val16, 11);
 		*val = val16;
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_OFFSET:
-- 
2.3.0


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

* [PATCH 3.12 104/175] iio: ad5686: fix optional reference voltage declaration
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (102 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 103/175] iio: imu: adis16400: Fix sign extension Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 105/175] mei: make device disabled on stop unconditionally Jiri Slaby
                   ` (72 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Urs Fässler, Jonathan Cameron, Jiri Slaby

From: Urs Fässler <urs.fassler@bytesatwork.ch>

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

===============

commit da019f59cb16570e78feaf10380ac65a3a06861e upstream.

When not using the "_optional" function, a dummy regulator is returned
and the driver fails to initialize.

Signed-off-by: Urs Fässler <urs.fassler@bytesatwork.ch>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/iio/dac/ad5686.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 57825ead7db2..7248147fbf2b 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -321,7 +321,7 @@ static int ad5686_probe(struct spi_device *spi)
 	st = iio_priv(indio_dev);
 	spi_set_drvdata(spi, indio_dev);
 
-	st->reg = devm_regulator_get(&spi->dev, "vcc");
+	st->reg = devm_regulator_get_optional(&spi->dev, "vcc");
 	if (!IS_ERR(st->reg)) {
 		ret = regulator_enable(st->reg);
 		if (ret)
-- 
2.3.0


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

* [PATCH 3.12 105/175] mei: make device disabled on stop unconditionally
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (103 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 104/175] iio: ad5686: fix optional reference voltage declaration Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 106/175] btrfs: fix lost return value due to variable shadowing Jiri Slaby
                   ` (71 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexander Usyskin, Tomas Winkler, Jiri Slaby

From: Alexander Usyskin <alexander.usyskin@intel.com>

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

===============

commit 6c15a8516b8118eb19a59fd0bd22df41b9101c32 upstream.

Set the internal device state to to disabled after hardware reset in stop flow.
This will cover cases when driver was not brought to disabled state because of
an error and in stop flow we wish not to retry the reset.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/misc/mei/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 3fd43b0e69d1..65bcebb89260 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -228,6 +228,8 @@ void mei_stop(struct mei_device *dev)
 
 	dev->dev_state = MEI_DEV_POWER_DOWN;
 	mei_reset(dev, 0);
+	/* move device to disabled state unconditionally */
+	dev->dev_state = MEI_DEV_DISABLED;
 
 	mutex_unlock(&dev->device_lock);
 
-- 
2.3.0


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

* [PATCH 3.12 106/175] btrfs: fix lost return value due to variable shadowing
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (104 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 105/175] mei: make device disabled on stop unconditionally Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 107/175] Btrfs: fix data loss in the fast fsync path Jiri Slaby
                   ` (70 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Sterba, Chris Mason, Jiri Slaby

From: David Sterba <dsterba@suse.cz>

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

===============

commit 1932b7be973b554ffe20a5bba6ffaed6fa995cdc upstream.

A block-local variable stores error code but btrfs_get_blocks_direct may
not return it in the end as there's a ret defined in the function scope.

Fixes: d187663ef24c ("Btrfs: lock extents as we map them in DIO")
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/btrfs/inode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 68f7a1ff104a..904ed6d7e4bb 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6703,7 +6703,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
 	    ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) &&
 	     em->block_start != EXTENT_MAP_HOLE)) {
 		int type;
-		int ret;
 		u64 block_start, orig_start, orig_block_len, ram_bytes;
 
 		if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
-- 
2.3.0


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

* [PATCH 3.12 107/175] Btrfs: fix data loss in the fast fsync path
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (105 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 106/175] btrfs: fix lost return value due to variable shadowing Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 108/175] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Jiri Slaby
                   ` (69 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Filipe Manana, Chris Mason, Jiri Slaby

From: Filipe Manana <fdmanana@suse.com>

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

===============

commit 3a8b36f378060d20062a0918e99fae39ff077bf0 upstream.

When using the fast file fsync code path we can miss the fact that new
writes happened since the last file fsync and therefore return without
waiting for the IO to finish and write the new extents to the fsync log.

Here's an example scenario where the fsync will miss the fact that new
file data exists that wasn't yet durably persisted:

1. fs_info->last_trans_committed == N - 1 and current transaction is
   transaction N (fs_info->generation == N);

2. do a buffered write;

3. fsync our inode, this clears our inode's full sync flag, starts
   an ordered extent and waits for it to complete - when it completes
   at btrfs_finish_ordered_io(), the inode's last_trans is set to the
   value N (via btrfs_update_inode_fallback -> btrfs_update_inode ->
   btrfs_set_inode_last_trans);

4. transaction N is committed, so fs_info->last_trans_committed is now
   set to the value N and fs_info->generation remains with the value N;

5. do another buffered write, when this happens btrfs_file_write_iter
   sets our inode's last_trans to the value N + 1 (that is
   fs_info->generation + 1 == N + 1);

6. transaction N + 1 is started and fs_info->generation now has the
   value N + 1;

7. transaction N + 1 is committed, so fs_info->last_trans_committed
   is set to the value N + 1;

8. fsync our inode - because it doesn't have the full sync flag set,
   we only start the ordered extent, we don't wait for it to complete
   (only in a later phase) therefore its last_trans field has the
   value N + 1 set previously by btrfs_file_write_iter(), and so we
   have:

       inode->last_trans <= fs_info->last_trans_committed
           (N + 1)              (N + 1)

   Which made us not log the last buffered write and exit the fsync
   handler immediately, returning success (0) to user space and resulting
   in data loss after a crash.

This can actually be triggered deterministically and the following excerpt
from a testcase I made for xfstests triggers the issue. It moves a dummy
file across directories and then fsyncs the old parent directory - this
is just to trigger a transaction commit, so moving files around isn't
directly related to the issue but it was chosen because running 'sync' for
example does more than just committing the current transaction, as it
flushes/waits for all file data to be persisted. The issue can also happen
at random periods, since the transaction kthread periodicaly commits the
current transaction (about every 30 seconds by default).
The body of the test is:

  _scratch_mkfs >> $seqres.full 2>&1
  _init_flakey
  _mount_flakey

  # Create our main test file 'foo', the one we check for data loss.
  # By doing an fsync against our file, it makes btrfs clear the 'needs_full_sync'
  # bit from its flags (btrfs inode specific flags).
  $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 8K" \
                  -c "fsync" $SCRATCH_MNT/foo | _filter_xfs_io

  # Now create one other file and 2 directories. We will move this second file
  # from one directory to the other later because it forces btrfs to commit its
  # currently open transaction if we fsync the old parent directory. This is
  # necessary to trigger the data loss bug that affected btrfs.
  mkdir $SCRATCH_MNT/testdir_1
  touch $SCRATCH_MNT/testdir_1/bar
  mkdir $SCRATCH_MNT/testdir_2

  # Make sure everything is durably persisted.
  sync

  # Write more 8Kb of data to our file.
  $XFS_IO_PROG -c "pwrite -S 0xbb 8K 8K" $SCRATCH_MNT/foo | _filter_xfs_io

  # Move our 'bar' file into a new directory.
  mv $SCRATCH_MNT/testdir_1/bar $SCRATCH_MNT/testdir_2/bar

  # Fsync our first directory. Because it had a file moved into some other
  # directory, this made btrfs commit the currently open transaction. This is
  # a condition necessary to trigger the data loss bug.
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir_1

  # Now fsync our main test file. If the fsync succeeds, we expect the 8Kb of
  # data we wrote previously to be persisted and available if a crash happens.
  # This did not happen with btrfs, because of the transaction commit that
  # happened when we fsynced the parent directory.
  $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo

  # Simulate a crash/power loss.
  _load_flakey_table $FLAKEY_DROP_WRITES
  _unmount_flakey

  _load_flakey_table $FLAKEY_ALLOW_WRITES
  _mount_flakey

  # Now check that all data we wrote before are available.
  echo "File content after log replay:"
  od -t x1 $SCRATCH_MNT/foo

  status=0
  exit

The expected golden output for the test, which is what we get with this
fix applied (or when running against ext3/4 and xfs), is:

  wrote 8192/8192 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  wrote 8192/8192 bytes at offset 8192
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  File content after log replay:
  0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
  *
  0020000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb
  *
  0040000

Without this fix applied, the output shows the test file does not have
the second 8Kb extent that we successfully fsynced:

  wrote 8192/8192 bytes at offset 0
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  wrote 8192/8192 bytes at offset 8192
  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
  File content after log replay:
  0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
  *
  0020000

So fix this by skipping the fsync only if we're doing a full sync and
if the inode's last_trans is <= fs_info->last_trans_committed, or if
the inode is already in the log. Also remove setting the inode's
last_trans in btrfs_file_write_iter since it's useless/unreliable.

Also because btrfs_file_write_iter no longer sets inode->last_trans to
fs_info->generation + 1, don't set last_trans to 0 if we bail out and don't
bail out if last_trans is 0, otherwise something as simple as the following
example wouldn't log the second write on the last fsync:

  1. write to file

  2. fsync file

  3. fsync file
       |--> btrfs_inode_in_log() returns true and it set last_trans to 0

  4. write to file
       |--> btrfs_file_write_iter() no longers sets last_trans, so it
            remained with a value of 0
  5. fsync
       |--> inode->last_trans == 0, so it bails out without logging the
            second write

A test case for xfstests will be sent soon.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/btrfs/file.c | 56 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index ad80dfa6cf91..9663f6600973 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1697,22 +1697,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
 	mutex_unlock(&inode->i_mutex);
 
 	/*
-	 * we want to make sure fsync finds this change
-	 * but we haven't joined a transaction running right now.
-	 *
-	 * Later on, someone is sure to update the inode and get the
-	 * real transid recorded.
-	 *
-	 * We set last_trans now to the fs_info generation + 1,
-	 * this will either be one more than the running transaction
-	 * or the generation used for the next transaction if there isn't
-	 * one running right now.
-	 *
 	 * We also have to set last_sub_trans to the current log transid,
 	 * otherwise subsequent syncs to a file that's been synced in this
 	 * transaction will appear to have already occured.
 	 */
-	BTRFS_I(inode)->last_trans = root->fs_info->generation + 1;
 	BTRFS_I(inode)->last_sub_trans = root->log_transid;
 	if (num_written > 0) {
 		err = generic_write_sync(file, pos, num_written);
@@ -1810,25 +1798,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 	atomic_inc(&root->log_batch);
 
 	/*
-	 * check the transaction that last modified this inode
-	 * and see if its already been committed
-	 */
-	if (!BTRFS_I(inode)->last_trans) {
-		mutex_unlock(&inode->i_mutex);
-		goto out;
-	}
-
-	/*
-	 * if the last transaction that changed this file was before
-	 * the current transaction, we can bail out now without any
-	 * syncing
+	 * If the last transaction that changed this file was before the current
+	 * transaction and we have the full sync flag set in our inode, we can
+	 * bail out now without any syncing.
+	 *
+	 * Note that we can't bail out if the full sync flag isn't set. This is
+	 * because when the full sync flag is set we start all ordered extents
+	 * and wait for them to fully complete - when they complete they update
+	 * the inode's last_trans field through:
+	 *
+	 *     btrfs_finish_ordered_io() ->
+	 *         btrfs_update_inode_fallback() ->
+	 *             btrfs_update_inode() ->
+	 *                 btrfs_set_inode_last_trans()
+	 *
+	 * So we are sure that last_trans is up to date and can do this check to
+	 * bail out safely. For the fast path, when the full sync flag is not
+	 * set in our inode, we can not do it because we start only our ordered
+	 * extents and don't wait for them to complete (that is when
+	 * btrfs_finish_ordered_io runs), so here at this point their last_trans
+	 * value might be less than or equals to fs_info->last_trans_committed,
+	 * and setting a speculative last_trans for an inode when a buffered
+	 * write is made (such as fs_info->generation + 1 for example) would not
+	 * be reliable since after setting the value and before fsync is called
+	 * any number of transactions can start and commit (transaction kthread
+	 * commits the current transaction periodically), and a transaction
+	 * commit does not start nor waits for ordered extents to complete.
 	 */
 	smp_mb();
 	if (btrfs_inode_in_log(inode, root->fs_info->generation) ||
-	    BTRFS_I(inode)->last_trans <=
-	    root->fs_info->last_trans_committed) {
-		BTRFS_I(inode)->last_trans = 0;
-
+	    (full_sync && BTRFS_I(inode)->last_trans <=
+	     root->fs_info->last_trans_committed)) {
 		/*
 		 * We'v had everything committed since the last time we were
 		 * modified so clear this flag in case it was set for whatever
-- 
2.3.0


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

* [PATCH 3.12 108/175] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref.
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (106 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 107/175] Btrfs: fix data loss in the fast fsync path Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 109/175] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Jiri Slaby
                   ` (68 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Quentin Casasnovas, Chris Mason, Jiri Slaby

From: Quentin Casasnovas <quentin.casasnovas@oracle.com>

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

===============

commit dd9ef135e3542ffc621c4eb7f0091870ec7a1504 upstream.

Improper arithmetics when calculting the address of the extended ref could
lead to an out of bounds memory read and kernel panic.

Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/btrfs/tree-log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index e14e1f7748e5..be3bf0be13c7 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -980,7 +980,7 @@ again:
 		base = btrfs_item_ptr_offset(leaf, path->slots[0]);
 
 		while (cur_offset < item_size) {
-			extref = (struct btrfs_inode_extref *)base + cur_offset;
+			extref = (struct btrfs_inode_extref *)(base + cur_offset);
 
 			victim_name_len = btrfs_inode_extref_name_len(leaf, extref);
 
-- 
2.3.0


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

* [PATCH 3.12 109/175] KVM: emulate: fix CMPXCHG8B on 32-bit hosts
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (107 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 108/175] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 110/175] KVM: MIPS: Fix trace event to save PC directly Jiri Slaby
                   ` (67 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paolo Bonzini, Jiri Slaby

From: Paolo Bonzini <pbonzini@redhat.com>

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

===============

commit 4ff6f8e61eb7f96d3ca535c6d240f863ccd6fb7d upstream.

This has been broken for a long time: it broke first in 2.6.35, then was
almost fixed in 2.6.36 but this one-liner slipped through the cracks.
The bug shows up as an infinite loop in Windows 7 (and newer) boot on
32-bit hosts without EPT.

Windows uses CMPXCHG8B to write to page tables, which causes a
page fault if running without EPT; the emulator is then called from
kvm_mmu_page_fault.  The loop then happens if the higher 4 bytes are
not 0; the common case for this is that the NX bit (bit 63) is 1.

Fixes: 6550e1f165f384f3a46b60a1be9aba4bc3c2adad
Fixes: 16518d5ada690643453eb0aef3cc7841d3623c2d
Reported-by: Erik Rull <erik.rull@rdsoftware.de>
Tested-by: Erik Rull <erik.rull@rdsoftware.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kvm/emulate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8ab43ac68f06..c412bab82d1f 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4617,7 +4617,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
 		if (rc != X86EMUL_CONTINUE)
 			goto done;
 	}
-	ctxt->dst.orig_val = ctxt->dst.val;
+	/* Copy full 64-bit value for CMPXCHG8B.  */
+	ctxt->dst.orig_val64 = ctxt->dst.val64;
 
 special_insn:
 
-- 
2.3.0


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

* [PATCH 3.12 110/175] KVM: MIPS: Fix trace event to save PC directly
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (108 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 109/175] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 111/175] USB: serial: cp210x: Adding Seletek device id's Jiri Slaby
                   ` (66 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, James Hogan, Paolo Bonzini, Ralf Baechle,
	Marcelo Tosatti, Gleb Natapov, Steven Rostedt, Ingo Molnar,
	linux-mips, kvm, Jiri Slaby

From: James Hogan <james.hogan@imgtec.com>

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

===============

commit b3cffac04eca9af46e1e23560a8ee22b1bd36d43 upstream.

Currently the guest exit trace event saves the VCPU pointer to the
structure, and the guest PC is retrieved by dereferencing it when the
event is printed rather than directly from the trace record. This isn't
safe as the printing may occur long afterwards, after the PC has changed
and potentially after the VCPU has been freed. Usually this results in
the same (wrong) PC being printed for multiple trace events. It also
isn't portable as userland has no way to access the VCPU data structure
when interpreting the trace record itself.

Lets save the actual PC in the structure so that the correct value is
accessible later.

Fixes: 669e846e6c4e ("KVM/MIPS32: MIPS arch specific APIs for KVM")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kvm/trace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h
index bc9e0f406c08..e51621e36152 100644
--- a/arch/mips/kvm/trace.h
+++ b/arch/mips/kvm/trace.h
@@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit,
 	    TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason),
 	    TP_ARGS(vcpu, reason),
 	    TP_STRUCT__entry(
-			__field(struct kvm_vcpu *, vcpu)
+			__field(unsigned long, pc)
 			__field(unsigned int, reason)
 	    ),
 
 	    TP_fast_assign(
-			__entry->vcpu = vcpu;
+			__entry->pc = vcpu->arch.pc;
 			__entry->reason = reason;
 	    ),
 
 	    TP_printk("[%s]PC: 0x%08lx",
 		      kvm_mips_exit_types_str[__entry->reason],
-		      __entry->vcpu->arch.pc)
+		      __entry->pc)
 );
 
 #endif /* _TRACE_KVM_H */
-- 
2.3.0


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

* [PATCH 3.12 111/175] USB: serial: cp210x: Adding Seletek device id's
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (109 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 110/175] KVM: MIPS: Fix trace event to save PC directly Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 112/175] USB: usbfs: don't leak kernel data in siginfo Jiri Slaby
                   ` (65 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michiel vd Garde, Johan Hovold, Jiri Slaby

From: Michiel vd Garde <mgparser@gmail.com>

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

===============

commit 675af70856d7cc026be8b6ea7a8b9db10b8b38a1 upstream.

These device ID's are not associated with the cp210x module currently,
but should be. This patch allows the devices to operate upon connecting
them to the usb bus as intended.

Signed-off-by: Michiel van de Garde <mgparser@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/cp210x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index af5ccd292f27..622d349fd7da 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */
 	{ USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */
 	{ USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */
+	{ USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */
+	{ USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */
 	{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
 	{ USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */
 	{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
-- 
2.3.0


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

* [PATCH 3.12 112/175] USB: usbfs: don't leak kernel data in siginfo
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (110 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 111/175] USB: serial: cp210x: Adding Seletek device id's Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 113/175] USB: ftdi_sio: add PIDs for Actisense USB devices Jiri Slaby
                   ` (64 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alan Stern, Jiri Slaby

From: Alan Stern <stern@rowland.harvard.edu>

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

===============

commit f0c2b68198589249afd2b1f2c4e8de8c03e19c16 upstream.

When a signal is delivered, the information in the siginfo structure
is copied to userspace.  Good security practice dicatates that the
unused fields in this structure should be initialized to 0 so that
random kernel stack data isn't exposed to the user.  This patch adds
such an initialization to the two places where usbfs raises signals.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Dave Mielke <dave@mielke.cc>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/devio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 31ffd8459456..0b2de7d68a7a 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb)
 	as->status = urb->status;
 	signr = as->signr;
 	if (signr) {
+		memset(&sinfo, 0, sizeof(sinfo));
 		sinfo.si_signo = as->signr;
 		sinfo.si_errno = as->status;
 		sinfo.si_code = SI_ASYNCIO;
@@ -2229,6 +2230,7 @@ static void usbdev_remove(struct usb_device *udev)
 		wake_up_all(&ps->wait);
 		list_del_init(&ps->list);
 		if (ps->discsignr) {
+			memset(&sinfo, 0, sizeof(sinfo));
 			sinfo.si_signo = ps->discsignr;
 			sinfo.si_errno = EPIPE;
 			sinfo.si_code = SI_ASYNCIO;
-- 
2.3.0


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

* [PATCH 3.12 113/175] USB: ftdi_sio: add PIDs for Actisense USB devices
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (111 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 112/175] USB: usbfs: don't leak kernel data in siginfo Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 114/175] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Jiri Slaby
                   ` (63 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mark Glover, Johan Hovold, Jiri Slaby

From: Mark Glover <mark@actisense.com>

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

===============

commit f6950344d3cf4a1e231b5828b50c4ac168db3886 upstream.

These product identifiers (PID) all deal with marine NMEA format data
used on motor boats and yachts. We supply the programmed devices to
Chetco, for use inside their equipment. The PIDs are a direct copy of
our Windows device drivers (FTDI drivers with altered PIDs).

Signed-off-by: Mark Glover <mark@actisense.com>
[johan: edit commit message slightly ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ftdi_sio.c     | 17 +++++++++++++++++
 drivers/usb/serial/ftdi_sio_ids.h | 20 ++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 00710ff5ebb8..fe8aa739df51 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -992,6 +992,23 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
 	/* GE Healthcare devices */
 	{ USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) },
+	/* Active Research (Actisense) devices */
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) },
+	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) },
+	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) },
 	{ }					/* Terminating entry */
 };
 
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index e52409c9be99..4d3da89cd8dd 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1438,3 +1438,23 @@
  */
 #define GE_HEALTHCARE_VID		0x1901
 #define GE_HEALTHCARE_NEMO_TRACKER_PID	0x0015
+
+/*
+ * Active Research (Actisense) devices
+ */
+#define ACTISENSE_NDC_PID		0xD9A8 /* NDC USB Serial Adapter */
+#define ACTISENSE_USG_PID		0xD9A9 /* USG USB Serial Adapter */
+#define ACTISENSE_NGT_PID		0xD9AA /* NGT NMEA2000 Interface */
+#define ACTISENSE_NGW_PID		0xD9AB /* NGW NMEA2000 Gateway */
+#define ACTISENSE_D9AC_PID		0xD9AC /* Actisense Reserved */
+#define ACTISENSE_D9AD_PID		0xD9AD /* Actisense Reserved */
+#define ACTISENSE_D9AE_PID		0xD9AE /* Actisense Reserved */
+#define ACTISENSE_D9AF_PID		0xD9AF /* Actisense Reserved */
+#define CHETCO_SEAGAUGE_PID		0xA548 /* SeaGauge USB Adapter */
+#define CHETCO_SEASWITCH_PID		0xA549 /* SeaSwitch USB Adapter */
+#define CHETCO_SEASMART_NMEA2000_PID	0xA54A /* SeaSmart NMEA2000 Gateway */
+#define CHETCO_SEASMART_ETHERNET_PID	0xA54B /* SeaSmart Ethernet Gateway */
+#define CHETCO_SEASMART_WIFI_PID	0xA5AC /* SeaSmart Wifi Gateway */
+#define CHETCO_SEASMART_DISPLAY_PID	0xA5AD /* SeaSmart NMEA2000 Display */
+#define CHETCO_SEASMART_LITE_PID	0xA5AE /* SeaSmart Lite USB Adapter */
+#define CHETCO_SEASMART_ANALOG_PID	0xA5AF /* SeaSmart Analog Adapter */
-- 
2.3.0


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

* [PATCH 3.12 114/175] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (112 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 113/175] USB: ftdi_sio: add PIDs for Actisense USB devices Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 115/175] usb: dwc3: dwc3-omap: Fix disable IRQ Jiri Slaby
                   ` (62 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Max Mansfield, Johan Hovold, Jiri Slaby

From: Max Mansfield <max.m.mansfield@gmail.com>

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

===============

commit c7d373c3f0da2b2b78c4b1ce5ae41485b3ef848c upstream.

This patch integrates Cyber Cortex AV boards with the existing
ftdi_jtag_quirk in order to use serial port 0 with JTAG which is
required by the manufacturers' software.

Steps: 2

[ftdi_sio_ids.h]
1. Defined the device PID

[ftdi_sio.c]
2. Added a macro declaration to the ids array, in order to enable the
jtag quirk for the device.

Signed-off-by: Max Mansfield <max.m.mansfield@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ftdi_sio.c     | 2 ++
 drivers/usb/serial/ftdi_sio_ids.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index fe8aa739df51..97abe6bef2f9 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -813,6 +813,8 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) },
+	{ USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID),
+		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID),
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 4d3da89cd8dd..56b1b55c4751 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -38,6 +38,9 @@
 
 #define FTDI_LUMEL_PD12_PID	0x6002
 
+/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */
+#define CYBER_CORTEX_AV_PID	0x8698
+
 /*
  * Marvell OpenRD Base, Client
  * http://www.open-rd.org
-- 
2.3.0


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

* [PATCH 3.12 115/175] usb: dwc3: dwc3-omap: Fix disable IRQ
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (113 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 114/175] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 116/175] xhci: Allocate correct amount of scratchpad buffers Jiri Slaby
                   ` (61 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, George Cherian, Felipe Balbi, Jiri Slaby

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

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

===============

commit 96e5d31244c5542f5b2ea81d76f14ba4b8a7d440 upstream.

In the wrapper the IRQ disable should be done by writing 1's to the
IRQ*_CLR register. Existing code is broken because it instead writes
zeros to IRQ*_SET register.

Fix this by adding functions dwc3_omap_write_irqmisc_clr() and
dwc3_omap_write_irq0_clr() which do the right thing.

Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/dwc3/dwc3-omap.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 2a0422b7c42f..662441bebd1b 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -215,6 +215,18 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value)
 						omap->irq0_offset, value);
 }
 
+static void dwc3_omap_write_irqmisc_clr(struct dwc3_omap *omap, u32 value)
+{
+	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_MISC +
+						omap->irqmisc_offset, value);
+}
+
+static void dwc3_omap_write_irq0_clr(struct dwc3_omap *omap, u32 value)
+{
+	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_0 -
+						omap->irq0_offset, value);
+}
+
 static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
 	enum omap_dwc3_vbus_id_status status)
 {
@@ -359,9 +371,23 @@ static void dwc3_omap_enable_irqs(struct dwc3_omap *omap)
 
 static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 {
+	u32			reg;
+
 	/* disable all IRQs */
-	dwc3_omap_write_irqmisc_set(omap, 0x00);
-	dwc3_omap_write_irq0_set(omap, 0x00);
+	reg = USBOTGSS_IRQO_COREIRQ_ST;
+	dwc3_omap_write_irq0_clr(omap, reg);
+
+	reg = (USBOTGSS_IRQMISC_OEVT |
+			USBOTGSS_IRQMISC_DRVVBUS_RISE |
+			USBOTGSS_IRQMISC_CHRGVBUS_RISE |
+			USBOTGSS_IRQMISC_DISCHRGVBUS_RISE |
+			USBOTGSS_IRQMISC_IDPULLUP_RISE |
+			USBOTGSS_IRQMISC_DRVVBUS_FALL |
+			USBOTGSS_IRQMISC_CHRGVBUS_FALL |
+			USBOTGSS_IRQMISC_DISCHRGVBUS_FALL |
+			USBOTGSS_IRQMISC_IDPULLUP_FALL);
+
+	dwc3_omap_write_irqmisc_clr(omap, reg);
 }
 
 static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
-- 
2.3.0


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

* [PATCH 3.12 116/175] xhci: Allocate correct amount of scratchpad buffers
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (114 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 115/175] usb: dwc3: dwc3-omap: Fix disable IRQ Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 117/175] xhci: fix reporting of 0-sized URBs in control endpoint Jiri Slaby
                   ` (60 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mathias Nyman, Jiri Slaby

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

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

===============

commit 6596a926b0b6c80b730a1dd2fa91908e0a539c37 upstream.

Include the high order bit fields for Max scratchpad buffers when
calculating how many scratchpad buffers are needed.

I'm suprised this hasn't caused more issues, we never allocated more than
32 buffers even if xhci needed more. Either we got lucky and xhci never
really used past that area, or then we got enough zeroed dma memory anyway.

Should be backported as far back as possible

Reported-by: Tim Chen <tim.c.chen@linux.intel.com>
Tested-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 1703de9f0509..43f0b2ef7b60 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -88,9 +88,10 @@ struct xhci_cap_regs {
 #define HCS_IST(p)		(((p) >> 0) & 0xf)
 /* bits 4:7, max number of Event Ring segments */
 #define HCS_ERST_MAX(p)		(((p) >> 4) & 0xf)
+/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */
 /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */
-/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */
-#define HCS_MAX_SCRATCHPAD(p)   (((p) >> 27) & 0x1f)
+/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */
+#define HCS_MAX_SCRATCHPAD(p)   ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f))
 
 /* HCSPARAMS3 - hcs_params3 - bitmasks */
 /* bits 0:7, Max U1 to U0 latency for the roothub ports */
-- 
2.3.0


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

* [PATCH 3.12 117/175] xhci: fix reporting of 0-sized URBs in control endpoint
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (115 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 116/175] xhci: Allocate correct amount of scratchpad buffers Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 118/175] mac80211: Send EAPOL frames at lowest rate Jiri Slaby
                   ` (59 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Aleksander Morgado, Mathias Nyman, Jiri Slaby

From: Aleksander Morgado <aleksander@aleksander.es>

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

===============

commit 45ba2154d12fc43b70312198ec47085f10be801a upstream.

When a control transfer has a short data stage, the xHCI controller generates
two transfer events: a COMP_SHORT_TX event that specifies the untransferred
amount, and a COMP_SUCCESS event. But when the data stage is not short, only the
COMP_SUCCESS event occurs. Therefore, xhci-hcd must set urb->actual_length to
urb->transfer_buffer_length while processing the COMP_SUCCESS event, unless
urb->actual_length was set already by a previous COMP_SHORT_TX event.

The driver checks this by seeing whether urb->actual_length == 0, but this alone
is the wrong test, as it is entirely possible for a short transfer to have an
urb->actual_length = 0.

This patch changes the xhci driver to rely on a new td->urb_length_set flag,
which is set to true when a COMP_SHORT_TX event is received and the URB length
updated at that stage.

This fixes a bug which affected the HSO plugin, which relies on URBs with
urb->actual_length == 0 to halt re-submitting the RX URB in the control
endpoint.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci-ring.c | 10 ++++++++--
 drivers/usb/host/xhci.h      |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6f052daed694..6bf308798a2d 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2100,7 +2100,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
 	if (event_trb != ep_ring->dequeue) {
 		/* The event was for the status stage */
 		if (event_trb == td->last_trb) {
-			if (td->urb->actual_length != 0) {
+			if (td->urb_length_set) {
 				/* Don't overwrite a previously set error code
 				 */
 				if ((*status == -EINPROGRESS || *status == 0) &&
@@ -2114,7 +2114,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
 					td->urb->transfer_buffer_length;
 			}
 		} else {
-		/* Maybe the event was for the data stage? */
+			/*
+			 * Maybe the event was for the data stage? If so, update
+			 * already the actual_length of the URB and flag it as
+			 * set, so that it is not overwritten in the event for
+			 * the last TRB.
+			 */
+			td->urb_length_set = true;
 			td->urb->actual_length =
 				td->urb->transfer_buffer_length -
 				EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 43f0b2ef7b60..d14b3e17b906 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1,3 +1,4 @@
+
 /*
  * xHCI host controller driver
  *
@@ -1284,6 +1285,8 @@ struct xhci_td {
 	struct xhci_segment	*start_seg;
 	union xhci_trb		*first_trb;
 	union xhci_trb		*last_trb;
+	/* actual_length of the URB has already been set */
+	bool			urb_length_set;
 };
 
 /* xHCI command default timeout value */
-- 
2.3.0


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

* [PATCH 3.12 000/175] 3.12.39-stable review
@ 2015-03-17  8:41 Jiri Slaby
  2015-03-17  8:39 ` [PATCH 3.12 001/175] xfs: ensure buffer types are set correctly Jiri Slaby
                   ` (176 more replies)
  0 siblings, 177 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux, satoru.takeuchi, shuah.kh, linux-kernel, Jiri Slaby

This is the start of the stable review cycle for the 3.12.39 release.
There are 175 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 Mar 19 09:40:21 CET 2015.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.39-rc1.xz
and the diffstat can be found below.

thanks,
js

===============


Adel Gadllah (1):
  HID: usbhid: enable always-poll quirk for Elan Touchscreen 0103

Adrian Knoth (1):
  ALSA: hdspm - Constrain periods to 2 on older cards

Al Viro (4):
  autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for
    allocation
  debugfs: leave freeing a symlink body until inode eviction
  procfs: fix race between symlink removals and traversals
  sunrpc: fix braino in ->poll()

Alan Stern (3):
  USB: fix use-after-free bug in usb_hcd_unlink_urb()
  USB: EHCI: adjust error return code
  USB: usbfs: don't leak kernel data in siginfo

Alan Wu (2):
  HID: add support for MS Surface Pro 3 Type Cover
  HID: microsoft: add support for Japanese Surface Type Cover 3

Aleksander Morgado (1):
  xhci: fix reporting of 0-sized URBs in control endpoint

Alex Deucher (3):
  drm/radeon: only enable kv/kb dpm interrupts once v3
  drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
  drm/radeon: fix 1 RB harvest config setup for TN/RL

Alexander Drozdov (2):
  ipv4: ip_check_defrag should correctly check return value of
    skb_copy_bits
  ipv4: ip_check_defrag should not assume that skb_network_offset is
    zero

Alexander Usyskin (1):
  mei: make device disabled on stop unconditionally

Alexey Brodkin (1):
  ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE

Anantha Krishnan (1):
  Bluetooth: Add support for Acer [0489:e078]

Andy Lutomirski (1):
  x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization

Anton Staaf (1):
  USB: serial: add Google simple serial SubClass support

Arnd Bergmann (1):
  cpufreq: s3c: remove incorrect __init annotations

Ben Hutchings (1):
  splice: Apply generic position and size checks to each write

Ben Shelton (1):
  usb: plusb: Add support for National Instruments host-to-host cable

Björn Gerhart (1):
  cdc-acm: Add support for Denso cradle CU-321

Catalin Marinas (2):
  arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big
    endian
  net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg

Chen Jie (1):
  jffs2: fix handling of corrupted summary length

Chen-Yu Tsai (1):
  clk: sunxi: Support factor clocks with N factor starting not from 0

Chris Wilson (1):
  ACPI / video: Load the module even if ACPI is disabled

Christian König (1):
  drm/radeon: workaround for CP HW bug on CIK

Christophe Ricard (1):
  tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send

Cyrille Pitchen (1):
  tty/serial: at91: fix error handling in atmel_serial_probe()

Dan Carpenter (1):
  ALSA: off by one bug in snd_riptide_joystick_probe()

Daniel Borkmann (1):
  rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY

Daniel J Blueman (1):
  EDAC, amd64_edac: Prevent OOPS with >16 memory controllers

Darrick J. Wong (1):
  dm io: reject unsupported DISCARD requests with EOPNOTSUPP

Dave Chinner (3):
  xfs: ensure buffer types are set correctly
  xfs: inode unlink does not set AGI buffer type
  xfs: set superblock buffer type correctly

David Herrmann (1):
  HID: input: fix confusion on conflicting mappings

David Howells (1):
  TPM: Add new TPMs to the tail of the list to prevent inadvertent
    change of dev

David Sterba (2):
  btrfs: set proper message level for skinny metadata
  btrfs: fix lost return value due to variable shadowing

Dmitry Eremin-Solenikov (3):
  ARM: 8284/1: sa1100: clear RCSR_SMR on resume
  ARM: pxa: add regulator_has_full_constraints to corgi board file
  ARM: pxa: add regulator_has_full_constraints to poodle board file

Emmanuel Grumbach (1):
  iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN

Eric Dumazet (2):
  netfilter: xt_socket: fix a stack corruption bug
  macvtap: make sure neighbour code can push ethernet header

Eyal Shapira (1):
  iwlwifi: mvm: validate tid and sta_id in ba_notif

Felipe Balbi (2):
  usb: gadget: function: phonet: balance usb_ep_disable calls
  usb: musb: core: add pm_runtime_irq_safe()

Filipe Manana (1):
  Btrfs: fix data loss in the fast fsync path

George Cherian (1):
  usb: dwc3: dwc3-omap: Fix disable IRQ

Grazvydas Ignotas (1):
  mm/memory.c: actually remap enough memory

Guenter Roeck (2):
  net: phy: Fix verification of EEE support in phy_init_eee
  arc: mm: Fix build failure

Hans Holmberg (1):
  gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one
    chip per node

Hans de Goede (2):
  HID: hid-microsoft: Add support for scrollwheel and special keypad
    keys
  sunxi: clk: Set sun6i-pll1 n_start = 1

Hector Marco-Gisbert (1):
  x86, mm/ASLR: Fix stack randomization on 64-bit systems

Hon Ching (Vicky) Lo (1):
  tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma

Ian Abbott (2):
  staging: comedi: cb_pcidas64: fix incorrect AI range code handling
  staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

Ignacy Gawędzki (2):
  gen_stats.c: Duplicate xstats buffer for later use
  ematch: Fix auto-loading of ematch modules.

Ilya Dryomov (3):
  libceph: assert both regular and lingering lists in __remove_osd()
  libceph: change from BUG to WARN for __remove_osd() asserts
  libceph: fix double __remove_osd() problem

Jakub Sitnicki (1):
  HID: microsoft: Add ID for NE7K wireless keyboard

James Hogan (5):
  MIPS: KVM: Deliver guest interrupts after local_irq_disable()
  KVM: MIPS: Don't leak FPU/DSP to guest
  metag: Fix KSTK_EIP() and KSTK_ESP() macros
  MIPS: Export FP functions used by lose_fpu(1) for KVM
  KVM: MIPS: Fix trace event to save PC directly

Jan Kara (2):
  fsnotify: fix handling of renames in audit
  xfs: Fix quota type in quota structures when reusing quota file

Jay Lan (1):
  kdb: fix incorrect counts in KDB summary command output

Jeff Layton (1):
  nfs: don't call blocking operations while !TASK_RUNNING

Jeff Moyer (1):
  cfq-iosched: fix incorrect filing of rt async cfqq

Jim Keir (1):
  HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2

Jiri Kosina (1):
  HID: fixup the conflicting keyboard mappings quirk

Jiri Pirko (2):
  team: fix possible null pointer dereference in team_handle_frame
  team: don't traverse port list using rcu in team_set_mac_address

Jiri Slaby (1):
  tty: fix up atime/mtime mess, take four

Jisheng Zhang (1):
  mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles

Johan Hovold (5):
  net: irda: fix wait_until_sent poll timeout
  USB: serial: fix infinite wait_until_sent timeout
  TTY: fix tty_wait_until_sent on 64-bit machines
  USB: serial: fix potential use-after-free after failed probe
  USB: serial: fix tty-device error handling at probe

Joonsoo Kim (1):
  mm/compaction: fix wrong order check in compact_finished()

Jouni Malinen (1):
  mac80211: Send EAPOL frames at lowest rate

Julian Anastasov (2):
  ipvs: add missing ip_vs_pe_put in sync code
  ipvs: rerouting to local clients is not needed anymore

Kalle Valo (1):
  ath6kl: fix struct hif_scatter_req list handling

Konstantin Khlebnikov (1):
  cfq-iosched: handle failure of cfq group allocation

Krzysztof Kozlowski (2):
  power_supply: 88pm860x: Fix leaked power supply on probe fail
  power: bq24190: Fix ignored supplicants

Lennart Sorensen (1):
  USB: cp210x: add ID for RUGGEDCOM USB Serial Console

Linus Torvalds (3):
  x86: mm: move mmap_sem unlock from mm_fault_error() to caller
  vm: add VM_FAULT_SIGSEGV handling support
  vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than
    SIGBUS

Lokesh Vutla (1):
  ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3

Lorenzo Colitti (1):
  net: ping: Return EAFNOSUPPORT when appropriate.

Luciano Coelho (1):
  iwlwifi: mvm: always use mac color zero

Malcolm Priestley (1):
  lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in
    interrupt urb

Marcelo Tosatti (1):
  KVM: x86: update masterclock values on TSC writes

Mark Glover (1):
  USB: ftdi_sio: add PIDs for Actisense USB devices

Martin KaFai Lau (1):
  ipv6: fix ipv6_cow_metrics for non DST_HOST case

Martin Vajnar (1):
  hx4700: regulator: declare full constraints

Mathias Nyman (1):
  xhci: Allocate correct amount of scratchpad buffers

Matthew Thode (1):
  net: reject creation of netdev names with colons

Matthew Wilcox (1):
  axonram: Fix bug in direct_access

Max Mansfield (1):
  usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards

Michal Kubeček (1):
  udp: only allow UFO for packets from SOCK_DGRAM sockets

Michel Dänzer (1):
  PCI: Fix infinite loop with ROM image of size 0

Michiel vd Garde (1):
  USB: serial: cp210x: Adding Seletek device id's

Mikulas Patocka (4):
  cpufreq: speedstep-smi: enable interrupts when waiting
  dm mirror: do not degrade the mirror on discard error
  dm: fix a race condition in dm_get_md
  dm snapshot: fix a possible invalid memory access on unload

Minh Duc Tran (1):
  fixed invalid assignment of 64bit mask to host dma_boundary for
    scatter gather segment boundary limit.

Mitko Haralanov (1):
  IB/qib: Do not write EEPROM

Naoya Horiguchi (6):
  mm/hugetlb: pmd_huge() returns true for non-present hugepage
  mm/hugetlb: add migration/hwpoisoned entry check in
    hugetlb_change_protection
  mm/hugetlb: add migration entry check in __unmap_hugepage_range
  mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()
  mm/hugetlb: reduce arch dependent code around follow_huge_*
  mm/hugetlb: take page table lock in follow_huge_pmd()

NeilBrown (1):
  md/raid5: Fix livelock when array is both resyncing and degraded.

Nicholas Bellinger (4):
  iscsi-target: Drop problematic active_ts_list usage
  target: Fix PR_APTPL_BUF_LEN buffer size limitation
  target: Add missing WRITE_SAME end-of-device sanity check
  target: Check for LBA + sectors wrap-around in sbc_parse_cdb

Nicolas Pitre (1):
  vt: provide notifications on selection changes

Nicolas Saenz Julienne (1):
  gpio: tps65912: fix wrong container_of arguments

Oliver Neukum (4):
  xhci: no switching back on non-ULT Haswell
  HID: usbhid: fix PIXART optical mouse
  HID: usbhid: add another mouse that needs QUIRK_ALWAYS_POLL
  HID: yet another buggy ELAN touchscreen

Paolo Bonzini (1):
  KVM: emulate: fix CMPXCHG8B on 32-bit hosts

Peter Hurley (1):
  tty: Prevent untrappable signals from malicious program

Peter Ujfalusi (1):
  ASoC: omap-pcm: Correct dma mask

Quentin Casasnovas (1):
  Btrfs:__add_inode_ref: out of bounds memory read when looking for
    extended ref.

Rasmus Villemoes (1):
  iio: imu: adis16400: Fix sign extension

Ricardo Ribalda Delgado (1):
  PCI: Generate uppercase hex for modalias var in uevent

Robert Nelson (1):
  ARM: dts: am335x-bone*: usb0 is hardwired for peripheral

Roman Gushchin (2):
  mm/mmap.c: fix arithmetic overflow in __vm_enough_memory()
  mm/nommu.c: fix arithmetic overflow in __vm_enough_memory()

Ross Lagerwall (1):
  xen/manage: Fix USB interaction issues when resuming

Ross Skaliotis (1):
  HID: apple: fix battery support for the 2009 ANSI wireless keyboard

Ryusuke Konishi (1):
  nilfs2: fix potential memory overrun on inode

Sabrina Dubroca (1):
  pktgen: fix UDP checksum computation

Scot Doyle (1):
  tpm_tis: verify interrupt during init

Sebastian Andrzej Siewior (1):
  usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN

Sergei Shtylyov (1):
  clk-gate: fix bit # check in clk_register_gate()

Sergey Ryazanov (1):
  ath5k: fix spontaneus AR5312 freezes

Seth Forshee (1):
  HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events

Soren Brinkmann (1):
  clk: zynq: Force CPU_2X clock to be ungated

Sumit.Saxena@avagotech.com (1):
  megaraid_sas: disable interrupt_mask before enabling hardware
    interrupts

Takashi Iwai (2):
  ALSA: pcm: Don't leave PREPARED state after draining
  ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec

Thadeu Lima de Souza Cascardo (1):
  blk-throttle: check stats_cpu before reading it from sysfs

Tomáš Hodek (1):
  md/raid1: fix read balance when a drive is write-mostly.

Tony Battersby (1):
  sg: fix read() error reporting

Trond Myklebust (2):
  NFSv4.1: Fix a kfree() of uninitialised pointers in
    decode_cb_sequence_args
  NFSv4: Don't call put_rpccred() under the rcu_read_lock()

Urs Fässler (1):
  iio: ad5686: fix optional reference voltage declaration

Vikram Mulukutla (1):
  tracing: Fix unmapping loop in tracing_mark_write

Vineet Gupta (1):
  ARC: Fix KSTK_ESP()

WANG Cong (1):
  rtnetlink: call ->dellink on failure when ->newlink exists

honclo (1):
  Added Little Endian support to vtpm module

 arch/alpha/mm/fault.c                        |   2 +
 arch/arc/include/asm/pgtable.h               |   3 +-
 arch/arc/include/asm/processor.h             |   9 +-
 arch/arc/kernel/stacktrace.c                 |   6 +-
 arch/arc/mm/fault.c                          |   2 +
 arch/arm/boot/dts/am335x-bone-common.dtsi    |   1 +
 arch/arm/mach-omap2/omap_hwmod_7xx_data.c    |   2 +-
 arch/arm/mach-pxa/corgi.c                    |   3 +
 arch/arm/mach-pxa/hx4700.c                   |   2 +
 arch/arm/mach-pxa/poodle.c                   |   2 +
 arch/arm/mach-sa1100/pm.c                    |   1 +
 arch/arm/mm/hugetlbpage.c                    |   6 -
 arch/arm64/kernel/signal32.c                 |   5 +-
 arch/arm64/mm/hugetlbpage.c                  |   6 -
 arch/avr32/mm/fault.c                        |   2 +
 arch/cris/mm/fault.c                         |   2 +
 arch/frv/mm/fault.c                          |   2 +
 arch/ia64/mm/fault.c                         |   2 +
 arch/ia64/mm/hugetlbpage.c                   |   6 -
 arch/m32r/mm/fault.c                         |   2 +
 arch/m68k/mm/fault.c                         |   2 +
 arch/metag/include/asm/processor.h           |   4 +-
 arch/metag/mm/fault.c                        |   2 +
 arch/metag/mm/hugetlbpage.c                  |   6 -
 arch/microblaze/mm/fault.c                   |   2 +
 arch/mips/kernel/mips_ksyms.c                |   8 ++
 arch/mips/kvm/kvm_locore.S                   |   2 +-
 arch/mips/kvm/kvm_mips.c                     |   8 +-
 arch/mips/kvm/trace.h                        |   6 +-
 arch/mips/mm/fault.c                         |   2 +
 arch/mips/mm/hugetlbpage.c                   |  18 ---
 arch/mn10300/mm/fault.c                      |   2 +
 arch/openrisc/mm/fault.c                     |   2 +
 arch/parisc/mm/fault.c                       |   2 +
 arch/powerpc/mm/fault.c                      |   2 +
 arch/powerpc/mm/hugetlbpage.c                |   8 ++
 arch/powerpc/platforms/cell/spu_fault.c      |   2 +-
 arch/powerpc/sysdev/axonram.c                |   2 +-
 arch/s390/mm/fault.c                         |   6 +
 arch/s390/mm/hugetlbpage.c                   |  20 ---
 arch/score/mm/fault.c                        |   2 +
 arch/sh/mm/fault.c                           |   2 +
 arch/sh/mm/hugetlbpage.c                     |  12 --
 arch/sparc/mm/fault_32.c                     |   2 +
 arch/sparc/mm/fault_64.c                     |   2 +
 arch/sparc/mm/hugetlbpage.c                  |  12 --
 arch/tile/mm/fault.c                         |   2 +
 arch/tile/mm/hugetlbpage.c                   |  28 -----
 arch/um/kernel/trap.c                        |   2 +
 arch/x86/kernel/entry_64.S                   |  13 +-
 arch/x86/kvm/emulate.c                       |   3 +-
 arch/x86/kvm/x86.c                           |  19 +--
 arch/x86/mm/fault.c                          |  10 +-
 arch/x86/mm/gup.c                            |   2 +-
 arch/x86/mm/hugetlbpage.c                    |  20 ++-
 arch/x86/mm/mmap.c                           |   6 +-
 arch/xtensa/mm/fault.c                       |   2 +
 block/blk-throttle.c                         |   3 +
 block/cfq-iosched.c                          |  16 ++-
 drivers/acpi/video.c                         |  11 ++
 drivers/bluetooth/ath3k.c                    |   2 +
 drivers/bluetooth/btusb.c                    |   1 +
 drivers/char/tpm/tpm.c                       |   2 +-
 drivers/char/tpm/tpm_i2c_stm_st33.c          |   2 +-
 drivers/char/tpm/tpm_ibmvtpm.c               |  28 +++--
 drivers/char/tpm/tpm_tis.c                   |  76 ++++++++---
 drivers/clk/clk-gate.c                       |   2 +-
 drivers/clk/sunxi/clk-factors.c              |   2 +-
 drivers/clk/sunxi/clk-factors.h              |   1 +
 drivers/clk/sunxi/clk-sunxi.c                |   1 +
 drivers/clk/zynq/clkc.c                      |   1 +
 drivers/cpufreq/s3c2416-cpufreq.c            |   4 +-
 drivers/cpufreq/s3c24xx-cpufreq.c            |   2 +-
 drivers/cpufreq/speedstep-lib.c              |   3 +
 drivers/cpufreq/speedstep-smi.c              |  12 ++
 drivers/edac/amd64_edac.c                    |   8 +-
 drivers/gpio/gpio-tps65912.c                 |  14 ++-
 drivers/gpio/gpiolib-of.c                    |   9 +-
 drivers/gpu/drm/radeon/cik.c                 |  37 +++---
 drivers/gpu/drm/radeon/kv_dpm.c              |  17 ++-
 drivers/gpu/drm/radeon/ni.c                  |   8 +-
 drivers/gpu/drm/radeon/r600_dpm.c            |   2 +-
 drivers/hid/hid-core.c                       |  10 ++
 drivers/hid/hid-ids.h                        |   8 ++
 drivers/hid/hid-input.c                      |  26 +++-
 drivers/hid/hid-microsoft.c                  |  55 +++++++-
 drivers/hid/i2c-hid/i2c-hid.c                |   5 +-
 drivers/hid/usbhid/hid-pidff.c               |   6 +
 drivers/hid/usbhid/hid-quirks.c              |   6 +
 drivers/iio/dac/ad5686.c                     |   2 +-
 drivers/iio/imu/adis16400_core.c             |   3 +-
 drivers/infiniband/hw/qib/qib.h              |   9 +-
 drivers/infiniband/hw/qib/qib_eeprom.c       | 181 ---------------------------
 drivers/infiniband/hw/qib/qib_iba6120.c      |   2 -
 drivers/infiniband/hw/qib/qib_iba7220.c      |   2 -
 drivers/infiniband/hw/qib/qib_iba7322.c      |   2 -
 drivers/infiniband/hw/qib/qib_init.c         |   1 -
 drivers/infiniband/hw/qib/qib_sysfs.c        |  24 ----
 drivers/md/dm-io.c                           |   6 +
 drivers/md/dm-raid1.c                        |   9 ++
 drivers/md/dm-snap.c                         |   4 +-
 drivers/md/dm.c                              |  27 ++--
 drivers/md/raid1.c                           |   5 +-
 drivers/md/raid5.c                           |   3 +-
 drivers/media/usb/dvb-usb-v2/lmedm04.c       |   7 ++
 drivers/misc/mei/init.c                      |   2 +
 drivers/mmc/host/sdhci-pxav3.c               |   4 +-
 drivers/net/macvtap.c                        |   7 +-
 drivers/net/phy/phy.c                        |  24 +++-
 drivers/net/team/team.c                      |  10 +-
 drivers/net/usb/plusb.c                      |   5 +
 drivers/net/wireless/ath/ath5k/reset.c       |   2 +-
 drivers/net/wireless/ath/ath6kl/hif.h        |   4 +-
 drivers/net/wireless/ath/ath6kl/sdio.c       |   2 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c  |   3 -
 drivers/net/wireless/iwlwifi/mvm/tx.c        |   5 +
 drivers/net/wireless/iwlwifi/pcie/tx.c       |   7 +-
 drivers/pci/pci-driver.c                     |   2 +-
 drivers/pci/rom.c                            |   7 +-
 drivers/power/88pm860x_charger.c             |   1 +
 drivers/power/bq24190_charger.c              |   2 +-
 drivers/scsi/be2iscsi/be_main.c              |   1 -
 drivers/scsi/megaraid/megaraid_sas_fusion.c  |   3 +-
 drivers/scsi/sg.c                            |   6 +-
 drivers/staging/comedi/comedi_compat32.c     |  12 +-
 drivers/staging/comedi/drivers/cb_pcidas64.c | 122 +++++++++++-------
 drivers/staging/lustre/lustre/llite/vvp_io.c |   2 +-
 drivers/target/iscsi/iscsi_target_tq.c       |  28 +----
 drivers/target/target_core_pr.c              |  25 ++--
 drivers/target/target_core_sbc.c             |  15 ++-
 drivers/tty/pty.c                            |   3 +
 drivers/tty/serial/atmel_serial.c            |   4 +-
 drivers/tty/tty_io.c                         |   4 +-
 drivers/tty/tty_ioctl.c                      |  12 +-
 drivers/tty/vt/vt.c                          |   4 +-
 drivers/usb/class/cdc-acm.c                  |   2 +
 drivers/usb/core/buffer.c                    |  26 ++--
 drivers/usb/core/devio.c                     |   2 +
 drivers/usb/core/hcd.c                       |  16 +--
 drivers/usb/core/quirks.c                    |   3 +
 drivers/usb/core/usb.c                       |   1 +
 drivers/usb/dwc3/dwc3-omap.c                 |  30 ++++-
 drivers/usb/gadget/f_phonet.c                |   5 +-
 drivers/usb/host/ehci-sched.c                |   6 +-
 drivers/usb/host/xhci-pci.c                  |  14 ---
 drivers/usb/host/xhci-ring.c                 |  10 +-
 drivers/usb/host/xhci.h                      |   8 +-
 drivers/usb/musb/musb_core.c                 |  10 +-
 drivers/usb/serial/Kconfig                   |   1 +
 drivers/usb/serial/bus.c                     |  13 +-
 drivers/usb/serial/cp210x.c                  |   3 +
 drivers/usb/serial/ftdi_sio.c                |  19 +++
 drivers/usb/serial/ftdi_sio_ids.h            |  23 ++++
 drivers/usb/serial/generic.c                 |   5 +-
 drivers/usb/serial/usb-serial-simple.c       |  10 ++
 drivers/xen/manage.c                         |   8 +-
 fs/autofs4/dev-ioctl.c                       |   8 +-
 fs/binfmt_elf.c                              |   5 +-
 fs/btrfs/disk-io.c                           |   2 +-
 fs/btrfs/file.c                              |  56 ++++-----
 fs/btrfs/inode.c                             |   1 -
 fs/btrfs/tree-log.c                          |   2 +-
 fs/debugfs/inode.c                           |  34 ++---
 fs/jffs2/scan.c                              |   5 +
 fs/nfs/callback.c                            |   8 +-
 fs/nfs/callback_xdr.c                        |   4 +-
 fs/nfs/delegation.c                          |   2 +-
 fs/nilfs2/btree.c                            |  47 ++++++-
 fs/ocfs2/file.c                              |   8 +-
 fs/proc/generic.c                            |  12 --
 fs/proc/inode.c                              |  21 ++++
 fs/proc/internal.h                           |   1 +
 fs/splice.c                                  |   8 +-
 fs/xfs/xfs_buf_item.c                        |   4 +
 fs/xfs/xfs_inode.c                           |   2 +
 fs/xfs/xfs_qm.c                              |   5 +
 fs/xfs/xfs_trans.c                           |   1 +
 include/linux/fsnotify.h                     |   6 +-
 include/linux/hugetlb.h                      |   8 +-
 include/linux/mm.h                           |   6 +-
 include/linux/swapops.h                      |   4 +
 include/linux/usb/hcd.h                      |   1 +
 include/target/target_core_base.h            |   2 +-
 kernel/debug/kdb/kdb_main.c                  |   2 +-
 kernel/trace/trace.c                         |   2 +-
 mm/compaction.c                              |   2 +-
 mm/hugetlb.c                                 |  98 ++++++++++-----
 mm/ksm.c                                     |   2 +-
 mm/memory-failure.c                          |   2 -
 mm/memory.c                                  |  34 ++---
 mm/migrate.c                                 |   5 +-
 mm/mmap.c                                    |   4 +-
 mm/nommu.c                                   |   4 +-
 net/ceph/osd_client.c                        |  30 +++--
 net/compat.c                                 |   9 --
 net/core/dev.c                               |   2 +-
 net/core/gen_stats.c                         |  15 ++-
 net/core/pktgen.c                            |  16 +--
 net/core/rtnetlink.c                         |  24 ++--
 net/ipv4/ip_fragment.c                       |  11 +-
 net/ipv4/ip_output.c                         |   3 +-
 net/ipv4/ping.c                              |  14 ++-
 net/ipv6/ip6_output.c                        |   3 +-
 net/ipv6/ping.c                              |   5 +-
 net/ipv6/route.c                             |   2 +-
 net/irda/ircomm/ircomm_tty.c                 |   4 +-
 net/mac80211/tx.c                            |   1 +
 net/netfilter/ipvs/ip_vs_core.c              |  33 +++--
 net/netfilter/ipvs/ip_vs_sync.c              |   3 +
 net/netfilter/xt_socket.c                    |  21 ++--
 net/sched/ematch.c                           |   1 +
 net/sunrpc/cache.c                           |   2 +-
 sound/core/pcm_native.c                      |   2 +
 sound/pci/hda/patch_sigmatel.c               |  17 ++-
 sound/pci/riptide/riptide.c                  |  27 ++--
 sound/pci/rme9652/hdspm.c                    |   6 +
 sound/soc/omap/omap-pcm.c                    |   4 +-
 217 files changed, 1295 insertions(+), 899 deletions(-)

-- 
2.3.0


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

* [PATCH 3.12 118/175] mac80211: Send EAPOL frames at lowest rate
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (116 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 117/175] xhci: fix reporting of 0-sized URBs in control endpoint Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 119/175] net: irda: fix wait_until_sent poll timeout Jiri Slaby
                   ` (58 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jouni Malinen, Johannes Berg, Jiri Slaby

From: Jouni Malinen <jouni@qca.qualcomm.com>

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

===============

commit 9c1c98a3bb7b7593b60264b9a07e001e68b46697 upstream.

The current minstrel_ht rate control behavior is somewhat optimistic in
trying to find optimum TX rate. While this is usually fine for normal
Data frames, there are cases where a more conservative set of retry
parameters would be beneficial to make the connection more robust.

EAPOL frames are critical to the authentication and especially the
EAPOL-Key message 4/4 (the last message in the 4-way handshake) is
important to get through to the AP. If that message is lost, the only
recovery mechanism in many cases is to reassociate with the AP and start
from scratch. This can often be avoided by trying to send the frame with
more conservative rate and/or with more link layer retries.

In most cases, minstrel_ht is currently using the initial EAPOL-Key
frames for probing higher rates and this results in only five link layer
transmission attempts (one at high(ish) MCS and four at MCS0). While
this works with most APs, it looks like there are some deployed APs that
may have issues with the EAPOL frames using HT MCS immediately after
association. Similarly, there may be issues in cases where the signal
strength or radio environment is not good enough to be able to get
frames through even at couple of MCS 0 tries.

The best approach for this would likely to be to reduce the TX rate for
the last rate (3rd rate parameter in the set) to a low basic rate (say,
6 Mbps on 5 GHz and 2 or 5.5 Mbps on 2.4 GHz), but doing that cleanly
requires some more effort. For now, we can start with a simple one-liner
that forces the minimum rate to be used for EAPOL frames similarly how
the TX rate is selected for the IEEE 802.11 Management frames. This does
result in a small extra latency added to the cases where the AP would be
able to receive the higher rate, but taken into account how small number
of EAPOL frames are used, this is likely to be insignificant. A future
optimization in the minstrel_ht design can also allow this patch to be
reverted to get back to the more optimized initial TX rate.

It should also be noted that many drivers that do not use minstrel as
the rate control algorithm are already doing similar workarounds by
forcing the lowest TX rate to be used for EAPOL frames.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/mac80211/tx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c2785b2af97c..d36e0977f44a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -560,6 +560,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx)
 		if (tx->sdata->control_port_no_encrypt)
 			info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 		info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
+		info->flags |= IEEE80211_TX_CTL_USE_MINRATE;
 	}
 
 	return TX_CONTINUE;
-- 
2.3.0


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

* [PATCH 3.12 119/175] net: irda: fix wait_until_sent poll timeout
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (117 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 118/175] mac80211: Send EAPOL frames at lowest rate Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 120/175] USB: serial: fix infinite wait_until_sent timeout Jiri Slaby
                   ` (57 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

===============

commit 2c3fbe3cf28fbd7001545a92a83b4f8acfd9fa36 upstream.

In case an infinite timeout (0) is requested, the irda wait_until_sent
implementation would use a zero poll timeout rather than the default
200ms.

Note that wait_until_sent is currently never called with a 0-timeout
argument due to a bug in tty_wait_until_sent.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/irda/ircomm/ircomm_tty.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 41ac7938268b..2ee29ed13bd4 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -820,7 +820,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
 	orig_jiffies = jiffies;
 
 	/* Set poll time to 200 ms */
-	poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200));
+	poll_time = msecs_to_jiffies(200);
+	if (timeout)
+		poll_time = min_t(unsigned long, timeout, poll_time);
 
 	spin_lock_irqsave(&self->spinlock, flags);
 	while (self->tx_skb && self->tx_skb->len) {
-- 
2.3.0


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

* [PATCH 3.12 120/175] USB: serial: fix infinite wait_until_sent timeout
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (118 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 119/175] net: irda: fix wait_until_sent poll timeout Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 121/175] TTY: fix tty_wait_until_sent on 64-bit machines Jiri Slaby
                   ` (56 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

===============

commit f528bf4f57e43d1af4b2a5c97f09e43e0338c105 upstream.

Make sure to handle an infinite timeout (0).

Note that wait_until_sent is currently never called with a 0-timeout
argument due to a bug in tty_wait_until_sent.

Fixes: dcf010503966 ("USB: serial: add generic wait_until_sent
implementation")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/generic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index dc97744489b0..6e66b5f84f78 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -261,7 +261,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
 	 * character or at least one jiffy.
 	 */
 	period = max_t(unsigned long, (10 * HZ / bps), 1);
-	period = min_t(unsigned long, period, timeout);
+	if (timeout)
+		period = min_t(unsigned long, period, timeout);
 
 	dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
 					__func__, jiffies_to_msecs(timeout),
@@ -271,7 +272,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
 		schedule_timeout_interruptible(period);
 		if (signal_pending(current))
 			break;
-		if (time_after(jiffies, expire))
+		if (timeout && time_after(jiffies, expire))
 			break;
 	}
 }
-- 
2.3.0


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

* [PATCH 3.12 121/175] TTY: fix tty_wait_until_sent on 64-bit machines
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (119 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 120/175] USB: serial: fix infinite wait_until_sent timeout Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 122/175] USB: serial: fix potential use-after-free after failed probe Jiri Slaby
                   ` (55 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

===============

commit 79fbf4a550ed6a22e1ae1516113e6c7fa5d56a53 upstream.

Fix overflow bug in tty_wait_until_sent on 64-bit machines, where an
infinite timeout (0) would be passed to the underlying tty-driver's
wait_until_sent-operation as a negative timeout (-1), causing it to
return immediately.

This manifests itself for example as tcdrain() returning immediately,
drivers not honouring the drain flags when setting terminal attributes,
or even dropped data on close as a requested infinite closing-wait
timeout would be ignored.

The first symptom  was reported by Asier LLANO who noted that tcdrain()
returned prematurely when using the ftdi_sio usb-serial driver.

Fix this by passing 0 rather than MAX_SCHEDULE_TIMEOUT (LONG_MAX) to the
underlying tty driver.

Note that the serial-core wait_until_sent-implementation is not affected
by this bug due to a lucky chance (comparison to an unsigned maximum
timeout), and neither is the cyclades one that had an explicit check for
negative timeouts, but all other tty drivers appear to be affected.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: ZIV-Asier Llano Palacios <asier.llano@cgglobal.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/tty_ioctl.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 6fd60fece6b4..22da05d27009 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)
 #endif
 	if (!timeout)
 		timeout = MAX_SCHEDULE_TIMEOUT;
+
 	if (wait_event_interruptible_timeout(tty->write_wait,
-			!tty_chars_in_buffer(tty), timeout) >= 0) {
-		if (tty->ops->wait_until_sent)
-			tty->ops->wait_until_sent(tty, timeout);
+			!tty_chars_in_buffer(tty), timeout) < 0) {
+		return;
 	}
+
+	if (timeout == MAX_SCHEDULE_TIMEOUT)
+		timeout = 0;
+
+	if (tty->ops->wait_until_sent)
+		tty->ops->wait_until_sent(tty, timeout);
 }
 EXPORT_SYMBOL(tty_wait_until_sent);
 
-- 
2.3.0


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

* [PATCH 3.12 122/175] USB: serial: fix potential use-after-free after failed probe
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (120 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 121/175] TTY: fix tty_wait_until_sent on 64-bit machines Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 123/175] USB: serial: fix tty-device error handling at probe Jiri Slaby
                   ` (54 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

===============

commit 07fdfc5e9f1c966be8722e8fa927e5ea140df5ce upstream.

Fix return value in probe error path, which could end up returning
success (0) on errors. This could in turn lead to use-after-free or
double free (e.g. in port_remove) when the port device is removed.

Fixes: c706ebdfc895 ("USB: usb-serial: call port_probe and port_remove
at the right times")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 74fc63b2e7fc..95ee3e734209 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -75,7 +75,7 @@ static int usb_serial_device_probe(struct device *dev)
 	retval = device_create_file(dev, &dev_attr_port_number);
 	if (retval) {
 		if (driver->port_remove)
-			retval = driver->port_remove(port);
+			driver->port_remove(port);
 		goto exit_with_autopm;
 	}
 
-- 
2.3.0


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

* [PATCH 3.12 123/175] USB: serial: fix tty-device error handling at probe
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (121 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 122/175] USB: serial: fix potential use-after-free after failed probe Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 124/175] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation Jiri Slaby
                   ` (53 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

===============

commit ca4383a3947a83286bc9b9c598a1f55e867871d7 upstream.

Add missing error handling when registering the tty device at port
probe. This avoids trying to remove an uninitialised character device
when the port device is removed.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/bus.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 95ee3e734209..a5500cf12e0e 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -51,6 +51,7 @@ static int usb_serial_device_probe(struct device *dev)
 {
 	struct usb_serial_driver *driver;
 	struct usb_serial_port *port;
+	struct device *tty_dev;
 	int retval = 0;
 	int minor;
 
@@ -80,7 +81,15 @@ static int usb_serial_device_probe(struct device *dev)
 	}
 
 	minor = port->minor;
-	tty_register_device(usb_serial_tty_driver, minor, dev);
+	tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev);
+	if (IS_ERR(tty_dev)) {
+		retval = PTR_ERR(tty_dev);
+		device_remove_file(dev, &dev_attr_port_number);
+		if (driver->port_remove)
+			driver->port_remove(port);
+		goto exit_with_autopm;
+	}
+
 	dev_info(&port->serial->dev->dev,
 		 "%s converter now attached to ttyUSB%d\n",
 		 driver->description, minor);
-- 
2.3.0


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

* [PATCH 3.12 124/175] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (122 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 123/175] USB: serial: fix tty-device error handling at probe Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 125/175] debugfs: leave freeing a symlink body until inode eviction Jiri Slaby
                   ` (52 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Al Viro, Jiri Slaby

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

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

===============

commit 0a280962dc6e117e0e4baa668453f753579265d9 upstream.

X-Coverup: just ask spender
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/autofs4/dev-ioctl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 0f00da329e71..792234f15b9f 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
  */
 static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
 {
-	struct autofs_dev_ioctl tmp;
+	struct autofs_dev_ioctl tmp, *res;
 
 	if (copy_from_user(&tmp, in, sizeof(tmp)))
 		return ERR_PTR(-EFAULT);
@@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
 	if (tmp.size < sizeof(tmp))
 		return ERR_PTR(-EINVAL);
 
-	return memdup_user(in, tmp.size);
+	res = memdup_user(in, tmp.size);
+	if (!IS_ERR(res))
+		res->size = tmp.size;
+
+	return res;
 }
 
 static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)
-- 
2.3.0


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

* [PATCH 3.12 125/175] debugfs: leave freeing a symlink body until inode eviction
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (123 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 124/175] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 126/175] procfs: fix race between symlink removals and traversals Jiri Slaby
                   ` (51 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Al Viro, Jiri Slaby

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

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

===============

commit 0db59e59299f0b67450c5db21f7f316c8fb04e84 upstream.

As it is, we have debugfs_remove() racing with symlink traversals.
Supply ->evict_inode() and do freeing there - inode will remain
pinned until we are done with the symlink body.

And rip the idiocy with checking if dentry is positive right after
we'd verified debugfs_positive(), which is a stronger check...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/debugfs/inode.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index f3784dd57353..eb6918b70be1 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -245,10 +245,19 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root)
 	return 0;
 }
 
+static void debugfs_evict_inode(struct inode *inode)
+{
+	truncate_inode_pages(&inode->i_data, 0);
+	clear_inode(inode);
+	if (S_ISLNK(inode->i_mode))
+		kfree(inode->i_private);
+}
+
 static const struct super_operations debugfs_super_operations = {
 	.statfs		= simple_statfs,
 	.remount_fs	= debugfs_remount,
 	.show_options	= debugfs_show_options,
+	.evict_inode	= debugfs_evict_inode,
 };
 
 static int debug_fill_super(struct super_block *sb, void *data, int silent)
@@ -465,23 +474,14 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
 	int ret = 0;
 
 	if (debugfs_positive(dentry)) {
-		if (dentry->d_inode) {
-			dget(dentry);
-			switch (dentry->d_inode->i_mode & S_IFMT) {
-			case S_IFDIR:
-				ret = simple_rmdir(parent->d_inode, dentry);
-				break;
-			case S_IFLNK:
-				kfree(dentry->d_inode->i_private);
-				/* fall through */
-			default:
-				simple_unlink(parent->d_inode, dentry);
-				break;
-			}
-			if (!ret)
-				d_delete(dentry);
-			dput(dentry);
-		}
+		dget(dentry);
+		if (S_ISDIR(dentry->d_inode->i_mode))
+			ret = simple_rmdir(parent->d_inode, dentry);
+		else
+			simple_unlink(parent->d_inode, dentry);
+		if (!ret)
+			d_delete(dentry);
+		dput(dentry);
 	}
 	return ret;
 }
-- 
2.3.0


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

* [PATCH 3.12 126/175] procfs: fix race between symlink removals and traversals
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (124 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 125/175] debugfs: leave freeing a symlink body until inode eviction Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 127/175] sunrpc: fix braino in ->poll() Jiri Slaby
                   ` (50 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Al Viro, Jiri Slaby

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

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

===============

commit 7e0e953bb0cf649f93277ac8fb67ecbb7f7b04a9 upstream.

use_pde()/unuse_pde() in ->follow_link()/->put_link() resp.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/proc/generic.c  | 12 ------------
 fs/proc/inode.c    | 21 +++++++++++++++++++++
 fs/proc/internal.h |  1 +
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 737e15615b04..9638eec27691 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -19,7 +19,6 @@
 #include <linux/mount.h>
 #include <linux/init.h>
 #include <linux/idr.h>
-#include <linux/namei.h>
 #include <linux/bitops.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -163,17 +162,6 @@ void proc_free_inum(unsigned int inum)
 	spin_unlock_irqrestore(&proc_inum_lock, flags);
 }
 
-static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
-{
-	nd_set_link(nd, __PDE_DATA(dentry->d_inode));
-	return NULL;
-}
-
-static const struct inode_operations proc_link_inode_operations = {
-	.readlink	= generic_readlink,
-	.follow_link	= proc_follow_link,
-};
-
 /*
  * As some entries in /proc are volatile, we want to 
  * get rid of unused dentries.  This could be made 
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 8eaa1ba793fc..a5def0c492c4 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/mount.h>
 #include <linux/magic.h>
+#include <linux/namei.h>
 
 #include <asm/uaccess.h>
 
@@ -393,6 +394,26 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
 };
 #endif
 
+static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+	struct proc_dir_entry *pde = PDE(dentry->d_inode);
+	if (unlikely(!use_pde(pde)))
+		return ERR_PTR(-EINVAL);
+	nd_set_link(nd, pde->data);
+	return pde;
+}
+
+static void proc_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
+{
+	unuse_pde(p);
+}
+
+const struct inode_operations proc_link_inode_operations = {
+	.readlink	= generic_readlink,
+	.follow_link	= proc_follow_link,
+	.put_link	= proc_put_link,
+};
+
 struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
 {
 	struct inode *inode = new_inode_pseudo(sb);
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 651d09a11dde..8b8ca1db6316 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -202,6 +202,7 @@ struct pde_opener {
 	int closing;
 	struct completion *c;
 };
+extern const struct inode_operations proc_link_inode_operations;
 
 extern const struct inode_operations proc_pid_link_inode_operations;
 
-- 
2.3.0


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

* [PATCH 3.12 127/175] sunrpc: fix braino in ->poll()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (125 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 126/175] procfs: fix race between symlink removals and traversals Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 128/175] ARC: Fix KSTK_ESP() Jiri Slaby
                   ` (49 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Al Viro, Al Viro, Bruce Fields, Linus Torvalds, Jiri Slaby

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

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

===============

commit 1711fd9addf214823b993468567cab1f8254fc51 upstream.

POLL_OUT isn't what callers of ->poll() are expecting to see; it's
actually __SI_POLL | 2 and it's a siginfo code, not a poll bitmap
bit...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Bruce Fields <bfields@fieldses.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sunrpc/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index a72de074172d..8a6e3b0d25d4 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -920,7 +920,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait,
 	poll_wait(filp, &queue_wait, wait);
 
 	/* alway allow write */
-	mask = POLL_OUT | POLLWRNORM;
+	mask = POLLOUT | POLLWRNORM;
 
 	if (!rp)
 		return mask;
-- 
2.3.0


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

* [PATCH 3.12 128/175] ARC: Fix KSTK_ESP()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (126 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 127/175] sunrpc: fix braino in ->poll() Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 129/175] tty: fix up atime/mtime mess, take four Jiri Slaby
                   ` (48 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vineet Gupta, Jiri Slaby

From: Vineet Gupta <vgupta@synopsys.com>

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

===============

commit 13648b0118a24f4fc76c34e6c7b6ccf447e46a2a upstream.

/proc/<pid>/maps currently don't annotate stack vma with "[stack]"
This is because KSTK_ESP ie expected to return usermode SP of tsk while
currently it returns the kernel mode SP of a sleeping tsk.

While the fix is trivial, we also need to adjust the ARC kernel stack
unwinder to not use KSTK_SP and friends any more.

Reported-and-suggested-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arc/include/asm/processor.h | 9 +++++----
 arch/arc/kernel/stacktrace.c     | 6 +++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
index 15334ab66b56..fb95aa807215 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -69,18 +69,19 @@ unsigned long thread_saved_pc(struct task_struct *t);
 #define release_segments(mm)        do { } while (0)
 
 #define KSTK_EIP(tsk)   (task_pt_regs(tsk)->ret)
+#define KSTK_ESP(tsk)   (task_pt_regs(tsk)->sp)
 
 /*
  * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode.
  * Look in process.c for details of kernel stack layout
  */
-#define KSTK_ESP(tsk)   (tsk->thread.ksp)
+#define TSK_K_ESP(tsk)		(tsk->thread.ksp)
 
-#define KSTK_REG(tsk, off)	(*((unsigned int *)(KSTK_ESP(tsk) + \
+#define TSK_K_REG(tsk, off)	(*((unsigned int *)(TSK_K_ESP(tsk) + \
 					sizeof(struct callee_regs) + off)))
 
-#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4)
-#define KSTK_FP(tsk)    KSTK_REG(tsk, 0)
+#define TSK_K_BLINK(tsk)	TSK_K_REG(tsk, 4)
+#define TSK_K_FP(tsk)		TSK_K_REG(tsk, 0)
 
 /*
  * Do necessary setup to start up a newly executed thread.
diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
index f8b7d880304d..9c9e1d3ec5fe 100644
--- a/arch/arc/kernel/stacktrace.c
+++ b/arch/arc/kernel/stacktrace.c
@@ -64,9 +64,9 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
 
 		frame_info->task = tsk;
 
-		frame_info->regs.r27 = KSTK_FP(tsk);
-		frame_info->regs.r28 = KSTK_ESP(tsk);
-		frame_info->regs.r31 = KSTK_BLINK(tsk);
+		frame_info->regs.r27 = TSK_K_FP(tsk);
+		frame_info->regs.r28 = TSK_K_ESP(tsk);
+		frame_info->regs.r31 = TSK_K_BLINK(tsk);
 		frame_info->regs.r63 = (unsigned int)__switch_to;
 
 		/* In the prologue of __switch_to, first FP is saved on stack
-- 
2.3.0


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

* [PATCH 3.12 129/175] tty: fix up atime/mtime mess, take four
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (127 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 128/175] ARC: Fix KSTK_ESP() Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 130/175] HID: apple: fix battery support for the 2009 ANSI wireless keyboard Jiri Slaby
                   ` (47 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jiri Slaby

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

===============

commit f0bf0bd07943bfde8f5ac39a32664810a379c7d3 upstream.

This problem was taken care of three times already in
* b0de59b5733d18b0d1974a060860a8b5c1b36a2e (TTY: do not update
  atime/mtime on read/write),
* 37b7f3c76595e23257f61bd80b223de8658617ee (TTY: fix atime/mtime
  regression), and
* b0b885657b6c8ef63a46bc9299b2a7715d19acde (tty: fix up atime/mtime
  mess, take three)

But it still misses one point. As John Paul correctly points out, we
do not care about setting date. If somebody ever changes wall
time backwards (by mistake for example), tty timestamps are never
updated until the original wall time passes.

So check the absolute difference of times and if it large than "8
seconds or so", always update the time. That means we will update
immediatelly when changing time. Ergo, CAP_SYS_TIME can foul the
check, but it was always that way.

Thanks John for serving me this so nicely debugged.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: John Paul Perry <john_paul.perry@alcatel-lucent.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/tty_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 25d07412e08e..39988fa91294 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -996,8 +996,8 @@ EXPORT_SYMBOL(start_tty);
 /* We limit tty time update visibility to every 8 seconds or so. */
 static void tty_update_time(struct timespec *time)
 {
-	unsigned long sec = get_seconds() & ~7;
-	if ((long)(sec - time->tv_sec) > 0)
+	unsigned long sec = get_seconds();
+	if (abs(sec - time->tv_sec) & ~7)
 		time->tv_sec = sec;
 }
 
-- 
2.3.0


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

* [PATCH 3.12 130/175] HID: apple: fix battery support for the 2009 ANSI wireless keyboard
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (128 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 129/175] tty: fix up atime/mtime mess, take four Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 131/175] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2 Jiri Slaby
                   ` (46 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ross Skaliotis, Jiri Kosina, Jiri Slaby

From: Ross Skaliotis <rskaliotis@gmail.com>

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

===============

commit cbd366bea2b8513bc0fc1c9e8832cb0ab221d6d5 upstream.

Enabled quirks necessary for correct battery capacity reporting. Cleaned up
surrounding style.

Signed-off-by: Ross Skaliotis <rskaliotis@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-input.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 6f568b64784b..153ae423618e 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -306,10 +306,13 @@ static enum power_supply_property hidinput_battery_props[] = {
 
 static const struct hid_device_id hid_battery_quirks[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
-			USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
-	HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
+	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
+	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
-			       USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
 	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
 			       USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
-- 
2.3.0


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

* [PATCH 3.12 131/175] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (129 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 130/175] HID: apple: fix battery support for the 2009 ANSI wireless keyboard Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 132/175] HID: hid-microsoft: Add support for scrollwheel and special keypad keys Jiri Slaby
                   ` (45 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jim Keir, Jiri Kosina, Jiri Slaby

From: Jim Keir <jimkeir@oracledbadirect.com>

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

===============

commit afd700d933963d07391e3e3dfbfbc05e905960ef upstream.

The FF2 driver (usbhid/hid-pidff.c) sends commands to the stick during ff_init.
However, this is called inside a block where driver_input_lock is locked, so
the results of these initial commands are discarded. This behavior is the
"killer", without this nothing else works.

ff_init issues commands using "hid_hw_request". This eventually goes to
hid_input_report, which returns -EBUSY because driver_input_lock is locked. The
change is to delay the ff_init call in hid-core.c until after this lock has
been released.

Calling hid_device_io_start() releases the lock so the device can be
configured.  We also need to call hid_device_io_stop() on exit for the lock to
remain locked while ending the init of the drivers.

[ benjamin.tissoires@redhat.com: imrpoved the changelog a lot ]

Signed-off-by: Jim Keir <jimkeir@oracledbadirect.com>
Reviewed-by: Benjamin.tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/usbhid/hid-pidff.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index 10b616702780..0b531c6a76a5 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1252,6 +1252,8 @@ int hid_pidff_init(struct hid_device *hid)
 
 	pidff->hid = hid;
 
+	hid_device_io_start(hid);
+
 	pidff_find_reports(hid, HID_OUTPUT_REPORT, pidff);
 	pidff_find_reports(hid, HID_FEATURE_REPORT, pidff);
 
@@ -1315,9 +1317,13 @@ int hid_pidff_init(struct hid_device *hid)
 
 	hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
 
+	hid_device_io_stop(hid);
+
 	return 0;
 
  fail:
+	hid_device_io_stop(hid);
+
 	kfree(pidff);
 	return error;
 }
-- 
2.3.0


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

* [PATCH 3.12 132/175] HID: hid-microsoft: Add support for scrollwheel and special keypad keys
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (130 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 131/175] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2 Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 133/175] HID: add support for MS Surface Pro 3 Type Cover Jiri Slaby
                   ` (44 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Jiri Kosina, Jiri Slaby

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

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

===============

commit 3faed1aff786a007b3ea0549ac469e09f48c98f9 upstream.

The Microsoft Office keyboard has a scrollwheel as well as some special keys
above the keypad which are handled through the custom MS usage page, this
commit adds support for these.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c      |  1 +
 drivers/hid/hid-ids.h       |  1 +
 drivers/hid/hid-microsoft.c | 49 ++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 62d73264b3e2..d9f2b11d28aa 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1794,6 +1794,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 60348ec399fc..793bb281234a 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -611,6 +611,7 @@
 
 #define USB_VENDOR_ID_MICROSOFT		0x045e
 #define USB_DEVICE_ID_SIDEWINDER_GV	0x003b
+#define USB_DEVICE_ID_MS_OFFICE_KB	0x0048
 #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
 #define USB_DEVICE_ID_MS_NE4K		0x00db
 #define USB_DEVICE_ID_MS_NE4K_JP	0x00dc
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 551795b7da1d..e17f684f9bb2 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -65,6 +65,26 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
 	switch (usage->hid & HID_USAGE) {
 	case 0xfd06: ms_map_key_clear(KEY_CHAT);	break;
 	case 0xfd07: ms_map_key_clear(KEY_PHONE);	break;
+	case 0xff00:
+		/* Special keypad keys */
+		ms_map_key_clear(KEY_KPEQUAL);
+		set_bit(KEY_KPLEFTPAREN, input->keybit);
+		set_bit(KEY_KPRIGHTPAREN, input->keybit);
+		break;
+	case 0xff01:
+		/* Scroll wheel */
+		hid_map_usage_clear(hi, usage, bit, max, EV_REL, REL_WHEEL);
+		break;
+	case 0xff02:
+		/*
+		 * This byte contains a copy of the modifier keys byte of a
+		 * standard hid keyboard report, as send by interface 0
+		 * (this usage is found on interface 1).
+		 *
+		 * This byte only gets send when another key in the same report
+		 * changes state, and as such is useless, ignore it.
+		 */
+		return -1;
 	case 0xff05:
 		set_bit(EV_REP, input->evbit);
 		ms_map_key_clear(KEY_F13);
@@ -133,14 +153,39 @@ static int ms_event(struct hid_device *hdev, struct hid_field *field,
 		struct hid_usage *usage, __s32 value)
 {
 	unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
+	struct input_dev *input;
 
 	if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
 			!usage->type)
 		return 0;
 
+	input = field->hidinput->input;
+
 	/* Handling MS keyboards special buttons */
+	if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff00)) {
+		/* Special keypad keys */
+		input_report_key(input, KEY_KPEQUAL, value & 0x01);
+		input_report_key(input, KEY_KPLEFTPAREN, value & 0x02);
+		input_report_key(input, KEY_KPRIGHTPAREN, value & 0x04);
+		return 1;
+	}
+
+	if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff01)) {
+		/* Scroll wheel */
+		int step = ((value & 0x60) >> 5) + 1;
+
+		switch (value & 0x1f) {
+		case 0x01:
+			input_report_rel(input, REL_WHEEL, step);
+			break;
+		case 0x1f:
+			input_report_rel(input, REL_WHEEL, -step);
+			break;
+		}
+		return 1;
+	}
+
 	if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff05)) {
-		struct input_dev *input = field->hidinput->input;
 		static unsigned int last_key = 0;
 		unsigned int key = 0;
 		switch (value) {
@@ -193,6 +238,8 @@ err_free:
 static const struct hid_device_id ms_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV),
 		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB),
+		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K),
 		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
-- 
2.3.0


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

* [PATCH 3.12 133/175] HID: add support for MS Surface Pro 3 Type Cover
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (131 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 132/175] HID: hid-microsoft: Add support for scrollwheel and special keypad keys Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 134/175] HID: microsoft: add support for Japanese Surface Type Cover 3 Jiri Slaby
                   ` (43 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alan Wu, Jiri Kosina, Jiri Slaby

From: Alan Wu <alan.c.wu@gmail.com>

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

===============

commit be3b16341d5cd8cf2a64fcc7a604a8efe6599ff0 upstream.

Surface Pro 3 Type Cover that works with Ubuntu (and possibly Arch) from this thread. Both trackpad and keyboard work after compiling my own kernel.
http://ubuntuforums.org/showthread.php?t=2231207&page=2&s=44910e0c56047e4f93dfd9fea58121ef

Also includes Jarrad Whitaker's message which sources
http://winaero.com/blog/how-to-install-linux-on-surface-pro-3/
which he says is sourced from a Russian site

Signed-off-by: Alan Wu <alan.c.wu@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c          | 6 ++++++
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/hid-microsoft.c     | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 10 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d9f2b11d28aa..3e58b8cbe6aa 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -702,6 +702,11 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 	if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
 	    type == HID_COLLECTION_PHYSICAL)
 		hid->group = HID_GROUP_SENSOR_HUB;
+
+	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
+	    hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 &&
+	    hid->group == HID_GROUP_MULTITOUCH)
+		hid->group = HID_GROUP_GENERIC;
 }
 
 static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
@@ -1795,6 +1800,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 793bb281234a..28eb1eab1997 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -620,6 +620,7 @@
 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB	0x0713
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K	0x0730
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
+#define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
 
 #define USB_VENDOR_ID_MOJO		0x8282
 #define USB_DEVICE_ID_RETRO_ADAPTER	0x3201
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index e17f684f9bb2..973a6ca6ed02 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -254,6 +254,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_NOGET },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
 		.driver_data = MS_DUPLICATE_USAGES },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
+		.driver_data = MS_HIDINPUT },
 
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
 		.driver_data = MS_PRESENTER },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 3554496bacf8..2eb5719835ad 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -77,6 +77,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.3.0


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

* [PATCH 3.12 134/175] HID: microsoft: add support for Japanese Surface Type Cover 3
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (132 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 133/175] HID: add support for MS Surface Pro 3 Type Cover Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 135/175] USB: serial: add Google simple serial SubClass support Jiri Slaby
                   ` (42 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alan Wu, Jiri Kosina, Jiri Slaby

From: Alan Wu <alan.c.wu@gmail.com>

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

===============

commit 5e7e9e90b5867a3754159a8ce524299d930fbac8 upstream.

Based on code for the US Surface Type Cover 3
from commit be3b16341d5cd8cf2a64fcc7a604a8efe6599ff0
("HID: add support for MS Surface Pro 3 Type Cover"):

Signed-off-by: Alan Wu <alan.c.wu@gmail.com>
Tested-by: Karlis Dreizis <karlisdreizis@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c          | 4 +++-
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/hid-microsoft.c     | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3e58b8cbe6aa..b3ac5fb99128 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -704,7 +704,8 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 		hid->group = HID_GROUP_SENSOR_HUB;
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
-	    hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 &&
+	    (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
+	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP) &&
 	    hid->group == HID_GROUP_MULTITOUCH)
 		hid->group = HID_GROUP_GENERIC;
 }
@@ -1801,6 +1802,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 28eb1eab1997..c0118d3090a1 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -621,6 +621,7 @@
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K	0x0730
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
 #define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
+#define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd
 
 #define USB_VENDOR_ID_MOJO		0x8282
 #define USB_DEVICE_ID_RETRO_ADAPTER	0x3201
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 973a6ca6ed02..f488959212d1 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -256,6 +256,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_DUPLICATE_USAGES },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
 		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP),
+		.driver_data = MS_HIDINPUT },
 
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
 		.driver_data = MS_PRESENTER },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 2eb5719835ad..e721bdc878e6 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -78,6 +78,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.3.0


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

* [PATCH 3.12 135/175] USB: serial: add Google simple serial SubClass support
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (133 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 134/175] HID: microsoft: add support for Japanese Surface Type Cover 3 Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 136/175] usb: gadget: function: phonet: balance usb_ep_disable calls Jiri Slaby
                   ` (41 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Anton Staaf, Johan Hovold, Jiri Slaby

From: Anton Staaf <robotboy@chromium.org>

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

===============

commit 679315e5fae1e4614eed0d9aa26999ddcb6a0f77 upstream.

Add support for Google devices that export simple serial
interfaces using the vendor specific SubClass/Protocol pair
0x50/0x01.

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
[johan: move id entries and update Kconfig]
Signed-off-by: Johan Hovold <johan@kernel.org>

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/Kconfig             |  1 +
 drivers/usb/serial/usb-serial-simple.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index ddb9c51f2c99..a9435cd819f8 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -59,6 +59,7 @@ config USB_SERIAL_SIMPLE
 	  driver.  Specifically, it supports:
 		- Suunto ANT+ USB device.
 		- Fundamental Software dongle.
+		- Google USB serial devices
 		- HP4x calculators
 		- a number of Motorola phones
 		- Siemens USB/MPI adapter.
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
index 147f01971c39..cc61d3781c21 100644
--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -51,6 +51,14 @@ DEVICE(funsoft, FUNSOFT_IDS);
 	{ USB_DEVICE(0x8087, 0x0716) }
 DEVICE(flashloader, FLASHLOADER_IDS);
 
+/* Google Serial USB SubClass */
+#define GOOGLE_IDS()						\
+	{ USB_VENDOR_AND_INTERFACE_INFO(0x18d1,			\
+					USB_CLASS_VENDOR_SPEC,	\
+					0x50,			\
+					0x01) }
+DEVICE(google, GOOGLE_IDS);
+
 /* ViVOpay USB Serial Driver */
 #define VIVOPAY_IDS()			\
 	{ USB_DEVICE(0x1d5f, 0x1004) }	/* ViVOpay 8800 */
@@ -86,6 +94,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
 	&zio_device,
 	&funsoft_device,
 	&flashloader_device,
+	&google_device,
 	&vivopay_device,
 	&moto_modem_device,
 	&hp4x_device,
@@ -98,6 +107,7 @@ static const struct usb_device_id id_table[] = {
 	ZIO_IDS(),
 	FUNSOFT_IDS(),
 	FLASHLOADER_IDS(),
+	GOOGLE_IDS(),
 	VIVOPAY_IDS(),
 	MOTO_IDS(),
 	HP4X_IDS(),
-- 
2.3.0


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

* [PATCH 3.12 136/175] usb: gadget: function: phonet: balance usb_ep_disable calls
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (134 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 135/175] USB: serial: add Google simple serial SubClass support Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 137/175] usb: musb: core: add pm_runtime_irq_safe() Jiri Slaby
                   ` (40 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Felipe Balbi, Jiri Slaby

From: Felipe Balbi <balbi@ti.com>

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

===============

commit 9ec36f7fe20ef919cc15171e1da1b6739222541a upstream.

f_phonet's ->set_alt() method will call usb_ep_disable()
potentially on an endpoint which is already disabled. That's
something the gadget/function driver must guarantee that it's
always balanced.

In order to balance the calls, just make sure the endpoint
was enabled before by means of checking the validity of
driver_data.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/gadget/f_phonet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index eb3aa817a662..74ff54141416 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 			return -EINVAL;
 
 		spin_lock(&port->lock);
-		__pn_reset(f);
+
+		if (fp->in_ep->driver_data)
+			__pn_reset(f);
+
 		if (alt == 1) {
 			int i;
 
-- 
2.3.0


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

* [PATCH 3.12 137/175] usb: musb: core: add pm_runtime_irq_safe()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (135 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 136/175] usb: gadget: function: phonet: balance usb_ep_disable calls Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 138/175] cdc-acm: Add support for Denso cradle CU-321 Jiri Slaby
                   ` (39 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Felipe Balbi, Jiri Slaby

From: Felipe Balbi <balbi@ti.com>

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

===============

commit 3e43a0725637299a14369e3ef109c25a8ec5c008 upstream.

We need a pm_runtime_get_sync() call from
within musb_gadget_pullup() to make sure
registers are accessible at that time.

The problem is that musb_gadget_pullup() is
called with IRQs disabled and, because of that,
we need to tell pm_runtime that this pm_runtime_get_sync()
is IRQ safe.

We can simply add pm_runtime_irq_safe(), however, because
we need to make our read/write accessor function pointers
have been initialized before trying to use them. This means
that all pm_runtime initialization for musb_core needs to
be moved down so that when we call pm_runtime_irq_safe(),
the pm_runtime_get_sync() that it calls on the parent, won't
cause a crash due to NULL musb_read/write accessors.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/musb/musb_core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2cca870d9762..7c0c9335a0d9 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1843,16 +1843,18 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 		goto fail0;
 	}
 
-	pm_runtime_use_autosuspend(musb->controller);
-	pm_runtime_set_autosuspend_delay(musb->controller, 200);
-	pm_runtime_enable(musb->controller);
-
 	spin_lock_init(&musb->lock);
 	musb->board_set_power = plat->set_power;
 	musb->min_power = plat->min_power;
 	musb->ops = plat->platform_ops;
 	musb->port_mode = plat->mode;
 
+	/* We need musb_read/write functions initialized for PM */
+	pm_runtime_use_autosuspend(musb->controller);
+	pm_runtime_set_autosuspend_delay(musb->controller, 200);
+	pm_runtime_irq_safe(musb->controller);
+	pm_runtime_enable(musb->controller);
+
 	/* The musb_platform_init() call:
 	 *   - adjusts musb->mregs
 	 *   - sets the musb->isr
-- 
2.3.0


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

* [PATCH 3.12 138/175] cdc-acm: Add support for Denso cradle CU-321
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (136 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 137/175] usb: musb: core: add pm_runtime_irq_safe() Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 139/175] x86: mm: move mmap_sem unlock from mm_fault_error() to caller Jiri Slaby
                   ` (38 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Björn Gerhart, Greg Kroah-Hartman, Jiri Slaby

From: Björn Gerhart <oss@airbjorn.de>

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

===============

commit b20b1618b8fca858c83e52da4aa22cd6b13b0359 upstream.

In order to support an older USB cradle by Denso, I added its vendor- and product-ID to the array of usb_device_id acm_ids. In this way cdc-acm feels responsible for this cradle. The related /dev/ttyACM node is being created properly, and the data transfer works.

However, later cradle models by Denso do have proper descriptors, so the patch is not required for these. At the same time both the older and the later model have the same vendor- and product-ID, but they both work with the patched driver.

Declaration of the Denso cradles I tested:
- both models have the same IDs: vendorID 0x076d, productID 0x0006
- older model: Denso CU-321 (descriptors not properly set)
- later model: Denso CU-821 (with proper descriptors)

Signed-off-by: Bjoern Gerhart <oss@airbjorn.de>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/class/cdc-acm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 2574b24d70c0..e2b4ea7fb2b1 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1542,6 +1542,8 @@ static int acm_reset_resume(struct usb_interface *intf)
 
 static const struct usb_device_id acm_ids[] = {
 	/* quirky and broken devices */
+	{ USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */
+	.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
 	{ USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
 	.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
 	{ USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
-- 
2.3.0


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

* [PATCH 3.12 139/175] x86: mm: move mmap_sem unlock from mm_fault_error() to caller
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (137 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 138/175] cdc-acm: Add support for Denso cradle CU-321 Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 140/175] vm: add VM_FAULT_SIGSEGV handling support Jiri Slaby
                   ` (37 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Linus Torvalds, Jiri Slaby

From: Linus Torvalds <torvalds@linux-foundation.org>

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

===============

commit 7fb08eca45270d0ae86e1ad9d39c40b7a55d0190 upstream.

This replaces four copies in various stages of mm_fault_error() handling
with just a single one.  It will also allow for more natural placement
of the unlocking after some further cleanup.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/fault.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 5b90bbcad9f6..31dceb131c46 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -812,11 +812,8 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
 	  unsigned int fault)
 {
 	struct task_struct *tsk = current;
-	struct mm_struct *mm = tsk->mm;
 	int code = BUS_ADRERR;
 
-	up_read(&mm->mmap_sem);
-
 	/* Kernel mode? Handle exceptions or die: */
 	if (!(error_code & PF_USER)) {
 		no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
@@ -847,7 +844,6 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
 	       unsigned long address, unsigned int fault)
 {
 	if (fatal_signal_pending(current) && !(error_code & PF_USER)) {
-		up_read(&current->mm->mmap_sem);
 		no_context(regs, error_code, address, 0, 0);
 		return;
 	}
@@ -855,14 +851,11 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
 	if (fault & VM_FAULT_OOM) {
 		/* Kernel mode? Handle exceptions or die: */
 		if (!(error_code & PF_USER)) {
-			up_read(&current->mm->mmap_sem);
 			no_context(regs, error_code, address,
 				   SIGSEGV, SEGV_MAPERR);
 			return;
 		}
 
-		up_read(&current->mm->mmap_sem);
-
 		/*
 		 * We ran out of memory, call the OOM killer, and return the
 		 * userspace (which will retry the fault, or kill us if we got
@@ -1193,6 +1186,7 @@ good_area:
 		return;
 
 	if (unlikely(fault & VM_FAULT_ERROR)) {
+		up_read(&mm->mmap_sem);
 		mm_fault_error(regs, error_code, address, fault);
 		return;
 	}
-- 
2.3.0


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

* [PATCH 3.12 140/175] vm: add VM_FAULT_SIGSEGV handling support
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (138 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 139/175] x86: mm: move mmap_sem unlock from mm_fault_error() to caller Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:41 ` [PATCH 3.12 141/175] arc: mm: Fix build failure Jiri Slaby
                   ` (36 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Linus Torvalds, linux-arch, Jiri Slaby

From: Linus Torvalds <torvalds@linux-foundation.org>

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

===============

commit 33692f27597fcab536d7cbbcc8f52905133e4aa7 upstream.

The core VM already knows about VM_FAULT_SIGBUS, but cannot return a
"you should SIGSEGV" error, because the SIGSEGV case was generally
handled by the caller - usually the architecture fault handler.

That results in lots of duplication - all the architecture fault
handlers end up doing very similar "look up vma, check permissions, do
retries etc" - but it generally works.  However, there are cases where
the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV.

In particular, when accessing the stack guard page, libsigsegv expects a
SIGSEGV.  And it usually got one, because the stack growth is handled by
that duplicated architecture fault handler.

However, when the generic VM layer started propagating the error return
from the stack expansion in commit fee7e49d4514 ("mm: propagate error
from stack expansion even for guard page"), that now exposed the
existing VM_FAULT_SIGBUS result to user space.  And user space really
expected SIGSEGV, not SIGBUS.

To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those
duplicate architecture fault handlers about it.  They all already have
the code to handle SIGSEGV, so it's about just tying that new return
value to the existing code, but it's all a bit annoying.

This is the mindless minimal patch to do this.  A more extensive patch
would be to try to gather up the mostly shared fault handling logic into
one generic helper routine, and long-term we really should do that
cleanup.

Just from this patch, you can generally see that most architectures just
copied (directly or indirectly) the old x86 way of doing things, but in
the meantime that original x86 model has been improved to hold the VM
semaphore for shorter times etc and to handle VM_FAULT_RETRY and other
"newer" things, so it would be a good idea to bring all those
improvements to the generic case and teach other architectures about
them too.

Reported-and-tested-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Jan Engelhardt <jengelh@inai.de>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # "s390 still compiles and boots"
Cc: linux-arch@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/alpha/mm/fault.c                        | 2 ++
 arch/arc/mm/fault.c                          | 2 ++
 arch/avr32/mm/fault.c                        | 2 ++
 arch/cris/mm/fault.c                         | 2 ++
 arch/frv/mm/fault.c                          | 2 ++
 arch/ia64/mm/fault.c                         | 2 ++
 arch/m32r/mm/fault.c                         | 2 ++
 arch/m68k/mm/fault.c                         | 2 ++
 arch/metag/mm/fault.c                        | 2 ++
 arch/microblaze/mm/fault.c                   | 2 ++
 arch/mips/mm/fault.c                         | 2 ++
 arch/mn10300/mm/fault.c                      | 2 ++
 arch/openrisc/mm/fault.c                     | 2 ++
 arch/parisc/mm/fault.c                       | 2 ++
 arch/powerpc/mm/fault.c                      | 2 ++
 arch/powerpc/platforms/cell/spu_fault.c      | 2 +-
 arch/s390/mm/fault.c                         | 6 ++++++
 arch/score/mm/fault.c                        | 2 ++
 arch/sh/mm/fault.c                           | 2 ++
 arch/sparc/mm/fault_32.c                     | 2 ++
 arch/sparc/mm/fault_64.c                     | 2 ++
 arch/tile/mm/fault.c                         | 2 ++
 arch/um/kernel/trap.c                        | 2 ++
 arch/x86/mm/fault.c                          | 2 ++
 arch/xtensa/mm/fault.c                       | 2 ++
 drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +-
 include/linux/mm.h                           | 6 ++++--
 mm/ksm.c                                     | 2 +-
 mm/memory.c                                  | 5 +++--
 29 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index 98838a05ba6d..9d0ac091a52a 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -156,6 +156,8 @@ retry:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 0c14d8a52683..6d4094986cc4 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -162,6 +162,8 @@ good_area:
 	/* TBD: switch to pagefault_out_of_memory() */
 	if (fault & VM_FAULT_OOM)
 		goto out_of_memory;
+	else if (fault & VM_FAULT_SIGSEV)
+		goto bad_area;
 	else if (fault & VM_FAULT_SIGBUS)
 		goto do_sigbus;
 
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index 0eca93327195..d223a8b57c1e 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -142,6 +142,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 1790f22e71a2..2686a7aa8ec8 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -176,6 +176,8 @@ retry:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c
index 9a66372fc7c7..ec4917ddf678 100644
--- a/arch/frv/mm/fault.c
+++ b/arch/frv/mm/fault.c
@@ -168,6 +168,8 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 7225dad87094..ba5ba7accd0d 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -172,6 +172,8 @@ retry:
 		 */
 		if (fault & VM_FAULT_OOM) {
 			goto out_of_memory;
+		} else if (fault & VM_FAULT_SIGSEGV) {
+			goto bad_area;
 		} else if (fault & VM_FAULT_SIGBUS) {
 			signal = SIGBUS;
 			goto bad_area;
diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c
index e9c6a8014bd6..e3d4d4890104 100644
--- a/arch/m32r/mm/fault.c
+++ b/arch/m32r/mm/fault.c
@@ -200,6 +200,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index eb1d61f68725..f0eef0491f77 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -153,6 +153,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto map_err;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto bus_err;
 		BUG();
diff --git a/arch/metag/mm/fault.c b/arch/metag/mm/fault.c
index 332680e5ebf2..2de5dc695a87 100644
--- a/arch/metag/mm/fault.c
+++ b/arch/metag/mm/fault.c
@@ -141,6 +141,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c
index fa4cf52aa7a6..d46a5ebb7570 100644
--- a/arch/microblaze/mm/fault.c
+++ b/arch/microblaze/mm/fault.c
@@ -224,6 +224,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index becc42bb1849..70ab5d664332 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -158,6 +158,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c
index 3516cbdf1ee9..0c2cc5d39c8e 100644
--- a/arch/mn10300/mm/fault.c
+++ b/arch/mn10300/mm/fault.c
@@ -262,6 +262,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c
index 0703acf7d327..230ac20ae794 100644
--- a/arch/openrisc/mm/fault.c
+++ b/arch/openrisc/mm/fault.c
@@ -171,6 +171,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 0293588d5b8c..0dda59ccc98d 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -226,6 +226,8 @@ good_area:
 		 */
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto bad_area;
 		BUG();
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 51ab9e7e6c39..010fabf3828c 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -432,6 +432,8 @@ good_area:
 	 */
 	fault = handle_mm_fault(mm, vma, address, flags);
 	if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) {
+		if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		rc = mm_fault_error(regs, address, fault);
 		if (rc >= MM_FAULT_RETURN)
 			goto bail;
diff --git a/arch/powerpc/platforms/cell/spu_fault.c b/arch/powerpc/platforms/cell/spu_fault.c
index 641e7273d75a..62f3e4e48a0b 100644
--- a/arch/powerpc/platforms/cell/spu_fault.c
+++ b/arch/powerpc/platforms/cell/spu_fault.c
@@ -75,7 +75,7 @@ int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
 		if (*flt & VM_FAULT_OOM) {
 			ret = -ENOMEM;
 			goto out_unlock;
-		} else if (*flt & VM_FAULT_SIGBUS) {
+		} else if (*flt & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
 			ret = -EFAULT;
 			goto out_unlock;
 		}
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index fc6679210d83..b53f37fbe056 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -244,6 +244,12 @@ static noinline void do_fault_error(struct pt_regs *regs, int fault)
 				do_no_context(regs);
 			else
 				pagefault_out_of_memory();
+		} else if (fault & VM_FAULT_SIGSEGV) {
+			/* Kernel mode? Handle exceptions or die */
+			if (!user_mode(regs))
+				do_no_context(regs);
+			else
+				do_sigsegv(regs, SEGV_MAPERR);
 		} else if (fault & VM_FAULT_SIGBUS) {
 			/* Kernel mode? Handle exceptions or die */
 			if (!user_mode(regs))
diff --git a/arch/score/mm/fault.c b/arch/score/mm/fault.c
index 52238983527d..6860beb2a280 100644
--- a/arch/score/mm/fault.c
+++ b/arch/score/mm/fault.c
@@ -114,6 +114,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index 541dc6101508..a58fec9b55e0 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -353,6 +353,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
 	} else {
 		if (fault & VM_FAULT_SIGBUS)
 			do_sigbus(regs, error_code, address);
+		else if (fault & VM_FAULT_SIGSEGV)
+			bad_area(regs, error_code, address);
 		else
 			BUG();
 	}
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index 59dbd4645725..163c78712110 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -252,6 +252,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 603e462a210e..c7009d7762b1 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -446,6 +446,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
index 6c0571216a9d..c6d2a76d91a8 100644
--- a/arch/tile/mm/fault.c
+++ b/arch/tile/mm/fault.c
@@ -444,6 +444,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 5c3aef74237f..06ab0ebe0a0f 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -80,6 +80,8 @@ good_area:
 		if (unlikely(fault & VM_FAULT_ERROR)) {
 			if (fault & VM_FAULT_OOM) {
 				goto out_of_memory;
+			} else if (fault & VM_FAULT_SIGSEGV) {
+				goto out;
 			} else if (fault & VM_FAULT_SIGBUS) {
 				err = -EACCES;
 				goto out;
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 31dceb131c46..814a25d88738 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -866,6 +866,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
 		if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
 			     VM_FAULT_HWPOISON_LARGE))
 			do_sigbus(regs, error_code, address, fault);
+		else if (fault & VM_FAULT_SIGSEGV)
+			bad_area_nosemaphore(regs, error_code, address);
 		else
 			BUG();
 	}
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 70fa7bc42b4a..38278337d85e 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -117,6 +117,8 @@ good_area:
 	if (unlikely(fault & VM_FAULT_ERROR)) {
 		if (fault & VM_FAULT_OOM)
 			goto out_of_memory;
+		else if (fault & VM_FAULT_SIGSEGV)
+			goto bad_area;
 		else if (fault & VM_FAULT_SIGBUS)
 			goto do_sigbus;
 		BUG();
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index 3ff664ce7503..37b14f39551e 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -601,7 +601,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
 		return 0;
 	}
 
-	if (cfio->fault.ft_flags & VM_FAULT_SIGBUS) {
+	if (cfio->fault.ft_flags & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
 		CDEBUG(D_PAGE, "got addr %p - SIGBUS\n", vmf->virtual_address);
 		return -EFAULT;
 	}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 306f0d4ce7e3..f5965a923d44 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -886,6 +886,7 @@ static inline int page_mapped(struct page *page)
 #define VM_FAULT_WRITE	0x0008	/* Special case for get_user_pages */
 #define VM_FAULT_HWPOISON 0x0010	/* Hit poisoned small page */
 #define VM_FAULT_HWPOISON_LARGE 0x0020  /* Hit poisoned large page. Index encoded in upper bits */
+#define VM_FAULT_SIGSEGV 0x0040
 
 #define VM_FAULT_NOPAGE	0x0100	/* ->fault installed the pte, not return page */
 #define VM_FAULT_LOCKED	0x0200	/* ->fault locked the returned page */
@@ -894,8 +895,9 @@ static inline int page_mapped(struct page *page)
 
 #define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */
 
-#define VM_FAULT_ERROR	(VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \
-			 VM_FAULT_FALLBACK | VM_FAULT_HWPOISON_LARGE)
+#define VM_FAULT_ERROR	(VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \
+			 VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE | \
+			 VM_FAULT_FALLBACK)
 
 /* Encode hstate index for a hwpoisoned large page */
 #define VM_FAULT_SET_HINDEX(x) ((x) << 12)
diff --git a/mm/ksm.c b/mm/ksm.c
index 29cbd06c4884..b61ad555184f 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -376,7 +376,7 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr)
 		else
 			ret = VM_FAULT_WRITE;
 		put_page(page);
-	} while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM)));
+	} while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM)));
 	/*
 	 * We must loop because handle_mm_fault() may back out if there's
 	 * any difficulty e.g. if pte accessed bit gets updated concurrently.
diff --git a/mm/memory.c b/mm/memory.c
index cf05415c25a6..7c11dd8b9571 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1836,7 +1836,8 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 						else
 							return -EFAULT;
 					}
-					if (ret & VM_FAULT_SIGBUS)
+					if (ret & (VM_FAULT_SIGBUS |
+							VM_FAULT_SIGSEGV))
 						return i ? i : -EFAULT;
 					BUG();
 				}
@@ -1946,7 +1947,7 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
 			return -ENOMEM;
 		if (ret & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE))
 			return -EHWPOISON;
-		if (ret & VM_FAULT_SIGBUS)
+		if (ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV))
 			return -EFAULT;
 		BUG();
 	}
-- 
2.3.0


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

* [PATCH 3.12 141/175] arc: mm: Fix build failure
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (139 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 140/175] vm: add VM_FAULT_SIGSEGV handling support Jiri Slaby
@ 2015-03-17  8:41 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 142/175] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS Jiri Slaby
                   ` (35 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:41 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Guenter Roeck, Linus Torvalds, Jiri Slaby

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

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

===============

commit e262eb9381ad51b5de7a9e762ee773bbd25ce650 upstream.

Fix misspelled define.

Fixes: 33692f27597f ("vm: add VM_FAULT_SIGSEGV handling support")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arc/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 6d4094986cc4..babd9462d2c4 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -162,7 +162,7 @@ good_area:
 	/* TBD: switch to pagefault_out_of_memory() */
 	if (fault & VM_FAULT_OOM)
 		goto out_of_memory;
-	else if (fault & VM_FAULT_SIGSEV)
+	else if (fault & VM_FAULT_SIGSEGV)
 		goto bad_area;
 	else if (fault & VM_FAULT_SIGBUS)
 		goto do_sigbus;
-- 
2.3.0


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

* [PATCH 3.12 142/175] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (140 preceding siblings ...)
  2015-03-17  8:41 ` [PATCH 3.12 141/175] arc: mm: Fix build failure Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 143/175] splice: Apply generic position and size checks to each write Jiri Slaby
                   ` (34 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Linus Torvalds, linux-arch, Jiri Slaby

From: Linus Torvalds <torvalds@linux-foundation.org>

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

===============

commit 9c145c56d0c8a0b62e48c8d71e055ad0fb2012ba upstream.

The stack guard page error case has long incorrectly caused a SIGBUS
rather than a SIGSEGV, but nobody actually noticed until commit
fee7e49d4514 ("mm: propagate error from stack expansion even for guard
page") because that error case was never actually triggered in any
normal situations.

Now that we actually report the error, people noticed the wrong signal
that resulted.  So far, only the test suite of libsigsegv seems to have
actually cared, but there are real applications that use libsigsegv, so
let's not wait for any of those to break.

Reported-and-tested-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Jan Engelhardt <jengelh@inai.de>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # "s390 still compiles and boots"
Cc: linux-arch@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index 7c11dd8b9571..9d6f692c49c3 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3226,7 +3226,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
 
 	/* Check if we need to add a guard page to the stack */
 	if (check_stack_guard_page(vma, address) < 0)
-		return VM_FAULT_SIGBUS;
+		return VM_FAULT_SIGSEGV;
 
 	/* Use the zero-page for reads */
 	if (!(flags & FAULT_FLAG_WRITE)) {
-- 
2.3.0


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

* [PATCH 3.12 143/175] splice: Apply generic position and size checks to each write
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (141 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 142/175] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 144/175] ALSA: pcm: Don't leave PREPARED state after draining Jiri Slaby
                   ` (33 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ben Hutchings, Kamal Mostafa, Jiri Slaby

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

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

===============

We need to check the position and size of file writes against various
limits, using generic_write_check().  This was not being done for
the splice write path.  It was fixed upstream by commit 8d0207652cbe
("->splice_write() via ->write_iter()") but we can't apply that.

CVE-2014-7822

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[ kamal: port to 3.13-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ocfs2/file.c | 8 ++++++--
 fs/splice.c     | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index cc6e925749de..8add05c84ae5 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2448,9 +2448,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
 	struct address_space *mapping = out->f_mapping;
 	struct inode *inode = mapping->host;
 	struct splice_desc sd = {
-		.total_len = len,
 		.flags = flags,
-		.pos = *ppos,
 		.u.file = out,
 	};
 
@@ -2460,6 +2458,12 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
 			out->f_path.dentry->d_name.len,
 			out->f_path.dentry->d_name.name, len);
 
+	ret = generic_write_checks(out, ppos, &len, 0);
+	if (ret)
+		return ret;
+	sd.total_len = len;
+	sd.pos = *ppos;
+
 	pipe_lock(pipe);
 
 	splice_from_pipe_begin(&sd);
diff --git a/fs/splice.c b/fs/splice.c
index 84f810d63c37..c915e215a50e 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1012,13 +1012,17 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 	struct address_space *mapping = out->f_mapping;
 	struct inode *inode = mapping->host;
 	struct splice_desc sd = {
-		.total_len = len,
 		.flags = flags,
-		.pos = *ppos,
 		.u.file = out,
 	};
 	ssize_t ret;
 
+	ret = generic_write_checks(out, ppos, &len, S_ISBLK(inode->i_mode));
+	if (ret)
+		return ret;
+	sd.total_len = len;
+	sd.pos = *ppos;
+
 	pipe_lock(pipe);
 
 	splice_from_pipe_begin(&sd);
-- 
2.3.0


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

* [PATCH 3.12 144/175] ALSA: pcm: Don't leave PREPARED state after draining
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (142 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 143/175] splice: Apply generic position and size checks to each write Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 145/175] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Jiri Slaby
                   ` (32 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

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

===============

commit 70372a7566b5e552dbe48abdac08c275081d8558 upstream.

When a PCM draining is performed to an empty stream that has been
already in PREPARED state, the current code just ignores and leaves as
it is, although the drain is supposed to set all such streams to SETUP
state.  This patch covers that overlooked case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/pcm_native.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c882d07e56c9..d44bc54f142e 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1404,6 +1404,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
 			if (! snd_pcm_playback_empty(substream)) {
 				snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING);
 				snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING);
+			} else {
+				runtime->status->state = SNDRV_PCM_STATE_SETUP;
 			}
 			break;
 		case SNDRV_PCM_STATE_RUNNING:
-- 
2.3.0


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

* [PATCH 3.12 145/175] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (143 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 144/175] ALSA: pcm: Don't leave PREPARED state after draining Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 146/175] sg: fix read() error reporting Jiri Slaby
                   ` (31 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

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

===============

commit 6426460e5d87810e042962281fe3c1e8fc256162 upstream.

BIOS doesn't seem to set up pins for 5.1 and the SPDIF out, so we need
to give explicitly here.

Reported-and-tested-by: Misan Thropos <misanthropos@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/patch_sigmatel.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 121336b0d3a8..984b75ef1190 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -85,6 +85,7 @@ enum {
 	STAC_ALIENWARE_M17X,
 	STAC_92HD89XX_HP_FRONT_JACK,
 	STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
+	STAC_92HD73XX_ASUS_MOBO,
 	STAC_92HD73XX_MODELS
 };
 
@@ -1924,7 +1925,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = {
 	[STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
-	}
+	},
+	[STAC_92HD73XX_ASUS_MOBO] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			/* enable 5.1 and SPDIF out */
+			{ 0x0c, 0x01014411 },
+			{ 0x0d, 0x01014410 },
+			{ 0x0e, 0x01014412 },
+			{ 0x22, 0x014b1180 },
+			{ }
+		}
+	},
 };
 
 static const struct hda_model_fixup stac92hd73xx_models[] = {
@@ -1936,6 +1948,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = {
 	{ .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
 	{ .id = STAC_DELL_EQ, .name = "dell-eq" },
 	{ .id = STAC_ALIENWARE_M17X, .name = "alienware" },
+	{ .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" },
 	{}
 };
 
@@ -1988,6 +2001,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
 				"HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
 				"unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
+	SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10",
+		      STAC_92HD73XX_ASUS_MOBO),
 	{} /* terminator */
 };
 
-- 
2.3.0


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

* [PATCH 3.12 146/175] sg: fix read() error reporting
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (144 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 145/175] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 147/175] IB/qib: Do not write EEPROM Jiri Slaby
                   ` (30 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Tony Battersby, James Bottomley, Jiri Slaby

From: Tony Battersby <tonyb@cybernetics.com>

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

===============

commit 3b524a683af8991b4eab4182b947c65f0ce1421b upstream.

Fix SCSI generic read() incorrectly returning success after detecting an
error.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/sg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index df5e961484e1..eb81c98386b9 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -522,7 +522,7 @@ static ssize_t
 sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 {
 	sg_io_hdr_t *hp = &srp->header;
-	int err = 0;
+	int err = 0, err2;
 	int len;
 
 	if (count < SZ_SG_IO_HDR) {
@@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 		goto err_out;
 	}
 err_out:
-	err = sg_finish_rem_req(srp);
-	return (0 == err) ? count : err;
+	err2 = sg_finish_rem_req(srp);
+	return err ? : err2 ? : count;
 }
 
 static ssize_t
-- 
2.3.0


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

* [PATCH 3.12 147/175] IB/qib: Do not write EEPROM
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (145 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 146/175] sg: fix read() error reporting Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 148/175] xhci: no switching back on non-ULT Haswell Jiri Slaby
                   ` (29 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Mitko Haralanov, Mike Marciniszyn, Roland Dreier,
	Jiri Slaby

From: Mitko Haralanov <mitko.haralanov@intel.com>

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

===============

commit 18c0b82a3e4501511b08d0e8676fb08ac08734a3 upstream.

This changeset removes all the code that allows the driver to write to
the EEPROM and update the recorded error counters and power on hours.

These two stats are unused and writing them exposes a timing risk
which could leave the EEPROM in a bad state preventing further normal
operation of the HCA.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/hw/qib/qib.h         |   9 +-
 drivers/infiniband/hw/qib/qib_eeprom.c  | 181 --------------------------------
 drivers/infiniband/hw/qib/qib_iba6120.c |   2 -
 drivers/infiniband/hw/qib/qib_iba7220.c |   2 -
 drivers/infiniband/hw/qib/qib_iba7322.c |   2 -
 drivers/infiniband/hw/qib/qib_init.c    |   1 -
 drivers/infiniband/hw/qib/qib_sysfs.c   |  24 -----
 7 files changed, 1 insertion(+), 220 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
index 1946101419a3..675d3c796b9f 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -1080,12 +1080,6 @@ struct qib_devdata {
 	/* control high-level access to EEPROM */
 	struct mutex eep_lock;
 	uint64_t traffic_wds;
-	/* active time is kept in seconds, but logged in hours */
-	atomic_t active_time;
-	/* Below are nominal shadow of EEPROM, new since last EEPROM update */
-	uint8_t eep_st_errs[QIB_EEP_LOG_CNT];
-	uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT];
-	uint16_t eep_hrs;
 	/*
 	 * masks for which bits of errs, hwerrs that cause
 	 * each of the counters to increment.
@@ -1307,8 +1301,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer,
 int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr,
 		    const void *buffer, int len);
 void qib_get_eeprom_info(struct qib_devdata *);
-int qib_update_eeprom_log(struct qib_devdata *dd);
-void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr);
+#define qib_inc_eeprom_err(dd, eidx, incr)
 void qib_dump_lookup_output_queue(struct qib_devdata *);
 void qib_force_pio_avail_update(struct qib_devdata *);
 void qib_clear_symerror_on_linkup(unsigned long opaque);
diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c
index 4d5d71aaa2b4..e2280b07df02 100644
--- a/drivers/infiniband/hw/qib/qib_eeprom.c
+++ b/drivers/infiniband/hw/qib/qib_eeprom.c
@@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd)
 			"Board SN %s did not pass functional test: %s\n",
 			dd->serial, ifp->if_comment);
 
-	memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT);
-	/*
-	 * Power-on (actually "active") hours are kept as little-endian value
-	 * in EEPROM, but as seconds in a (possibly as small as 24-bit)
-	 * atomic_t while running.
-	 */
-	atomic_set(&dd->active_time, 0);
-	dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8);
-
 done:
 	vfree(buf);
 
 bail:;
 }
 
-/**
- * qib_update_eeprom_log - copy active-time and error counters to eeprom
- * @dd: the qlogic_ib device
- *
- * Although the time is kept as seconds in the qib_devdata struct, it is
- * rounded to hours for re-write, as we have only 16 bits in EEPROM.
- * First-cut code reads whole (expected) struct qib_flash, modifies,
- * re-writes. Future direction: read/write only what we need, assuming
- * that the EEPROM had to have been "good enough" for driver init, and
- * if not, we aren't making it worse.
- *
- */
-int qib_update_eeprom_log(struct qib_devdata *dd)
-{
-	void *buf;
-	struct qib_flash *ifp;
-	int len, hi_water;
-	uint32_t new_time, new_hrs;
-	u8 csum;
-	int ret, idx;
-	unsigned long flags;
-
-	/* first, check if we actually need to do anything. */
-	ret = 0;
-	for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
-		if (dd->eep_st_new_errs[idx]) {
-			ret = 1;
-			break;
-		}
-	}
-	new_time = atomic_read(&dd->active_time);
-
-	if (ret == 0 && new_time < 3600)
-		goto bail;
-
-	/*
-	 * The quick-check above determined that there is something worthy
-	 * of logging, so get current contents and do a more detailed idea.
-	 * read full flash, not just currently used part, since it may have
-	 * been written with a newer definition
-	 */
-	len = sizeof(struct qib_flash);
-	buf = vmalloc(len);
-	ret = 1;
-	if (!buf) {
-		qib_dev_err(dd,
-			"Couldn't allocate memory to read %u bytes from eeprom for logging\n",
-			len);
-		goto bail;
-	}
-
-	/* Grab semaphore and read current EEPROM. If we get an
-	 * error, let go, but if not, keep it until we finish write.
-	 */
-	ret = mutex_lock_interruptible(&dd->eep_lock);
-	if (ret) {
-		qib_dev_err(dd, "Unable to acquire EEPROM for logging\n");
-		goto free_bail;
-	}
-	ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len);
-	if (ret) {
-		mutex_unlock(&dd->eep_lock);
-		qib_dev_err(dd, "Unable read EEPROM for logging\n");
-		goto free_bail;
-	}
-	ifp = (struct qib_flash *)buf;
-
-	csum = flash_csum(ifp, 0);
-	if (csum != ifp->if_csum) {
-		mutex_unlock(&dd->eep_lock);
-		qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n",
-			    csum, ifp->if_csum);
-		ret = 1;
-		goto free_bail;
-	}
-	hi_water = 0;
-	spin_lock_irqsave(&dd->eep_st_lock, flags);
-	for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
-		int new_val = dd->eep_st_new_errs[idx];
-		if (new_val) {
-			/*
-			 * If we have seen any errors, add to EEPROM values
-			 * We need to saturate at 0xFF (255) and we also
-			 * would need to adjust the checksum if we were
-			 * trying to minimize EEPROM traffic
-			 * Note that we add to actual current count in EEPROM,
-			 * in case it was altered while we were running.
-			 */
-			new_val += ifp->if_errcntp[idx];
-			if (new_val > 0xFF)
-				new_val = 0xFF;
-			if (ifp->if_errcntp[idx] != new_val) {
-				ifp->if_errcntp[idx] = new_val;
-				hi_water = offsetof(struct qib_flash,
-						    if_errcntp) + idx;
-			}
-			/*
-			 * update our shadow (used to minimize EEPROM
-			 * traffic), to match what we are about to write.
-			 */
-			dd->eep_st_errs[idx] = new_val;
-			dd->eep_st_new_errs[idx] = 0;
-		}
-	}
-	/*
-	 * Now update active-time. We would like to round to the nearest hour
-	 * but unless atomic_t are sure to be proper signed ints we cannot,
-	 * because we need to account for what we "transfer" to EEPROM and
-	 * if we log an hour at 31 minutes, then we would need to set
-	 * active_time to -29 to accurately count the _next_ hour.
-	 */
-	if (new_time >= 3600) {
-		new_hrs = new_time / 3600;
-		atomic_sub((new_hrs * 3600), &dd->active_time);
-		new_hrs += dd->eep_hrs;
-		if (new_hrs > 0xFFFF)
-			new_hrs = 0xFFFF;
-		dd->eep_hrs = new_hrs;
-		if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) {
-			ifp->if_powerhour[0] = new_hrs & 0xFF;
-			hi_water = offsetof(struct qib_flash, if_powerhour);
-		}
-		if ((new_hrs >> 8) != ifp->if_powerhour[1]) {
-			ifp->if_powerhour[1] = new_hrs >> 8;
-			hi_water = offsetof(struct qib_flash, if_powerhour) + 1;
-		}
-	}
-	/*
-	 * There is a tiny possibility that we could somehow fail to write
-	 * the EEPROM after updating our shadows, but problems from holding
-	 * the spinlock too long are a much bigger issue.
-	 */
-	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
-	if (hi_water) {
-		/* we made some change to the data, uopdate cksum and write */
-		csum = flash_csum(ifp, 1);
-		ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1);
-	}
-	mutex_unlock(&dd->eep_lock);
-	if (ret)
-		qib_dev_err(dd, "Failed updating EEPROM\n");
-
-free_bail:
-	vfree(buf);
-bail:
-	return ret;
-}
-
-/**
- * qib_inc_eeprom_err - increment one of the four error counters
- * that are logged to EEPROM.
- * @dd: the qlogic_ib device
- * @eidx: 0..3, the counter to increment
- * @incr: how much to add
- *
- * Each counter is 8-bits, and saturates at 255 (0xFF). They
- * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log()
- * is called, but it can only be called in a context that allows sleep.
- * This function can be called even at interrupt level.
- */
-void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr)
-{
-	uint new_val;
-	unsigned long flags;
-
-	spin_lock_irqsave(&dd->eep_st_lock, flags);
-	new_val = dd->eep_st_new_errs[eidx] + incr;
-	if (new_val > 255)
-		new_val = 255;
-	dd->eep_st_new_errs[eidx] = new_val;
-	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
-}
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c
index 84e593d6007b..295f6312e6a9 100644
--- a/drivers/infiniband/hw/qib/qib_iba6120.c
+++ b/drivers/infiniband/hw/qib/qib_iba6120.c
@@ -2682,8 +2682,6 @@ static void qib_get_6120_faststats(unsigned long opaque)
 	spin_lock_irqsave(&dd->eep_st_lock, flags);
 	traffic_wds -= dd->traffic_wds;
 	dd->traffic_wds += traffic_wds;
-	if (traffic_wds  >= QIB_TRAFFIC_ACTIVE_THRESHOLD)
-		atomic_add(5, &dd->active_time); /* S/B #define */
 	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
 
 	qib_chk_6120_errormask(dd);
diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c
index 454c2e7668fe..c86e71b9e160 100644
--- a/drivers/infiniband/hw/qib/qib_iba7220.c
+++ b/drivers/infiniband/hw/qib/qib_iba7220.c
@@ -3299,8 +3299,6 @@ static void qib_get_7220_faststats(unsigned long opaque)
 	spin_lock_irqsave(&dd->eep_st_lock, flags);
 	traffic_wds -= dd->traffic_wds;
 	dd->traffic_wds += traffic_wds;
-	if (traffic_wds  >= QIB_TRAFFIC_ACTIVE_THRESHOLD)
-		atomic_add(5, &dd->active_time); /* S/B #define */
 	spin_unlock_irqrestore(&dd->eep_st_lock, flags);
 done:
 	mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER);
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index d1bd21319d7d..0f8d1f0bd929 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -5191,8 +5191,6 @@ static void qib_get_7322_faststats(unsigned long opaque)
 		spin_lock_irqsave(&ppd->dd->eep_st_lock, flags);
 		traffic_wds -= ppd->dd->traffic_wds;
 		ppd->dd->traffic_wds += traffic_wds;
-		if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD)
-			atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time);
 		spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags);
 		if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active &
 						QIB_IB_QDR) &&
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index 76c3e177164d..8c9bb6c35838 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -922,7 +922,6 @@ static void qib_shutdown_device(struct qib_devdata *dd)
 		}
 	}
 
-	qib_update_eeprom_log(dd);
 }
 
 /**
diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c
index 3c8e4e3caca6..b9ccbda7817d 100644
--- a/drivers/infiniband/hw/qib/qib_sysfs.c
+++ b/drivers/infiniband/hw/qib/qib_sysfs.c
@@ -611,28 +611,6 @@ bail:
 	return ret < 0 ? ret : count;
 }
 
-static ssize_t show_logged_errs(struct device *device,
-				struct device_attribute *attr, char *buf)
-{
-	struct qib_ibdev *dev =
-		container_of(device, struct qib_ibdev, ibdev.dev);
-	struct qib_devdata *dd = dd_from_dev(dev);
-	int idx, count;
-
-	/* force consistency with actual EEPROM */
-	if (qib_update_eeprom_log(dd) != 0)
-		return -ENXIO;
-
-	count = 0;
-	for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) {
-		count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c",
-				   dd->eep_st_errs[idx],
-				   idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' ');
-	}
-
-	return count;
-}
-
 /*
  * Dump tempsense regs. in decimal, to ease shell-scripts.
  */
@@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL);
 static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL);
 static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
 static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL);
-static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL);
 static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL);
 static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL);
 static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset);
@@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = {
 	&dev_attr_nfreectxts,
 	&dev_attr_serial,
 	&dev_attr_boardversion,
-	&dev_attr_logged_errors,
 	&dev_attr_tempsense,
 	&dev_attr_localbus_info,
 	&dev_attr_chip_reset,
-- 
2.3.0


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

* [PATCH 3.12 148/175] xhci: no switching back on non-ULT Haswell
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (146 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 147/175] IB/qib: Do not write EEPROM Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 149/175] HID: microsoft: Add ID for NE7K wireless keyboard Jiri Slaby
                   ` (28 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Neukum, Greg Kroah-Hartman, Jiri Slaby

From: Oliver Neukum <oneukum@suse.de>

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

===============

commit b45abacde3d551c6696c6738bef4a1805d0bf27a upstream.

The switch back is limited to ULT even on HP. The contrary
finding arose by bad luck in BIOS versions for testing.
This fixes spontaneous resume from S3 on some HP laptops.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci-pci.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 7dad9e5ad2f3..2a2e1de244d8 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -126,20 +126,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
-	    (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI)) {
-		/* Workaround for occasional spurious wakeups from S5 (or
-		 * any other sleep) on Haswell machines with LPT and LPT-LP
-		 * with the new Intel BIOS
-		 */
-		/* Limit the quirk to only known vendors, as this triggers
-		 * yet another BIOS bug on some other machines
-		 * https://bugzilla.kernel.org/show_bug.cgi?id=66171
-		 */
-		if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)
-			xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
-	}
-	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 		pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
 		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
 	}
-- 
2.3.0


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

* [PATCH 3.12 149/175] HID: microsoft: Add ID for NE7K wireless keyboard
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (147 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 148/175] xhci: no switching back on non-ULT Haswell Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 150/175] HID: usbhid: fix PIXART optical mouse Jiri Slaby
                   ` (27 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jakub Sitnicki, Jiri Kosina, Jiri Slaby

From: Jakub Sitnicki <jsitnicki@gmail.com>

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

===============

commit ef567cf9ddb682dbfa840bf4a2600931299f9555 upstream.

Microsoft Natural Wireless Ergonomic Keyboard 7000 has special My
Favorites 1..5 keys which are handled through a vendor-defined usage
page (0xff05).

Apply MS_ERGONOMY quirks handling to USB PID 0x071d (Microsoft Microsoft
2.4GHz Transceiver V1.0) so that the My Favorites 1..5 keys are reported
as KEY_F14..18 events.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=52841
Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c      | 1 +
 drivers/hid/hid-ids.h       | 1 +
 drivers/hid/hid-microsoft.c | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b3ac5fb99128..b2ee609f77a9 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1796,6 +1796,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index c0118d3090a1..7b8e6755ae0b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -618,6 +618,7 @@
 #define USB_DEVICE_ID_MS_LK6K		0x00f9
 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT	0x0701
 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB	0x0713
+#define USB_DEVICE_ID_MS_NE7K		0x071d
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K	0x0730
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
 #define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index f488959212d1..7e56e18665da 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -244,6 +244,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
 		.driver_data = MS_ERGONOMY },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K),
+		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K),
 		.driver_data = MS_ERGONOMY | MS_RDESC },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),
-- 
2.3.0


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

* [PATCH 3.12 150/175] HID: usbhid: fix PIXART optical mouse
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (148 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 149/175] HID: microsoft: Add ID for NE7K wireless keyboard Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 151/175] HID: usbhid: add another mouse that needs QUIRK_ALWAYS_POLL Jiri Slaby
                   ` (26 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Neukum, Jiri Kosina, Jiri Slaby

From: Oliver Neukum <oneukum@suse.de>

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

===============

commit 4980f95755e2966b30ac70d1841f4db66d1a8a22 upstream.

This mouse keeps disconnecting in runlevel 3. It needs the ALWAYS_POLL quirk.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 7b8e6755ae0b..081caadda019 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -715,6 +715,7 @@
 #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL	0xff
 
 #define USB_VENDOR_ID_PIXART				0x093a
+#define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE		0x2510
 #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN	0x8001
 #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1	0x8002
 #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2	0x8003
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index e721bdc878e6..62623813804e 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -84,6 +84,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.3.0


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

* [PATCH 3.12 151/175] HID: usbhid: add another mouse that needs QUIRK_ALWAYS_POLL
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (149 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 150/175] HID: usbhid: fix PIXART optical mouse Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 152/175] HID: usbhid: enable always-poll quirk for Elan Touchscreen 0103 Jiri Slaby
                   ` (25 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Neukum, Jiri Kosina, Jiri Slaby

From: Oliver Neukum <oneukum@suse.de>

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

===============

commit 5235166fbc332c8b5dcf49e3a498a8b510a77449 upstream.

There is a second mouse sharing the same vendor strings but different IDs.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 081caadda019..4ef1403625de 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -715,6 +715,7 @@
 #define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL	0xff
 
 #define USB_VENDOR_ID_PIXART				0x093a
+#define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2	0x0137
 #define USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE		0x2510
 #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN	0x8001
 #define USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1	0x8002
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 62623813804e..2e95a2417f48 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -85,6 +85,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.3.0


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

* [PATCH 3.12 152/175] HID: usbhid: enable always-poll quirk for Elan Touchscreen 0103
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (150 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 151/175] HID: usbhid: add another mouse that needs QUIRK_ALWAYS_POLL Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 153/175] HID: yet another buggy ELAN touchscreen Jiri Slaby
                   ` (24 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Adel Gadllah, Jiri Kosina, Jiri Slaby

From: Adel Gadllah <adel.gadllah@gmail.com>

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

===============

commit fa51ee1085d6f2fa344d4ba64faadc9c6db0a3f1 upstream.

Yet another device that needs this quirk.

Reported-by: Tanguy de Baritault <tdebaritault@gmail.com>
Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4ef1403625de..7786f652c4f9 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -291,6 +291,7 @@
 #define USB_VENDOR_ID_ELAN		0x04f3
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN	0x0089
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B	0x009b
+#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103	0x0103
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F	0x016f
 
 #define USB_VENDOR_ID_ELECOM		0x056e
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 2e95a2417f48..7b608f5c3fbc 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -72,6 +72,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.3.0


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

* [PATCH 3.12 153/175] HID: yet another buggy ELAN touchscreen
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (151 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 152/175] HID: usbhid: enable always-poll quirk for Elan Touchscreen 0103 Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 154/175] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page() Jiri Slaby
                   ` (23 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Neukum, Jiri Kosina, Jiri Slaby

From: Oliver Neukum <oneukum@suse.de>

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

===============

commit a32c99e7ab8410bae7c276a7e94ca84d108de034 upstream.

The touchscreen needs the same quirk as the other models.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Reported-by: Bryan Poling <poli0048@umn.edu>
CC: stable@vger.kernel.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 drivers/usb/core/quirks.c       | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 7786f652c4f9..946b8cbfaa9f 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -292,6 +292,7 @@
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN	0x0089
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B	0x009b
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103	0x0103
+#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c	0x010c
 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F	0x016f
 
 #define USB_VENDOR_ID_ELECOM		0x056e
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 7b608f5c3fbc..25484ee3c51e 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -73,6 +73,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index aa7759583c73..f2121b56e681 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -102,6 +102,9 @@ static const struct usb_device_id usb_quirk_list[] = {
 	{ USB_DEVICE(0x04f3, 0x009b), .driver_info =
 			USB_QUIRK_DEVICE_QUALIFIER },
 
+	{ USB_DEVICE(0x04f3, 0x010c), .driver_info =
+			USB_QUIRK_DEVICE_QUALIFIER },
+
 	{ USB_DEVICE(0x04f3, 0x016f), .driver_info =
 			USB_QUIRK_DEVICE_QUALIFIER },
 
-- 
2.3.0


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

* [PATCH 3.12 154/175] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (152 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 153/175] HID: yet another buggy ELAN touchscreen Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 155/175] mm/hugetlb: reduce arch dependent code around follow_huge_* Jiri Slaby
                   ` (22 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, Andi Kleen, Tony Luck, Chen Gong,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

===============

commit 9ab3b598d2dfbdb0153ffa7e4b1456bbff59a25d upstream.

A race condition starts to be visible in recent mmotm, where a PG_hwpoison
flag is set on a migration source page *before* it's back in buddy page
poo= l.

This is problematic because no page flag is supposed to be set when
freeing (see __free_one_page().) So the user-visible effect of this race
is that it could trigger the BUG_ON() when soft-offlining is called.

The root cause is that we call lru_add_drain_all() to make sure that the
page is in buddy, but that doesn't work because this function just
schedule= s a work item and doesn't wait its completion.
drain_all_pages() does drainin= g directly, so simply dropping
lru_add_drain_all() solves this problem.

Fixes: f15bdfa802bf ("mm/memory-failure.c: fix memory leak in successful soft offlining")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Chen Gong <gong.chen@linux.intel.com>
Cc: <stable@vger.kernel.org>	[3.11+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/memory-failure.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 4ab233d4714a..532b4661985c 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1653,8 +1653,6 @@ static int __soft_offline_page(struct page *page, int flags)
 			 * setting PG_hwpoison.
 			 */
 			if (!is_free_buddy_page(page))
-				lru_add_drain_all();
-			if (!is_free_buddy_page(page))
 				drain_all_pages();
 			SetPageHWPoison(page);
 			if (!is_free_buddy_page(page))
-- 
2.3.0


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

* [PATCH 3.12 155/175] mm/hugetlb: reduce arch dependent code around follow_huge_*
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (153 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 154/175] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page() Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 156/175] mm/hugetlb: take page table lock in follow_huge_pmd() Jiri Slaby
                   ` (21 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, James Hogan, David Rientjes,
	Mel Gorman, Johannes Weiner, Michal Hocko, Rik van Riel,
	Andrea Arcangeli, Luiz Capitulino, Nishanth Aravamudan,
	Lee Schermerhorn, Steve Capper, Andrew Morton, Linus Torvalds,
	Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

===============

commit 61f77eda9bbf0d2e922197ed2dcf88638a639ce5 upstream.

Currently we have many duplicates in definitions around
follow_huge_addr(), follow_huge_pmd(), and follow_huge_pud(), so this
patch tries to remove the m.  The basic idea is to put the default
implementation for these functions in mm/hugetlb.c as weak symbols
(regardless of CONFIG_ARCH_WANT_GENERAL_HUGETL B), and to implement
arch-specific code only when the arch needs it.

For follow_huge_addr(), only powerpc and ia64 have their own
implementation, and in all other architectures this function just returns
ERR_PTR(-EINVAL).  So this patch sets returning ERR_PTR(-EINVAL) as
default.

As for follow_huge_(pmd|pud)(), if (pmd|pud)_huge() is implemented to
always return 0 in your architecture (like in ia64 or sparc,) it's never
called (the callsite is optimized away) no matter how implemented it is.
So in such architectures, we don't need arch-specific implementation.

In some architecture (like mips, s390 and tile,) their current
arch-specific follow_huge_(pmd|pud)() are effectively identical with the
common code, so this patch lets these architecture use the common code.

One exception is metag, where pmd_huge() could return non-zero but it
expects follow_huge_pmd() to always return NULL.  This means that we need
arch-specific implementation which returns NULL.  This behavior looks
strange to me (because non-zero pmd_huge() implies that the architecture
supports PMD-based hugepage, so follow_huge_pmd() can/should return some
relevant value,) but that's beyond this cleanup patch, so let's keep it.

Justification of non-trivial changes:
- in s390, follow_huge_pmd() checks !MACHINE_HAS_HPAGE at first, and this
  patch removes the check. This is OK because we can assume MACHINE_HAS_HPAGE
  is true when follow_huge_pmd() can be called (note that pmd_huge() has
  the same check and always returns 0 for !MACHINE_HAS_HPAGE.)
- in s390 and mips, we use HPAGE_MASK instead of PMD_MASK as done in common
  code. This patch forces these archs use PMD_MASK, but it's OK because
  they are identical in both archs.
  In s390, both of HPAGE_SHIFT and PMD_SHIFT are 20.
  In mips, HPAGE_SHIFT is defined as (PAGE_SHIFT + PAGE_SHIFT - 3) and
  PMD_SHIFT is define as (PAGE_SHIFT + PAGE_SHIFT + PTE_ORDER - 3), but
  PTE_ORDER is always 0, so these are identical.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mm/hugetlbpage.c     |  6 ------
 arch/arm64/mm/hugetlbpage.c   |  6 ------
 arch/ia64/mm/hugetlbpage.c    |  6 ------
 arch/metag/mm/hugetlbpage.c   |  6 ------
 arch/mips/mm/hugetlbpage.c    | 18 ------------------
 arch/powerpc/mm/hugetlbpage.c |  8 ++++++++
 arch/s390/mm/hugetlbpage.c    | 20 --------------------
 arch/sh/mm/hugetlbpage.c      | 12 ------------
 arch/sparc/mm/hugetlbpage.c   | 12 ------------
 arch/tile/mm/hugetlbpage.c    | 28 ----------------------------
 arch/x86/mm/hugetlbpage.c     | 12 ------------
 mm/hugetlb.c                  | 30 +++++++++++++++---------------
 12 files changed, 23 insertions(+), 141 deletions(-)

diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c
index 66781bf34077..c72412415093 100644
--- a/arch/arm/mm/hugetlbpage.c
+++ b/arch/arm/mm/hugetlbpage.c
@@ -36,12 +36,6 @@
  * of type casting from pmd_t * to pte_t *.
  */
 
-struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
-			      int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pud_huge(pud_t pud)
 {
 	return 0;
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 023747bf4dd7..2de9d2e59d96 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -38,12 +38,6 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
 }
 #endif
 
-struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
-			      int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return !(pmd_val(pmd) & PMD_TABLE_BIT);
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index 76069c18ee42..52b7604b5215 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -114,12 +114,6 @@ int pud_huge(pud_t pud)
 	return 0;
 }
 
-struct page *
-follow_huge_pmd(struct mm_struct *mm, unsigned long address, pmd_t *pmd, int write)
-{
-	return NULL;
-}
-
 void hugetlb_free_pgd_range(struct mmu_gather *tlb,
 			unsigned long addr, unsigned long end,
 			unsigned long floor, unsigned long ceiling)
diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c
index 3c52fa6d0f8e..745081427659 100644
--- a/arch/metag/mm/hugetlbpage.c
+++ b/arch/metag/mm/hugetlbpage.c
@@ -94,12 +94,6 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
 	return 0;
 }
 
-struct page *follow_huge_addr(struct mm_struct *mm,
-			      unsigned long address, int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return pmd_page_shift(pmd) > PAGE_SHIFT;
diff --git a/arch/mips/mm/hugetlbpage.c b/arch/mips/mm/hugetlbpage.c
index a7fee0dfb7a9..e656e7f61e65 100644
--- a/arch/mips/mm/hugetlbpage.c
+++ b/arch/mips/mm/hugetlbpage.c
@@ -69,12 +69,6 @@ int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
 	return 0;
 }
 
-struct page *
-follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return (pmd_val(pmd) & _PAGE_HUGE) != 0;
@@ -84,15 +78,3 @@ int pud_huge(pud_t pud)
 {
 	return (pud_val(pud) & _PAGE_HUGE) != 0;
 }
-
-struct page *
-follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-		pmd_t *pmd, int write)
-{
-	struct page *page;
-
-	page = pte_page(*(pte_t *)pmd);
-	if (page)
-		page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
-	return page;
-}
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 834ca8eb38f2..fc2427323414 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -706,6 +706,14 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 	return NULL;
 }
 
+struct page *
+follow_huge_pud(struct mm_struct *mm, unsigned long address,
+		pud_t *pud, int write)
+{
+	BUG();
+	return NULL;
+}
+
 static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
 				      unsigned long sz)
 {
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
index 248445f92604..99a68d579828 100644
--- a/arch/s390/mm/hugetlbpage.c
+++ b/arch/s390/mm/hugetlbpage.c
@@ -204,12 +204,6 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
 	return 0;
 }
 
-struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
-			      int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	if (!MACHINE_HAS_HPAGE)
@@ -222,17 +216,3 @@ int pud_huge(pud_t pud)
 {
 	return 0;
 }
-
-struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-			     pmd_t *pmdp, int write)
-{
-	struct page *page;
-
-	if (!MACHINE_HAS_HPAGE)
-		return NULL;
-
-	page = pmd_page(*pmdp);
-	if (page)
-		page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
-	return page;
-}
diff --git a/arch/sh/mm/hugetlbpage.c b/arch/sh/mm/hugetlbpage.c
index d7762349ea48..534bc978af8a 100644
--- a/arch/sh/mm/hugetlbpage.c
+++ b/arch/sh/mm/hugetlbpage.c
@@ -67,12 +67,6 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
 	return 0;
 }
 
-struct page *follow_huge_addr(struct mm_struct *mm,
-			      unsigned long address, int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return 0;
@@ -82,9 +76,3 @@ int pud_huge(pud_t pud)
 {
 	return 0;
 }
-
-struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-			     pmd_t *pmd, int write)
-{
-	return NULL;
-}
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index 8545f62fa62c..d941cd024f22 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -216,12 +216,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
 	return entry;
 }
 
-struct page *follow_huge_addr(struct mm_struct *mm,
-			      unsigned long address, int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return 0;
@@ -231,9 +225,3 @@ int pud_huge(pud_t pud)
 {
 	return 0;
 }
-
-struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-			     pmd_t *pmd, int write)
-{
-	return NULL;
-}
diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c
index e514899e1100..8a00c7b7b862 100644
--- a/arch/tile/mm/hugetlbpage.c
+++ b/arch/tile/mm/hugetlbpage.c
@@ -150,12 +150,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return NULL;
 }
 
-struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
-			      int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 int pmd_huge(pmd_t pmd)
 {
 	return !!(pmd_val(pmd) & _PAGE_HUGE_PAGE);
@@ -166,28 +160,6 @@ int pud_huge(pud_t pud)
 	return !!(pud_val(pud) & _PAGE_HUGE_PAGE);
 }
 
-struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-			     pmd_t *pmd, int write)
-{
-	struct page *page;
-
-	page = pte_page(*(pte_t *)pmd);
-	if (page)
-		page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
-	return page;
-}
-
-struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
-			     pud_t *pud, int write)
-{
-	struct page *page;
-
-	page = pte_page(*(pte_t *)pud);
-	if (page)
-		page += ((address & ~PUD_MASK) >> PAGE_SHIFT);
-	return page;
-}
-
 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
 {
 	return 0;
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index e473dbe45c0f..9d80a1b5dc86 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -52,20 +52,8 @@ int pud_huge(pud_t pud)
 	return 0;
 }
 
-struct page *
-follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-		pmd_t *pmd, int write)
-{
-	return NULL;
-}
 #else
 
-struct page *
-follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
-{
-	return ERR_PTR(-EINVAL);
-}
-
 /*
  * pmd_huge() returns 1 if @pmd is hugetlb related entry, that is normal
  * hugetlb entry or non-present (migration or hwpoisoned) hugetlb entry.
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 33193ab3dbd3..ef1fbe317213 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3478,7 +3478,20 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 	return (pte_t *) pmd;
 }
 
-struct page *
+#endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */
+
+/*
+ * These functions are overwritable if your architecture needs its own
+ * behavior.
+ */
+struct page * __weak
+follow_huge_addr(struct mm_struct *mm, unsigned long address,
+			      int write)
+{
+	return ERR_PTR(-EINVAL);
+}
+
+struct page * __weak
 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 		pmd_t *pmd, int write)
 {
@@ -3492,7 +3505,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 	return page;
 }
 
-struct page *
+struct page * __weak
 follow_huge_pud(struct mm_struct *mm, unsigned long address,
 		pud_t *pud, int write)
 {
@@ -3504,19 +3517,6 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,
 	return page;
 }
 
-#else /* !CONFIG_ARCH_WANT_GENERAL_HUGETLB */
-
-/* Can be overriden by architectures */
-__attribute__((weak)) struct page *
-follow_huge_pud(struct mm_struct *mm, unsigned long address,
-	       pud_t *pud, int write)
-{
-	BUG();
-	return NULL;
-}
-
-#endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */
-
 #ifdef CONFIG_MEMORY_FAILURE
 
 /* Should be called in hugetlb_lock */
-- 
2.3.0


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

* [PATCH 3.12 156/175] mm/hugetlb: take page table lock in follow_huge_pmd()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (154 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 155/175] mm/hugetlb: reduce arch dependent code around follow_huge_* Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 157/175] nilfs2: fix potential memory overrun on inode Jiri Slaby
                   ` (20 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, James Hogan, David Rientjes,
	Mel Gorman, Johannes Weiner, Michal Hocko, Rik van Riel,
	Andrea Arcangeli, Luiz Capitulino, Nishanth Aravamudan,
	Lee Schermerhorn, Steve Capper, Andrew Morton, Linus Torvalds,
	Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

===============

commit e66f17ff71772b209eed39de35aaa99ba819c93d upstream.

We have a race condition between move_pages() and freeing hugepages, where
move_pages() calls follow_page(FOLL_GET) for hugepages internally and
tries to get its refcount without preventing concurrent freeing.  This
race crashes the kernel, so this patch fixes it by moving FOLL_GET code
for hugepages into follow_huge_pmd() with taking the page table lock.

This patch intentionally removes page==NULL check after pte_page.
This is justified because pte_page() never returns NULL for any
architectures or configurations.

This patch changes the behavior of follow_huge_pmd() for tail pages and
then tail pages can be pinned/returned.  So the caller must be changed to
properly handle the returned tail pages.

We could have a choice to add the similar locking to
follow_huge_(addr|pud) for consistency, but it's not necessary because
currently these functions don't support FOLL_GET flag, so let's leave it
for future development.

Here is the reproducer:

  $ cat movepages.c
  #include <stdio.h>
  #include <stdlib.h>
  #include <numaif.h>

  #define ADDR_INPUT      0x700000000000UL
  #define HPS             0x200000
  #define PS              0x1000

  int main(int argc, char *argv[]) {
          int i;
          int nr_hp = strtol(argv[1], NULL, 0);
          int nr_p  = nr_hp * HPS / PS;
          int ret;
          void **addrs;
          int *status;
          int *nodes;
          pid_t pid;

          pid = strtol(argv[2], NULL, 0);
          addrs  = malloc(sizeof(char *) * nr_p + 1);
          status = malloc(sizeof(char *) * nr_p + 1);
          nodes  = malloc(sizeof(char *) * nr_p + 1);

          while (1) {
                  for (i = 0; i < nr_p; i++) {
                          addrs[i] = (void *)ADDR_INPUT + i * PS;
                          nodes[i] = 1;
                          status[i] = 0;
                  }
                  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
                                        MPOL_MF_MOVE_ALL);
                  if (ret == -1)
                          err("move_pages");

                  for (i = 0; i < nr_p; i++) {
                          addrs[i] = (void *)ADDR_INPUT + i * PS;
                          nodes[i] = 0;
                          status[i] = 0;
                  }
                  ret = numa_move_pages(pid, nr_p, addrs, nodes, status,
                                        MPOL_MF_MOVE_ALL);
                  if (ret == -1)
                          err("move_pages");
          }
          return 0;
  }

  $ cat hugepage.c
  #include <stdio.h>
  #include <sys/mman.h>
  #include <string.h>

  #define ADDR_INPUT      0x700000000000UL
  #define HPS             0x200000

  int main(int argc, char *argv[]) {
          int nr_hp = strtol(argv[1], NULL, 0);
          char *p;

          while (1) {
                  p = mmap((void *)ADDR_INPUT, nr_hp * HPS, PROT_READ | PROT_WRITE,
                           MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
                  if (p != (void *)ADDR_INPUT) {
                          perror("mmap");
                          break;
                  }
                  memset(p, 0, nr_hp * HPS);
                  munmap(p, nr_hp * HPS);
          }
  }

  $ sysctl vm.nr_hugepages=40
  $ ./hugepage 10 &
  $ ./movepages 10 $(pgrep -f hugepage)

Fixes: e632a938d914 ("mm: migrate: add hugepage migration code to move_pages()")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reported-by: Hugh Dickins <hughd@google.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: <stable@vger.kernel.org>	[3.12+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz> [backport to 3.12]
---
 include/linux/hugetlb.h |  8 ++++----
 include/linux/swapops.h |  4 ++++
 mm/hugetlb.c            | 48 ++++++++++++++++++++++++++++++++++--------------
 mm/memory.c             | 25 +++++++------------------
 mm/migrate.c            |  5 +++--
 5 files changed, 52 insertions(+), 38 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 511b1a0d6cc2..e492c34439c3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -90,9 +90,9 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep);
 struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
 			      int write);
 struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-				pmd_t *pmd, int write);
+				pmd_t *pmd, int flags);
 struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
-				pud_t *pud, int write);
+				pud_t *pud, int flags);
 int pmd_huge(pmd_t pmd);
 int pud_huge(pud_t pmd);
 unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
@@ -129,8 +129,8 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
 static inline void hugetlb_show_meminfo(void)
 {
 }
-#define follow_huge_pmd(mm, addr, pmd, write)	NULL
-#define follow_huge_pud(mm, addr, pud, write)	NULL
+#define follow_huge_pmd(mm, addr, pmd, flags)	NULL
+#define follow_huge_pud(mm, addr, pud, flags)	NULL
 #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
 #define pmd_huge(x)	0
 #define pud_huge(x)	0
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 8d4fa82bfb91..08a158dbe502 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -137,6 +137,8 @@ static inline void make_migration_entry_read(swp_entry_t *entry)
 	*entry = swp_entry(SWP_MIGRATION_READ, swp_offset(*entry));
 }
 
+extern void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
+					spinlock_t *ptl);
 extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
 					unsigned long address);
 extern void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte);
@@ -149,6 +151,8 @@ static inline int is_migration_entry(swp_entry_t swp)
 }
 #define migration_entry_to_page(swp) NULL
 static inline void make_migration_entry_read(swp_entry_t *entryp) { }
+static inline void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
+					spinlock_t *ptl) { }
 static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
 					 unsigned long address) { }
 static inline void migration_entry_wait_huge(struct mm_struct *mm,
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ef1fbe317213..ed00a70fb052 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3493,28 +3493,48 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address,
 
 struct page * __weak
 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
-		pmd_t *pmd, int write)
+		pmd_t *pmd, int flags)
 {
-	struct page *page;
-
-	if (!pmd_present(*pmd))
-		return NULL;
-	page = pte_page(*(pte_t *)pmd);
-	if (page)
-		page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
+	struct page *page = NULL;
+	spinlock_t *ptl;
+retry:
+	ptl = &mm->page_table_lock;
+	spin_lock(ptl);
+	/*
+	 * make sure that the address range covered by this pmd is not
+	 * unmapped from other threads.
+	 */
+	if (!pmd_huge(*pmd))
+		goto out;
+	if (pmd_present(*pmd)) {
+		page = pte_page(*(pte_t *)pmd) +
+			((address & ~PMD_MASK) >> PAGE_SHIFT);
+		if (flags & FOLL_GET)
+			get_page(page);
+	} else {
+		if (is_hugetlb_entry_migration(huge_ptep_get((pte_t *)pmd))) {
+			spin_unlock(ptl);
+			__migration_entry_wait(mm, (pte_t *)pmd, ptl);
+			goto retry;
+		}
+		/*
+		 * hwpoisoned entry is treated as no_page_table in
+		 * follow_page_mask().
+		 */
+	}
+out:
+	spin_unlock(ptl);
 	return page;
 }
 
 struct page * __weak
 follow_huge_pud(struct mm_struct *mm, unsigned long address,
-		pud_t *pud, int write)
+		pud_t *pud, int flags)
 {
-	struct page *page;
+	if (flags & FOLL_GET)
+		return NULL;
 
-	page = pte_page(*(pte_t *)pud);
-	if (page)
-		page += ((address & ~PUD_MASK) >> PAGE_SHIFT);
-	return page;
+	return pte_page(*(pte_t *)pud) + ((address & ~PUD_MASK) >> PAGE_SHIFT);
 }
 
 #ifdef CONFIG_MEMORY_FAILURE
diff --git a/mm/memory.c b/mm/memory.c
index 9d6f692c49c3..38617f049b9f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1483,10 +1483,10 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
 	if (pud_none(*pud))
 		goto no_page_table;
 	if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
-		if (flags & FOLL_GET)
+		page = follow_huge_pud(mm, address, pud, flags);
+		if (page)
 			goto out;
-		page = follow_huge_pud(mm, address, pud, flags & FOLL_WRITE);
-		goto out;
+		goto no_page_table;
 	}
 	if (unlikely(pud_bad(*pud)))
 		goto no_page_table;
@@ -1495,21 +1495,10 @@ struct page *follow_page_mask(struct vm_area_struct *vma,
 	if (pmd_none(*pmd))
 		goto no_page_table;
 	if (pmd_huge(*pmd) && vma->vm_flags & VM_HUGETLB) {
-		page = follow_huge_pmd(mm, address, pmd, flags & FOLL_WRITE);
-		if (flags & FOLL_GET) {
-			/*
-			 * Refcount on tail pages are not well-defined and
-			 * shouldn't be taken. The caller should handle a NULL
-			 * return when trying to follow tail pages.
-			 */
-			if (PageHead(page))
-				get_page(page);
-			else {
-				page = NULL;
-				goto out;
-			}
-		}
-		goto out;
+		page = follow_huge_pmd(mm, address, pmd, flags);
+		if (page)
+			goto out;
+		goto no_page_table;
 	}
 	if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
 		goto no_page_table;
diff --git a/mm/migrate.c b/mm/migrate.c
index fac5fa0813c4..66ca0c494b90 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -208,7 +208,7 @@ static void remove_migration_ptes(struct page *old, struct page *new)
  * get to the page and wait until migration is finished.
  * When we return from this function the fault will be retried.
  */
-static void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
+void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
 				spinlock_t *ptl)
 {
 	pte_t pte;
@@ -1195,7 +1195,8 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
 			goto put_and_set;
 
 		if (PageHuge(page)) {
-			isolate_huge_page(page, &pagelist);
+			if (PageHead(page))
+				isolate_huge_page(page, &pagelist);
 			goto put_and_set;
 		}
 
-- 
2.3.0


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

* [PATCH 3.12 157/175] nilfs2: fix potential memory overrun on inode
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (155 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 156/175] mm/hugetlb: take page table lock in follow_huge_pmd() Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 158/175] ASoC: omap-pcm: Correct dma mask Jiri Slaby
                   ` (19 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Ryusuke Konishi, Andrew Morton, Linus Torvalds, Jiri Slaby

From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

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

===============

commit 957ed60b53b519064a54988c4e31e0087e47d091 upstream.

Each inode of nilfs2 stores a root node of a b-tree, and it turned out to
have a memory overrun issue:

Each b-tree node of nilfs2 stores a set of key-value pairs and the number
of them (in "bn_nchildren" member of nilfs_btree_node struct), as well as
a few other "bn_*" members.

Since the value of "bn_nchildren" is used for operations on the key-values
within the b-tree node, it can cause memory access overrun if a large
number is incorrectly set to "bn_nchildren".

For instance, nilfs_btree_node_lookup() function determines the range of
binary search with it, and too large "bn_nchildren" leads
nilfs_btree_node_get_key() in that function to overrun.

As for intermediate b-tree nodes, this is prevented by a sanity check
performed when each node is read from a drive, however, no sanity check
has been done for root nodes stored in inodes.

This patch fixes the issue by adding missing sanity check against b-tree
root nodes so that it's called when on-memory inodes are read from ifile,
inode metadata file.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nilfs2/btree.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index b2e3ff347620..ecdbae19a766 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -31,6 +31,8 @@
 #include "alloc.h"
 #include "dat.h"
 
+static void __nilfs_btree_init(struct nilfs_bmap *bmap);
+
 static struct nilfs_btree_path *nilfs_btree_alloc_path(void)
 {
 	struct nilfs_btree_path *path;
@@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
 	return ret;
 }
 
+/**
+ * nilfs_btree_root_broken - verify consistency of btree root node
+ * @node: btree root node to be examined
+ * @ino: inode number
+ *
+ * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned.
+ */
+static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
+				   unsigned long ino)
+{
+	int level, flags, nchildren;
+	int ret = 0;
+
+	level = nilfs_btree_node_get_level(node);
+	flags = nilfs_btree_node_get_flags(node);
+	nchildren = nilfs_btree_node_get_nchildren(node);
+
+	if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN ||
+		     level > NILFS_BTREE_LEVEL_MAX ||
+		     nchildren < 0 ||
+		     nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) {
+		pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n",
+			ino, level, flags, nchildren);
+		ret = 1;
+	}
+	return ret;
+}
+
 int nilfs_btree_broken_node_block(struct buffer_head *bh)
 {
 	int ret;
@@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree,
 
 	/* convert and insert */
 	dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL;
-	nilfs_btree_init(btree);
+	__nilfs_btree_init(btree);
 	if (nreq != NULL) {
 		nilfs_bmap_commit_alloc_ptr(btree, dreq, dat);
 		nilfs_bmap_commit_alloc_ptr(btree, nreq, dat);
@@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = {
 	.bop_gather_data	=	NULL,
 };
 
-int nilfs_btree_init(struct nilfs_bmap *bmap)
+static void __nilfs_btree_init(struct nilfs_bmap *bmap)
 {
 	bmap->b_ops = &nilfs_btree_ops;
 	bmap->b_nchildren_per_block =
 		NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap));
-	return 0;
+}
+
+int nilfs_btree_init(struct nilfs_bmap *bmap)
+{
+	int ret = 0;
+
+	__nilfs_btree_init(bmap);
+
+	if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap),
+				    bmap->b_inode->i_ino))
+		ret = -EIO;
+	return ret;
 }
 
 void nilfs_btree_init_gc(struct nilfs_bmap *bmap)
-- 
2.3.0


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

* [PATCH 3.12 158/175] ASoC: omap-pcm: Correct dma mask
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (156 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 157/175] nilfs2: fix potential memory overrun on inode Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 159/175] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Jiri Slaby
                   ` (18 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Peter Ujfalusi, Mark Brown, Jiri Slaby

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

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

===============

commit d51199a83a2cf82a291d19ee852c44caa511427d upstream.

DMA_BIT_MASK of 64 is not valid dma address mask for OMAPs, it should
be set to 32.
The 64 was introduced by commit (in 2009):
a152ff24b978 ASoC: OMAP: Make DMA 64 aligned

But the dma_mask and coherent_dma_mask can not be used to specify
alignment.

Fixes: a152ff24b978 (ASoC: OMAP: Make DMA 64 aligned)
Reported-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/omap/omap-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index a11405de86e8..137ab9c05798 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -156,7 +156,7 @@ static struct snd_pcm_ops omap_pcm_ops = {
 	.mmap		= omap_pcm_mmap,
 };
 
-static u64 omap_pcm_dmamask = DMA_BIT_MASK(64);
+static u64 omap_pcm_dmamask = DMA_BIT_MASK(32);
 
 static int omap_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
 	int stream)
@@ -207,7 +207,7 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	if (!card->dev->dma_mask)
 		card->dev->dma_mask = &omap_pcm_dmamask;
 	if (!card->dev->coherent_dma_mask)
-		card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
+		card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
 
 	if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
 		ret = omap_pcm_preallocate_dma_buffer(pcm,
-- 
2.3.0


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

* [PATCH 3.12 159/175] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit.
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (157 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 158/175] ASoC: omap-pcm: Correct dma mask Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 160/175] clk: zynq: Force CPU_2X clock to be ungated Jiri Slaby
                   ` (17 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Minh Duc Tran, Minh Tran, James Bottomley, Jiri Slaby

From: Minh Duc Tran <MinhDuc.Tran@Emulex.Com>

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

===============

commit f76a610a8b4b6280eaedf48f3af9d5d74e418b66 upstream.

In reference to bug https://bugzilla.redhat.com/show_bug.cgi?id=1097141
Assert is seen with AMD cpu whenever calling pci_alloc_consistent.

[   29.406183] ------------[ cut here ]------------
[   29.410505] kernel BUG at lib/iommu-helper.c:13!

Signed-off-by: Minh Tran <minh.tran@emulex.com>
Fixes: 6733b39a1301b0b020bbcbf3295852e93e624cb1
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/be2iscsi/be_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index a1f5ac7a9806..b19dee79e1c4 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -564,7 +564,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
 			"beiscsi_hba_alloc - iscsi_host_alloc failed\n");
 		return NULL;
 	}
-	shost->dma_boundary = pcidev->dma_mask;
 	shost->max_id = BE2_MAX_SESSIONS;
 	shost->max_channel = 0;
 	shost->max_cmd_len = BEISCSI_MAX_CMD_LEN;
-- 
2.3.0


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

* [PATCH 3.12 160/175] clk: zynq: Force CPU_2X clock to be ungated
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (158 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 159/175] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 161/175] clk: sunxi: Support factor clocks with N factor starting not from 0 Jiri Slaby
                   ` (16 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Soren Brinkmann, Michael Turquette, Jiri Slaby

From: Soren Brinkmann <soren.brinkmann@xilinx.com>

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

===============

commit 3dccfecdb867fe35b305a4e493ef5652b7d9d4cb upstream.

The CPU_2X clock does not have a classical in-kernel user, but is,
amongst other things, required for OCM and debug access. Make sure this
clock is not mistakenly disabled during boot up by enabling it in the
platform's clock driver.

Fixes: 0ee52b157b8e 'clk: zynq: Add clock controller driver'
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/zynq/clkc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index cc40fe64f2dc..01eb95cd549e 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -276,6 +276,7 @@ static void __init zynq_clk_setup(struct device_node *np)
 	clks[cpu_2x] = clk_register_gate(NULL, clk_output_name[cpu_2x],
 			"cpu_2x_div", CLK_IGNORE_UNUSED, SLCR_ARM_CLK_CTRL,
 			26, 0, &armclk_lock);
+	clk_prepare_enable(clks[cpu_2x]);
 
 	clk = clk_register_fixed_factor(NULL, "cpu_1x_div", "cpu_div", 0, 1,
 			4 + 2 * tmp);
-- 
2.3.0


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

* [PATCH 3.12 161/175] clk: sunxi: Support factor clocks with N factor starting not from 0
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (159 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 160/175] clk: zynq: Force CPU_2X clock to be ungated Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 162/175] sunxi: clk: Set sun6i-pll1 n_start = 1 Jiri Slaby
                   ` (15 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Chen-Yu Tsai, Maxime Ripard, Jiri Slaby

From: Chen-Yu Tsai <wens@csie.org>

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

===============

commit 9a5e6c7eb5ccbb5f0d3a1dffce135f0a727f40e1 upstream.

The PLLs on newer Allwinner SoC's, such as the A31 and A23, have a
N multiplier factor that starts from 1, not 0.

This patch adds an option to the factor clk driver's config data
structures to specify the base value of N.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/sunxi/clk-factors.c | 2 +-
 drivers/clk/sunxi/clk-factors.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c
index 88523f91d9b7..7555793097f2 100644
--- a/drivers/clk/sunxi/clk-factors.c
+++ b/drivers/clk/sunxi/clk-factors.c
@@ -70,7 +70,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw,
 		p = FACTOR_GET(config->pshift, config->pwidth, reg);
 
 	/* Calculate the rate */
-	rate = (parent_rate * n * (k + 1) >> p) / (m + 1);
+	rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1);
 
 	return rate;
 }
diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h
index f49851cc4380..441fdc3f5717 100644
--- a/drivers/clk/sunxi/clk-factors.h
+++ b/drivers/clk/sunxi/clk-factors.h
@@ -15,6 +15,7 @@ struct clk_factors_config {
 	u8 mwidth;
 	u8 pshift;
 	u8 pwidth;
+	u8 n_start;
 };
 
 struct clk *clk_register_factors(struct device *dev, const char *name,
-- 
2.3.0


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

* [PATCH 3.12 162/175] sunxi: clk: Set sun6i-pll1 n_start = 1
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (160 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 161/175] clk: sunxi: Support factor clocks with N factor starting not from 0 Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 163/175] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Jiri Slaby
                   ` (14 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Hans de Goede, Chen-Yu Tsai, Maxime Ripard, Jiri Slaby

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

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

===============

commit 76820fcf7aa5a418b69cb7bed31b62d1feb1d6ad upstream.

For all pll-s on sun6i n == 0 means use a multiplier of 1, rather then 0 as
it means on sun4i / sun5i / sun7i. n_start = 1 is already correctly set
for sun6i pll6, but was missing for pll1, this commit fixes this.

Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/sunxi/clk-sunxi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 34ee69f4d50c..2cc7b59b5e4a 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -279,6 +279,7 @@ static struct clk_factors_config sun6i_a31_pll1_config = {
 	.kwidth = 2,
 	.mshift = 0,
 	.mwidth = 2,
+	.n_start = 1,
 };
 
 static struct clk_factors_config sun4i_apb1_config = {
-- 
2.3.0


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

* [PATCH 3.12 163/175] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (161 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 162/175] sunxi: clk: Set sun6i-pll1 n_start = 1 Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 164/175] dm mirror: do not degrade the mirror on discard error Jiri Slaby
                   ` (13 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ian Abbott, Jiri Slaby

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

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

===============

commit 42b8ce6f55facfa101462e694d33fc6bca471138 upstream.

`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/comedi/comedi_compat32.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c
index 2dfb06aedb15..b1c264e3a7b4 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -265,7 +265,7 @@ static int compat_cmd(struct file *file, unsigned long arg)
 {
 	struct comedi_cmd __user *cmd;
 	struct comedi32_cmd_struct __user *cmd32;
-	int rc;
+	int rc, err;
 
 	cmd32 = compat_ptr(arg);
 	cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -274,7 +274,15 @@ static int compat_cmd(struct file *file, unsigned long arg)
 	if (rc)
 		return rc;
 
-	return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+	rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+	if (rc == -EAGAIN) {
+		/* Special case: copy cmd back to user. */
+		err = put_compat_cmd(cmd32, cmd);
+		if (err)
+			rc = err;
+	}
+
+	return rc;
 }
 
 /* Handle 32-bit COMEDI_CMDTEST ioctl. */
-- 
2.3.0


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

* [PATCH 3.12 164/175] dm mirror: do not degrade the mirror on discard error
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (162 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 163/175] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 165/175] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Jiri Slaby
                   ` (12 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mikulas Patocka, Mike Snitzer, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

===============

commit f2ed51ac64611d717d1917820a01930174c2f236 upstream.

It may be possible that a device claims discard support but it rejects
discards with -EOPNOTSUPP.  It happens when using loopback on ext2/ext3
filesystem driven by the ext4 driver.  It may also happen if the
underlying devices are moved from one disk on another.

If discard error happens, we reject the bio with -EOPNOTSUPP, but we do
not degrade the array.

This patch fixes failed test shell/lvconvert-repair-transient.sh in the
lvm2 testsuite if the testsuite is extracted on an ext2 or ext3
filesystem and it is being driven by the ext4 driver.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm-raid1.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 9584443c5614..9388c3654f0a 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context)
 		return;
 	}
 
+	/*
+	 * If the bio is discard, return an error, but do not
+	 * degrade the array.
+	 */
+	if (bio->bi_rw & REQ_DISCARD) {
+		bio_endio(bio, -EOPNOTSUPP);
+		return;
+	}
+
 	for (i = 0; i < ms->nr_mirrors; i++)
 		if (test_bit(i, &error))
 			fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR);
-- 
2.3.0


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

* [PATCH 3.12 165/175] dm io: reject unsupported DISCARD requests with EOPNOTSUPP
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (163 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 164/175] dm mirror: do not degrade the mirror on discard error Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 166/175] dm: fix a race condition in dm_get_md Jiri Slaby
                   ` (11 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Darrick J. Wong, Mike Snitzer, Jiri Slaby

From: "Darrick J. Wong" <darrick.wong@oracle.com>

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

===============

commit 37527b869207ad4c208b1e13967d69b8bba1fbf9 upstream.

I created a dm-raid1 device backed by a device that supports DISCARD
and another device that does NOT support DISCARD with the following
dm configuration:

 #  echo '0 2048 mirror core 1 512 2 /dev/sda 0 /dev/sdb 0' | dmsetup create moo
 # lsblk -D
 NAME         DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
 sda                 0        4K       1G         0
 `-moo (dm-0)        0        4K       1G         0
 sdb                 0        0B       0B         0
 `-moo (dm-0)        0        4K       1G         0

Notice that the mirror device /dev/mapper/moo advertises DISCARD
support even though one of the mirror halves doesn't.

If I issue a DISCARD request (via fstrim, mount -o discard, or ioctl
BLKDISCARD) through the mirror, kmirrord gets stuck in an infinite
loop in do_region() when it tries to issue a DISCARD request to sdb.
The problem is that when we call do_region() against sdb, num_sectors
is set to zero because q->limits.max_discard_sectors is zero.
Therefore, "remaining" never decreases and the loop never terminates.

To fix this: before entering the loop, check for the combination of
REQ_DISCARD and no discard and return -EOPNOTSUPP to avoid hanging up
the mirror device.

This bug was found by the unfortunate coincidence of pvmove and a
discard operation in the RHEL 6.5 kernel; upstream is also affected.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm-io.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index e60c2eaea7bb..951addc80fcc 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -290,6 +290,12 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
 	unsigned short logical_block_size = queue_logical_block_size(q);
 	sector_t num_sectors;
 
+	/* Reject unsupported discard requests */
+	if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) {
+		dec_count(io, region, -EOPNOTSUPP);
+		return;
+	}
+
 	/*
 	 * where->count may be zero if rw holds a flush and we need to
 	 * send a zero-sized flush.
-- 
2.3.0


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

* [PATCH 3.12 166/175] dm: fix a race condition in dm_get_md
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (164 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 165/175] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 167/175] dm snapshot: fix a possible invalid memory access on unload Jiri Slaby
                   ` (10 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mikulas Patocka, Mike Snitzer, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

===============

commit 2bec1f4a8832e74ebbe859f176d8a9cb20dd97f4 upstream.

The function dm_get_md finds a device mapper device with a given dev_t,
increases the reference count and returns the pointer.

dm_get_md calls dm_find_md, dm_find_md takes _minor_lock, finds the
device, tests that the device doesn't have DMF_DELETING or DMF_FREEING
flag, drops _minor_lock and returns pointer to the device. dm_get_md then
calls dm_get. dm_get calls BUG if the device has the DMF_FREEING flag,
otherwise it increments the reference count.

There is a possible race condition - after dm_find_md exits and before
dm_get is called, there are no locks held, so the device may disappear or
DMF_FREEING flag may be set, which results in BUG.

To fix this bug, we need to call dm_get while we hold _minor_lock. This
patch renames dm_find_md to dm_get_md and changes it so that it calls
dm_get while holding the lock.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2f03e8e10c24..93f3fe443657 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2375,7 +2375,7 @@ int dm_setup_md_queue(struct mapped_device *md)
 	return 0;
 }
 
-static struct mapped_device *dm_find_md(dev_t dev)
+struct mapped_device *dm_get_md(dev_t dev)
 {
 	struct mapped_device *md;
 	unsigned minor = MINOR(dev);
@@ -2386,12 +2386,15 @@ static struct mapped_device *dm_find_md(dev_t dev)
 	spin_lock(&_minor_lock);
 
 	md = idr_find(&_minor_idr, minor);
-	if (md && (md == MINOR_ALLOCED ||
-		   (MINOR(disk_devt(dm_disk(md))) != minor) ||
-		   dm_deleting_md(md) ||
-		   test_bit(DMF_FREEING, &md->flags))) {
-		md = NULL;
-		goto out;
+	if (md) {
+		if ((md == MINOR_ALLOCED ||
+		     (MINOR(disk_devt(dm_disk(md))) != minor) ||
+		     dm_deleting_md(md) ||
+		     test_bit(DMF_FREEING, &md->flags))) {
+			md = NULL;
+			goto out;
+		}
+		dm_get(md);
 	}
 
 out:
@@ -2399,16 +2402,6 @@ out:
 
 	return md;
 }
-
-struct mapped_device *dm_get_md(dev_t dev)
-{
-	struct mapped_device *md = dm_find_md(dev);
-
-	if (md)
-		dm_get(md);
-
-	return md;
-}
 EXPORT_SYMBOL_GPL(dm_get_md);
 
 void *dm_get_mdptr(struct mapped_device *md)
-- 
2.3.0


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

* [PATCH 3.12 167/175] dm snapshot: fix a possible invalid memory access on unload
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (165 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 166/175] dm: fix a race condition in dm_get_md Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 168/175] HID: input: fix confusion on conflicting mappings Jiri Slaby
                   ` (9 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mikulas Patocka, Mike Snitzer, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

===============

commit 22aa66a3ee5b61e0f4a0bfeabcaa567861109ec3 upstream.

When the snapshot target is unloaded, snapshot_dtr() waits until
pending_exceptions_count drops to zero.  Then, it destroys the snapshot.
Therefore, the function that decrements pending_exceptions_count
should not touch the snapshot structure after the decrement.

pending_complete() calls free_pending_exception(), which decrements
pending_exceptions_count, and then it performs up_write(&s->lock) and it
calls retry_origin_bios() which dereferences  s->origin.  These two
memory accesses to the fields of the snapshot may touch the dm_snapshot
struture after it is freed.

This patch moves the call to free_pending_exception() to the end of
pending_complete(), so that the snapshot will not be destroyed while
pending_complete() is in progress.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm-snap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 944690bafd93..d892a05c84f4 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1439,8 +1439,6 @@ out:
 		full_bio->bi_end_io = pe->full_bio_end_io;
 		full_bio->bi_private = pe->full_bio_private;
 	}
-	free_pending_exception(pe);
-
 	increment_pending_exceptions_done_count();
 
 	up_write(&s->lock);
@@ -1457,6 +1455,8 @@ out:
 	}
 
 	retry_origin_bios(s, origin_bios);
+
+	free_pending_exception(pe);
 }
 
 static void commit_callback(void *context, int success)
-- 
2.3.0


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

* [PATCH 3.12 168/175] HID: input: fix confusion on conflicting mappings
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (166 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 167/175] dm snapshot: fix a possible invalid memory access on unload Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 169/175] HID: fixup the conflicting keyboard mappings quirk Jiri Slaby
                   ` (8 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Herrmann, Jiri Kosina, Jiri Slaby

From: David Herrmann <dh.herrmann@gmail.com>

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

===============

commit 6ce901eb61aa30ba8565c62049ee80c90728ef14 upstream.

On an PC-101/103/104 keyboard (American layout) the 'Enter' key and its
neighbours look like this:

           +---+ +---+ +-------+
           | 1 | | 2 | |   5   |
           +---+ +---+ +-------+
             +---+ +-----------+
             | 3 | |     4     |
             +---+ +-----------+

On a PC-102/105 keyboard (European layout) it looks like this:

           +---+ +---+ +-------+
           | 1 | | 2 | |       |
           +---+ +---+ +-+  4  |
             +---+ +---+ |     |
             | 3 | | 5 | |     |
             +---+ +---+ +-----+

(Note that the number of keys is the same, but key '5' is moved down and
 the shape of key '4' is changed. Keys '1' to '3' are exactly the same.)

The keys 1-4 report the same scan-code in HID in both layouts, even though
the keysym they produce is usually different depending on the XKB-keymap
used by user-space.
However, key '5' (US 'backslash'/'pipe') reports 0x31 for the upper layout
and 0x32 for the lower layout, as defined by the HID spec. This is highly
confusing as the linux-input API uses a single keycode for both.

So far, this was never a problem as there never has been a keyboard with
both of those keys present at the same time. It would have to look
something like this:

           +---+ +---+ +-------+
           | 1 | | 2 | |  x31  |
           +---+ +---+ +-------+
             +---+ +---+ +-----+
             | 3 | |x32| |  4  |
             +---+ +---+ +-----+

HID can represent such a keyboard, but the linux-input API cannot.
Furthermore, any user-space mapping would be confused by this and,
luckily, no-one ever produced such hardware.

Now, the HID input layer fixed this mess by mapping both 0x31 and 0x32 to
the same keycode (KEY_BACKSLASH==0x2b). As only one of both physical keys
is present on a hardware, this works just fine.

Lets introduce hardware-vendors into this:
------------------------------------------

Unfortunately, it seems way to expensive to produce a different device for
American and European layouts. Therefore, hardware-vendors put both keys,
(0x31 and 0x32) on the same keyboard, but only one of them is hooked up
to the physical button, the other one is 'dead'.
This means, they can use the same hardware, with a different button-layout
and automatically produce the correct HID events for American *and*
European layouts. This is unproblematic for normal keyboards, as the
'dead' key will never report any KEY-DOWN events. But RollOver keyboards
send the whole matrix on each key-event, allowing n-key roll-over mode.
This means, we get a 0x31 and 0x32 event on each key-press. One of them
will always be 0, the other reports the real state. As we map both to the
same keycode, we will get spurious key-events, even though the real
key-state never changed.

The easiest way would be to blacklist 'dead' keys and never handle those.
We could simply read the 'country' tag of USB devices and blacklist either
key according to the layout. But... hardware vendors... want the same
device for all countries and thus many of them set 'country' to 0 for all
devices. Meh..

So we have to deal with this properly. As we cannot know which of the keys
is 'dead', we either need a heuristic and track those keys, or we simply
make use of our value-tracking for HID fields. We simply ignore HID events
for absolute data if the data didn't change. As HID tracks events on the
HID level, we haven't done the keycode translation, yet. Therefore, the
'dead' key is tracked independently of the real key, therefore, any events
on it will be ignored.

This patch simply discards any HID events for absolute data if it didn't
change compared to the last report. We need to ignore relative and
buffered-byte reports for obvious reasons. But those cannot be affected by
this bug, so we're fine.

Preferably, we'd do this filtering on the HID-core level. But this might
break a lot of custom drivers, if they do not follow the HID specs.
Therefore, we do this late in hid-input just before we inject it into the
input layer (which does the exact same filtering, but on the keycode
level).

If this turns out to break some devices, we might have to limit filtering
to EV_KEY events. But lets try to do the Right Thing first, and properly
filter any absolute data that didn't change.

This patch is tagged for 'stable' as it fixes a lot of n-key RollOver
hardware. We might wanna wait with backporting for a while, before we know
it doesn't break anything else, though.

Reported-by: Adam Goode <adam@spicenitz.org>
Reported-by: Fredrik Hallenberg <megahallon@gmail.com>
Tested-by: Fredrik Hallenberg <megahallon@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-input.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 153ae423618e..a70e999209d9 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1069,6 +1069,22 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 		return;
 	}
 
+	/*
+	 * Ignore reports for absolute data if the data didn't change. This is
+	 * not only an optimization but also fixes 'dead' key reports. Some
+	 * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID
+	 * 0x31 and 0x32) report multiple keys, even though a localized keyboard
+	 * can only have one of them physically available. The 'dead' keys
+	 * report constant 0. As all map to the same keycode, they'd confuse
+	 * the input layer. If we filter the 'dead' keys on the HID level, we
+	 * skip the keycode translation and only forward real events.
+	 */
+	if (!(field->flags & (HID_MAIN_ITEM_RELATIVE |
+	                      HID_MAIN_ITEM_BUFFERED_BYTE)) &&
+	    usage->usage_index < field->maxusage &&
+	    value == field->value[usage->usage_index])
+		return;
+
 	/* report the usage code as scancode if the key status has changed */
 	if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
 		input_event(input, EV_MSC, MSC_SCAN, usage->hid);
-- 
2.3.0


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

* [PATCH 3.12 169/175] HID: fixup the conflicting keyboard mappings quirk
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (167 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 168/175] HID: input: fix confusion on conflicting mappings Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 170/175] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Jiri Slaby
                   ` (7 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jiri Kosina, Jiri Slaby

From: Jiri Kosina <jkosina@suse.cz>

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

===============

commit 8e7b341037db1835ee6eea64663013cbfcf33575 upstream.

The ignore check that got added in 6ce901eb61 ("HID: input: fix confusion
on conflicting mappings") needs to properly check for VARIABLE reports
as well (ARRAY reports should be ignored), otherwise legitimate keyboards
might break.

Fixes: 6ce901eb61 ("HID: input: fix confusion on conflicting mappings")
Reported-by: Fredrik Hallenberg <megahallon@gmail.com>
Reported-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index a70e999209d9..9dcccbde65fb 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1081,6 +1081,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 	 */
 	if (!(field->flags & (HID_MAIN_ITEM_RELATIVE |
 	                      HID_MAIN_ITEM_BUFFERED_BYTE)) &&
+			      (field->flags & HID_MAIN_ITEM_VARIABLE) &&
 	    usage->usage_index < field->maxusage &&
 	    value == field->value[usage->usage_index])
 		return;
-- 
2.3.0


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

* [PATCH 3.12 170/175] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (168 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 169/175] HID: fixup the conflicting keyboard mappings quirk Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 171/175] drm/radeon: fix 1 RB harvest config setup for TN/RL Jiri Slaby
                   ` (6 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Deucher, Jiri Slaby

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

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

===============

commit 3d2d98ee1af0cf6eebfbd6bff4c17d3601ac1284 upstream.

Just in case it hasn't been calculated for the mode.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/r600_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index cc4258a853fd..729ad831886f 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -187,7 +187,7 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev)
 		list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 			radeon_crtc = to_radeon_crtc(crtc);
 			if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) {
-				vrefresh = radeon_crtc->hw_mode.vrefresh;
+				vrefresh = drm_mode_vrefresh(&radeon_crtc->hw_mode);
 				break;
 			}
 		}
-- 
2.3.0


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

* [PATCH 3.12 171/175] drm/radeon: fix 1 RB harvest config setup for TN/RL
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (169 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 170/175] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 172/175] ACPI / video: Load the module even if ACPI is disabled Jiri Slaby
                   ` (5 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Deucher, Jiri Slaby

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

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

===============

commit dbfb00c3e7e18439f2ebf67fe99bf7a50b5bae1e upstream.

The logic was reversed from what the hw actually exposed.
Fixes graphics corruption in certain harvest configurations.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/ni.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 474343adf262..d5f7e8c14b2e 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1077,12 +1077,12 @@ static void cayman_gpu_init(struct radeon_device *rdev)
 
 	if ((rdev->config.cayman.max_backends_per_se == 1) &&
 	    (rdev->flags & RADEON_IS_IGP)) {
-		if ((disabled_rb_mask & 3) == 1) {
-			/* RB0 disabled, RB1 enabled */
-			tmp = 0x11111111;
-		} else {
+		if ((disabled_rb_mask & 3) == 2) {
 			/* RB1 disabled, RB0 enabled */
 			tmp = 0x00000000;
+		} else {
+			/* RB0 disabled, RB1 enabled */
+			tmp = 0x11111111;
 		}
 	} else {
 		tmp = gb_addr_config & NUM_PIPES_MASK;
-- 
2.3.0


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

* [PATCH 3.12 172/175] ACPI / video: Load the module even if ACPI is disabled
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (170 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 171/175] drm/radeon: fix 1 RB harvest config setup for TN/RL Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 173/175] NFSv4: Don't call put_rpccred() under the rcu_read_lock() Jiri Slaby
                   ` (4 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Chris Wilson, Daniel Vetter, Jani Nikula,
	Rafael J. Wysocki, Jiri Slaby

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

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

===============

commit 6e17cb12881ba8d5e456b89f072dc6b70048af36 upstream.

i915.ko depends upon the acpi/video.ko module and so refuses to load if
ACPI is disabled at runtime if for example the BIOS is broken beyond
repair. acpi/video provides an optional service for i915.ko and so we
should just allow the modules to load, but do no nothing in order to let
the machines boot correctly.

Reported-by: Bill Augur <bill-auger@programmer.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Acked-by: Aaron Lu <aaron.lu@intel.com>
[ rjw: Fixed up the new comment in acpi_video_init() ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/video.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 47e4deb9dfcd..ff5ec8ecc257 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1857,6 +1857,17 @@ EXPORT_SYMBOL(acpi_video_unregister);
 
 static int __init acpi_video_init(void)
 {
+	/*
+	 * Let the module load even if ACPI is disabled (e.g. due to
+	 * a broken BIOS) so that i915.ko can still be loaded on such
+	 * old systems without an AcpiOpRegion.
+	 *
+	 * acpi_video_register() will report -ENODEV later as well due
+	 * to acpi_disabled when i915.ko tries to register itself afterwards.
+	 */
+	if (acpi_disabled)
+		return 0;
+
 	dmi_check_system(video_dmi_table);
 
 	if (intel_opregion_present())
-- 
2.3.0


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

* [PATCH 3.12 173/175] NFSv4: Don't call put_rpccred() under the rcu_read_lock()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (171 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 172/175] ACPI / video: Load the module even if ACPI is disabled Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 174/175] ath5k: fix spontaneus AR5312 freezes Jiri Slaby
                   ` (3 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Trond Myklebust, Jiri Slaby

From: Trond Myklebust <trond.myklebust@primarydata.com>

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

===============

commit 7c0af9ffb7bb4e5355470fa60b3eb711ddf226fa upstream.

put_rpccred() can sleep.

Fixes: 8f649c3762547 ("NFSv4: Fix the locking in nfs_inode_reclaim_delegation()")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/delegation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 3ed1be9aade3..2ea3537b8bde 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -161,8 +161,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
 				  &delegation->flags);
 			NFS_I(inode)->delegation_state = delegation->type;
 			spin_unlock(&delegation->lock);
-			put_rpccred(oldcred);
 			rcu_read_unlock();
+			put_rpccred(oldcred);
 			trace_nfs4_reclaim_delegation(inode, res->delegation_type);
 		} else {
 			/* We appear to have raced with a delegation return. */
-- 
2.3.0


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

* [PATCH 3.12 174/175] ath5k: fix spontaneus AR5312 freezes
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (172 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 173/175] NFSv4: Don't call put_rpccred() under the rcu_read_lock() Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17  8:42 ` [PATCH 3.12 175/175] clk-gate: fix bit # check in clk_register_gate() Jiri Slaby
                   ` (2 subsequent siblings)
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Sergey Ryazanov, Jiri Slaby, Nick Kossifidis,
	Luis R. Rodriguez, Kalle Valo, Jiri Slaby

From: Sergey Ryazanov <ryazanov.s.a@gmail.com>

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

===============

commit 8bfae4f9938b6c1f033a5159febe97e441d6d526 upstream.

Sometimes while CPU have some load and ath5k doing the wireless
interface reset the whole WiSoC completely freezes. Set of tests shows
that using atomic delay function while we wait interface reset helps to
avoid such freezes.

The easiest way to reproduce this issue: create a station interface,
start continous scan with wpa_supplicant and load CPU by something. Or
just create multiple station interfaces and put them all in continous
scan.

This patch partially reverts the commit 1846ac3dbec0 ("ath5k: Use
usleep_range where possible"), which replaces initial udelay()
by usleep_range().

I do not know actual source of this issue, but all looks like that HW
freeze is caused by transaction on internal SoC bus, while wireless
block is in reset state.

Also I should note that I do not know how many chips are affected, but I
did not see this issue with chips, other than AR5312.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Fixes: 1846ac3dbec0 ("ath5k: Use usleep_range where possible")
Reported-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Christophe Prevotaux <c.prevotaux@rural-networks.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/ath/ath5k/reset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index a3399c4f13a9..b9b651ea9851 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags)
 	regval = ioread32(reg);
 	iowrite32(regval | val, reg);
 	regval = ioread32(reg);
-	usleep_range(100, 150);
+	udelay(100);	/* NB: should be atomic */
 
 	/* Bring BB/MAC out of reset */
 	iowrite32(regval & ~val, reg);
-- 
2.3.0


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

* [PATCH 3.12 175/175] clk-gate: fix bit # check in clk_register_gate()
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (173 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 174/175] ath5k: fix spontaneus AR5312 freezes Jiri Slaby
@ 2015-03-17  8:42 ` Jiri Slaby
  2015-03-17 16:36 ` [PATCH 3.12 000/175] 3.12.39-stable review Guenter Roeck
  2015-03-18 18:11 ` Shuah Khan
  176 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-17  8:42 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sergei Shtylyov, Michael Turquette, Jiri Slaby

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

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

===============

commit 2e9dcdae4068460c45a308dd891be5248260251c upstream.

In case CLK_GATE_HIWORD_MASK flag is passed to clk_register_gate(), the bit #
should be no higher than 15, however the corresponding check is obviously off-
by-one.

Fixes: 045779942c04 ("clk: gate: add CLK_GATE_HIWORD_MASK")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/clk-gate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c
index 4a58c55255bd..797bab97cea6 100644
--- a/drivers/clk/clk-gate.c
+++ b/drivers/clk/clk-gate.c
@@ -128,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
 	struct clk_init_data init;
 
 	if (clk_gate_flags & CLK_GATE_HIWORD_MASK) {
-		if (bit_idx > 16) {
+		if (bit_idx > 15) {
 			pr_err("gate bit exceeds LOWORD field\n");
 			return ERR_PTR(-EINVAL);
 		}
-- 
2.3.0


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

* Re: [PATCH 3.12 000/175] 3.12.39-stable review
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (174 preceding siblings ...)
  2015-03-17  8:42 ` [PATCH 3.12 175/175] clk-gate: fix bit # check in clk_register_gate() Jiri Slaby
@ 2015-03-17 16:36 ` Guenter Roeck
  2015-03-19 15:08   ` Jiri Slaby
  2015-03-18 18:11 ` Shuah Khan
  176 siblings, 1 reply; 179+ messages in thread
From: Guenter Roeck @ 2015-03-17 16:36 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: stable, satoru.takeuchi, shuah.kh, linux-kernel

On Tue, Mar 17, 2015 at 09:41:36AM +0100, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.39 release.
> There are 175 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 Mar 19 09:40:21 CET 2015.
> Anything received after that time might be too late.
> 
Build results:
	total: 121 pass: 121 fail: 0
Qemu test results:
	total: 27 pass: 27 fail: 0

Details are available at http://server.roeck-us.net:8010/builders.

Guenter

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

* Re: [PATCH 3.12 000/175] 3.12.39-stable review
  2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
                   ` (175 preceding siblings ...)
  2015-03-17 16:36 ` [PATCH 3.12 000/175] 3.12.39-stable review Guenter Roeck
@ 2015-03-18 18:11 ` Shuah Khan
  176 siblings, 0 replies; 179+ messages in thread
From: Shuah Khan @ 2015-03-18 18:11 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, satoru.takeuchi, shuah.kh, linux-kernel

On 03/17/2015 02:41 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.39 release.
> There are 175 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 Mar 19 09:40:21 CET 2015.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.39-rc1.xz
> and the diffstat can be found below.
> 
> thanks,
> js
> 

Compiled and booted on my test system. No dmesg regressions.

-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

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

* Re: [PATCH 3.12 000/175] 3.12.39-stable review
  2015-03-17 16:36 ` [PATCH 3.12 000/175] 3.12.39-stable review Guenter Roeck
@ 2015-03-19 15:08   ` Jiri Slaby
  0 siblings, 0 replies; 179+ messages in thread
From: Jiri Slaby @ 2015-03-19 15:08 UTC (permalink / raw)
  To: Guenter Roeck, shuah.kh; +Cc: stable, satoru.takeuchi, linux-kernel

On 03/17/2015, 05:36 PM, Guenter Roeck wrote:
> On Tue, Mar 17, 2015 at 09:41:36AM +0100, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.39 release.
>> There are 175 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 Mar 19 09:40:21 CET 2015.
>> Anything received after that time might be too late.
>>
> Build results:
> 	total: 121 pass: 121 fail: 0
> Qemu test results:
> 	total: 27 pass: 27 fail: 0
> 
> Details are available at http://server.roeck-us.net:8010/builders.

On 03/18/2015, 07:11 PM, Shuah Khan wrote:
> Compiled and booted on my test system. No dmesg regressions.

Thank you both!

-- 
js
suse labs

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

end of thread, other threads:[~2015-03-19 15:08 UTC | newest]

Thread overview: 179+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17  8:41 [PATCH 3.12 000/175] 3.12.39-stable review Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 001/175] xfs: ensure buffer types are set correctly Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 002/175] xfs: inode unlink does not set AGI buffer type Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 003/175] xfs: set superblock buffer type correctly Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 004/175] fsnotify: fix handling of renames in audit Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 005/175] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 006/175] iwlwifi: mvm: validate tid and sta_id in ba_notif Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 007/175] iwlwifi: mvm: always use mac color zero Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 008/175] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 009/175] PCI: Generate uppercase hex for modalias var in uevent Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 010/175] PCI: Fix infinite loop with ROM image of size 0 Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 011/175] cpufreq: speedstep-smi: enable interrupts when waiting Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 012/175] cpufreq: s3c: remove incorrect __init annotations Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 013/175] xen/manage: Fix USB interaction issues when resuming Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 014/175] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 015/175] ALSA: off by one bug in snd_riptide_joystick_probe() Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 016/175] ALSA: hdspm - Constrain periods to 2 on older cards Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 017/175] power_supply: 88pm860x: Fix leaked power supply on probe fail Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 018/175] power: bq24190: Fix ignored supplicants Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 019/175] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 020/175] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Jiri Slaby
2015-03-17  8:39 ` [PATCH 3.12 021/175] nfs: don't call blocking operations while !TASK_RUNNING Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 022/175] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 023/175] mm/hugetlb: pmd_huge() returns true for non-present hugepage Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 024/175] tracing: Fix unmapping loop in tracing_mark_write Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 025/175] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 026/175] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 027/175] ARM: dts: am335x-bone*: usb0 is hardwired for peripheral Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 028/175] tpm_tis: verify interrupt during init Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 029/175] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 030/175] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 031/175] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 032/175] Added Little Endian support to vtpm module Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 033/175] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 034/175] iscsi-target: Drop problematic active_ts_list usage Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 035/175] cfq-iosched: handle failure of cfq group allocation Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 036/175] cfq-iosched: fix incorrect filing of rt async cfqq Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 037/175] axonram: Fix bug in direct_access Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 038/175] tty: Prevent untrappable signals from malicious program Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 039/175] tty/serial: at91: fix error handling in atmel_serial_probe() Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 040/175] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 041/175] USB: fix use-after-free bug in usb_hcd_unlink_urb() Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 042/175] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 043/175] vt: provide notifications on selection changes Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 044/175] ARM: pxa: add regulator_has_full_constraints to corgi board file Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 045/175] ARM: pxa: add regulator_has_full_constraints to poodle " Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 046/175] kdb: fix incorrect counts in KDB summary command output Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 047/175] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 048/175] KVM: MIPS: Don't leak FPU/DSP to guest Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 049/175] Bluetooth: Add support for Acer [0489:e078] Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 050/175] libceph: assert both regular and lingering lists in __remove_osd() Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 051/175] libceph: change from BUG to WARN for __remove_osd() asserts Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 052/175] libceph: fix double __remove_osd() problem Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 053/175] KVM: x86: update masterclock values on TSC writes Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 054/175] hx4700: regulator: declare full constraints Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 055/175] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 056/175] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 057/175] gpio: tps65912: fix wrong container_of arguments Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 058/175] xfs: Fix quota type in quota structures when reusing quota file Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 059/175] metag: Fix KSTK_EIP() and KSTK_ESP() macros Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 060/175] md/raid5: Fix livelock when array is both resyncing and degraded Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 061/175] md/raid1: fix read balance when a drive is write-mostly Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 062/175] EDAC, amd64_edac: Prevent OOPS with >16 memory controllers Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 063/175] jffs2: fix handling of corrupted summary length Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 064/175] btrfs: set proper message level for skinny metadata Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 065/175] blk-throttle: check stats_cpu before reading it from sysfs Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 066/175] x86, mm/ASLR: Fix stack randomization on 64-bit systems Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 067/175] ath6kl: fix struct hif_scatter_req list handling Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 068/175] staging: comedi: cb_pcidas64: fix incorrect AI range code handling Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 069/175] USB: EHCI: adjust error return code Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 070/175] MIPS: Export FP functions used by lose_fpu(1) for KVM Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 071/175] ipvs: add missing ip_vs_pe_put in sync code Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 072/175] ipvs: rerouting to local clients is not needed anymore Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 073/175] netfilter: xt_socket: fix a stack corruption bug Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 074/175] pktgen: fix UDP checksum computation Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 075/175] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 076/175] ipv6: fix ipv6_cow_metrics for non DST_HOST case Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 077/175] rtnetlink: call ->dellink on failure when ->newlink exists Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 078/175] gen_stats.c: Duplicate xstats buffer for later use Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 079/175] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 080/175] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Jiri Slaby
2015-03-17  8:40 ` [PATCH 3.12 081/175] net: phy: Fix verification of EEE support in phy_init_eee Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 082/175] ematch: Fix auto-loading of ematch modules Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 083/175] net: reject creation of netdev names with colons Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 084/175] team: fix possible null pointer dereference in team_handle_frame Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 085/175] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 086/175] macvtap: make sure neighbour code can push ethernet header Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 087/175] usb: plusb: Add support for National Instruments host-to-host cable Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 088/175] udp: only allow UFO for packets from SOCK_DGRAM sockets Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 089/175] net: ping: Return EAFNOSUPPORT when appropriate Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 090/175] team: don't traverse port list using rcu in team_set_mac_address Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 091/175] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 092/175] mm/hugetlb: add migration entry check in __unmap_hugepage_range Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 093/175] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 094/175] mm/nommu.c: " Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 095/175] mm/compaction: fix wrong order check in compact_finished() Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 096/175] mm/memory.c: actually remap enough memory Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 097/175] drm/radeon: only enable kv/kb dpm interrupts once v3 Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 098/175] drm/radeon: workaround for CP HW bug on CIK Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 099/175] target: Fix PR_APTPL_BUF_LEN buffer size limitation Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 100/175] target: Add missing WRITE_SAME end-of-device sanity check Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 101/175] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 102/175] x86/asm/entry/64: Remove a bogus 'ret_from_fork' optimization Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 103/175] iio: imu: adis16400: Fix sign extension Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 104/175] iio: ad5686: fix optional reference voltage declaration Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 105/175] mei: make device disabled on stop unconditionally Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 106/175] btrfs: fix lost return value due to variable shadowing Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 107/175] Btrfs: fix data loss in the fast fsync path Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 108/175] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 109/175] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 110/175] KVM: MIPS: Fix trace event to save PC directly Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 111/175] USB: serial: cp210x: Adding Seletek device id's Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 112/175] USB: usbfs: don't leak kernel data in siginfo Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 113/175] USB: ftdi_sio: add PIDs for Actisense USB devices Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 114/175] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 115/175] usb: dwc3: dwc3-omap: Fix disable IRQ Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 116/175] xhci: Allocate correct amount of scratchpad buffers Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 117/175] xhci: fix reporting of 0-sized URBs in control endpoint Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 118/175] mac80211: Send EAPOL frames at lowest rate Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 119/175] net: irda: fix wait_until_sent poll timeout Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 120/175] USB: serial: fix infinite wait_until_sent timeout Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 121/175] TTY: fix tty_wait_until_sent on 64-bit machines Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 122/175] USB: serial: fix potential use-after-free after failed probe Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 123/175] USB: serial: fix tty-device error handling at probe Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 124/175] autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 125/175] debugfs: leave freeing a symlink body until inode eviction Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 126/175] procfs: fix race between symlink removals and traversals Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 127/175] sunrpc: fix braino in ->poll() Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 128/175] ARC: Fix KSTK_ESP() Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 129/175] tty: fix up atime/mtime mess, take four Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 130/175] HID: apple: fix battery support for the 2009 ANSI wireless keyboard Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 131/175] HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2 Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 132/175] HID: hid-microsoft: Add support for scrollwheel and special keypad keys Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 133/175] HID: add support for MS Surface Pro 3 Type Cover Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 134/175] HID: microsoft: add support for Japanese Surface Type Cover 3 Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 135/175] USB: serial: add Google simple serial SubClass support Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 136/175] usb: gadget: function: phonet: balance usb_ep_disable calls Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 137/175] usb: musb: core: add pm_runtime_irq_safe() Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 138/175] cdc-acm: Add support for Denso cradle CU-321 Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 139/175] x86: mm: move mmap_sem unlock from mm_fault_error() to caller Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 140/175] vm: add VM_FAULT_SIGSEGV handling support Jiri Slaby
2015-03-17  8:41 ` [PATCH 3.12 141/175] arc: mm: Fix build failure Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 142/175] vm: make stack guard page errors return VM_FAULT_SIGSEGV rather than SIGBUS Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 143/175] splice: Apply generic position and size checks to each write Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 144/175] ALSA: pcm: Don't leave PREPARED state after draining Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 145/175] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 146/175] sg: fix read() error reporting Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 147/175] IB/qib: Do not write EEPROM Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 148/175] xhci: no switching back on non-ULT Haswell Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 149/175] HID: microsoft: Add ID for NE7K wireless keyboard Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 150/175] HID: usbhid: fix PIXART optical mouse Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 151/175] HID: usbhid: add another mouse that needs QUIRK_ALWAYS_POLL Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 152/175] HID: usbhid: enable always-poll quirk for Elan Touchscreen 0103 Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 153/175] HID: yet another buggy ELAN touchscreen Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 154/175] mm: hwpoison: drop lru_add_drain_all() in __soft_offline_page() Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 155/175] mm/hugetlb: reduce arch dependent code around follow_huge_* Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 156/175] mm/hugetlb: take page table lock in follow_huge_pmd() Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 157/175] nilfs2: fix potential memory overrun on inode Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 158/175] ASoC: omap-pcm: Correct dma mask Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 159/175] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 160/175] clk: zynq: Force CPU_2X clock to be ungated Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 161/175] clk: sunxi: Support factor clocks with N factor starting not from 0 Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 162/175] sunxi: clk: Set sun6i-pll1 n_start = 1 Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 163/175] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 164/175] dm mirror: do not degrade the mirror on discard error Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 165/175] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 166/175] dm: fix a race condition in dm_get_md Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 167/175] dm snapshot: fix a possible invalid memory access on unload Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 168/175] HID: input: fix confusion on conflicting mappings Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 169/175] HID: fixup the conflicting keyboard mappings quirk Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 170/175] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 171/175] drm/radeon: fix 1 RB harvest config setup for TN/RL Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 172/175] ACPI / video: Load the module even if ACPI is disabled Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 173/175] NFSv4: Don't call put_rpccred() under the rcu_read_lock() Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 174/175] ath5k: fix spontaneus AR5312 freezes Jiri Slaby
2015-03-17  8:42 ` [PATCH 3.12 175/175] clk-gate: fix bit # check in clk_register_gate() Jiri Slaby
2015-03-17 16:36 ` [PATCH 3.12 000/175] 3.12.39-stable review Guenter Roeck
2015-03-19 15:08   ` Jiri Slaby
2015-03-18 18:11 ` Shuah Khan

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.